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/XJadeSlotDrawer.cs | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XJadeSlotDrawer.cs (limited to 'Client/Assets/Scripts/XMainClient/XJadeSlotDrawer.cs') diff --git a/Client/Assets/Scripts/XMainClient/XJadeSlotDrawer.cs b/Client/Assets/Scripts/XMainClient/XJadeSlotDrawer.cs new file mode 100644 index 00000000..1f575725 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XJadeSlotDrawer.cs @@ -0,0 +1,72 @@ +using System; +using UILib; +using UnityEngine; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XJadeSlotDrawer : XItemDrawer + { + private IXUISprite cover; + + private IXUISprite back; + + private IXUISprite total; + + private IXUISprite lockJade; + + public void DrawItem(GameObject go, uint slot, bool hasLock, XJadeItem realItem) + { + this._GetUI(go); + this.SetupCoverAndBack(slot, hasLock); + this._SetupAttrIcon(null); + XSingleton.singleton.jadeItemDrawer.DrawItem(go, realItem, false); + this._ClearVariables(); + } + + private void SetupCoverAndBack(uint slot, bool hasLock) + { + bool flag = !XJadeInfo.SlotExists(slot); + if (flag) + { + if (hasLock) + { + this.cover.SetVisible(true); + this.lockJade.SetVisible(true); + this.total.SetVisible(true); + } + else + { + this.lockJade.SetVisible(false); + this.cover.SetVisible(false); + this.back.SetVisible(false); + this.total.SetVisible(false); + } + } + else + { + this.total.SetVisible(true); + this.lockJade.SetVisible(false); + this.cover.SetVisible(false); + this.back.SetVisible(true); + this.back.SetSprite("iconly_" + slot); + } + } + + protected override void _GetUI(GameObject uiGo) + { + base._GetUI(uiGo); + this.cover = (uiGo.transform.Find("Cover").GetComponent("XUISprite") as IXUISprite); + this.back = (uiGo.transform.Find("Back").GetComponent("XUISprite") as IXUISprite); + this.total = (uiGo.transform.GetComponent("XUISprite") as IXUISprite); + this.lockJade = (uiGo.transform.Find("Lock").GetComponent("XUISprite") as IXUISprite); + } + + protected override void _ClearVariables() + { + base._ClearVariables(); + this.cover = null; + this.back = null; + } + } +} -- cgit v1.1-26-g67d0