zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/Model/Game/Event/AppStartEvent.cs

47 lines
1.2 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET.EventType;
using System;
using System.Collections.Generic;
#if UNITY
using libx;
2021-04-08 20:09:59 +08:00
using UnityEngine;
#endif
2021-04-08 20:09:59 +08:00
namespace ET
{
public class AppStartEvent : AEvent<AppStart>
{
public override async ETTask Run(AppStart args)
{
#if UNITY
2021-04-08 20:09:59 +08:00
//!设置帧率
Application.targetFrameRate = Define.FrameRate;
#endif
2021-04-08 20:09:59 +08:00
Game.Scene.AddComponent<TimerComponent>();
Game.Scene.AddComponent<CoroutineLockComponent>();
Game.Scene.AddComponent<GlobalConfigComponent>();
Define.IsEditorMode = GlobalConfigComponent.Instance.GlobalProto.isEditorMode;
2021-08-06 15:04:29 +08:00
if (!Define.IsEditorMode)
{
//关闭日志
Game.Options.LogLevel = 4;
}
2021-04-08 20:09:59 +08:00
2021-04-11 19:50:39 +08:00
GameKeyComponent keyComponent = Game.Scene.AddComponent<GameKeyComponent>();
2021-04-08 20:09:59 +08:00
keyComponent.key = args.key;
keyComponent.keyIV = args.keyIV;
keyComponent.xorKey = args.xorKey;
#if UNITY
2021-04-08 20:09:59 +08:00
Game.Scene.AddComponent<Updater>();
#endif
2021-04-08 20:09:59 +08:00
await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { });
2021-04-08 20:09:59 +08:00
await ETTask.CompletedTask;
}
}
}