From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/UI/GVGDuelWrapDisplay.cs | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/GVGDuelWrapDisplay.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/GVGDuelWrapDisplay.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/GVGDuelWrapDisplay.cs b/Client/Assets/Scripts/XMainClient/UI/GVGDuelWrapDisplay.cs new file mode 100644 index 00000000..1bd74fca --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/GVGDuelWrapDisplay.cs @@ -0,0 +1,160 @@ +using System; +using UILib; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class GVGDuelWrapDisplay + { + private IXUILabel m_time; + + private IXUILabel m_guildNameCurrent; + + private IXUILabel m_guildNameUsed; + + private IXUILabel m_guildNameNext; + + private IXUISprite m_PortraitCurrent; + + private IXUISprite m_PortraitUsed; + + private IXUISprite m_PortraitNext; + + private IXUISprite m_enterBattle; + + private IXUILabel m_score; + + private Transform m_UsedPortraitEmpty; + + private Transform m_CurrentPortraitEmpty; + + private Transform m_NextPortraitEmpty; + + private Transform m_CurrentVS; + + private Transform m_CurrentMessage; + + private Transform m_win; + + private Transform m_lose; + + private Transform m_current; + + private Transform m_next; + + private Transform m_used; + + private int _index; + + public void Setup(Transform t, int index, SpriteClickEventHandler handler) + { + this._index = index; + this.m_current = t.Find("Current"); + this.m_next = t.Find("Next"); + this.m_used = t.Find("Used"); + this.m_win = t.Find("Used/Result/Win"); + this.m_lose = t.Find("Used/Result/Lose"); + this.m_time = (t.Find("Day").GetComponent("XUILabel") as IXUILabel); + this.m_guildNameCurrent = (t.Find("Current/GuildName").GetComponent("XUILabel") as IXUILabel); + this.m_guildNameUsed = (t.Find("Used/GuildName").GetComponent("XUILabel") as IXUILabel); + this.m_guildNameNext = (t.Find("Next/GuildName").GetComponent("XUILabel") as IXUILabel); + this.m_PortraitCurrent = (t.Find("Current/Portrait").GetComponent("XUISprite") as IXUISprite); + this.m_PortraitUsed = (t.Find("Used/Portrait").GetComponent("XUISprite") as IXUISprite); + this.m_PortraitNext = (t.Find("Next/Portrait").GetComponent("XUISprite") as IXUISprite); + this.m_CurrentPortraitEmpty = t.Find("Current/Portrait_empty"); + this.m_UsedPortraitEmpty = t.Find("Used/Portrait_empty"); + this.m_NextPortraitEmpty = t.Find("Next/Portrait_empty"); + this.m_CurrentVS = t.Find("Current/VS"); + this.m_CurrentMessage = t.Find("Current/VS_empty"); + this.m_score = (t.Find("Used/Score").GetComponent("XUILabel") as IXUILabel); + this.m_enterBattle = (t.Find("Current/Btn").GetComponent("XUISprite") as IXUISprite); + this.m_enterBattle.RegisterSpriteClickEventHandler(handler); + this.m_enterBattle.ID = (ulong)((long)index); + } + + public void Reset() + { + this.m_time.SetText(string.Empty); + this.m_next.gameObject.SetActive(true); + this.m_used.gameObject.SetActive(false); + this.m_current.gameObject.SetActive(false); + } + + public void Set(GVGDuelCombatInfo combatInfo) + { + bool flag = combatInfo == null; + if (flag) + { + this.Reset(); + } + else + { + this.m_time.SetText(combatInfo.ToTimeString()); + this.m_next.gameObject.SetActive(combatInfo.gs == GVGDuelStatu.IDLE); + this.m_used.gameObject.SetActive(combatInfo.gs == GVGDuelStatu.FINISH); + this.m_current.gameObject.SetActive(combatInfo.gs == GVGDuelStatu.FIGHTING); + GVGDuelStatu gs = combatInfo.gs; + if (gs != GVGDuelStatu.FINISH) + { + if (gs != GVGDuelStatu.FIGHTING) + { + this.m_guildNameNext.SetText(combatInfo.GetGuildName()); + this.m_PortraitNext.SetSprite(combatInfo.GetPortraitName()); + this.m_PortraitNext.SetVisible(combatInfo.Pass()); + this.m_PortraitNext.SetVisible(combatInfo.Pass()); + this.m_PortraitNext.ID = combatInfo.GuildID; + this.m_NextPortraitEmpty.gameObject.SetActive(!combatInfo.Pass()); + } + else + { + this.m_guildNameCurrent.SetText(combatInfo.GetGuildName()); + this.m_PortraitCurrent.SetSprite(combatInfo.GetPortraitName()); + this.m_PortraitCurrent.SetVisible(combatInfo.Pass()); + this.m_PortraitCurrent.SetVisible(combatInfo.Pass()); + this.m_PortraitCurrent.ID = combatInfo.GuildID; + this.m_CurrentPortraitEmpty.gameObject.SetActive(!combatInfo.Pass()); + this.m_enterBattle.SetGrey(combatInfo.gs == GVGDuelStatu.FIGHTING); + this.m_enterBattle.SetVisible(combatInfo.Pass()); + this.m_CurrentVS.gameObject.SetActive(combatInfo.Pass()); + this.m_CurrentMessage.gameObject.SetActive(!combatInfo.Pass()); + } + } + else + { + this.m_guildNameUsed.SetText(combatInfo.GetGuildName()); + this.m_PortraitUsed.SetSprite(combatInfo.GetPortraitName()); + this.m_UsedPortraitEmpty.gameObject.SetActive(!combatInfo.Pass()); + this.m_PortraitUsed.SetVisible(combatInfo.Pass()); + this.m_score.SetText(XSingleton.singleton.StringCombine("+", combatInfo.AddScore.ToString())); + this.m_win.gameObject.SetActive(combatInfo.Winner); + this.m_lose.gameObject.SetActive(!combatInfo.Winner); + this.m_PortraitUsed.ID = combatInfo.GuildID; + } + } + } + + public void Recycle() + { + this.m_time = null; + this.m_guildNameCurrent = null; + this.m_guildNameUsed = null; + this.m_guildNameNext = null; + this.m_PortraitCurrent = null; + this.m_PortraitUsed = null; + this.m_PortraitNext = null; + this.m_enterBattle = null; + this.m_score = null; + this.m_UsedPortraitEmpty = null; + this.m_CurrentPortraitEmpty = null; + this.m_NextPortraitEmpty = null; + this.m_CurrentVS = null; + this.m_CurrentMessage = null; + this.m_win = null; + this.m_lose = null; + this.m_current = null; + this.m_next = null; + this.m_used = null; + } + } +} -- cgit v1.1-26-g67d0