コード例 #1
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();
     }
 }
コード例 #2
0
ファイル: FrameWindow.cs プロジェクト: wujiangu/wanshiwu0.1
        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);
        }
コード例 #3
0
ファイル: FrameWindow.cs プロジェクト: isoundy000/wzry-1
        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);
        }