summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XJadeSlotDrawer.cs
blob: 1f57572500abc93cdbdd861e1e9fcd4b832f926b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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<XItemDrawerMgr>.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;
		}
	}
}