提交 33860994 编写于 作者: T tanghai

修复UI的bug

上级 c943b282
......@@ -25,7 +25,7 @@ namespace ET
Log.Info("登陆gate成功!");
await Game.EventSystem.Publish(new EventType.LoginFinish());
await Game.EventSystem.Publish(new EventType.LoginFinish() {ZoneScene = zoneScene});
}
catch (Exception e)
{
......
......@@ -26,7 +26,7 @@ namespace ET
//Game.Scene.AddComponent<OperaComponent>();
Game.EventSystem.Publish(new EventType.EnterMapFinish());
Game.EventSystem.Publish(new EventType.EnterMapFinish() {ZoneScene = zoneScene});
}
catch (Exception e)
{
......
......@@ -14,10 +14,11 @@ namespace ET
/// </summary>
public static class UIComponentSystem
{
public static async ETTask Create(this UIComponent self, string uiType)
public static async ETTask<UI> Create(this UIComponent self, string uiType)
{
UI ui = await UIEventComponent.Instance.OnCreate(self, uiType);
self.UIs.Add(uiType, ui);
return ui;
}
public static void Remove(this UIComponent self, string uiType)
......
......@@ -4,14 +4,12 @@ namespace ET
{
public static async ETTask<UI> Create(Scene scene, string uiType)
{
UIComponent uiComponent = scene.GetComponent<UIComponent>();
return await UIEventComponent.Instance.OnCreate(uiComponent, uiType);
return await scene.GetComponent<UIComponent>().Create(uiType);
}
public static async ETTask Remove(Scene scene, string uiType)
{
UIComponent uiComponent = scene.GetComponent<UIComponent>();
UIEventComponent.Instance.OnRemove(uiComponent, uiType);
scene.GetComponent<UIComponent>().Remove(uiType);
}
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ namespace ET
{
public override async ETTask Run(EventType.LoadingBegin args)
{
await args.Scene.GetComponent<UIComponent>().Create(UIType.UILoading);
await UIHelper.Create(args.Scene, UIType.UILoading);
}
}
}
......@@ -4,7 +4,7 @@
{
public override async ETTask Run(EventType.LoadingFinish args)
{
args.Scene.GetComponent<UIComponent>().Remove(UIType.UILoading);
await UIHelper.Create(args.Scene, UIType.UILoading);
}
}
}
......@@ -27,7 +27,6 @@ namespace ET
public override void OnRemove(UIComponent uiComponent)
{
uiComponent.Remove(UIType.UILoading);
}
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
{
public override async ETTask Run(EventType.EnterMapFinish args)
{
Game.Scene.GetComponent<UIComponent>().Remove(UIType.UILobby);
await UIHelper.Remove(args.ZoneScene, UIType.UILobby);
}
}
}
......@@ -6,7 +6,7 @@ namespace ET
{
public override async ETTask Run(EventType.LoginFinish args)
{
await Game.Scene.GetComponent<UIComponent>().Create(UIType.UILobby);
await UIHelper.Create(args.ZoneScene, UIType.UILobby);
}
}
}
......@@ -8,9 +8,8 @@ namespace ET
{
public override async ETTask<UI> OnCreate(UIComponent uiComponent)
{
ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
resourcesComponent.LoadBundle(UIType.UILobby.StringToAB());
GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(UIType.UILobby.StringToAB(), UIType.UILobby);
ResourcesComponent.Instance.LoadBundle(UIType.UILobby.StringToAB());
GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILobby.StringToAB(), UIType.UILobby);
GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
UI ui = EntityFactory.CreateWithParent<UI, string, GameObject>(uiComponent, UIType.UILobby, gameObject);
......@@ -20,7 +19,7 @@ namespace ET
public override void OnRemove(UIComponent uiComponent)
{
uiComponent.Remove(UIType.UILobby);
ResourcesComponent.Instance.UnloadBundle(UIType.UILobby.StringToAB());
}
}
}
\ No newline at end of file
......@@ -8,9 +8,8 @@ namespace ET
{
public override async ETTask<UI> OnCreate(UIComponent uiComponent)
{
ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
await resourcesComponent.LoadBundleAsync(UIType.UILogin.StringToAB());
GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
await ResourcesComponent.Instance.LoadBundleAsync(UIType.UILogin.StringToAB());
GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
UI ui = EntityFactory.CreateWithParent<UI, string, GameObject>(uiComponent, UIType.UILogin, gameObject);
......@@ -21,7 +20,7 @@ namespace ET
public override void OnRemove(UIComponent uiComponent)
{
uiComponent.Remove(UIType.UILogin);
ResourcesComponent.Instance.UnloadBundle(UIType.UILogin.StringToAB());
}
}
}
\ No newline at end of file
......@@ -38,6 +38,7 @@
public struct EnterMapFinish
{
public Scene ZoneScene;
}
public struct AfterUnitCreate
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册