public void Update() { ETModel.EventEntity modelEventEntity = ETModel.Game.Scene.GetComponent <ETModel.EventEntity>(); if (modelEventEntity == null) { return; } for (int i = 0; i < modelEventEntity.eventInfoList.Count; i++) { EventInfo info = modelEventEntity.eventInfoList[i]; EventMgr.Send(info.name, info.args); } modelEventEntity.eventInfoList.Clear(); }
public void Update() { ETModel.EventEntity modelEventEntity = ETModel.Game.Scene.GetComponent <ETModel.EventEntity>(); if (modelEventEntity == null) { return; } List <EventInfo> eventInfos = modelEventEntity.GetAll(); for (int i = 0; i < eventInfos.Count; i++) { EventMgr.Send(eventInfos[i].key, eventInfos[i].args); } modelEventEntity.Clear(); }
public static async ETVoid LoadScene(string sceneName, Action onLoaded = null) { Game.Scene.GetComponent <UnitEntity>().RemoveAll(); EventMgr.Send(EventKey.StartLoadScene); // 加载场景资源 await ETModel.Game.Scene.GetComponent <ResourcesComponent>().LoadBundleAsync(sceneName.StringToAB()); while (ETModel.Game.Scene.GetComponent <SceneChangeComponent>() != null) { await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(100); } using (SceneChangeComponent sceneChangeComponent = ETModel.Game.Scene.AddComponent <SceneChangeComponent>()) { await sceneChangeComponent.ChangeSceneAsync(sceneName); } EventMgr.Send(EventKey.EndLoadScene); onLoaded?.Invoke(); }
public static void Send(this object self, string eventName, params object[] args) { EventMgr.Send(eventName, args); }
public static void Send(this object self, EventKey eventType, params object[] args) { EventMgr.Send(eventType, args); }