From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/UI/XGuildLogView.cs | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/XGuildLogView.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/XGuildLogView.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/XGuildLogView.cs b/Client/Assets/Scripts/XMainClient/UI/XGuildLogView.cs new file mode 100644 index 00000000..dcb17969 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/XGuildLogView.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class XGuildLogView : DlgHandlerBase + { + public ILogSource LogSource + { + set + { + this.m_LogSource = value; + } + } + + private ILogSource m_LogSource; + + private IXUIWrapContent m_WrapContent; + + private IXUIScrollView m_ScrollView; + + protected override void Init() + { + 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)); + } + + public override void RegisterEvent() + { + base.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)); + } + } + + 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) + { + ILogData logData = logList[index]; + IXUILabelSymbol ixuilabelSymbol = t.Find("Content").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + IXUILabel ixuilabel = t.Find("Time").GetComponent("XUILabel") as IXUILabel; + ixuilabelSymbol.RegisterNameEventHandler(new HyperLinkClickEventHandler(this._NameClick)); + ixuilabelSymbol.InputText = logData.GetContent(); + ixuilabel.SetText(logData.GetTime()); + } + } + + 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