private static void SendPlayerAttackTargetMode() { FrameCommand <PlayAttackTargetModeCommand> command = FrameCommandFactory.CreateFrameCommand <PlayAttackTargetModeCommand>(); command.cmdData.AttackTargetMode = (sbyte)_selectType; command.Send(); }
private static void SendPlayerCommonAttackMode() { FrameCommand <PlayCommonAttackModeCommand> command = FrameCommandFactory.CreateFrameCommand <PlayCommonAttackModeCommand>(); command.cmdData.CommonAttackMode = (byte)_normalAttackType; command.Send(); }
private static void HandleClientClientSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CC ccSynDt) { int usedSize = 0; FRAME_CMD_PKG msg = FRAME_CMD_PKG.New(); TdrError.ErrorType type = msg.unpack(ref ccSynDt.stSyncInfo.szBuff, ccSynDt.stSyncInfo.wLen, ref usedSize, 0); DebugHelper.Assert(type == TdrError.ErrorType.TDR_NO_ERROR); if (type == TdrError.ErrorType.TDR_NO_ERROR) { IFrameCommand command = FrameCommandFactory.CreateFrameCommand(ref msg); if (command != null) { command.playerID = ccSynDt.dwObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create ccSync frame command error!"); } } } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("TdrUnpackException"), "CCSync unpack error!"); } } msg.Release(); }
private static void HandleClientStateSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_ACNTSTATE stateSyncDt) { IFrameCommand command = null; switch (stateSyncDt.bStateChgType) { case 1: command = FrameCommandFactory.CreateFrameCommand <SvrDisconnectCommand>(); break; case 2: command = FrameCommandFactory.CreateFrameCommand <SvrReconnectCommand>(); break; case 3: command = FrameCommandFactory.CreateFrameCommand <SvrRunawayCommand>(); break; } if (command != null) { command.playerID = stateSyncDt.dwObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create stateChange frame command error!"); } } }
private void PackCmd2Msg(ref IFrameCommand cmd, CSDT_GAMING_UPER_INFO msg) { if (cmd.isCSSync) { msg.bType = 2; msg.dwCmdSeq = cmd.cmdId; msg.stUperDt.construct((long)msg.bType); msg.stUperDt.get_stCSInfo().stCSSyncDt.construct((long)cmd.cmdType); cmd.TransProtocol(msg.stUperDt.get_stCSInfo()); } else { msg.bType = 1; msg.dwCmdSeq = cmd.cmdId; msg.stUperDt.construct((long)msg.bType); msg.stUperDt.get_stCCInfo().construct(); FRAME_CMD_PKG fRAME_CMD_PKG = FrameCommandFactory.CreateCommandPKG(cmd); cmd.TransProtocol(fRAME_CMD_PKG); int num = 0; TdrError.ErrorType errorType = fRAME_CMD_PKG.pack(ref msg.stUperDt.get_stCCInfo().szBuff, 64, ref num, 0u); msg.stUperDt.get_stCCInfo().wLen = (ushort)num; DebugHelper.Assert(errorType == 0); fRAME_CMD_PKG.Release(); } }
private static void HandleClientClientSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CC ccSynDt) { int num = 0; FRAME_CMD_PKG fRAME_CMD_PKG = FRAME_CMD_PKG.New(); TdrError.ErrorType errorType = fRAME_CMD_PKG.unpack(ref ccSynDt.stSyncInfo.szBuff, (int)ccSynDt.stSyncInfo.wLen, ref num, 0u); DebugHelper.Assert(errorType == 0); if (errorType == null) { IFrameCommand frameCommand = FrameCommandFactory.CreateFrameCommand(ref fRAME_CMD_PKG); if (frameCommand != null) { frameCommand.playerID = ccSynDt.dwObjID; frameCommand.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand); } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create ccSync frame command error!"); } } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("TdrUnpackException"), "CCSync unpack error!"); } fRAME_CMD_PKG.Release(); }
private void HandleClientStateSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_ACNTSTATE stateSyncDt) { IFrameCommand command = null; switch (stateSyncDt.bStateChgType) { case 1: command = FrameCommandFactory.CreateFrameCommand <SvrDisconnectCommand>(); break; case 2: command = FrameCommandFactory.CreateFrameCommand <SvrReconnectCommand>(); break; case 3: command = FrameCommandFactory.CreateFrameCommand <SvrRunawayCommand>(); break; } if (command != null) { command.playerID = stateSyncDt.dwObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } }
private static void SendPlayerCommonAttackMode() { if (!Singleton <WatchController> .GetInstance().IsWatching) { FrameCommand <PlayCommonAttackModeCommand> command = FrameCommandFactory.CreateFrameCommand <PlayCommonAttackModeCommand>(); command.cmdData.CommonAttackMode = (byte)_normalAttackType; command.Send(); } }
private static void SendPlayerAttackTargetMode() { if (!Singleton <WatchController> .GetInstance().IsWatching) { FrameCommand <PlayAttackTargetModeCommand> command = FrameCommandFactory.CreateFrameCommand <PlayAttackTargetModeCommand>(); command.cmdData.AttackTargetMode = (sbyte)_selectType; command.Send(); } }
private void HandleClientServerSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CS csSynDt) { IFrameCommand command = FrameCommandFactory.CreateFrameCommandByCSSyncInfo(ref csSynDt.stSyncInfo); if (command != null) { command.playerID = csSynDt.dwObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } }
private static void SendPlayerCommonAttackMode() { if (Singleton <WatchController> .GetInstance().IsWatching) { return; } FrameCommand <PlayCommonAttackModeCommand> frameCommand = FrameCommandFactory.CreateFrameCommand <PlayCommonAttackModeCommand>(); frameCommand.cmdData.CommonAttackMode = (byte)GameSettings._normalAttackType; frameCommand.Send(); }
private static void SendPlayerLastHitMode() { if (Singleton <WatchController> .GetInstance().IsWatching) { return; } FrameCommand <PlayLastHitModeCommand> frameCommand = FrameCommandFactory.CreateFrameCommand <PlayLastHitModeCommand>(); frameCommand.cmdData.LastHitMode = (byte)GameSettings._lastHitMode; frameCommand.Send(); }
private static void SendPlayerAttackTargetMode() { if (Singleton <WatchController> .GetInstance().IsWatching) { return; } FrameCommand <PlayAttackTargetModeCommand> frameCommand = FrameCommandFactory.CreateFrameCommand <PlayAttackTargetModeCommand>(); frameCommand.cmdData.AttackTargetMode = (sbyte)GameSettings._selectType; frameCommand.Send(); }
public bool SendGameCmd(IFrameCommand cmd, bool bMultiGame, bool bUseCSSync = false) { if (Singleton <NetworkModule> .GetInstance().isOnlineMode) { if (bMultiGame) { if (Singleton <NetworkModule> .GetInstance().gameSvr.connected) { CSPkg msg = null; TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; if (!bUseCSSync) { msg = NetworkModule.CreateDefaultCSPKG(0x3ed); FRAME_CMD_PKG frame_cmd_pkg = FrameCommandFactory.CreateCommandPKG(cmd); msg.stPkgData.stGamingCCSync.dwCmdSeq = this.NewSendCmdSeq; msg.stPkgData.stGamingCCSync.stSyncInfo.construct(); cmd.TransProtocol(ref frame_cmd_pkg); int usedSize = 0; type = frame_cmd_pkg.pack(ref msg.stPkgData.stGamingCCSync.stSyncInfo.szBuff, 0x40, ref usedSize, 0); msg.stPkgData.stGamingCCSync.stSyncInfo.wLen = (ushort)usedSize; } else { msg = NetworkModule.CreateDefaultCSPKG(0x3ec); msg.stPkgData.stGamingCSSync.dwCmdSeq = this.NewSendCmdSeq; msg.stPkgData.stGamingCSSync.stSyncInfo.stCSSyncDt.construct((long)cmd.cmdType); cmd.TransProtocol(ref msg.stPkgData.stGamingCSSync.stSyncInfo); } DebugHelper.Assert(type == TdrError.ErrorType.TDR_NO_ERROR); Singleton <NetworkModule> .GetInstance().gameSvr.PushSendMsg(msg); Singleton <NetworkModule> .GetInstance().HandleGameMsgSend(); ulong num2 = (ulong)Mathf.RoundToInt(Time.time * 1000f); this._cmdPingWin[(int)((IntPtr)(((ulong)this.CurSendCmdSeq) % ((long)this._cmdPingWin.Length)))] = (num2 << 1) | (num2 << 0x21); if (this._showChart) { MonoSingleton <RealTimeChart> .instance.AddSample("FrameCmdRecvPing", 1001f); MonoSingleton <RealTimeChart> .instance.AddSample("FrameCmdHandPing", 1001f); MonoSingleton <RealTimeChart> .instance.AddSample("FrameCmdAvrgPing", this._recentPingAvg); } cmd.Preprocess(); } } else { Singleton <FrameSynchr> .GetInstance().PushFrameCommand(cmd); } } return(true); }
private static void HandleGameOverCommand(uint dwFrqNo, CSDT_FRAPBOOT_GAMEOVERNTF OverNtf) { FrameCommand <SvrNtfGameOverCommand> frameCommand = FrameCommandFactory.CreateSCSyncFrameCommand <SvrNtfGameOverCommand>(); frameCommand.cmdData.m_bWinCamp = OverNtf.bWinCamp; IFrameCommand frameCommand2 = frameCommand; if (frameCommand2 != null) { frameCommand2.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand2); } }
private static void HandleGameOverCommand(uint dwFrqNo, CSDT_FRAPBOOT_GAMEOVERNTF OverNtf) { IFrameCommand command = null; FrameCommand <SvrNtfGameOverCommand> command2 = FrameCommandFactory.CreateFrameCommand <SvrNtfGameOverCommand>(); command2.cmdData.m_bWinCamp = OverNtf.bWinCamp; command = command2; if (command != null) { command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } }
public override void Init() { FrameCommandFactory.PrepareRegisterCommand(); Assembly assembly = typeof(FrameSynchr).get_Assembly(); Type[] types = assembly.GetTypes(); int num = 0; while (types != null && num < types.Length) { Type type = types[num]; object[] customAttributes = type.GetCustomAttributes(typeof(FrameCommandClassAttribute), true); for (int i = 0; i < customAttributes.Length; i++) { FrameCommandClassAttribute frameCommandClassAttribute = customAttributes[i] as FrameCommandClassAttribute; if (frameCommandClassAttribute != null) { CreatorDelegate creator = this.GetCreator(type); if (creator != null) { FrameCommandFactory.RegisterCommandCreator(frameCommandClassAttribute.get_ID(), type, creator); } } } object[] customAttributes2 = type.GetCustomAttributes(typeof(FrameCSSYNCCommandClassAttribute), true); for (int j = 0; j < customAttributes2.Length; j++) { FrameCSSYNCCommandClassAttribute frameCSSYNCCommandClassAttribute = customAttributes2[j] as FrameCSSYNCCommandClassAttribute; if (frameCSSYNCCommandClassAttribute != null) { CreatorCSSyncDelegate cSSyncCreator = this.GetCSSyncCreator(type); if (cSSyncCreator != null) { FrameCommandFactory.RegisterCSSyncCommandCreator(frameCSSYNCCommandClassAttribute.get_ID(), type, cSSyncCreator); } } } object[] customAttributes3 = type.GetCustomAttributes(typeof(FrameSCSYNCCommandClassAttribute), true); for (int k = 0; k < customAttributes3.Length; k++) { FrameSCSYNCCommandClassAttribute frameSCSYNCCommandClassAttribute = customAttributes3[k] as FrameSCSYNCCommandClassAttribute; if (frameSCSYNCCommandClassAttribute != null) { FrameCommandFactory.RegisterSCSyncCommandCreator(frameSCSYNCCommandClassAttribute.get_ID(), type, null); } } num++; } this.ResetSynchr(); }
private static void HandleClientServerSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CS csSynDt) { IFrameCommand frameCommand = FrameCommandFactory.CreateFrameCommandByCSSyncInfo(ref csSynDt.stSyncInfo); if (frameCommand != null) { frameCommand.playerID = csSynDt.dwObjID; frameCommand.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand); } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create csSync frame command error!"); } }
private void HandleAIChgSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_AISTATE AIState) { IFrameCommand command = null; FrameCommand <AutoAIChgCommand> command2 = FrameCommandFactory.CreateFrameCommand <AutoAIChgCommand>(); command2.cmdData.m_autoType = AIState.bType; command2.cmdData.m_playerID = AIState.dwPlayerObjID; command = command2; if (command != null) { command.playerID = AIState.dwPlayerObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } }
public bool SendGameCmd(IFrameCommand cmd, bool bMultiGame, bool bUseCSSync = false) { if (Singleton <WatchController> .GetInstance().IsWatching) { return(false); } if (Singleton <NetworkModule> .GetInstance().isOnlineMode) { if (bMultiGame) { if (Singleton <NetworkModule> .GetInstance().gameSvr.connected) { CSPkg msg = null; TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; if (!bUseCSSync) { msg = NetworkModule.CreateDefaultCSPKG(0x3ed); FRAME_CMD_PKG frame_cmd_pkg = FrameCommandFactory.CreateCommandPKG(cmd); msg.stPkgData.stGamingCCSync.dwCmdSeq = this.NewSendCmdSeq; msg.stPkgData.stGamingCCSync.stSyncInfo.construct(); cmd.TransProtocol(ref frame_cmd_pkg); int usedSize = 0; type = frame_cmd_pkg.pack(ref msg.stPkgData.stGamingCCSync.stSyncInfo.szBuff, 0x40, ref usedSize, 0); msg.stPkgData.stGamingCCSync.stSyncInfo.wLen = (ushort)usedSize; frame_cmd_pkg.Release(); Singleton <NetworkModule> .GetInstance().gameSvr.PushSendMsg(msg); } else { msg = NetworkModule.CreateDefaultCSPKG(0x3ec); msg.stPkgData.stGamingCSSync.dwCmdSeq = this.NewSendCmdSeq; msg.stPkgData.stGamingCSSync.stSyncInfo.stCSSyncDt.construct((long)cmd.cmdType); cmd.TransProtocol(ref msg.stPkgData.stGamingCSSync.stSyncInfo); Singleton <NetworkModule> .GetInstance().gameSvr.PushSendMsg(msg); } DebugHelper.Assert(type == TdrError.ErrorType.TDR_NO_ERROR); Singleton <NetworkModule> .GetInstance().HandleGameMsgSend(); cmd.Preprocess(); } } else { Singleton <FrameSynchr> .GetInstance().PushFrameCommand(cmd); } } return(true); }
private void HandleAssistChgSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_ASSISTSTATE assistChgState) { IFrameCommand command = null; FrameCommand <AssistStateChgCommand> command2 = FrameCommandFactory.CreateFrameCommand <AssistStateChgCommand>(); command2.cmdData.m_chgType = assistChgState.bType; command2.cmdData.m_aiPlayerID = assistChgState.dwAiPlayerObjID; command2.cmdData.m_masterPlayerID = assistChgState.dwMasterObjID; command = command2; if (command != null) { command.playerID = assistChgState.dwAiPlayerObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } }
private static void HandleGamePauseCommand(uint dwFrqNo, CSDT_FRAPBOOT_PAUSE pauseNtf) { FrameCommand <PauseResumeGameCommand> frameCommand = FrameCommandFactory.CreateSCSyncFrameCommand <PauseResumeGameCommand>(); frameCommand.cmdData.PauseCommand = pauseNtf.bType; frameCommand.cmdData.PauseByCamp = pauseNtf.bCamp; frameCommand.cmdData.CampPauseTimes = new byte[pauseNtf.szCampPauseNum.Length]; Buffer.BlockCopy(pauseNtf.szCampPauseNum, 0, frameCommand.cmdData.CampPauseTimes, 0, pauseNtf.szCampPauseNum.Length); IFrameCommand frameCommand2 = frameCommand; if (frameCommand2 != null) { frameCommand2.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand2); } }
private void HandleClientClientSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_CC ccSynDt) { int usedSize = 0; FRAME_CMD_PKG msg = new FRAME_CMD_PKG(); TdrError.ErrorType type = msg.unpack(ref ccSynDt.stSyncInfo.szBuff, ccSynDt.stSyncInfo.wLen, ref usedSize, 0); DebugHelper.Assert(type == TdrError.ErrorType.TDR_NO_ERROR); if (type == TdrError.ErrorType.TDR_NO_ERROR) { IFrameCommand command = FrameCommandFactory.CreateFrameCommand(ref msg); if (command != null) { command.playerID = ccSynDt.dwObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } } }
private static void HandleAIChgSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_AISTATE AIState) { FrameCommand <AutoAIChgCommand> frameCommand = FrameCommandFactory.CreateSCSyncFrameCommand <AutoAIChgCommand>(); frameCommand.cmdData.m_autoType = AIState.bType; frameCommand.cmdData.m_playerID = AIState.dwPlayerObjID; IFrameCommand frameCommand2 = frameCommand; if (frameCommand2 != null) { frameCommand2.playerID = AIState.dwPlayerObjID; frameCommand2.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(frameCommand2); } else if ((FrameWindow._frameExceptionCounter += 1) <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create aiChange frame command error!"); } }
private static void HandleAIChgSyncCommand(uint dwFrqNo, CSDT_FRAPBOOT_AISTATE AIState) { IFrameCommand command = null; FrameCommand <AutoAIChgCommand> command2 = FrameCommandFactory.CreateFrameCommand <AutoAIChgCommand>(); command2.cmdData.m_autoType = AIState.bType; command2.cmdData.m_playerID = AIState.dwPlayerObjID; command = command2; if (command != null) { command.playerID = AIState.dwPlayerObjID; command.frameNum = dwFrqNo; Singleton <FrameSynchr> .GetInstance().PushFrameCommand(command); } else { _frameExceptionCounter = (byte)(_frameExceptionCounter + 1); if (_frameExceptionCounter <= 30) { BuglyAgent.ReportException(new Exception("CreateFrameCommandException"), "create aiChange frame command error!"); } } }
public override void Init() { FrameCommandFactory.PrepareRegisterCommand(); System.Type[] types = typeof(FrameSynchr).Assembly.GetTypes(); for (int i = 0; (types != null) && (i < types.Length); i++) { System.Type inType = types[i]; object[] customAttributes = inType.GetCustomAttributes(typeof(FrameCommandClassAttribute), true); for (int j = 0; j < customAttributes.Length; j++) { FrameCommandClassAttribute attribute = customAttributes[j] as FrameCommandClassAttribute; if (attribute != null) { CreatorDelegate creator = this.GetCreator(inType); if (creator != null) { FrameCommandFactory.RegisterCommandCreator(attribute.ID, inType, creator); } } } object[] objArray2 = inType.GetCustomAttributes(typeof(FrameCSSYNCCommandClassAttribute), true); for (int k = 0; k < objArray2.Length; k++) { FrameCSSYNCCommandClassAttribute attribute2 = objArray2[k] as FrameCSSYNCCommandClassAttribute; if (attribute2 != null) { CreatorCSSyncDelegate cSSyncCreator = this.GetCSSyncCreator(inType); if (cSSyncCreator != null) { FrameCommandFactory.RegisterCSSyncCommandCreator(attribute2.ID, inType, cSSyncCreator); } } } } this.ResetSynchr(); }