summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XMultiPkLoadingView.cs
blob: 4827d7dfe1f2141a5e920083e530e999613e2f7c (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 KKSG;
using UILib;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XMultiPkLoadingView : DlgBase<XMultiPkLoadingView, XMultiPkLoadingBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "Common/PkLoadingDlg2";
			}
		}

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

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

		public bool IsLoadingOver
		{
			get
			{
				return this._isLoadingOver;
			}
		}

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

		private XQualifyingDocument _doc = null;

		private bool _isLoadingOver = false;

		protected override void Init()
		{
			base.Init();
			this._isLoadingOver = false;
			this._doc = XDocuments.GetSpecificDocument<XQualifyingDocument>(XQualifyingDocument.uuID);
		}

		public void ShowPkLoading()
		{
			this.SetVisible(true, true);
		}

		protected override void OnShow()
		{
			base.OnShow();
			XSingleton<XTimerMgr>.singleton.SetTimer(1f, new XTimerMgr.ElapsedEventHandler(this.LoadingOver), null);
			this.SetRoleInfo();
		}

		protected override void OnHide()
		{
			base.OnHide();
			for (int i = 0; i < base.uiBehaviour.m_HalfPic.Length; i++)
			{
				base.uiBehaviour.m_HalfPic[i].SetTexturePath("");
			}
		}

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

		private void LoadingOver(object o)
		{
			this._isLoadingOver = true;
		}

		private void SetRoleInfo()
		{
			int num = 0;
			while (num < this._doc.PkInfoList.Count && num < 4)
			{
				base.uiBehaviour.m_Name[num].SetText(this._doc.PkInfoList[num].brief.roleName);
				base.uiBehaviour.m_Score[num].SetText(this._doc.PkInfoList[num].point.ToString());
				int num2 = (int)this._doc.PkInfoList[num].brief.roleProfession;
				bool flag = XAttributes.GetCategory(this._doc.PkInfoList[num].brief.roleID) > EntityCategory.Category_Role;
				if (flag)
				{
					num2 %= 10;
				}
				base.uiBehaviour.m_Prefession[num].SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfIcon(num2));
				string halfPic = XSingleton<XProfessionSkillMgr>.singleton.GetHalfPic(this._doc.PkInfoList[num].brief.roleProfession % 10u);
				base.uiBehaviour.m_HalfPic[num].SetTexturePath("atlas/UI/common/2DAvatar/" + halfPic);
				num++;
			}
		}

		public void HidePkLoading()
		{
			bool flag = !base.IsVisible();
			if (!flag)
			{
				base.uiBehaviour.m_PkLoadingTween.PlayTween(true, -1f);
				base.uiBehaviour.m_PkLoadingTween.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnPkLoadingTweenFinish));
			}
		}

		private void OnPkLoadingTweenFinish(IXUITweenTool tween)
		{
			this.SetVisible(false, true);
		}
	}
}