summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_DoEnterScene.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_DoEnterScene.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_DoEnterScene.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_DoEnterScene.cs153
1 files changed, 153 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_DoEnterScene.cs b/Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_DoEnterScene.cs
new file mode 100644
index 00000000..ed1ff9c1
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_DoEnterScene.cs
@@ -0,0 +1,153 @@
+using System;
+using KKSG;
+using UnityEngine;
+using XMainClient.UI;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class Process_RpcC2G_DoEnterScene
+ {
+ public static uint runstate
+ {
+ get
+ {
+ return Process_RpcC2G_DoEnterScene._runstate;
+ }
+ }
+
+ private static uint _runstate = 0u;
+
+ public static void OnReply(DoEnterSceneArg oArg, DoEnterSceneRes oRes)
+ {
+ bool flag = oRes.errorcode == ErrorCode.ERR_INVALID_REQUEST;
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("RpcC2G_DoEnterScene ERR_INVALID_REQUEST!", null, null, null, null, null);
+ }
+ else
+ {
+ bool flag2 = !XSingleton<XScene>.singleton.bSceneLoadedRpcSend;
+ if (!flag2)
+ {
+ XSingleton<XScene>.singleton.bSceneServerReady = true;
+ XSingleton<XScene>.singleton.bSceneLoadedRpcSend = false;
+ XSingleton<XDebug>.singleton.AddLog("Enter scene ", XSingleton<XScene>.singleton.SceneID.ToString(), null, null, null, null, XDebugColor.XDebug_None);
+ bool flag3 = oRes.errorcode == ErrorCode.ERR_DOENTERSCENE_FAILED;
+ if (flag3)
+ {
+ XSingleton<XDebug>.singleton.AddLog("ERR_DOENTERSCENE_FAILED", null, null, null, null, null, XDebugColor.XDebug_None);
+ }
+ else
+ {
+ Process_RpcC2G_DoEnterScene._runstate = oRes.scenestate.runstate;
+ Vector3 vector;
+ vector = new Vector3(oRes.pos.x, oRes.pos.y, oRes.pos.z);
+ Vector3 vector2 = XSingleton<XCommon>.singleton.FloatToAngle(oRes.face);
+ Vector3 face = XSingleton<XCommon>.singleton.FloatToAngle(oRes.initface);
+ XSingleton<XEntityMgr>.singleton.Player.Attributes.OnFightGroupChange((XSingleton<XGame>.singleton.SyncModeValue != 0) ? oRes.fightgroup : 1u);
+ XSingleton<XEntityMgr>.singleton.Player.Attributes.AppearAt = vector;
+ XSingleton<XEntityMgr>.singleton.Player.Net.CorrectNet(vector, face, 0u, true);
+ XBattleDocument.MiniMapSetRotation(oRes.initface);
+ GameObject gameObject = GameObject.Find("Scene/BattlePoint");
+ XSingleton<XScene>.singleton.BattleTargetPoint = ((gameObject != null) ? gameObject.transform.position : Vector3.zero);
+ gameObject = GameObject.Find("Scene/NestPoint");
+ XSingleton<XScene>.singleton.NestTargetPoint = ((gameObject != null) ? gameObject.transform.position : Vector3.zero);
+ XSingleton<XScene>.singleton.GameCamera.Root_R_Y_Default = XSingleton<XEntityMgr>.singleton.Player.EngineObject.Rotation.eulerAngles.y;
+ XSingleton<XScene>.singleton.GameCamera.Root_R_Y = XSingleton<XScene>.singleton.GameCamera.Root_R_Y_Default;
+ bool flag4 = XSingleton<XScene>.singleton.GameCamera.Wall != null;
+ if (flag4)
+ {
+ XSingleton<XScene>.singleton.GameCamera.Wall.TargetY = XSingleton<XScene>.singleton.GameCamera.Root_R_Y_Default;
+ }
+ bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
+ if (bSpectator)
+ {
+ XSingleton<XEntityMgr>.singleton.Puppets(XSingleton<XEntityMgr>.singleton.Player, true, true);
+ XSingleton<XInput>.singleton.Freezed = true;
+ XSingleton<XEntityMgr>.singleton.Player.Attributes.OnFightGroupChange(2u);
+ }
+ else
+ {
+ bool flag5 = XSingleton<XEntityMgr>.singleton.Player.Nav != null;
+ if (flag5)
+ {
+ XSingleton<XEntityMgr>.singleton.Player.Nav.Active();
+ }
+ bool flag6 = XSingleton<XEntityMgr>.singleton.Player.AI != null;
+ if (flag6)
+ {
+ XSingleton<XEntityMgr>.singleton.Player.AI.Active();
+ }
+ bool flag7 = ((ulong)oRes.specialstate & (ulong)(1L << (XFastEnumIntEqualityComparer<UnitSpecialState>.ToInt(UnitSpecialState.Unit_Puppet) & 31))) > 0UL;
+ bool flag8 = ((ulong)oRes.specialstate & (ulong)(1L << (XFastEnumIntEqualityComparer<UnitSpecialState>.ToInt(UnitSpecialState.Unit_Invisible) & 31))) > 0UL;
+ bool flag9 = flag7 || flag8;
+ if (flag9)
+ {
+ XSingleton<XEntityMgr>.singleton.Player.UpdateSpecialStateFromServer(oRes.specialstate, uint.MaxValue);
+ }
+ else
+ {
+ XSingleton<XEntityMgr>.singleton.Player.Present.ShowUp();
+ }
+ }
+ bool bSpectator2 = XSingleton<XScene>.singleton.bSpectator;
+ if (bSpectator2)
+ {
+ XSpectateSceneDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
+ specificDocument.IsCrossServerBattle = oRes.is_cross;
+ }
+ else
+ {
+ XBattleDocument specificDocument2 = XDocuments.GetSpecificDocument<XBattleDocument>(XBattleDocument.uuID);
+ specificDocument2.IsCrossServerBattle = oRes.is_cross;
+ }
+ for (int i = 0; i < XSingleton<XGame>.singleton.Doc.Components.Count; i++)
+ {
+ (XSingleton<XGame>.singleton.Doc.Components[i] as XDocComponent).OnEnterSceneFinally();
+ }
+ XOutlookHelper.SetStatusState(XSingleton<XEntityMgr>.singleton.Player.Attributes, XSingleton<XEntityMgr>.singleton.Player, oRes.state, true);
+ XSingleton<XScene>.singleton.SceneStarted = oRes.scenestate.isready;
+ bool flag10 = !XSingleton<XScene>.singleton.SceneStarted && DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible();
+ if (flag10)
+ {
+ DlgBase<BattleMain, BattleMainBehaviour>.singleton.uiBehaviour.m_PromptFrame.gameObject.SetActive(true);
+ DlgBase<BattleMain, BattleMainBehaviour>.singleton.SetLoadingPrompt(null, false);
+ }
+ bool flag11 = XSingleton<XScene>.singleton.bSpectator && oRes.iswatchend;
+ if (flag11)
+ {
+ DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.ShowBackToMainCityTips();
+ }
+ XSingleton<XLevelFinishMgr>.singleton.LevelRewardToken = oRes.battlestamp;
+ bool isViewGridScene = XSingleton<XScene>.singleton.IsViewGridScene;
+ if (isViewGridScene)
+ {
+ XSingleton<XEntityMgr>.singleton.Player.Net.SetHallSequence();
+ }
+ bool flag12 = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World;
+ if (flag12)
+ {
+ XSingleton<XEntityMgr>.singleton.Player.Attributes.SecurityStatistics.OnStart();
+ }
+ XSingleton<XReconnection>.singleton.SetLoginReconnectFlag(oRes.lrdata != null);
+ bool flag13 = oRes.lrdata != null;
+ if (flag13)
+ {
+ XSingleton<XReconnection>.singleton.StartLoginReconnectSync(oRes.lrdata, oRes.otherunits);
+ }
+ else
+ {
+ XSingleton<XReconnection>.singleton.StartEnterSceneSync(oRes.otherunits);
+ }
+ }
+ }
+ }
+ }
+
+ public static void OnTimeout(DoEnterSceneArg oArg)
+ {
+ }
+ }
+}