Exemple #1
0
 public string GetLocale()
 {
     if (this.m_locale == null || this.m_locale == string.Empty)
     {
         this.m_locale = MobileDeviceLocale.GetBestGuessForLocale();
     }
     return(this.m_locale);
 }
Exemple #2
0
    public static string BundleURL(string fileName)
    {
        string remoteUri = m_remoteUri;

        if ((MobileDeviceLocale.GetCurrentRegionId() == Network.BnetRegion.REGION_CN) && (m_remoteUriCNIndex != GetTryCount()))
        {
            remoteUri = string.Format(m_remoteUriCN, "0" + m_remoteUriCNIndex.ToString());
        }
        return(string.Format("{0}{1}/{2}", remoteUri, DownloadManifest.Get().HashForBundle(fileName), fileName));
    }
Exemple #3
0
 private void OnClick(UIEvent e)
 {
     if (ApplicationMgr.AllowResetFromFatalError != null)
     {
         if (this.m_redirectToStore)
         {
             PlatformDependentValue <string> value4 = new PlatformDependentValue <string>(PlatformCategory.OS)
             {
                 iOS     = "https://itunes.apple.com/app/hearthstone-heroes-warcraft/id625257520?ls=1&mt=8",
                 Android = "https://play.google.com/store/apps/details?id=com.blizzard.wtcg.hearthstone"
             };
             PlatformDependentValue <string> value2 = value4;
             value4 = new PlatformDependentValue <string>(PlatformCategory.OS)
             {
                 iOS     = "https://itunes.apple.com/cn/app/lu-shi-chuan-shuo-mo-shou/id841140063?ls=1&mt=8",
                 Android = "https://www.battlenet.com.cn/account/download/hearthstone/android?style=hearthstone"
             };
             PlatformDependentValue <string> value3 = value4;
             if (ApplicationMgr.GetAndroidStore() == AndroidStore.AMAZON)
             {
                 value2.Android = "http://www.amazon.com/gp/mas/dl/android?p=com.blizzard.wtcg.hearthstone";
             }
             if (MobileDeviceLocale.GetCurrentRegionId() == Network.BnetRegion.REGION_CN)
             {
                 value2 = value3;
             }
             Application.OpenURL((string)value2);
         }
         else
         {
             float waitDuration = (ApplicationMgr.Get().LastResetTime() + this.m_delayBeforeNextReset) - UnityEngine.Time.realtimeSinceStartup;
             Log.JMac.Print("Remaining time to wait before allowing a reconnect attempt: " + waitDuration, new object[0]);
             if (waitDuration > 0f)
             {
                 this.m_inputBlocker.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnClick));
                 this.m_closedSignText.Text = GameStrings.Get("GLOBAL_SPLASH_CLOSED_RECONNECTING");
                 this.m_allowClick          = false;
                 this.m_reconnectTip.gameObject.SetActive(false);
                 base.StartCoroutine(this.WaitBeforeReconnecting(waitDuration));
             }
             else
             {
                 UnityEngine.Debug.Log("resetting!");
                 this.m_inputBlocker.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnClick));
                 ApplicationMgr.Get().Reset();
             }
         }
     }
     else
     {
         this.m_inputBlocker.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnClick));
         ApplicationMgr.Get().Exit();
     }
 }
 private void GoToNoAccountTutorialServer(int scenario)
 {
     BattleNet.GameServerInfo gameServer = new BattleNet.GameServerInfo();
     if (!BattleNet.IsVersionInt() && (BattleNet.GetVersionString() == "PAX"))
     {
         gameServer.Version = BattleNet.GetVersionString() + BattleNet.GetVersionInt().ToString();
     }
     else
     {
         gameServer.Version = BattleNet.GetVersion();
     }
     if (Vars.Key("Loopback.Active").GetBool(false))
     {
         gameServer.Address        = Vars.Key("Loopback.Address").GetStr(string.Empty);
         gameServer.Port           = Vars.Key("Loopback.Port").GetInt(0);
         gameServer.AuroraPassword = BattleNet.GetVersionString();
     }
     else
     {
         Network.BnetRegion currentRegionId = MobileDeviceLocale.GetCurrentRegionId();
         if (ApplicationMgr.GetMobileEnvironment() == MobileEnv.PRODUCTION)
         {
             string str;
             try
             {
                 str = RegionToTutorialName[currentRegionId];
             }
             catch (KeyNotFoundException)
             {
                 Debug.LogWarning("No matching tutorial server name found for region " + currentRegionId);
                 str = "us";
             }
             gameServer.Address = string.Format("{0}-tutorial{1}.actual.battle.net", str, BattleNet.TutorialServer);
             gameServer.Port    = 0x45f;
         }
         else
         {
             gameServer.Address = "10.130.126.28";
             MobileDeviceLocale.ConnectionData connectionDataFromRegionId = MobileDeviceLocale.GetConnectionDataFromRegionId(currentRegionId, true);
             gameServer.Port    = connectionDataFromRegionId.tutorialPort;
             gameServer.Version = connectionDataFromRegionId.version;
         }
         object[] args = new object[] { currentRegionId, gameServer.Address, gameServer.Port, gameServer.Version };
         Log.JMac.Print(string.Format("Connecting to account-free tutorial server for region {0}.  Address: {1}  Port: {2}  Version: {3}", args), new object[0]);
         gameServer.AuroraPassword = string.Empty;
     }
     gameServer.GameHandle   = 0;
     gameServer.ClientHandle = 0L;
     gameServer.Mission      = scenario;
     this.ResolveAddressAndGotoGameServer(gameServer);
 }
Exemple #5
0
    private static void GetLocalizedLinkVars(out string baseUrl, out string localeString, out string regionString)
    {
        localeString = Localization.GetLocaleName();
        bool isDev = (ApplicationMgr.GetMobileEnvironment() == MobileEnv.DEVELOPMENT) || ApplicationMgr.IsInternal();

        MobileDeviceLocale.ConnectionData connectionDataFromRegionId = MobileDeviceLocale.GetConnectionDataFromRegionId(MobileDeviceLocale.GetCurrentRegionId(), isDev);
        try
        {
            regionString = TargetServerToRegion[connectionDataFromRegionId.address];
        }
        catch (KeyNotFoundException)
        {
            Debug.LogWarning("No matching region found for " + connectionDataFromRegionId.address + " to get Nydus Link");
            regionString = "US";
        }
        baseUrl = !isDev ? ProdHost : DevHost;
    }
Exemple #6
0
 public static string GetLanguageCode()
 {
     return(MobileDeviceLocale.GetLocaleLanguageCode());
 }
Exemple #7
0
 public static string GetCountryCode()
 {
     return(MobileDeviceLocale.GetLocaleCountryCode());
 }
Exemple #8
0
    public static string GetBestGuessForLocale()
    {
        string result = "enUS";
        bool   flag   = false;
        string text   = MobileDeviceLocale.GetLanguageCode();

        try
        {
            flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, ref result);
        }
        catch (Exception)
        {
        }
        if (!flag)
        {
            text = text.Substring(0, 2);
            try
            {
                flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, ref result);
            }
            catch (Exception)
            {
            }
        }
        if (!flag)
        {
            int    num         = 1;
            string countryCode = MobileDeviceLocale.GetCountryCode();
            try
            {
                MobileDeviceLocale.s_countryCodeToRegionId.TryGetValue(countryCode, ref num);
            }
            catch (Exception)
            {
            }
            string text2 = text;
            if (text2 != null)
            {
                if (MobileDeviceLocale.< > f__switch$map7 == null)
                {
                    Dictionary <string, int> dictionary = new Dictionary <string, int>(2);
                    dictionary.Add("es", 0);
                    dictionary.Add("zh", 1);
                    MobileDeviceLocale.< > f__switch$map7 = dictionary;
                }
                int num2;
                if (MobileDeviceLocale.< > f__switch$map7.TryGetValue(text2, ref num2))
                {
                    if (num2 == 0)
                    {
                        if (num == 1)
                        {
                            result = "esMX";
                        }
                        else
                        {
                            result = "esES";
                        }
                        return(result);
                    }
                    if (num2 == 1)
                    {
                        if (countryCode == "CN")
                        {
                            result = "zhCN";
                        }
                        else
                        {
                            result = "zhTW";
                        }
                        return(result);
                    }
                }
            }
            result = "enUS";
        }
        return(result);
    }
    public static string GetBestGuessForLocale()
    {
        string result = "enUS";
        bool   flag   = false;
        string text   = MobileDeviceLocale.GetLanguageCode();

        try
        {
            flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, out result);
        }
        catch (Exception)
        {
        }
        if (!flag)
        {
            text = text.Substring(0, 2);
            try
            {
                flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, out result);
            }
            catch (Exception)
            {
            }
        }
        if (!flag)
        {
            int    num         = 1;
            string countryCode = MobileDeviceLocale.GetCountryCode();
            try
            {
                MobileDeviceLocale.s_countryCodeToRegionId.TryGetValue(countryCode, out num);
            }
            catch (Exception)
            {
            }
            if (text != null)
            {
                if (text == "es")
                {
                    if (num == 1)
                    {
                        result = "esMX";
                    }
                    else
                    {
                        result = "esES";
                    }
                    return(result);
                }
                if (text == "zh")
                {
                    if (countryCode == "CN")
                    {
                        result = "zhCN";
                    }
                    else
                    {
                        result = "zhTW";
                    }
                    return(result);
                }
            }
            result = "enUS";
        }
        return(result);
    }