Exemple #1
0
        public static void InitRelayConnnecting(COMDT_TGWINFO inRelayTgw)
        {
            if (inRelayTgw.dwVipCnt > 0)
            {
                string host = null;
                if (MonoSingleton <CTongCaiSys> .GetInstance().IsCanUseTongCai())
                {
                    host = ApolloConfig.loginOnlyIpOrUrl;
                }
                else if ((inRelayTgw.szRelayUrl.Length > 0) && (inRelayTgw.szRelayUrl[0] != 0))
                {
                    host = StringHelper.UTF8BytesToString(ref inRelayTgw.szRelayUrl);
                }
                else
                {
                    host = ApolloConfig.loginOnlyIpOrUrl;
                }
                Singleton <ReconnectIpSelect> .instance.SetRelayTgw(inRelayTgw);

                LookUpDNSOfServerAndConfigNetAcc(host, inRelayTgw.wEchoPort);
                ConnectorParam para = new ConnectorParam {
                    bIsUDP = (inRelayTgw.bIsUDP <= 0) ? false : true,
                    ip     = host
                };
                para.SetVPort(inRelayTgw.wVPort);
                NetworkAccelerator.ClearUDPCache();
                NetworkAccelerator.SetEchoPort(inRelayTgw.wEchoPort);
                ApolloConfig.echoPort = inRelayTgw.wEchoPort;
                Singleton <NetworkModule> .GetInstance().InitGameServerConnect(para);
            }
        }
        public static void InitRelayConnnecting(COMDT_TGWINFO inRelayTgw)
        {
            if (inRelayTgw.dwVipCnt > 0u)
            {
                string text;
                if (MonoSingleton <CTongCaiSys> .GetInstance().IsCanUseTongCai())
                {
                    text = ApolloConfig.loginOnlyIpOrUrl;
                }
                else if (inRelayTgw.szRelayUrl.Length > 0 && inRelayTgw.szRelayUrl[0] != 0)
                {
                    text = StringHelper.UTF8BytesToString(ref inRelayTgw.szRelayUrl);
                }
                else
                {
                    text = ApolloConfig.loginOnlyIpOrUrl;
                }
                MonoSingleton <GSDKsys> .GetInstance().DetermineWhichSpeed();

                Singleton <ReconnectIpSelect> .instance.SetRelayTgw(inRelayTgw);

                NetworkModule.LookUpDNSOfServerAndConfigNetAcc(text, (int)inRelayTgw.wEchoPort);
                ConnectorParam connectorParam = new ConnectorParam();
                connectorParam.bIsUDP = (inRelayTgw.bIsUDP > 0);
                connectorParam.ip     = text;
                connectorParam.SetVPort(inRelayTgw.wVPort);
                NetworkAccelerator.ClearUDPCache();
                NetworkAccelerator.SetEchoPort((int)inRelayTgw.wEchoPort);
                NetworkAccelerator.SetConnectIP(text, inRelayTgw.wVPort);
                ApolloConfig.echoPort = inRelayTgw.wEchoPort;
                Singleton <NetworkModule> .GetInstance().InitGameServerConnect(connectorParam);

                MonoSingleton <GSDKsys> .GetInstance().StartSpeed(text, (int)inRelayTgw.wVPort);
            }
        }
Exemple #3
0
        private void CloseConnect()
        {
            if (this._tgw != null)
            {
                Singleton <NetworkModule> .GetInstance().CloseGameServerConnect(false);

                this._tgw = null;
            }
        }
Exemple #4
0
 public void StartJudge(COMDT_TGWINFO inTGW)
 {
     if (!this.IsWatching && !Singleton <BattleLogic> .instance.isRuning)
     {
         this._workMode = WorkMode.Judge;
         this._tgw      = inTGW;
         if (this._tgw != null)
         {
             NetworkModule.InitRelayConnnecting(this._tgw);
         }
     }
 }
 private string GetIPFromTgw(COMDT_TGWINFO tgwInfo, IspType ispType)
 {
     for (int i = 0; i < tgwInfo.dwVipCnt; i++)
     {
         if (tgwInfo.astVipInfo[i].iISPType == ispType)
         {
             IPAddress address = new IPAddress((long)tgwInfo.astVipInfo[i].dwVIP);
             return(address.ToString());
         }
     }
     return(null);
 }
Exemple #6
0
 public void StartJudge(COMDT_TGWINFO inTGW)
 {
     if (this.IsWatching || Singleton <BattleLogic> .get_instance().isRuning)
     {
         return;
     }
     this._workMode = WatchController.WorkMode.Judge;
     this.IsRunning = true;
     this._tgw      = inTGW;
     if (this._tgw != null)
     {
         NetworkModule.InitRelayConnnecting(this._tgw);
     }
 }
Exemple #7
0
 public void StartReplay(string replayPath)
 {
     if (!this.IsWatching && !Singleton <BattleLogic> .instance.isRuning)
     {
         if (Singleton <GameReplayModule> .GetInstance().BeginReplay(replayPath, false))
         {
             this._workMode = WorkMode.Replay;
             this._overTime = 0f;
             this.IsRunning = true;
             this.SpeedRate = 1;
         }
         else
         {
             Singleton <CUIManager> .GetInstance().OpenTips("Can not play file: " + replayPath, false, 2f, null, new object[0]);
         }
         this._tgw = null;
     }
 }
        public void StartReplay(string replayPath)
        {
            if (this.IsWatching || Singleton <BattleLogic> .instance.isRuning)
            {
                Singleton <CUIManager> .GetInstance().OpenTips(Singleton <CTextManager> .GetInstance().GetText("Last_match_isnot_clean"), false, 1.5f, null, new object[0]);

                return;
            }
            if (Singleton <GameReplayModule> .GetInstance().BeginReplay(replayPath))
            {
                this._workMode     = WatchController.WorkMode.Replay;
                this._overTime     = 0f;
                this.FightOverJust = false;
                this.IsRunning     = true;
                this.SpeedRate     = 1;
            }
            else
            {
                Singleton <CUIManager> .GetInstance().OpenTips("Can not play file: " + replayPath, false, 2f, null, new object[0]);
            }
            this._tgw = null;
        }
Exemple #9
0
        private string GetIPFromTgw(COMDT_TGWINFO tgwInfo, IspType ispType)
        {
            this.tempIpList.Clear();
            int num = 0;

            while ((long)num < (long)((ulong)tgwInfo.dwVipCnt))
            {
                if (tgwInfo.astVipInfo[num].iISPType == (int)ispType)
                {
                    IPAddress iPAddress = new IPAddress((long)((ulong)tgwInfo.astVipInfo[num].dwVIP));
                    string    item      = iPAddress.ToString();
                    this.tempIpList.Add(item);
                }
                num++;
            }
            if (this.tempIpList.Count == 0)
            {
                return(null);
            }
            int index = Random.Range(0, this.tempIpList.Count);

            return(this.tempIpList[index]);
        }
        public bool StartObserve(COMDT_TGWINFO inTGW)
        {
            if (this.IsWatching || Singleton <BattleLogic> .instance.isRuning)
            {
                return(false);
            }
            this._workMode        = WatchController.WorkMode.Observe;
            this._overTime        = 0f;
            this.FightOverJust    = false;
            this.IsRunning        = true;
            this.SpeedRate        = 1;
            this._recvBuff        = new byte[409600];
            this._buffRecvSize    = 0u;
            this._totalRecvSize   = 0u;
            this._pkgQueue        = new Queue <object>(1000);
            this._maxFrameNo      = 0u;
            this._isStreamEnd     = false;
            this._thisTick        = 0u;
            this._lastRequestTick = 0u;
            ResGlobalInfo resGlobalInfo = new ResGlobalInfo();

            if (GameDataMgr.svr2CltCfgDict.TryGetValue(215u, out resGlobalInfo))
            {
                this._observeDelayFrames = (uint)Mathf.Clamp((int)(resGlobalInfo.dwConfValue * 1000u / Singleton <FrameSynchr> .GetInstance().SvrFrameDelta), 0, 4500);
            }
            else
            {
                this._observeDelayFrames = 900u;
            }
            this._tgw = inTGW;
            if (this._tgw != null)
            {
                NetworkModule.InitRelayConnnecting(this._tgw);
            }
            this.RequestVideoPiece(true);
            return(true);
        }
Exemple #11
0
 public void SetRelayTgw(COMDT_TGWINFO tgw)
 {
     this.m_tgwInfo = tgw;
     this.m_successRelayUrlForNormal = null;
 }