summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_ChooseProfession.cs
blob: 0a46333289ccbc7082ba234c6b10a674080ef2ee (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
using System;
using System.Reflection;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class Process_RpcC2G_ChooseProfession
	{
		public static void OnReply(ChooseProfArg oArg, ChooseProfRes oRes)
		{
			bool flag = oRes.errorcode == ErrorCode.ERR_INVALID_REQUEST;
			if (flag)
			{
				string fullName = MethodBase.GetCurrentMethod().ReflectedType.FullName;
				XSingleton<UiUtility>.singleton.OnGetInvalidRequest(fullName);
			}
			else
			{
				bool flag2 = oRes.errorcode == ErrorCode.ERR_SUCCESS;
				if (flag2)
				{
					XSingleton<XAttributeMgr>.singleton.XPlayerData.Profession = oArg.prof;
					int num = XFastEnumIntEqualityComparer<RoleType>.ToInt(XSingleton<XAttributeMgr>.singleton.XPlayerData.Profession);
					XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID);
					bool flag3 = entity != null && entity.Attributes != null;
					if (flag3)
					{
						entity.Attributes.Outlook.SetProfType((uint)num);
						entity.Attributes.Outlook.CalculateOutLookFashion();
						XEquipChangeEventArgs @event = XEventPool<XEquipChangeEventArgs>.GetEvent();
						@event.Firer = XSingleton<XEntityMgr>.singleton.Player;
						XSingleton<XEventMgr>.singleton.FireEvent(@event);
					}
					bool flag4 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
					if (flag4)
					{
						DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.SetAvatar(XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon(num));
					}
					XSkillTreeDocument specificDocument = XDocuments.GetSpecificDocument<XSkillTreeDocument>(XSkillTreeDocument.uuID);
					specificDocument.CreateAndPlayFxFxFirework();
					specificDocument.SkillRefresh(true, true);
					XSingleton<XTutorialHelper>.singleton.SwitchProf = true;
				}
			}
		}

		public static void OnTimeout(ChooseProfArg oArg)
		{
		}
	}
}