예제 #1
0
        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();
        }
예제 #2
0
        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();
        }
예제 #3
0
 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();
     }
 }
예제 #4
0
        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);
        }