public void ShowLevelInfo() { levelInfo.SetActive(true); levelInfoTitle.text = Localisation.Get(StringKey.UI_LevelInfo_Title); levelInfoNumber.text = GameManager.instance.NumberOfMissions.ToString(); MissionDifficulty difficulty = GameManager.instance.DifficultyRank; switch (difficulty) { case MissionDifficulty.Easy: levelInfoDifficulty.text = Localisation.Get(StringKey.UI_LevelInfo_Easy); break; case MissionDifficulty.Medium: levelInfoDifficulty.text = Localisation.Get(StringKey.UI_LevelInfo_Medium); break; case MissionDifficulty.Hard: levelInfoDifficulty.text = Localisation.Get(StringKey.UI_LevelInfo_Hard); break; default: levelInfoDifficulty.text = "???"; break; } }
public static bool ParseCountry(string path) { string f = File.ReadAllText(path); currentFile = RemoveWhiteSpace(f); string tag = Regex.Match(path.Split(@"\").Last(), @"([A-Z]+) - .+").Groups[1].Value.ToUpper(); //string tag = path.Split(@"\").Last().Substring(1, 3).ToUpper(); if (!Regex.IsMatch(tag, @"[A-Z]+")) { Status = $"Country tag {tag} is not valid for {path}."; return(false); } string pol = FindKey("set_politics"); string pop = FindKey("set_popularities"); Politics p = new Politics(); if (pop != string.Empty) { p.neutrality = FindKeyInt("neutrality", pop); p.democracy = FindKeyInt("democratic", pop); p.fascism = FindKeyInt("fascism", pop); p.communism = FindKeyInt("communism", pop); } ; if (pol != string.Empty) { p.rulingParty = (Ideology)Enum.Parse(typeof(Ideology), FindKey("ruling_party", pol), true); p.lastElection = DateTime.Parse(FindKey("last_election", pol)); p.electionFrequency = FindKeyInt("election_frequency", pol); p.electionsAllowed = FindKey("election_allowed", pol) == "yes"; } if (Country.Create(tag)) { Country c = Country.Get(tag); c.Name = Localisation.Get($"{tag}_{p.rulingParty.ToString().ToLower()}"); c.Oob = FindKey("oob"); c.ResearchSlots = FindKeyInt("set_research_slots"); c.Convoys = FindKeyInt("set_convoys"); c.Stability = FindKeyDouble("set_stability"); c.WarSupport = FindKeyDouble("set_war_support"); c.Politics = p; c.FactionName = FindKey("create_faction"); c.FactionMembers = FindMultipleKey("add_to_faction"); c.Capital = FindKeyInt("capital"); c.SetUnmodified(); } else { Status = $"Error creating country {tag} for {path}."; return(false); } return(true); }
public string GetLocalisedString(params LocalisationLocalVariable[] variables) { _cachedLanguage = Localisation.GetCurrentLanguage(); _cachedText = Localisation.Get(_localisationKey, variables); _cachedVariables = Localisation.GetGlobalVariables(_cachedText); return(_cachedText); }
public string GetLocalisedString(SystemLanguage language) { if (!string.IsNullOrEmpty(_localisationKey)) { return(Localisation.Get(language, _localisationKey, _localVariables)); } return(string.Empty); }
public void Init(SecretDoor secretDoor) { this.secretDoor = secretDoor; EnableAll(); secretDoorMessage.text = Localisation.Get(secretDoorMessageStringKey); EventSystem.current.SetSelectedGameObject(passCodeField.gameObject); }
// void Awake() // { // if (gameObject.activeSelf) // { // Hide(); // } // } internal void Show(OracleData data) { oracleMessageText.text = Localisation.Get(oracleMessageStringKey); this.data = data; Item item = ItemManager.instance.itemsData.GetItemByName(data.itemName); SetText(item.ItemName); SetSprite(item.sprite); gameObject.SetActive(true); }
public string GetLocalisedString(params LocalisationLocalVariable[] variables) { if (variables.Length > 0 || _cachedLanguage != Localisation.GetCurrentLanguage() || Localisation.AreGlobalVariablesOutOfDate(_cachedVariables)) { _cachedLanguage = Localisation.GetCurrentLanguage(); _cachedText = Localisation.Get(_localisationKey, variables); _cachedVariables = Localisation.GetGlobalVariables(_cachedText); } return(_cachedText); }
private void OnEnable() { // exitButton.gameObject.SetActive(true); foreach (Transform child in layoutGroup) { Destroy(child.gameObject); } foreach (var characterClass in possibleStartingClasses) { var classSelect = Instantiate(classSelectButton, layoutGroup); var toggle = classSelect.GetComponent <Toggle>(); if (!characterClass.Unlocked) { classSelect.Init(characterClass.ClassName, lockedClassSprite, lockedIconColor); toggle.interactable = false; } else { classSelect.Init(characterClass.ClassName, characterClass.initialWeapon.GetComponentInChildren <SpriteRenderer>().sprite); toggle.interactable = true; if (GameManager.instance.currentSelectedClass == characterClass) { toggle.isOn = true; } } toggle.group = layoutGroup.GetComponent <ToggleGroup>(); toggle.onValueChanged.AddListener((isOn) => { if (isOn) { LogsManager.SendLogDirectly(new Log( LogType.ClassSelected, new Dictionary <string, string>() { { "Class", characterClass.ClassName } } )); GameManager.instance.currentSelectedClass = characterClass; } }); } classSelectTitleText.text = Localisation.Get(classSelectTitleTextKey); }
public void Initialize(string itemName, int amount, Sprite itemSprite) { panel.gameObject.SetActive(true); if (feedbackTitle != null) { feedbackTitle.text = Localisation.Get(StringKey.HUD_NewLootFeedback_Title); if (feedbackSubtitle != null) { feedbackSubtitle.text = Localisation.Get(StringKey.HUD_NewLootFeedback_Subtitle); } if (feedbackTitleItem != null) { feedbackTitleItem.text = itemName; } } else { string feedbackTextString = Localisation.Get(StringKey.HUD_LootFeedback); feedbackTextString = feedbackTextString.Replace("$AMOUNT$", amount.ToString()); feedbackTextString = feedbackTextString.Replace("$ITEM$", itemName); feedbackText.text = feedbackTextString; } feedbackImage.sprite = itemSprite; var stuffToDisableAndReenable = GetComponentsInChildren <RectTransform>(); foreach (var transform in stuffToDisableAndReenable) { LayoutRebuilder.ForceRebuildLayoutImmediate(transform); // transform.enabled = false; } // foreach (var transform in stuffToDisableAndReenable) // { // transform.enabled = true; // } StartCoroutine(DisableAfterSeconds(feedbackTime)); }
private void OnEnable() { windowTitleText.text = Localisation.Get(windowTitleStringKey); collectedItemsText.text = Localisation.Get(collectedItemsStringKey); offeringText.text = Localisation.Get(offeringStringKey); continueText.text = Localisation.Get(continueStringKey); MoreMountains.TopDownEngine.GameManager.Instance.Paused = true; Cursor.visible = true; foreach (Transform child in itemsLootedLayout) { Destroy(child.gameObject); } ItemsList itemsList = ItemManager.instance.itemsData; // Show items caught foreach (var itemQuantity in InventoryManager.instance.ItemQuantity) { Item item = itemsList.GetItemByName(itemQuantity.Key); Instantiate(itemUIPrefab, itemsLootedLayout).Init(item.sprite, item.ItemNameKey, itemQuantity.Value); } if (!playerDied) { // Show enemies defeated // Show time remaining // Other stats ShowOfferingIfNotNotified(); } // button listener }
public string GetLocalisedString() { if (_cachedLanguage != Localisation.GetCurrentLanguage() || Localisation.AreGlobalVariablesOutOfDate(_cachedVariables) #if UNITY_EDITOR || !Application.isPlaying #endif ) { if (_localVariables != null && _localVariables.Length > 0) { _cachedText = Localisation.Get(_localisationKey, _localVariables); } else { _cachedText = Localisation.Get(_localisationKey); } _cachedLanguage = Localisation.GetCurrentLanguage(); _cachedVariables = Localisation.GetGlobalVariables(_cachedText); } return(_cachedText); }
private void HandleShowDailyQuest() { dailyQuestTitleImage.sprite = dailyQuestTitleSprites[Localisation.currentLanguage]; // destroy childs of dailyQuestLayout foreach (Transform item in dailyQuestLayout.transform) { Destroy(item.gameObject); } if (!QuestManager.instance.ExistsManagerQuest()) { HideDailyQuest(); } else { QuestManager.instance.CheckManagerQuest(); // create childs of dailyQuestLayout foreach (var itemQuantity in QuestManager.instance.ManagerQuestItems) { Item item = ItemManager.instance.itemsData.GetItemByName(itemQuantity.Key); ItemSmallUI itemUI = Instantiate(itemSmallUIPrefab); itemUI.transform.SetParent(dailyQuestLayout.transform, false); itemUI.Init(item, itemQuantity.Value); } questCompleteImage.SetActive(QuestManager.instance.IsManagerQuestComplete); questReward.transform.parent.gameObject.SetActive(true); dailyQuestDescription.gameObject.SetActive(true); dailyQuestDescription.text = Localisation.Get(StringKey.UI_DailyQuestDescription); questReward.text = Localisation.Get(StringKey.UI_DailyQuestReward); } }