summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/ModalDlg2.cs
blob: 0eef61349f56f3955340a4db51ba707a662c43eb (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
using System;
using UILib;
using XMainClient.UI.UICommon;

namespace XMainClient.UI
{
	public class ModalDlg2 : DlgBase<ModalDlg2, ModalDlg2Behaviour>
	{
		public override string fileName
		{
			get
			{
				return "Common/GreyModalDlg2";
			}
		}

		public override int layer
		{
			get
			{
				return 100;
			}
		}

		public override bool isHideChat
		{
			get
			{
				return false;
			}
		}

		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		private ButtonClickEventHandler _bFrButtonDelegate = null;

		private ButtonClickEventHandler _bSecButtonDelegate = null;

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseBtnClick));
			base.uiBehaviour.m_Select1.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSelect1BtnClick));
			base.uiBehaviour.m_Select2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSelect2BtnClick));
		}

		public bool OnCloseBtnClick(IXUIButton btn)
		{
			this.SetVisible(false, true);
			return true;
		}

		public bool OnSelect1BtnClick(IXUIButton btn)
		{
			this._bFrButtonDelegate(base.uiBehaviour.m_Select1);
			this.SetVisible(false, true);
			return true;
		}

		public bool OnSelect2BtnClick(IXUIButton btn)
		{
			this._bSecButtonDelegate(base.uiBehaviour.m_Select2);
			this.SetVisible(false, true);
			return true;
		}

		public void SetBtnMsg(IXUIButton btn, string price, string label)
		{
			IXUILabelSymbol ixuilabelSymbol = btn.gameObject.transform.Find("Price").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
			IXUILabel ixuilabel = btn.gameObject.transform.Find("Label").GetComponent("XUILabel") as IXUILabel;
			ixuilabelSymbol.InputText = price;
			ixuilabel.SetText(label);
		}

		public void InitShow(string text, ButtonClickEventHandler func1, ButtonClickEventHandler func2, string price1, string price2, string btnLabel1, string btnLabel2)
		{
			this.SetVisible(true, true);
			this.SetBtnMsg(base.uiBehaviour.m_Select1, price1, btnLabel1);
			this.SetBtnMsg(base.uiBehaviour.m_Select2, price2, btnLabel2);
			base.uiBehaviour.m_Text.InputText = text;
			this._bFrButtonDelegate = func1;
			this._bSecButtonDelegate = func2;
		}
	}
}