|
@@ -80,62 +80,53 @@ namespace ET.Client
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*[Event]
|
|
|
- public class SkillChangeEventHandler : BEvent<SkillChangeEvent>
|
|
|
- {
|
|
|
- protected override async ETTask OnEvent(SkillChangeEvent a)
|
|
|
- {
|
|
|
- Log.Debug("actor's skill changed.");
|
|
|
- await ETTask.CompletedTask;
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
[Event]
|
|
|
public class HPRefreshEventHandler : BEvent<HPRefresh>
|
|
|
{
|
|
|
protected override async ETTask OnEvent(HPRefresh a)
|
|
|
{
|
|
|
- var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
- if (view != null)
|
|
|
+ if (UIHelper.GetUI("HUD") == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ GProgressBar progress = null;
|
|
|
+ switch (a.HPIndex)
|
|
|
+ {
|
|
|
+ case HPRefresh.Index.Tower:
|
|
|
+ progress = HUDComonent.pgTower;
|
|
|
+ HUDComonent.pgTKLike.visible = a.Visible;
|
|
|
+ break;
|
|
|
+ case HPRefresh.Index.Boss1:
|
|
|
+ progress = HUDComonent.pgBoss1;
|
|
|
+ break;
|
|
|
+ case HPRefresh.Index.Boss2:
|
|
|
+ progress = HUDComonent.pgBoss2;
|
|
|
+ break;
|
|
|
+ case HPRefresh.Index.Boss3:
|
|
|
+ progress = HUDComonent.pgBoss3;
|
|
|
+ break;
|
|
|
+ case HPRefresh.Index.Boss4:
|
|
|
+ progress = HUDComonent.pgBoss4;
|
|
|
+ break;
|
|
|
+ case HPRefresh.Index.TiktokLike:
|
|
|
+ progress = HUDComonent.pgTKLike;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ progress.visible = a.Visible;
|
|
|
+ if (a.Visible)
|
|
|
{
|
|
|
- GProgressBar progress = null;
|
|
|
- switch (a.HPIndex)
|
|
|
+ progress.value = a.Progress;
|
|
|
+ var name = progress.GetChild("name");
|
|
|
+ if (name != null)
|
|
|
{
|
|
|
- case HPRefresh.Index.Tower:
|
|
|
- progress = HUDComonent.pgTower;
|
|
|
- HUDComonent.pgTKLike.visible = a.Visible;
|
|
|
- break;
|
|
|
- case HPRefresh.Index.Boss1:
|
|
|
- progress = HUDComonent.pgBoss1;
|
|
|
- break;
|
|
|
- case HPRefresh.Index.Boss2:
|
|
|
- progress = HUDComonent.pgBoss2;
|
|
|
- break;
|
|
|
- case HPRefresh.Index.Boss3:
|
|
|
- progress = HUDComonent.pgBoss3;
|
|
|
- break;
|
|
|
- case HPRefresh.Index.Boss4:
|
|
|
- progress = HUDComonent.pgBoss4;
|
|
|
- break;
|
|
|
- case HPRefresh.Index.TiktokLike:
|
|
|
- progress = HUDComonent.pgTKLike;
|
|
|
- break;
|
|
|
+ name.text = a.Name;
|
|
|
}
|
|
|
-
|
|
|
- progress.visible = a.Visible;
|
|
|
- if (a.Visible)
|
|
|
+ var txt = progress.GetChild("title");
|
|
|
+ if (txt != null)
|
|
|
{
|
|
|
- progress.value = a.Progress;
|
|
|
- var name = progress.GetChild("name");
|
|
|
- if (name != null)
|
|
|
- {
|
|
|
- name.text = a.Name;
|
|
|
- }
|
|
|
- var txt = progress.GetChild("title");
|
|
|
- if (txt != null)
|
|
|
- {
|
|
|
- txt.text = a.Title;
|
|
|
- }
|
|
|
+ txt.text = a.Title;
|
|
|
}
|
|
|
}
|
|
|
await ETTask.CompletedTask;
|
|
@@ -147,6 +138,11 @@ namespace ET.Client
|
|
|
{
|
|
|
protected override async ETTask OnEvent(RankChangeEvent a)
|
|
|
{
|
|
|
+ if (UIHelper.GetUI("HUD") == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
var list = HUDComonent.listRank;
|
|
|
if (list == null) return;
|
|
|
|
|
@@ -197,6 +193,10 @@ namespace ET.Client
|
|
|
{
|
|
|
protected override async ETTask OnEvent(ShowUIAnimation a)
|
|
|
{
|
|
|
+ if (UIHelper.GetUI("HUD") == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
var view = HUDComonent.Root;
|
|
|
if (view == null) return;
|
|
|
|
|
@@ -245,6 +245,11 @@ namespace ET.Client
|
|
|
{
|
|
|
protected override async ETTask OnEvent(TiktokGiftEvent a)
|
|
|
{
|
|
|
+ if (UIHelper.GetUI("HUD") == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
var comp = HUDComonent.listGift[a.index - 1];
|
|
|
comp.GetChild("Text1").text = a.nickname;
|
|
|
comp.GetChild("Text2").text = "X" + a.num;
|