/// <summary> /// ILR状态下初始化Type /// </summary> public void TypeIlrInit() { List <Type> attributeTypes = HotfixHelper.GetIlrAttributeTypes(allAssembliesTypes); foreach (Type attType in attributeTypes) { foreach (Type type in allAssembliesTypes) { if (type.IsAbstract) { continue; } object[] objects = type.GetCustomAttributes(attType, true); if (objects.Length == 0) { continue; } foreach (BaseAttribute baseAttribute in objects) { this.types.Add(baseAttribute.AttributeType, type); } } } }
public static void Start() { try { Log.Info("初始化EventSystem"); { List <Type> types = new List <Type>(); types.AddRange(HotfixHelper.GetAssemblyTypes()); Game.EventSystem.AddRangeType(types); if (GlobalDefine.ILRuntimeMode) { Game.EventSystem.TypeIlrInit(); } else { Game.EventSystem.TypeMonoInit(); } Game.EventSystem.EventSystemInit(); } ProtobufHelper.Init(); GlobalDefine.Options = new Options(); Game.EventSystem.Publish(new EventType.AppStart()).Coroutine(); } catch (Exception e) { Log.Error(e); } }
private async ETVoid InternalAwake() { try { // 设置全局模式 GlobalDefine.ILRuntimeMode = this.ILRuntimeMode; GlobalDefine.DevelopMode = this.DevelopMode; GlobalDefine.SetLoginAddress(LoginAddress); // 限制帧率,尽量避免手机发烫 QualitySettings.vSyncCount = 0; Application.targetFrameRate = 60; SynchronizationContext.SetSynchronizationContext(ThreadSynchronizationContext.Instance); DontDestroyOnLoad(gameObject); // 初始化FGUI系统 FUIEntry.Init(); Updater updater = this.GetComponent <Updater>(); m_XAssetUpdater = new XAssetUpdater(updater); FUI_CheckForResUpdateComponent.Init(m_XAssetUpdater.Updater); await m_XAssetUpdater.StartUpdate(); byte[] dllByte = XAssetLoader.LoadAsset <TextAsset>(XAssetPathUtilities.GetHotfixDllPath("Hotfix")) .bytes; byte[] pdbByte = XAssetLoader.LoadAsset <TextAsset>(XAssetPathUtilities.GetHotfixPdbPath("Hotfix")) .bytes; HotfixHelper.GoToHotfix(dllByte, pdbByte); GloabLifeCycle.StartAction?.Invoke(); } catch (Exception e) { Log.Error(e); throw; } }