|
@@ -3,27 +3,45 @@ using FairyGUI;
|
|
|
|
|
|
namespace ET.Client
|
|
|
{
|
|
|
+ public class HUDComonent
|
|
|
+ {
|
|
|
+ public static GComponent Root;
|
|
|
+ public static GProgressBar pgTower;
|
|
|
+ public static GProgressBar pgBoss1;
|
|
|
+ public static GProgressBar pgBoss2;
|
|
|
+ public static GProgressBar pgBoss3;
|
|
|
+ public static GProgressBar pgTKLike;
|
|
|
+ public static GList listRank;
|
|
|
+ public static GComponent[] listGift = new GComponent[6];
|
|
|
+ }
|
|
|
+
|
|
|
[Event]
|
|
|
public class ShowHUDEventHandler : BEvent<ShowHUDEvent>
|
|
|
{
|
|
|
protected override async ETTask OnEvent(ShowHUDEvent _)
|
|
|
{
|
|
|
var view = await UIHelper.Create( "HUD" );
|
|
|
+ HUDComonent.Root = view;
|
|
|
|
|
|
- var pgTower = view.GetChild("HPBarTower") as GProgressBar;
|
|
|
- var pgBoss1 = view.GetChild("HPBarBoss1") as GProgressBar;
|
|
|
- var pgBoss2 = view.GetChild("HPBarBoss2") as GProgressBar;
|
|
|
- var pgBoss3 = view.GetChild("HPBarBoss3") as GProgressBar;
|
|
|
- var progresslike = view.GetChild("EnergyBar") as GProgressBar;
|
|
|
+ HUDComonent.pgTower = view.GetChild("HPBarTower") as GProgressBar;
|
|
|
+ HUDComonent.pgBoss1 = view.GetChild("HPBarBoss1") as GProgressBar;
|
|
|
+ HUDComonent.pgBoss2 = view.GetChild("HPBarBoss2") as GProgressBar;
|
|
|
+ HUDComonent.pgBoss3 = view.GetChild("HPBarBoss3") as GProgressBar;
|
|
|
+ HUDComonent.pgTKLike = view.GetChild("EnergyBar") as GProgressBar;
|
|
|
+ HUDComonent.listRank = view.GetChild("list_rank").asList;
|
|
|
+ for( int i = 1; i <= 6; i++ )
|
|
|
+ {
|
|
|
+ HUDComonent.listGift[i - 1] = view.GetChild($"CompGift{i}").asCom;
|
|
|
+ }
|
|
|
|
|
|
- pgTower.visible = false;
|
|
|
- pgBoss1.visible = false;
|
|
|
- pgBoss2.visible = false;
|
|
|
- pgBoss3.visible = false;
|
|
|
- progresslike.visible = false;
|
|
|
+ HUDComonent.pgTower.visible = false;
|
|
|
+ HUDComonent.pgBoss1.visible = false;
|
|
|
+ HUDComonent.pgBoss2.visible = false;
|
|
|
+ HUDComonent.pgBoss3.visible = false;
|
|
|
+ HUDComonent.pgTKLike.visible = false;
|
|
|
|
|
|
- var compIcon = view.GetChild("Comp_gifticon");
|
|
|
- var compTips = view.GetChild("Comp_tips");
|
|
|
+ var compIcon = view.GetChild("CompGifticon");
|
|
|
+ var compTips = view.GetChild("CompTips");
|
|
|
var btn = view.GetChild("btn_start");
|
|
|
btn.onClick.Set(() =>
|
|
|
{
|
|
@@ -42,30 +60,19 @@ namespace ET.Client
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- [Event]
|
|
|
+ /*[Event]
|
|
|
public class SkillChangeEventHandler : BEvent<SkillChangeEvent>
|
|
|
{
|
|
|
protected override async ETTask OnEvent(SkillChangeEvent a)
|
|
|
{
|
|
|
Log.Debug("actor's skill changed.");
|
|
|
- /*var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
- if(view != null)
|
|
|
- {
|
|
|
- HUDMgr.InitView(view);
|
|
|
- }*/
|
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
[Event]
|
|
|
public class HPRefreshEventHandler : BEvent<HPRefresh>
|
|
|
{
|
|
|
- GProgressBar pgTower;
|
|
|
- GProgressBar pgBoss1;
|
|
|
- GProgressBar pgBoss2;
|
|
|
- GProgressBar pgBoss3;
|
|
|
- GProgressBar pgTKLike;
|
|
|
-
|
|
|
protected override async ETTask OnEvent(HPRefresh a)
|
|
|
{
|
|
|
var view = UIHelper.GetUI("HUD") as GComponent;
|
|
@@ -75,39 +82,19 @@ namespace ET.Client
|
|
|
switch (a.HPIndex)
|
|
|
{
|
|
|
case HPRefresh.Index.Tower:
|
|
|
- if (pgTower == null)
|
|
|
- {
|
|
|
- pgTower = view.GetChild("HPBarTower").asProgress;
|
|
|
- }
|
|
|
- progress = pgTower;
|
|
|
+ progress = HUDComonent.pgTower;
|
|
|
break;
|
|
|
case HPRefresh.Index.Boss1:
|
|
|
- if (pgBoss1 == null)
|
|
|
- {
|
|
|
- pgBoss1 = view.GetChild("HPBarBoss1").asProgress;
|
|
|
- }
|
|
|
- progress = pgBoss1;
|
|
|
+ progress = HUDComonent.pgBoss1;
|
|
|
break;
|
|
|
case HPRefresh.Index.Boss2:
|
|
|
- if (pgBoss2 == null)
|
|
|
- {
|
|
|
- pgBoss2 = view.GetChild("HPBarBoss2").asProgress;
|
|
|
- }
|
|
|
- progress = pgBoss2;
|
|
|
+ progress = HUDComonent.pgBoss2;
|
|
|
break;
|
|
|
case HPRefresh.Index.Boss3:
|
|
|
- if (pgBoss3 == null)
|
|
|
- {
|
|
|
- pgBoss3 = view.GetChild("HPBarBoss3").asProgress;
|
|
|
- }
|
|
|
- progress = pgBoss3;
|
|
|
+ progress = HUDComonent.pgBoss3;
|
|
|
break;
|
|
|
case HPRefresh.Index.TiktokLike:
|
|
|
- if (pgTKLike == null)
|
|
|
- {
|
|
|
- pgTKLike = view.GetChild("EnergyBar").asProgress;
|
|
|
- }
|
|
|
- progress = pgTKLike;
|
|
|
+ progress = HUDComonent.pgTKLike;
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -136,10 +123,7 @@ namespace ET.Client
|
|
|
{
|
|
|
protected override async ETTask OnEvent(RankChangeEvent a)
|
|
|
{
|
|
|
- var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
- if (view == null) return;
|
|
|
-
|
|
|
- var list = view.GetChild("list_rank").asList;
|
|
|
+ var list = HUDComonent.listRank;
|
|
|
if (list == null) return;
|
|
|
|
|
|
list.visible = a.InfoList != null && a.InfoList.Count > 0;
|
|
@@ -176,7 +160,7 @@ namespace ET.Client
|
|
|
{
|
|
|
protected override async ETTask OnEvent(ShowUIAnimation a)
|
|
|
{
|
|
|
- var view = UIHelper.GetUI("HUD") as GComponent;
|
|
|
+ var view = HUDComonent.Root;
|
|
|
if (view == null) return;
|
|
|
|
|
|
switch(a.Type)
|
|
@@ -207,11 +191,19 @@ namespace ET.Client
|
|
|
}
|
|
|
break;
|
|
|
case ShowUIAnimation.AniType.Tower:
|
|
|
- trans = view.GetTransition("t_help");
|
|
|
- trans.Play();
|
|
|
+ if (a.Param1 == 0)
|
|
|
+ {
|
|
|
+ view.GetTransition("t_help").Play();
|
|
|
+ }
|
|
|
+ else if (a.Param1 == 1)
|
|
|
+ {
|
|
|
+ view.GetTransition("t_jiayuangaoji").Play();
|
|
|
+ }
|
|
|
break;
|
|
|
case ShowUIAnimation.AniType.LikeEnergy:
|
|
|
- trans = view.GetTransition("t_help");
|
|
|
+ HUDComonent.pgTKLike.visible = true;
|
|
|
+ HUDComonent.pgTKLike.value = a.Param1;
|
|
|
+ trans = HUDComonent.pgTKLike.GetTransition("t0");
|
|
|
trans.Play();
|
|
|
break;
|
|
|
default:
|
|
@@ -222,7 +214,22 @@ namespace ET.Client
|
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ [Event]
|
|
|
+ public class TiktokGiftEventHandler : BEvent<TiktokGiftEvent>
|
|
|
+ {
|
|
|
+ protected override async ETTask OnEvent(TiktokGiftEvent a)
|
|
|
+ {
|
|
|
+ var comp = HUDComonent.listGift[a.index - 1];
|
|
|
+ comp.GetChild("Text1").text = a.nickname;
|
|
|
+ comp.GetChild("Text2").text = "X" + a.num;
|
|
|
+ var trans = HUDComonent.Root.GetTransition($"t_gift_00{a.index}");
|
|
|
+ if (trans != null)
|
|
|
+ {
|
|
|
+ trans.Play();
|
|
|
+ }
|
|
|
+ await ETTask.CompletedTask;
|
|
|
+ }
|
|
|
+ }
|
|
|
[Event]
|
|
|
public class ShowOrHideHeadBarHandler : BEvent<ShowOrHideHeadBar>
|
|
|
{
|