Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
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);
        }