summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XCharStage.cs
blob: 7acc3f2db0150a12109713be932011c9d30bee90 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal abstract class XCharStage : XStage
	{
		protected static string[] role_type;

		private uint _token1 = 0u;

		protected int _cur_tag = 0;

		protected bool _prelusive = false;

		protected bool _auto_enter = false;

		private string[] open_profession = null;

		private float _dofFade = 0f;

		private bool _setDofFade = false;

		public XCharStage(EXStage eStage) : base(eStage)
		{
			bool flag = XCharStage.role_type == null || XCharStage.role_type.Length != XGame.RoleCount + 1;
			if (flag)
			{
				XCharStage.role_type = new string[XGame.RoleCount + 1];
			}
			for (int i = 1; i <= XGame.RoleCount; i++)
			{
				XCharStage.role_type[i] = "_" + XSingleton<XProfessionSkillMgr>.singleton.GetLowerCaseWord((uint)i);
			}
		}

		public override void OnEnterStage(EXStage eOld)
		{
			base.OnEnterStage(eOld);
			XSingleton<XGameUI>.singleton.LoadSelectCharUI(this._eStage);
			XQualitySetting.SetDofFade(0f);
			this._dofFade = 0f;
			this._setDofFade = false;
		}

		public override void OnLeaveStage(EXStage eNew)
		{
			base.OnLeaveStage(eNew);
			XSingleton<XTimerMgr>.singleton.KillTimer(this._token1);
			XSingleton<XGameUI>.singleton.UnLoadSelectCharUI();
		}

		public override void Update(float fDeltaT)
		{
			base.Update(fDeltaT);
			XSingleton<XLoginDocument>.singleton.Update();
			bool flag = this._setDofFade && this._dofFade < 1f;
			if (flag)
			{
				this._dofFade += fDeltaT;
				XQualitySetting.SetDofFade(this._dofFade);
			}
		}

		public override void OnEnterScene(uint sceneid, bool transfer)
		{
			base.OnEnterScene(sceneid, transfer);
		}

		public void ShowCharacterTurn(int tag)
		{
			XSingleton<XTimerMgr>.singleton.KillTimer(this._token1);
			XSingleton<XCutScene>.singleton.Start("CutScene/character_show_turn" + XCharStage.role_type[this._cur_tag], false, true);
			this._token1 = XSingleton<XTimerMgr>.singleton.SetTimer(XSingleton<XCutScene>.singleton.Length, new XTimerMgr.ElapsedEventHandler(this.OnPrelusiveDone), null);
			this._prelusive = true;
		}

		public void ShowCharacter(int tag)
		{
			bool flag = tag == 0 || tag == this._cur_tag;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddLog("Error Tag: ", tag.ToString(), null, null, null, null, XDebugColor.XDebug_None);
				this._prelusive = false;
			}
			else
			{
				bool flag2 = tag - 1 >= XSingleton<XAttributeMgr>.singleton.XPlayerCharacters.PlayerBriefInfo.Count;
				if (flag2)
				{
					XSingleton<XDebug>.singleton.AddLog("Character with tag ", tag.ToString(), " exceeded server PlayerBriefInfo count.", null, null, null, XDebugColor.XDebug_None);
				}
				else
				{
					bool flag3 = this.open_profession == null;
					if (flag3)
					{
						this.open_profession = XSingleton<XGlobalConfig>.singleton.GetValue("OpenProfession").Split(XGlobalConfig.ListSeparator);
					}
					bool flag4 = true;
					for (int i = 0; i < this.open_profession.Length; i++)
					{
						bool flag5 = int.Parse(this.open_profession[i]) == tag;
						if (flag5)
						{
							flag4 = false;
							break;
						}
					}
					bool flag6 = flag4;
					if (flag6)
					{
						this._prelusive = false;
					}
					else
					{
						bool flag7 = !this._setDofFade;
						if (flag7)
						{
							this._setDofFade = true;
						}
						XSingleton<XLoginDocument>.singleton.SetBlockUIVisable(true);
						bool flag8 = !this._auto_enter;
						if (flag8)
						{
							XSingleton<XLoginDocument>.singleton.ShowSelectCharGerenalUI();
							DlgBase<XSelectCharView, SelectCharWindowBehaviour>.singleton.SwitchProfession(tag);
						}
						XSingleton<XTimerMgr>.singleton.KillTimer(this._token1);
						XSingleton<XCutScene>.singleton.Start("CutScene/character_select" + XCharStage.role_type[tag], false, true);
						this._token1 = XSingleton<XTimerMgr>.singleton.SetTimer(XSingleton<XCutScene>.singleton.Length, new XTimerMgr.ElapsedEventHandler(this.OnPrelusiveDone), null);
						this._cur_tag = tag;
						this._prelusive = true;
					}
				}
			}
		}

		protected void OnPrelusiveDone(object o)
		{
			XSingleton<XLoginDocument>.singleton.SetBlockUIVisable(false);
			this.PrelusiveDone();
		}

		protected abstract void PrelusiveDone();
	}
}