zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/Hotfix/Init.cs

64 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Linq;
using System.Reflection;
using ET;
namespace ET
{
public static class InitHotfix
{
public static async void Start()
{
try
{
string clientVersion = await GlobalHotfixProtoHelper.GetClintVersion();
if (!clientVersion.Equals(GlobalConfigComponent.Instance.GlobalProto.ClientVersion))
{
Game.EventSystem.Publish(new ET.EventType.ShowMessageBox
{
title = "提示!",
content = $"客户端有更新,请下载最新版客户端{clientVersion}",
action = async (MessageBoxEventId id) =>
{
Game.EventSystem.Publish_Sync(new ET.EventType.Quit());
}
}).Coroutine();
}
if (Define.hasView)
{
Game.EventSystem.Add(Hotfix.instance.hotfix);
Game.EventSystem.Add(Hotfix.instance.hotfixView);
}
else
{
Game.EventSystem.Add(Hotfix.instance.hotfix);
}
Game.Scene.AddComponent<NetThreadComponent>();
Game.Scene.AddComponent<OpcodeTypeComponent>();
Game.Scene.AddComponent<MessageDispatcherComponent>();
Game.Scene.AddComponent<ZoneSceneManagerComponent>();
ConfigComponent config = Game.Scene.GetOrAddComponent<ConfigComponent>();
Game.Scene.AddComponent<NumericWatcherComponent>();
Game.Scene.AddComponent<WordComponent>();
Scene zoneScene = SceneFactory.CreateZoneScene(1, "Game");
OpcodeHotfixHelper.Init();
Game.EventSystem.Publish(new ET.EventType.AfterCreateZoneScene() { zoneScene = zoneScene }).Coroutine();
}
catch (Exception e)
{
Log.Error(e);
}
}
}
}