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

64 lines
2.1 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
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>();
2021-04-11 19:50:39 +08:00
ConfigComponent config = Game.Scene.GetOrAddComponent<ConfigComponent>();
2021-04-08 20:09:59 +08:00
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);
}
}
}
}