public static void setRecommendationGameIP(string ip, int port)
 {
     NetworkAccelerator.PrintLog(string.Concat(new object[]
     {
         "setRecommendationGameIP :",
         ip,
         ", port :",
         port
     }));
     if (!NetworkAccelerator.s_inited)
     {
         return;
     }
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("setRecommendationGameIP", new object[]
             {
                 ip,
                 port
             });
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
     NetworkAccelerator.PrintLog("Set setRecommendationGameIP Success!");
 }
    public static string GetEffect()
    {
        if (!NetworkAccelerator.s_started)
        {
            return(null);
        }
        string result = null;

        try
        {
            AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (androidJavaClass != null)
            {
                result = androidJavaClass.CallStatic <string>("getString", new object[]
                {
                    NetworkAccelerator.KEY_GET_ACCEL_EFFECT
                });
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
        return(result);
    }
    public static long GetDelay()
    {
        if (!NetworkAccelerator.s_started)
        {
            return(-1L);
        }
        long result = -1L;

        try
        {
            AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (androidJavaClass != null)
            {
                result = androidJavaClass.CallStatic <long>("getLong", new object[]
                {
                    NetworkAccelerator.KEY_GET_NETDELAY
                });
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
        return(result);
    }
    public static void ChangeLogLevel(int level)
    {
        if (!NetworkAccelerator.s_inited)
        {
            return;
        }
        long num = (long)Mathf.Clamp(level, 1, 5);

        try
        {
            AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (androidJavaClass != null)
            {
                androidJavaClass.CallStatic("setLong", new object[]
                {
                    NetworkAccelerator.KEY_LOG_LEVLE,
                    num
                });
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
    }
    public static void SetNetAccConfig(bool open)
    {
        if (open)
        {
            NetworkAccelerator.Start();
        }
        else
        {
            NetworkAccelerator.Stop();
        }
        PlayerPrefs.SetInt(NetworkAccelerator.PLAYER_PREF_NET_ACC, open ? 1 : 0);
        PlayerPrefs.Save();
        MonoSingleton <GSDKsys> .GetInstance().StartGSDKSpeed(!open);

        NetworkAccelerator.PrintLog("SetNetAccConfig " + open);
    }
    public static bool isAccelOpened()
    {
        bool result = false;

        try
        {
            AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (androidJavaClass != null)
            {
                result = androidJavaClass.CallStatic <bool>("isAccelOpened", new object[0]);
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
        return(result);
    }
 private static void setWiFiAccelSwitch(bool on)
 {
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("setWiFiAccelSwitch", new object[]
             {
                 on
             });
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
 public static void ClearUDPCache()
 {
     if (!NetworkAccelerator.s_inited)
     {
         return;
     }
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("clearUDPCache", new object[0]);
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
    public static NetworkAccelerator.UserStatus GetUserStatus()
    {
        int num = 0;

        try
        {
            AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (androidJavaClass != null)
            {
                num = androidJavaClass.CallStatic <int>("getAccelerationStatus", new object[0]);
            }
            NetworkAccelerator.PrintLog("GetUserStatus " + (NetworkAccelerator.UserStatus)num);
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
        return((NetworkAccelerator.UserStatus)num);
    }
    public static string getVIPValidTime()
    {
        string text = string.Empty;

        try
        {
            AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (androidJavaClass != null)
            {
                text = androidJavaClass.CallStatic <string>("getVIPValidTime", new object[0]);
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
        NetworkAccelerator.PrintLog("getVIPValidTime " + text);
        return(text);
    }
 private static void setUserToken(string openid, string token)
 {
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("setUserToken", new object[]
             {
                 openid,
                 token,
                 ApolloConfig.GetAppID()
             });
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
 public static void setSDKMode(NetworkAccelerator.XunYouMode mode)
 {
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("setSDKMode", new object[]
             {
                 (int)mode
             });
             NetworkAccelerator.s_mode = mode;
             NetworkAccelerator.PrintLog("setSDKMode " + NetworkAccelerator.s_mode);
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
 public static void GoBack()
 {
     if (!NetworkAccelerator.s_inited)
     {
         return;
     }
     NetworkAccelerator.PrintLog("Begin GoBack");
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("gameBackground", new object[0]);
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
 public static NetworkAccelerator.AccelRecommendation_State getAccelRecommendation()
 {
     NetworkAccelerator.AccelRecommendation_State accelRecommendation_State = NetworkAccelerator.AccelRecommendation_State.ACCEL_RECOMMENDATION_NONE;
     if (!NetworkAccelerator.s_inited || NetworkAccelerator.started)
     {
         return(accelRecommendation_State);
     }
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             accelRecommendation_State = (NetworkAccelerator.AccelRecommendation_State)androidJavaClass.CallStatic <int>("getAccelRecommendation", new object[0]);
             NetworkAccelerator.PrintLog("getAccelRecommendation :" + accelRecommendation_State);
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
     return(accelRecommendation_State);
 }
 public static void OnNetDelay(int millis)
 {
     if (!NetworkAccelerator.s_inited || NetworkAccelerator.started)
     {
         return;
     }
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("onNetDelay", new object[]
             {
                 millis
             });
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
    private static bool Start()
    {
        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>("start", new object[]
                {
                    0
                });
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
        if (flag)
        {
            NetworkAccelerator.PrintLog("Start GameMaster Success!");
            NetworkAccelerator.s_started = true;
        }
        else
        {
            NetworkAccelerator.PrintLog("Start GameMaster Fail!");
            NetworkAccelerator.s_started = false;
        }
        return(NetworkAccelerator.s_started);
    }
    public static int GetNetType()
    {
        int result = -1;

        if (!NetworkAccelerator.s_inited)
        {
            return(result);
        }
        try
        {
            AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (androidJavaClass != null)
            {
                result = androidJavaClass.CallStatic <int>("getCurrentConnectionType", new object[0]);
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("ex " + ex.ToString());
        }
        return(result);
    }
 private static void setGameId(int worldID)
 {
     if (!NetworkAccelerator.s_inited)
     {
         return;
     }
     NetworkAccelerator.PrintLog("worldID " + worldID);
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("setGameId", new object[]
             {
                 worldID
             });
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
 private static void setFreeFlowUser(int isFreeFlowUser)
 {
     if (!NetworkAccelerator.s_inited)
     {
         return;
     }
     NetworkAccelerator.PrintLog("BesetFreeFlowUser " + isFreeFlowUser);
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("setFreeFlowUser", new object[]
             {
                 isFreeFlowUser
             });
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
 }
 public static void SetEchoPort(int port)
 {
     NetworkAccelerator.PrintLog("Set UD Echo Port to :" + port);
     if (!NetworkAccelerator.s_inited)
     {
         return;
     }
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
         if (androidJavaClass != null)
         {
             androidJavaClass.CallStatic("setUdpEchoPort", new object[]
             {
                 port
             });
         }
     }
     catch (Exception ex)
     {
         NetworkAccelerator.PrintLog("ex " + ex.ToString());
     }
     NetworkAccelerator.PrintLog("Set UD Echo Port Success!");
 }
    public static void InitACC(NetworkAccelerator.XunYouMode mode = NetworkAccelerator.XunYouMode.Disable)
    {
        NetworkAccelerator.PrintLog("Begin Network Acc");
        NetworkAccelerator.setSDKMode(mode);
        if (mode == NetworkAccelerator.XunYouMode.Disable)
        {
            NetworkAccelerator.PrintLog("mode " + mode);
            return;
        }
        if (NetworkAccelerator.s_inited)
        {
            NetworkAccelerator.PrintLog("already init");
            NetworkAccelerator.Stop();
            return;
        }
        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.NetworkAccelerator_TurnOn, new CUIEventManager.OnUIEventHandler(NetworkAccelerator.OnEventTurnOn));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.NetworkAccelerator_Ignore, new CUIEventManager.OnUIEventHandler(NetworkAccelerator.OnEventTurnIgore));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.NetworkAccelerator_WIFI_TurnOn, new CUIEventManager.OnUIEventHandler(NetworkAccelerator.OnEventTurnOnWIFI));

        NetworkAccelerator.PrintLog(string.Concat(new object[]
        {
            "key:",
            NetworkAccelerator.key,
            " mode ",
            mode
        }));
        try
        {
            AndroidJavaObject GMContext = null;
            using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
            {
                GMContext = androidJavaClass.GetStatic <AndroidJavaObject>("currentActivity");
            }
            AndroidJavaClass GMClass = new AndroidJavaClass("com.subao.gamemaster.GameMaster");
            if (GMClass != null)
            {
                GMContext.Call("runOnUiThread", new object[]
                {
                    delegate
                    {
                        int num = GMClass.CallStatic <int>("init", new object[]
                        {
                            GMContext,
                            1,
                            NetworkAccelerator.key,
                            "KingsGlory",
                            "libapollo.so",
                            13001
                        });
                        if (num >= 0)
                        {
                            NetworkAccelerator.PrintLog("Initialize GameMaster Success!");
                            NetworkAccelerator.s_inited = true;
                            NetworkAccelerator.setSDKMode(mode);
                            NetworkAccelerator.SetUserToken();
                            if (MonoSingleton <CTongCaiSys> .GetInstance().IsTongCaiUserAndCanUse())
                            {
                                int freeFlowUser = -1;
                                if (MonoSingleton <CTongCaiSys> .GetInstance().supplierType == IspType.Dianxing)
                                {
                                    freeFlowUser = 2;
                                }
                                else if (MonoSingleton <CTongCaiSys> .GetInstance().supplierType == IspType.Liantong)
                                {
                                    freeFlowUser = 1;
                                }
                                else if (MonoSingleton <CTongCaiSys> .GetInstance().supplierType == IspType.Yidong)
                                {
                                    freeFlowUser = 0;
                                }
                                NetworkAccelerator.setFreeFlowUser(freeFlowUser);
                            }
                            NetworkAccelerator.setGameId(MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID);
                            NetworkAccelerator.ChangeLogLevel(NetworkAccelerator.LOG_LEVEL_ERROR);
                        }
                        else
                        {
                            NetworkAccelerator.PrintLog("Initialize GameMaster Fail!, ret:" + num);
                        }
                    }
                });
            }
        }
        catch (Exception ex)
        {
            NetworkAccelerator.PrintLog("catch ex " + ex.ToString());
        }
    }