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/GVGDuelHandlerBase.cs | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/GVGDuelHandlerBase.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/GVGDuelHandlerBase.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/GVGDuelHandlerBase.cs b/Client/Assets/Scripts/XMainClient/UI/GVGDuelHandlerBase.cs new file mode 100644 index 00000000..3f23e154 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/GVGDuelHandlerBase.cs @@ -0,0 +1,76 @@ +using System; +using UILib; +using UnityEngine; + +namespace XMainClient.UI +{ + internal class GVGDuelHandlerBase : DlgHandlerBase + { + private IXUIWrapContent _WrapContent; + + private IXUIScrollView _WrapScroll; + + private Transform _emptyTransform; + + protected IXUILabel m_DuelHelp; + + private GVGDuelWrapDisplay _display; + + protected override void Init() + { + this._WrapScroll = (base.transform.Find("DuelList").GetComponent("XUIScrollView") as IXUIScrollView); + this._WrapContent = (base.transform.Find("DuelList/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent); + this.m_DuelHelp = (base.transform.Find("Intro").GetComponent("XUILabel") as IXUILabel); + this._emptyTransform = base.transform.Find("UnApply"); + this._WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnItemWrapContentUpdate)); + } + + public override void OnUnload() + { + bool flag = this._display != null; + if (flag) + { + this._display.Recycle(); + this._display = null; + } + base.OnUnload(); + } + + public override void RefreshData() + { + int duelInfoSize = this.GetDuelInfoSize(); + this._WrapContent.SetContentCount(duelInfoSize, false); + this._WrapScroll.ResetPosition(); + } + + protected void ShowOrHide(bool active) + { + this._emptyTransform.gameObject.SetActive(active); + } + + protected virtual void OnEnterScene(IXUISprite sprite) + { + } + + protected virtual int GetDuelInfoSize() + { + return 0; + } + + protected virtual GVGDuelCombatInfo GetDuelInfo(int index) + { + return null; + } + + private void OnItemWrapContentUpdate(Transform t, int index) + { + bool flag = this._display == null; + if (flag) + { + this._display = new GVGDuelWrapDisplay(); + } + this._display.Setup(t, index, new SpriteClickEventHandler(this.OnEnterScene)); + this._display.Set(this.GetDuelInfo(index)); + } + } +} -- cgit v1.1-26-g67d0