summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/FlowerActivityHandler.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/UI/FlowerActivityHandler.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/FlowerActivityHandler.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/UI/FlowerActivityHandler.cs82
1 files changed, 82 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/FlowerActivityHandler.cs b/Client/Assets/Scripts/XMainClient/UI/FlowerActivityHandler.cs
new file mode 100644
index 00000000..ffbe4f6a
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/UI/FlowerActivityHandler.cs
@@ -0,0 +1,82 @@
+using System;
+using UILib;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient.UI
+{
+ internal class FlowerActivityHandler : DlgHandlerBase
+ {
+ protected override string FileName
+ {
+ get
+ {
+ return "OperatingActivity/FlowerActivityFrame";
+ }
+ }
+
+ private IXUILabel m_Tip1;
+
+ private IXUILabel m_Tip2;
+
+ private IXUILabel m_AwardRankCount;
+
+ private IXUIButton m_GoWeekRank;
+
+ private Transform m_AwardRoot;
+
+ private XUIPool m_ItemPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
+
+ protected override void Init()
+ {
+ base.Init();
+ this.m_Tip1 = (base.PanelObject.transform.Find("Main/Tip1").GetComponent("XUILabel") as IXUILabel);
+ this.m_Tip2 = (base.PanelObject.transform.Find("Main/Tip2").GetComponent("XUILabel") as IXUILabel);
+ this.m_AwardRankCount = (base.PanelObject.transform.Find("Main/Items/RankNum").GetComponent("XUILabel") as IXUILabel);
+ this.m_GoWeekRank = (base.PanelObject.transform.Find("Main/Btns/ViewRewardBtn").GetComponent("XUIButton") as IXUIButton);
+ this.m_AwardRoot = base.PanelObject.transform.Find("Main/Items");
+ GameObject gameObject = base.PanelObject.transform.Find("Main/Items/Item").gameObject;
+ this.m_ItemPool.SetupPool(this.m_AwardRoot.gameObject, gameObject, 7u, false);
+ }
+
+ protected override void OnShow()
+ {
+ base.OnShow();
+ this.m_Tip1.SetText(XSingleton<XStringTable>.singleton.GetString("FLOWER_ACTIVITY_TIP1"));
+ this.m_Tip2.SetText(XSingleton<XStringTable>.singleton.GetString("FLOWER_ACTIVITY_TIP3"));
+ this.m_AwardRankCount.SetText(XSingleton<XStringTable>.singleton.GetString("FLOWER_ACTIVITY_AWARD_RANK"));
+ this.SetAwardsInfo();
+ }
+
+ public override void RegisterEvent()
+ {
+ base.RegisterEvent();
+ this.m_GoWeekRank.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGoWeekRankClicked));
+ }
+
+ private bool OnGoWeekRankClicked(IXUIButton btn)
+ {
+ XSingleton<XGameSysMgr>.singleton.OpenSystem(XSysDefine.XSys_Flower_Rank_Week, 0UL);
+ return true;
+ }
+
+ private void SetAwardsInfo()
+ {
+ XFlowerRankDocument specificDocument = XDocuments.GetSpecificDocument<XFlowerRankDocument>(XFlowerRankDocument.uuID);
+ SeqListRef<int> weekRankAward = specificDocument.GetWeekRankAward(1);
+ this.m_ItemPool.ReturnAll(false);
+ for (int i = 0; i < weekRankAward.Count; i++)
+ {
+ GameObject gameObject = this.m_ItemPool.FetchGameObject(false);
+ gameObject.transform.parent = this.m_AwardRoot;
+ gameObject.name = i.ToString();
+ gameObject.transform.localScale = Vector3.one;
+ gameObject.transform.localPosition = new Vector3((float)(this.m_ItemPool.TplWidth * i), 0f, 0f);
+ IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
+ ixuisprite.ID = (ulong)((long)weekRankAward[i, 0]);
+ XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, weekRankAward[i, 0], weekRankAward[i, 1], false);
+ ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
+ }
+ }
+ }
+}