|
@@ -15,7 +15,7 @@ namespace ET.Client
|
|
|
public static GProgressBar pgBoss4;
|
|
|
public static GProgressBar pgTKLike;
|
|
|
public static GList listRank;
|
|
|
- public static GComponent[] listGift = new GComponent[6];
|
|
|
+ public static GComponent[,] listGift = new GComponent[4,6];
|
|
|
}
|
|
|
|
|
|
[Event]
|
|
@@ -33,9 +33,12 @@ namespace ET.Client
|
|
|
HUDComonent.pgBoss4 = view.GetChild("HPBarBoss4") as GProgressBar;
|
|
|
HUDComonent.pgTKLike = view.GetChild("EnergyBar") as GProgressBar;
|
|
|
HUDComonent.listRank = view.GetChild("list_rank").asList;
|
|
|
- for( int i = 1; i <= 6; i++ )
|
|
|
+ for( int i = 1; i <= 4; i++ )
|
|
|
{
|
|
|
- HUDComonent.listGift[i - 1] = view.GetChild($"CompGift{i}").asCom;
|
|
|
+ for (int j = 1; j <= 6; j++)
|
|
|
+ {
|
|
|
+ HUDComonent.listGift[i-1, j-1] = view.GetChild($"CompGift{i}{j}").asCom;
|
|
|
+ }
|
|
|
}
|
|
|
for (int i = 0; i < HUDComonent.listRank.numChildren; i++)
|
|
|
{
|
|
@@ -196,6 +199,7 @@ namespace ET.Client
|
|
|
[Event]
|
|
|
public class ShowUIAnimationHandler : BEvent<ShowUIAnimation>
|
|
|
{
|
|
|
+ private static bool bPlayingLikes = false;
|
|
|
protected override async ETTask OnEvent(ShowUIAnimation a)
|
|
|
{
|
|
|
if (UIHelper.GetUI("HUD") == null)
|
|
@@ -233,8 +237,11 @@ namespace ET.Client
|
|
|
break;
|
|
|
case ShowUIAnimation.AniType.LikeEnergy:
|
|
|
HUDComonent.pgTKLike.value = a.Param1;
|
|
|
+
|
|
|
+ if (bPlayingLikes) return;
|
|
|
+ bPlayingLikes = true;
|
|
|
HUDComonent.pgTKLike.GetTransition("t0").Play();
|
|
|
- view.GetTransition("+1").Play();
|
|
|
+ view.GetTransition("+1").Play(() => { bPlayingLikes = false; });
|
|
|
break;
|
|
|
default:
|
|
|
Log.Error($"unknow ui animation: {a.Type}");
|
|
@@ -247,6 +254,17 @@ namespace ET.Client
|
|
|
[Event]
|
|
|
public class TiktokGiftEventHandler : BEvent<TiktokGiftEvent>
|
|
|
{
|
|
|
+ private static List<TiktokGiftEvent> Pool = new() { };
|
|
|
+ private static List<TiktokGiftEvent> playlist = new();
|
|
|
+ private static List<string> idlelist = new() { "t_gift_1", "t_gift_2", "t_gift_3", "t_gift_4" };
|
|
|
+ public static void Reset()
|
|
|
+ {
|
|
|
+ idlelist.Clear();
|
|
|
+ idlelist.Add("t_gift_1");
|
|
|
+ idlelist.Add("t_gift_2");
|
|
|
+ idlelist.Add("t_gift_3");
|
|
|
+ idlelist.Add("t_gift_4");
|
|
|
+ }
|
|
|
protected override async ETTask OnEvent(TiktokGiftEvent a)
|
|
|
{
|
|
|
if (UIHelper.GetUI("HUD") == null)
|
|
@@ -254,21 +272,51 @@ namespace ET.Client
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var comp = HUDComonent.listGift[a.index - 1];
|
|
|
- comp.GetChild("Text1").text = a.nickname;
|
|
|
- comp.GetChild("Text2").text = "X" + a.num;
|
|
|
+ TiktokGiftEvent ob = null;
|
|
|
+ if (Pool.Count > 0)
|
|
|
+ {
|
|
|
+ ob = Pool[0];
|
|
|
+ Pool.RemoveAt(0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ob = new TiktokGiftEvent();
|
|
|
+ }
|
|
|
+ ob.nickname = a.nickname;
|
|
|
+ ob.avatar = a.avatar;
|
|
|
+ ob.index = a.index;
|
|
|
+ ob.num = a.num;
|
|
|
+ if (idlelist.Count == 0)
|
|
|
+ {
|
|
|
+ playlist.Add(ob);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ string workani = idlelist[0];
|
|
|
+ idlelist.RemoveAt(0);
|
|
|
+ int workindex = workani[7] - '1';
|
|
|
+
|
|
|
+ var comp = HUDComonent.listGift[workindex, ob.index - 1];
|
|
|
+ comp.GetChild("Text1").text = ob.nickname;
|
|
|
+ comp.GetChild("Text2").text = "X" + ob.num;
|
|
|
var mask = comp.GetChild("n0").asCom;
|
|
|
var icon = mask.GetChild("iconLoader").asLoader;
|
|
|
- var url = a.avatar;
|
|
|
+ var url = ob.avatar;
|
|
|
if (!string.IsNullOrEmpty(url))
|
|
|
{
|
|
|
LoadHeadIcon(icon, url).Coroutine();
|
|
|
}
|
|
|
- var trans = HUDComonent.Root.GetTransition($"t_gift_00{a.index}");
|
|
|
- if (trans != null)
|
|
|
+ HUDComonent.Root.GetTransition($"{workani}{ob.index}").Play(() =>
|
|
|
{
|
|
|
- trans.Play();
|
|
|
- }
|
|
|
+ Pool.Add(ob);
|
|
|
+ idlelist.Add(workani);
|
|
|
+ if(playlist.Count >0)
|
|
|
+ {
|
|
|
+ var toplay = playlist[0];
|
|
|
+ playlist.RemoveAt(0);
|
|
|
+ OnEvent(toplay).Coroutine();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
await ETTask.CompletedTask;
|
|
|
}
|
|
|
private async ETTask LoadHeadIcon(GLoader loader, string url)
|