コード例 #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);
            }
        }
コード例 #2
0
        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);
            }
        }