CTT/Unity/Assets/Model/Game/Event/AppStartEvent.cs

42 lines
1.0 KiB
C#

using ET.EventType;
using System;
using System.Collections.Generic;
#if UNITY
using libx;
using UnityEngine;
#endif
namespace ET
{
public class AppStartEvent : AEvent<AppStart>
{
public override async ETTask Run(AppStart args)
{
#if UNITY
//!设置帧率
Application.targetFrameRate = Define.FrameRate;
#endif
Game.Scene.AddComponent<TimerComponent>();
Game.Scene.AddComponent<CoroutineLockComponent>();
Game.Scene.AddComponent<GlobalConfigComponent>();
Define.IsEditorMode = GlobalConfigComponent.Instance.GlobalProto.isEditorMode;
GameKeyComponent keyComponent = Game.Scene.AddComponent<GameKeyComponent>();
keyComponent.key = args.key;
keyComponent.keyIV = args.keyIV;
keyComponent.xorKey = args.xorKey;
#if UNITY
Game.Scene.AddComponent<Updater>();
#endif
await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { });
await ETTask.CompletedTask;
}
}
}