From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/UI/XGuildRedPakageLogView.cs | 125 +++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/XGuildRedPakageLogView.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/XGuildRedPakageLogView.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/XGuildRedPakageLogView.cs b/Client/Assets/Scripts/XMainClient/UI/XGuildRedPakageLogView.cs new file mode 100644 index 00000000..7e6c2dc4 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/XGuildRedPakageLogView.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class XGuildRedPakageLogView : DlgHandlerBase + { + public ILogSource LogSource + { + set + { + this.m_LogSource = value; + } + } + + private ILogSource m_LogSource; + + private XGuildRedPacketDocument _Doc; + + private IXUIWrapContent m_WrapContent; + + private IXUIScrollView m_ScrollView; + + private Vector3 startPos = new Vector3(-96f, 0f, 0f); + + protected override void Init() + { + this._Doc = XDocuments.GetSpecificDocument(XGuildRedPacketDocument.uuID); + this.m_ScrollView = (base.PanelObject.transform.Find("LogMenu/Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this.m_WrapContent = (base.PanelObject.transform.Find("LogMenu/Panel/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent); + this.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this._WrapContentItemUpdated)); + } + + protected override void OnShow() + { + base.OnShow(); + } + + protected override void OnHide() + { + base.OnHide(); + } + + public void Refresh() + { + List logList = this.m_LogSource.GetLogList(); + int count = logList.Count; + this.m_WrapContent.SetContentCount(count, false); + this.m_ScrollView.ResetPosition(); + } + + private void _WrapContentItemUpdated(Transform t, int index) + { + List logList = this.m_LogSource.GetLogList(); + bool flag = index < 0 || index >= logList.Count; + if (!flag) + { + XGuildRedPacketLog xguildRedPacketLog = logList[index] as XGuildRedPacketLog; + IXUILabelSymbol ixuilabelSymbol = t.Find("Content").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + IXUILabel ixuilabel = t.Find("Time").GetComponent("XUILabel") as IXUILabel; + IXUILabelSymbol ixuilabelSymbol2 = t.Find("Gold").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + IXUISprite ixuisprite = t.Find("mvp").GetComponent("XUISprite") as IXUISprite; + ixuilabelSymbol.RegisterNameEventHandler(new HyperLinkClickEventHandler(this._NameClick)); + bool flag2 = XSingleton.singleton.XPlayerData.RoleID == xguildRedPacketLog.uid; + if (flag2) + { + ixuilabelSymbol.InputText = XStringDefineProxy.GetString("YOU"); + } + else + { + ixuilabelSymbol.InputText = XLabelSymbolHelper.FormatName(xguildRedPacketLog.name, xguildRedPacketLog.uid, "00ffff"); + } + Vector3 localPosition = this.startPos; + bool flag3 = this._Doc.CheckLuckest(xguildRedPacketLog.uid); + if (flag3) + { + ixuisprite.SetVisible(true); + ixuisprite.gameObject.transform.localPosition = localPosition; + localPosition.x += (float)(ixuisprite.spriteWidth + 10); + } + else + { + ixuisprite.SetVisible(false); + } + ixuilabelSymbol2.InputText = XLabelSymbolHelper.FormatCostWithIcon(xguildRedPacketLog.itemcount, (ItemEnum)xguildRedPacketLog.itemid); + ixuilabel.SetText(string.Empty); + } + } + + public override void RegisterEvent() + { + Transform transform = base.PanelObject.transform.Find("Close"); + bool flag = transform != null; + if (flag) + { + IXUIButton ixuibutton = transform.GetComponent("XUIButton") as IXUIButton; + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCloseBtnClick)); + } + } + + private bool _OnCloseBtnClick(IXUIButton go) + { + base.SetVisible(false); + return true; + } + + private void _NameClick(string param) + { + string text = ""; + ulong num = 0UL; + bool flag = XLabelSymbolHelper.ParseNameParam(param, ref text, ref num); + if (flag) + { + bool flag2 = num == XSingleton.singleton.Player.Attributes.EntityID; + if (!flag2) + { + XCharacterCommonMenuDocument.ReqCharacterMenuInfo(num, false); + } + } + } + } +} -- cgit v1.1-26-g67d0