64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
|
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>();
|
|||
|
|
|||
|
var 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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|