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); } }
private static bool Stop() { if (!NetworkAccelerator.s_inited) { return(NetworkAccelerator.s_started); } if (!NetworkAccelerator.s_started) { return(NetworkAccelerator.s_started); } AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster"); bool flag = false; if (androidJavaClass != null) { flag = androidJavaClass.CallStatic <bool>("stop", new object[0]); } if (flag) { Debug.Log("Stop GameMaster Success!"); NetworkAccelerator.ClearUDPCache(); NetworkAccelerator.s_started = false; } else { Debug.LogError("Stop GameMaster Fail!"); } return(NetworkAccelerator.s_started); }
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); } }
private static bool Stop() { if (!NetworkAccelerator.s_inited) { return(NetworkAccelerator.s_started); } if (!NetworkAccelerator.s_started) { return(NetworkAccelerator.s_started); } bool flag = false; try { AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster"); if (androidJavaClass != null) { flag = androidJavaClass.CallStatic <bool>("stop", new object[0]); } } catch (Exception ex) { NetworkAccelerator.PrintLog("ex " + ex.ToString()); } if (flag) { NetworkAccelerator.PrintLog("Stop GameMaster Success!"); NetworkAccelerator.ClearUDPCache(); NetworkAccelerator.s_started = false; } else { NetworkAccelerator.PrintLog("Stop GameMaster Fail!"); } return(NetworkAccelerator.s_started); }