private void UpdateCurrencyDisplayAmount() { Text mCurrencyAmountText = this.m_currencyAmountText; int num = GarrisonStatus.WarResources(); mCurrencyAmountText.text = num.ToString("N0", MobileDeviceLocale.GetCultureInfoLocale()); }
public static int GetPluralIndex(int quantity) { if (!MobileDeviceLocale.GetLanguageCode().StartsWith("ru", StringComparison.OrdinalIgnoreCase)) { return((quantity <= 1) ? 0 : 1); } switch (quantity % 100) { case 11: case 12: case 13: case 14: return(2); default: switch (quantity % 10) { case 1: return(0); case 2: case 3: case 4: return(1); default: return(2); } break; } }
private void Start() { this.LatestVersion = new Version(0, 0, 0); this.ForceUpgrade = false; this.m_locale = MobileDeviceLocale.GetBestGuessForLocale(); this.InitAssetBundleManager(); }
public string GetLocale() { if (string.IsNullOrEmpty(this.m_locale)) { this.m_locale = MobileDeviceLocale.GetBestGuessForLocale(); } return(this.m_locale); }
public static CultureInfo GetCultureInfoLocale() { string bestGuessForLocale = MobileDeviceLocale.GetBestGuessForLocale(); if (!MobileDeviceLocale.s_localeToCultureInfo.ContainsKey(bestGuessForLocale)) { return(CultureInfo.CurrentCulture); } return(MobileDeviceLocale.s_localeToCultureInfo[bestGuessForLocale]); }
private void Start() { if (MobileDeviceLocale.IsChineseDevice()) { Object.Destroy(base.transform.parent.gameObject); return; } this.m_dropdown = base.GetComponent <Dropdown>(); this.m_dropdown.options = (from entry in this.m_languageEntries select new Dropdown.OptionData(entry.displayName)).ToList <Dropdown.OptionData>(); int num = this.m_languageEntries.FindIndex((LanguageDropdown.LanguageEntry entry) => entry.localeCode == MobileDeviceLocale.GetBestGuessForLocale()); this.m_dropdown.value = ((num == -1) ? 0 : num); this.m_dropdown.RefreshShownValue(); this.m_dropdown.onValueChanged.AddListener(new UnityAction <int>(this.OnValueChanged)); this.m_value = this.m_dropdown.value; }
private void AddChatMessage(CommunityChatMessage message) { CultureInfo cultureInfoLocale = MobileDeviceLocale.GetCultureInfoLocale(); CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = cultureInfoLocale; string text = message.TimeStamp.ToString(StaticDB.GetString("FULL_DATE", "dddd, MMMM d, yyyy")); if (this.m_earliestDate == string.Empty) { this.m_earliestDate = text; } if (this.m_latestDate != text) { this.m_latestDate = text; GameObject gameObject = this.m_chatContent.AddAsChildObject(this.m_dateObjectPrefab); Text componentInChildren = gameObject.GetComponentInChildren <Text>(); componentInChildren.text = text; } GameObject gameObject2 = this.m_chatContent.AddAsChildObject(this.m_chatObjectPrefab); CommunityChatItem component = gameObject2.GetComponent <CommunityChatItem>(); component.SetChatInfo(message); if (string.IsNullOrEmpty(message.Author)) { if (this.m_pendingMemberIDs.Count == 0) { Club.OnClubMemberUpdated += new Club.ClubMemberUpdatedHandler(this.UpdatePendingMessages); } this.m_pendingMemberIDs.Add(message.MemberID); } if (this.ShouldMinimizeChatItem(message)) { gameObject2.GetComponent <CommunityChatItem>().MinimizeChatItem(); } else { this.m_lastChatItem = component; } Thread.CurrentThread.CurrentCulture = currentCulture; }
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 || text == "es") { 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); }
public void SetGold(int quantity, Sprite iconSprite) { this.m_rewardName.text = StaticDB.GetString("GOLD", null); this.m_rewardDescription.text = StaticDB.GetString("GOLD_DESCRIPTION", null); this.m_rewardQuantity.text = (quantity <= 1 ? string.Empty : string.Concat(string.Empty, quantity.ToString(MobileDeviceLocale.GetCultureInfoLocale()))); this.m_rewardIcon.sprite = iconSprite; }
public void InitReward(MissionRewardDisplay.RewardType rewardType, int rewardID, int rewardQuantity, int itemContext, int iconFileDataID = 0) { if (rewardType == MissionRewardDisplay.RewardType.faction) { return; } this.ClearResults(); this.m_rewardType = rewardType; this.m_rewardID = rewardID; this.m_rewardQuantity = rewardQuantity; this.m_itemContext = itemContext; if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(false); } switch (this.m_rewardType) { case MissionRewardDisplay.RewardType.item: { Sprite sprite = null; ItemRec record = StaticDB.itemDB.GetRecord(this.m_rewardID); if (iconFileDataID > 0) { sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, iconFileDataID); } else if (record != null) { sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); } if (sprite != null) { this.m_rewardIcon.sprite = sprite; } else if (this.m_iconErrorText != null) { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = string.Empty + iconFileDataID; } if (this.m_rewardName != null) { if (record != null) { this.m_rewardName.text = record.Display; this.m_rewardName.color = GeneralHelpers.GetQualityColor(record.OverallQualityID); } else { this.m_rewardName.text = "Unknown Item " + this.m_rewardID; } } if (this.m_isExpandedDisplay) { this.m_rewardQuantityText.text = ((this.m_rewardQuantity <= 1) ? string.Empty : this.m_rewardQuantity.ToString("N0", MobileDeviceLocale.GetCultureInfoLocale())); } break; } case MissionRewardDisplay.RewardType.gold: this.m_rewardIcon.sprite = Resources.Load <Sprite>("MiscIcons/INV_Misc_Coin_01"); if (this.m_isExpandedDisplay) { this.m_rewardQuantityText.text = string.Empty; this.m_rewardName.text = ((this.m_rewardQuantity <= 1) ? string.Empty : this.m_rewardQuantity.ToString("N0", MobileDeviceLocale.GetCultureInfoLocale())); } break; case MissionRewardDisplay.RewardType.followerXP: this.m_rewardIcon.sprite = GeneralHelpers.GetLocalizedFollowerXpIcon(); this.m_rewardQuantityText.text = string.Empty; if (this.m_rewardName != null && this.m_isExpandedDisplay) { this.m_rewardName.text = ((this.m_rewardQuantity <= 1) ? string.Empty : (this.m_rewardQuantity.ToString("N0", MobileDeviceLocale.GetCultureInfoLocale()) + " " + StaticDB.GetString("XP2", "XP"))); } break; case MissionRewardDisplay.RewardType.currency: { Sprite sprite2 = CurrencyContainerDB.LoadCurrencyContainerIcon(this.m_rewardID, this.m_rewardQuantity); if (sprite2 != null) { this.m_rewardIcon.sprite = sprite2; } else { this.m_iconErrorText.gameObject.SetActive(true); this.m_iconErrorText.text = "c " + this.m_rewardID; } if (this.m_isExpandedDisplay) { CurrencyTypesRec record2 = StaticDB.currencyTypesDB.GetRecord(rewardID); if (record2 != null) { CurrencyContainerRec currencyContainerRec = CurrencyContainerDB.CheckAndGetValidCurrencyContainer(this.m_rewardID, this.m_rewardQuantity); if (currencyContainerRec != null) { this.m_rewardName.text = currencyContainerRec.ContainerName; this.m_rewardName.color = GeneralHelpers.GetQualityColor((int)currencyContainerRec.ContainerQuality); this.m_rewardQuantityText.text = string.Empty; } else { this.m_rewardName.text = record2.Name; this.m_rewardQuantityText.text = ((this.m_rewardQuantity <= 1) ? string.Empty : this.m_rewardQuantity.ToString("N0", MobileDeviceLocale.GetCultureInfoLocale())); } } else { this.m_rewardName.text = string.Empty; this.m_rewardQuantityText.text = ((this.m_rewardQuantity <= 1) ? string.Empty : this.m_rewardQuantity.ToString("N0", MobileDeviceLocale.GetCultureInfoLocale())); } } else { CurrencyTypesRec record3 = StaticDB.currencyTypesDB.GetRecord(rewardID); if (record3 != null) { CurrencyContainerRec currencyContainerRec2 = CurrencyContainerDB.CheckAndGetValidCurrencyContainer(this.m_rewardID, this.m_rewardQuantity); if (currencyContainerRec2 != null && currencyContainerRec2.ContainerQuality > 0 && this.m_qualityBorder != null) { this.m_qualityBorder.color = GeneralHelpers.GetQualityColor((int)currencyContainerRec2.ContainerQuality); } } } break; } } if (!this.m_isExpandedDisplay) { CurrencyContainerRec currencyContainerRec3 = CurrencyContainerDB.CheckAndGetValidCurrencyContainer(this.m_rewardID, rewardQuantity); if (currencyContainerRec3 != null) { this.m_rewardQuantityText.text = string.Empty; } else { this.m_rewardQuantityText.text = ((this.m_rewardQuantity <= 1) ? string.Empty : this.m_rewardQuantity.ToString("N0", MobileDeviceLocale.GetCultureInfoLocale())); } } }
public void SetTalent(TalentTreeItemAbilityButton abilityButton) { this.m_abilityButton = abilityButton; this.m_garrTalentRec = StaticDB.garrTalentDB.GetRecord(abilityButton.GetTalentID()); this.m_talentName.text = this.m_garrTalentRec.Name; this.m_talentDescription.text = WowTextParser.parser.Parse(this.m_garrTalentRec.Description, 0); if (MobileDeviceLocale.GetLanguageCode().StartsWith("ru", StringComparison.OrdinalIgnoreCase) && (this.m_garrTalentRec.ID == 548 || this.m_garrTalentRec.ID == 552)) { try { Regex regex = new Regex("(?<quantity>\\d+)\\s+4(?<singular>[\\p{L}\\d\\s]+):(?<plural1>[\\p{L}\\d\\s]+):(?<plural2>[\\p{L}\\d\\s]+);"); if (regex.Match(this.m_talentDescription.text).Success) { try { this.m_talentDescription.text = regex.Replace(this.m_talentDescription.text, (Match m) => { int num = int.Parse(m.Groups["quantity"].Value); int russianPluralIndex = GeneralHelpers.GetRussianPluralIndex(num); if (russianPluralIndex == 0) { return(string.Concat(num, " ", m.Groups["singular"].Value)); } if (russianPluralIndex == 1) { return(string.Concat(num, " ", m.Groups["plural1"].Value)); } return(string.Concat(num, " ", m.Groups["plural2"].Value)); }); } catch (Exception exception) { Debug.LogException(exception); } } } catch (Exception exception1) { Debug.LogException(exception1); } } this.m_talentDescription.supportRichText = WowTextParser.parser.IsRichText(); Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, this.m_garrTalentRec.IconFileDataID); if (sprite != null) { this.m_abilityIcon.sprite = sprite; } this.m_researchTimeAndCostSection.SetActive(true); int num1 = (!abilityButton.CanRespec() ? this.m_garrTalentRec.ResearchCost : this.m_garrTalentRec.RespecCost); this.m_resourceCostText.text = string.Concat((GarrisonStatus.WarResources() >= num1 ? "<color=#ffffffff>" : "<color=#FF0000FF>"), (!abilityButton.CanRespec() ? this.m_garrTalentRec.ResearchCost : this.m_garrTalentRec.RespecCost), "</color>"); Sprite sprite1 = GeneralHelpers.LoadCurrencyIcon((int)this.m_garrTalentRec.ResearchCostCurrencyTypesID); if (sprite1 != null) { this.m_resourceIcon.sprite = sprite1; } bool flag = (!abilityButton.IsResearching() ? false : abilityButton.IsRespec()); bool flag1 = false; TalentTreeItemAbilityButton sameTierButton = abilityButton.GetSameTierButton(); if (sameTierButton != null && (sameTierButton.IsOwned() || sameTierButton.IsResearching() && sameTierButton.IsRespec())) { flag1 = true; } TimeSpan timeSpan = TimeSpan.FromSeconds((double)((abilityButton.CanRespec() || flag || flag1 ? this.m_garrTalentRec.RespecDurationSecs : this.m_garrTalentRec.ResearchDurationSecs))); this.m_researchDurationText.text = timeSpan.GetDurationString(false); this.m_yourResourcesDisplayObj.SetActive(false); if (abilityButton.CanResearch() || abilityButton.CanRespec()) { this.m_availableForResearchSection.SetActive(true); this.m_unavailableForResearchSection.SetActive(false); this.m_researchOrRespecText.text = (!abilityButton.CanRespec() ? StaticDB.GetString("RESEARCH", null) : StaticDB.GetString("RESPEC", null)); this.m_yourResourcesDisplayObj.SetActive(true); } else { this.m_availableForResearchSection.SetActive(false); this.m_unavailableForResearchSection.SetActive(true); if (this.m_abilityButton.IsOwned()) { this.m_yourResourcesDisplayObj.SetActive(false); this.m_statusText.text = string.Concat("<color=#ffffffff>", StaticDB.GetString("TALENT_OWNED", null), "</color>"); this.m_researchTimeAndCostSection.SetActive(false); } else if (this.m_abilityButton.IsResearching()) { TimeSpan timeSpan1 = (!abilityButton.IsRespec() ? this.m_abilityButton.GetRemainingResearchTime() : this.m_abilityButton.GetRemainingRespecTime()); this.m_statusText.text = string.Concat(new string[] { "<color=#FFC600FF>", StaticDB.GetString("TIME_LEFT", null), "</color> <color=#ffffffff>", timeSpan1.GetDurationString(false), "</color>" }); } else if (GarrisonStatus.WarResources() < num1) { this.m_yourResourcesDisplayObj.SetActive(true); this.m_statusText.text = string.Concat("<color=#FF0000FF>", StaticDB.GetString("NEED_MORE_RESOURCES", null), "</color>"); } else if (!this.m_talentTreePanel.AnyTalentIsResearching()) { string whyCantResearch = this.m_abilityButton.GetWhyCantResearch(); if (whyCantResearch == null || !(whyCantResearch != string.Empty)) { this.m_statusText.text = string.Concat("<color=#FF0000FF>", StaticDB.GetString("MUST_RESEARCH_PREVIOUS_TIER", null), "</color>"); } else { this.m_statusText.text = string.Concat("<color=#FF0000FF>", whyCantResearch, "</color>"); } } else { this.m_statusText.text = string.Concat("<color=#FF0000FF>", StaticDB.GetString("ALREADY_RESEARCHING", null), "</color>"); } } }
private IEnumerator AddEventsToContent() { CultureInfo cultureInfo = MobileDeviceLocale.GetCultureInfoLocale(); CultureInfo currentCultureInfo = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = cultureInfo; int numPendingInvites = 0; this.m_dateHeaders.Clear(); uint numGuildEvents = Calendar.GetNumGuildEvents(); List <CalendarGuildEventInfo> guildEvents = new List <CalendarGuildEventInfo>(); for (uint num = 0u; num < numGuildEvents; num += 1u) { CalendarGuildEventInfo item; if (Calendar.GetGuildEventInfo(num, ref item)) { guildEvents.Add(item); } } CalendarEventItem forceClosedEventItem = null; DateTime eventDate = DateTime.Now; int eventCount = 0; for (int offsetMonth = 0; offsetMonth <= 1; offsetMonth++) { int year = DateTime.Now.Year + ((DateTime.Now.Month != 12 || offsetMonth != 1) ? 0 : 1); int month = DateTime.Now.Month + offsetMonth; if (month > 12) { month -= 12; } int daysInMonth = DateTime.DaysInMonth(year, month); uint day = (uint)((offsetMonth != 0) ? 0 : (DateTime.Now.Day - 1)); while ((ulong)day < (ulong)((long)daysInMonth) && (eventDate - DateTime.Now).TotalDays < 15.0) { int currentEventCount = eventCount; uint numDayEvents = Calendar.GetNumDayEvents(offsetMonth, day); if (numDayEvents > 0u || guildEvents.Any((CalendarGuildEventInfo guildEvent) => this.$this.IsEventOnDay(guildEvent, eventDate))) { GameObject gameObject = this.m_scrollContent.AddAsChildObject(this.m_scrollSectionHeaderPrefab); gameObject.GetComponentInChildren <Text>().text = eventDate.ToString(StaticDB.GetString("FULL_DATE", "dddd, MMMM d, yyyy")); this.m_dateHeaders.Add(eventDate, gameObject); List <CalendarEventData> list = new List <CalendarEventData>(); for (uint num2 = 0u; num2 < numDayEvents; num2 += 1u) { CalendarDayEvent dayEvent; if (Calendar.GetDayEvent(offsetMonth, day, num2, ref dayEvent)) { CalendarEventData calendarEventData = new CalendarEventData(dayEvent, num2); list.Add(calendarEventData); if (calendarEventData.IsPendingInvite()) { numPendingInvites++; } } } uint num3 = 0u; while ((ulong)num3 < (ulong)((long)guildEvents.Count)) { CalendarGuildEventInfo guildEvent = guildEvents[(int)num3]; if (this.IsEventOnDay(guildEvent, eventDate)) { CalendarEventData calendarEventData2 = list.FirstOrDefault((CalendarEventData eventData) => eventData.EventID == guildEvent.eventID); if (calendarEventData2 == null) { list.Add(new CalendarEventData(guildEvent, num3)); } else { calendarEventData2.AddGuildInfo(guildEvent); } } num3 += 1u; } list.Sort(EventsListPanel.Sorter); bool flag = false; foreach (CalendarEventData calendarEventData3 in list) { GameObject gameObject2; if (calendarEventData3.CalendarType == CalendarType.Holiday) { gameObject2 = this.m_scrollContent.AddAsChildObject(this.m_holidayListItemPrefab); } else { gameObject2 = this.m_scrollContent.AddAsChildObject(this.m_eventListItemPrefab); } if (gameObject2 != null) { gameObject2.GetComponentInChildren <CalendarEventItem>().SetEventInfo(calendarEventData3); bool flag2 = !this.m_isOnlyShowingPendingInvites || calendarEventData3.IsPendingInvite(); if (calendarEventData3.IsCommunityEvent && calendarEventData3.ClubID != null) { ulong?guildID = CommunityData.Instance.GetGuildID(); if (guildID != null && guildID.Value == calendarEventData3.ClubID.Value) { flag2 &= CalendarCVar.ShowGuildEvents.GetValue(); } else { flag2 &= CalendarCVar.ShowCommunityEvents.GetValue(); } } gameObject2.gameObject.SetActive(flag2); flag = (flag || flag2); if (calendarEventData3.EventID == EventInviteResponseDialog.ForceClosedEventID) { forceClosedEventItem = gameObject2.GetComponentInChildren <CalendarEventItem>(); } if (flag) { eventCount++; } } } gameObject.gameObject.SetActive(flag); } eventDate = eventDate.AddDays(1.0); if (eventCount > currentEventCount) { yield return(null); } day += 1u; } } if (numPendingInvites > 0) { GameObject gameObject3 = this.m_scrollContent.AddAsChildObject(this.m_scrollSectionHeaderPrefab); gameObject3.GetComponentInChildren <Text>().text = StaticDB.GetString("CALENDAR_PENDING_INVITATIONS_HEADER", "Pending Invitations [PH]"); gameObject3.transform.SetSiblingIndex(0); this.m_pendingInvitesButton = this.m_scrollContent.AddAsChildObject(this.m_pendingInviteButtonPrefab); this.m_pendingInvitesButton.GetComponentInChildren <Button>().onClick.AddListener(new UnityAction(this.TogglePendingInvitesFilter)); this.m_pendingInvitesButton.transform.SetSiblingIndex(1); Text componentInChildren = this.m_pendingInvitesButton.GetComponentInChildren <Text>(); if (componentInChildren != null) { componentInChildren.text = StaticDB.GetString((!this.m_isOnlyShowingPendingInvites) ? "CALENDAR_PENDING_INVITATIONS" : "BACK", (!this.m_isOnlyShowingPendingInvites) ? "Invitations [PH]" : "Back [PH]"); } } else if (this.m_isOnlyShowingPendingInvites) { this.TogglePendingInvitesFilter(); } Thread.CurrentThread.CurrentCulture = currentCultureInfo; if (forceClosedEventItem != null) { forceClosedEventItem.OpenEventItem(); } else if (EventInviteResponseDialog.ForceClosedEventID != null) { AllPopups.instance.ShowGenericPopupFull(StaticDB.GetString("EVENT_NOT_AVAILABLE", "Event is no longer available [PH]")); } yield break; }
public static string GetBestGuessForLocale() { string str = SecurePlayerPrefs.GetString(MobileDeviceLocale.LocaleKey, Main.uniqueIdentifier); if (!string.IsNullOrEmpty(str)) { return(str); } string str1 = "enUS"; bool flag = false; string languageCode = MobileDeviceLocale.GetLanguageCode(); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(languageCode, out str1); } catch (Exception exception) { } if (!flag) { languageCode = languageCode.Substring(0, 2); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(languageCode, out str1); } catch (Exception exception1) { } } if (!flag || languageCode == "es") { int num = 1; string countryCode = MobileDeviceLocale.GetCountryCode(); try { MobileDeviceLocale.s_countryCodeToRegionId.TryGetValue(countryCode, out num); } catch (Exception exception2) { } if (languageCode != null) { if (languageCode == "es") { str1 = (num != 1 ? "esES" : "esMX"); return(str1); } else { if (languageCode != "zh") { goto Label2; } str1 = (countryCode != "CN" ? "zhTW" : "zhCN"); return(str1); } } Label2: str1 = "enUS"; } return(str1); }
private IEnumerator Start() { this.characterViewPanel = base.GetComponentInParent <CharacterViewPanel>(); string locale = MobileDeviceLocale.GetBestGuessForLocale(); if (Singleton <Login> .Instance.GetBnPortal() != "test") { this.Url = new StringBuilder().Append("https://worldofwarcraft.com/").Append(locale.Substring(0, 2).ToLower()).Append("-").Append(locale.Substring(2, 2).ToLower()).Append("/character/").Append(Singleton <Login> .Instance.GetBnPortal().ToLower()).Append("/").Append(Singleton <Login> .Instance.GetRealmName(Singleton <CharacterData> .Instance.VirtualRealmAddress).Replace(" ", "-").Replace("'", string.Empty).ToLower()).Append("/").Append(Singleton <CharacterData> .Instance.CharacterName.ToLower()).Append("/equipment").ToString(); } else { this.Url = "https://worldofwarcraft.com/en-us/character/us/proudmoore/cahoots/equipment"; } this.Url = Uri.EscapeUriString(this.Url); Debug.Log("WebView url: " + this.Url); this.webViewObject = base.gameObject.AddComponent <WebViewObject>(); this.webViewObject.Init(delegate(string msg) { Debug.Log(string.Format("CallFromJS[{0}]", msg)); }, false, string.Empty, delegate(string msg) { Debug.Log(string.Format("CallOnError[{0}]", msg)); this.$this.characterViewPanel.OnWebViewLoaded(false); }, delegate(string msg) { Debug.Log(string.Format("CallOnHttpError[{0}]", msg)); this.$this.characterViewPanel.OnWebViewLoaded(false); }, delegate(string msg) { Debug.Log(string.Format("CallOnLoaded[{0}]", msg)); this.$this.characterViewPanel.OnWebViewLoaded(true); this.$this.webViewObject.EvaluateJS("Unity.call('ua=' + navigator.userAgent)"); }, true, null); this.webViewObject.SetMargins(0, base.GetComponentInParent <CharacterViewPanel>().TopMargin, 0, 0); this.webViewObject.SetVisibility(false); if (this.Url.StartsWith("http")) { this.webViewObject.LoadURL(this.Url); } else { string[] exts = new string[] { ".jpg", ".js", ".html" }; foreach (string ext in exts) { string url = this.Url.Replace(".html", ext); string src = Path.Combine(Application.streamingAssetsPath, url); string dst = Path.Combine(Application.persistentDataPath, url); byte[] result = null; if (src.Contains("://")) { WWW www = new WWW(src); yield return(www); result = www.bytes; } else { result = File.ReadAllBytes(src); } File.WriteAllBytes(dst, result); if (ext == ".html") { this.webViewObject.LoadURL("file://" + dst.Replace(" ", "%20")); break; } } } yield break; }
public static string GetBestGuessForLocale() { if (!string.IsNullOrEmpty(MobileDeviceLocale.s_bestGuessLocale)) { return(MobileDeviceLocale.s_bestGuessLocale); } string @string = SecurePlayerPrefs.GetString(MobileDeviceLocale.LocaleKey, Main.uniqueIdentifier); if (!string.IsNullOrEmpty(@string)) { MobileDeviceLocale.s_bestGuessLocale = @string; return(MobileDeviceLocale.s_bestGuessLocale); } string text = "enUS"; bool flag = false; string text2 = MobileDeviceLocale.GetLanguageCode(); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text2, out text); } catch (Exception) { } if (!flag) { text2 = text2.Substring(0, 2); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text2, out text); } catch (Exception) { } } if (!flag || text2 == "es") { int num = 1; string countryCode = MobileDeviceLocale.GetCountryCode(); try { MobileDeviceLocale.s_countryCodeToRegionId.TryGetValue(countryCode, out num); } catch (Exception) { } if (text2 != null) { if (text2 == "es") { if (num == 1) { text = "esMX"; } else { text = "esES"; } goto IL_140; } if (text2 == "zh") { if (countryCode == "CN") { text = "zhCN"; } else { text = "zhTW"; } goto IL_140; } } text = "enUS"; } IL_140: MobileDeviceLocale.s_bestGuessLocale = text; return(MobileDeviceLocale.s_bestGuessLocale); }
public static string GetCountryCode() { return(MobileDeviceLocale.GetLocaleCountryCode()); }
public static string GetLanguageCode() { return(MobileDeviceLocale.GetLocaleLanguageCode()); }
public static bool IsChineseDevice() { return(MobileDeviceLocale.GetCountryCode().Equals("CN", StringComparison.OrdinalIgnoreCase)); }