|
@@ -4,9 +4,9 @@ using FairyGUI;
|
|
|
namespace ET.Client
|
|
|
{
|
|
|
[Event]
|
|
|
- public class SceneChangeFinishEvent_CreateUIHelp : BEvent<SceneLoadFinish>
|
|
|
+ public class SceneChangeFinishEvent_CreateUIHelp : BEvent<ShowHUDEvent>
|
|
|
{
|
|
|
- protected override async ETTask OnEvent(SceneLoadFinish a)
|
|
|
+ protected override async ETTask OnEvent(ShowHUDEvent _)
|
|
|
{
|
|
|
var view = await UIHelper.Create( "HUD" );
|
|
|
HUDMgr.InitView( view );
|
|
@@ -38,35 +38,36 @@ namespace ET.Client
|
|
|
|
|
|
protected override async ETTask OnEvent(HPRefresh a)
|
|
|
{
|
|
|
- GProgressBar progress = null;
|
|
|
- GTextField txt = null;
|
|
|
- if(a.HPIndex == HPRefresh.Index.Tower)
|
|
|
+ var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
+ if (view != null)
|
|
|
{
|
|
|
- if(progressBar1 == null)
|
|
|
+ GProgressBar progress = null;
|
|
|
+ GTextField txt = null;
|
|
|
+ if (a.HPIndex == HPRefresh.Index.Tower)
|
|
|
{
|
|
|
- var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
- progressBar1 = view.GetChild("HPBar1").asProgress;
|
|
|
- txt1 = progressBar1.GetChild("title").asTextField;
|
|
|
+ if (progressBar1 == null)
|
|
|
+ {
|
|
|
+ progressBar1 = view.GetChild("HPBar1").asProgress;
|
|
|
+ txt1 = progressBar1.GetChild("title").asTextField;
|
|
|
+ }
|
|
|
+ progress = progressBar1;
|
|
|
+ txt = txt1;
|
|
|
}
|
|
|
- progress = progressBar1;
|
|
|
- txt = txt1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (progressBar2 == null)
|
|
|
+ else
|
|
|
{
|
|
|
- var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
- progressBar2 = view.GetChild("HPBar2").asProgress;
|
|
|
- txt2 = progressBar2.GetChild("title").asTextField;
|
|
|
+ if (progressBar2 == null)
|
|
|
+ {
|
|
|
+ progressBar2 = view.GetChild("HPBar2").asProgress;
|
|
|
+ txt2 = progressBar2.GetChild("title").asTextField;
|
|
|
+ }
|
|
|
+ progress = progressBar2;
|
|
|
+ txt = txt2;
|
|
|
}
|
|
|
- progress = progressBar2;
|
|
|
- txt = txt2;
|
|
|
- }
|
|
|
-
|
|
|
- progress.visible = true;
|
|
|
- progress.value = a.Progress;
|
|
|
- txt.text = a.Progress.ToString("F2") + "%";
|
|
|
|
|
|
+ progress.visible = true;
|
|
|
+ progress.value = a.Progress;
|
|
|
+ txt.text = a.Progress.ToString("F2") + "%";
|
|
|
+ }
|
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
|
}
|
|
@@ -119,23 +120,26 @@ namespace ET.Client
|
|
|
protected override async ETTask OnEvent(BattleMsgEvent a)
|
|
|
{
|
|
|
var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
- var list = view.GetChild("InfoList").asList;
|
|
|
-
|
|
|
- if(CurIndex >= list.numChildren)
|
|
|
+ if (view != null)
|
|
|
{
|
|
|
- CurIndex = 0;
|
|
|
- }
|
|
|
+ var list = view.GetChild("InfoList").asList;
|
|
|
|
|
|
- var comp = list.GetChildAt(CurIndex).asCom;
|
|
|
- var txt = comp.GetChild("text");
|
|
|
- txt.text = a.msg;
|
|
|
+ if (CurIndex >= list.numChildren)
|
|
|
+ {
|
|
|
+ CurIndex = 0;
|
|
|
+ }
|
|
|
|
|
|
- ++CurIndex;
|
|
|
+ var comp = list.GetChildAt(CurIndex).asCom;
|
|
|
+ var txt = comp.GetChild("text");
|
|
|
+ txt.text = a.msg;
|
|
|
+
|
|
|
+ ++CurIndex;
|
|
|
+ }
|
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- [Event]
|
|
|
+ /*[Event]
|
|
|
public class CameraOkHandler : BEvent<CameraOkEvent>
|
|
|
{
|
|
|
protected override async ETTask OnEvent(CameraOkEvent a)
|
|
@@ -145,7 +149,7 @@ namespace ET.Client
|
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
public static class HUDMgr
|
|
@@ -214,7 +218,6 @@ namespace ET.Client
|
|
|
txthp2.text = "";
|
|
|
|
|
|
var btn = view.GetChild("btn_start");
|
|
|
- btn.visible = false;
|
|
|
btn.onClick.Set( () => {
|
|
|
btn.visible = false;
|
|
|
EventSystem.Instance.Publish(BattleFunc.Static.Clone((int)BattleFunc.FUNC.Start));
|