summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/RecycleSystemDlg.cs
blob: daacdabd90137f7292a0b2e24e57a18faae13971 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class RecycleSystemDlg : TabDlgBase<RecycleSystemDlg>
	{
		public string EffectPath
		{
			get
			{
				bool flag = string.IsNullOrEmpty(this.m_effectPath);
				if (flag)
				{
					this.m_effectPath = XSingleton<XGlobalConfig>.singleton.GetValue("RecycleEffectPath");
				}
				return this.m_effectPath;
			}
		}

		public override string fileName
		{
			get
			{
				return "GameSystem/RecycleDlg";
			}
		}

		public RecycleItemBagView _RecycleItemBagView;

		public RecycleItemOperateView _RecycleItemOperateView;

		public GameObject m_RecycleItemBagPanel;

		public GameObject m_RecycleItemOperatePanel;

		public GameObject m_InputBlocker;

		public IXUIButton m_helpBtn;

		private XFx m_fx;

		private string m_effectPath = string.Empty;

		protected override void Init()
		{
			base.Init();
			this.m_RecycleItemBagPanel = base.uiBehaviour.transform.Find("Bg/ItemListPanel").gameObject;
			this.m_RecycleItemBagPanel.SetActive(false);
			this.m_RecycleItemOperatePanel = base.uiBehaviour.transform.Find("Bg/LeftPanel/ItemOperateFrame").gameObject;
			this.m_RecycleItemOperatePanel.SetActive(false);
			this.m_InputBlocker = base.uiBehaviour.transform.Find("Bg/BlockerPanel/InputBlocker").gameObject;
			this.m_helpBtn = (base.uiBehaviour.transform.Find("Bg/LeftPanel/T/Help").GetComponent("XUIButton") as IXUIButton);
			this.m_helpBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.ShowHelp));
			bool flag = this.m_fx == null;
			if (flag)
			{
				this.m_fx = XSingleton<XFxMgr>.singleton.CreateFx(this.EffectPath, null, true);
			}
			else
			{
				this.m_fx.SetActive(true);
			}
			this.m_fx.Play(base.uiBehaviour.transform.Find("Bg/p"), Vector3.zero, Vector3.one, 1f, true, false);
		}

		protected override void OnLoad()
		{
			base.OnLoad();
		}

		protected override void OnUnload()
		{
			bool flag = this.m_fx != null;
			if (flag)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this.m_fx, true);
				this.m_fx = null;
			}
			DlgHandlerBase.EnsureUnload<RecycleItemBagView>(ref this._RecycleItemBagView);
			DlgHandlerBase.EnsureUnload<RecycleItemOperateView>(ref this._RecycleItemOperateView);
			base.OnUnload();
		}

		protected override void OnShow()
		{
			base.OnShow();
			DlgBase<CapacityDownDlg, CapacityBehaviour>.singleton.ShowRecycleTips();
		}

		private bool ShowHelp(IXUIButton button)
		{
			DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>.singleton.ShowHelp(XSysDefine.XSys_Recycle_Equip);
			return false;
		}

		public override void SetupHandlers(XSysDefine sys)
		{
			XRecycleItemDocument specificDocument = XDocuments.GetSpecificDocument<XRecycleItemDocument>(XRecycleItemDocument.uuID);
			specificDocument.CurrentSys = sys;
			XSysDefine xsysDefine = sys;
			if (xsysDefine != XSysDefine.XSys_Recycle_Equip)
			{
				if (xsysDefine != XSysDefine.XSys_Recycle_Jade)
				{
					XSingleton<XDebug>.singleton.AddErrorLog("System has not finished:", sys.ToString(), null, null, null, null);
					return;
				}
				base._AddActiveHandler(DlgHandlerBase.EnsureCreate<RecycleItemBagView>(ref this._RecycleItemBagView, this.m_RecycleItemBagPanel, this, true));
				base._AddActiveHandler(DlgHandlerBase.EnsureCreate<RecycleItemOperateView>(ref this._RecycleItemOperateView, this.m_RecycleItemOperatePanel, this, true));
			}
			else
			{
				base._AddActiveHandler(DlgHandlerBase.EnsureCreate<RecycleItemBagView>(ref this._RecycleItemBagView, this.m_RecycleItemBagPanel, this, true));
				base._AddActiveHandler(DlgHandlerBase.EnsureCreate<RecycleItemOperateView>(ref this._RecycleItemOperateView, this.m_RecycleItemOperatePanel, this, true));
			}
			this.ToggleInputBlocker(false);
		}

		public void ToggleInputBlocker(bool bBlock)
		{
			this.m_InputBlocker.SetActive(bBlock);
		}
	}
}