void PrintScore() { string text = GetComponent <Text>().text; text = LocalizedTexts.GetText(LocalizedTexts.Text.Total) + ": " + GameData.currentScore + "/" + GameData.maxScore; GetComponent <Text>().text = text; }
private static void PopulateLocalizedTexts(LocalizedTexts localized, ExcelSheet sheet) { localized.localizations = sheet.Headers.Select((header, languageIdx) => { var keys = sheet.Values.Select(value => value[0]).ToArray(); return(new LanguageGroup() { Language = header, Localizations = new LocalizedText() { localization = keys.Select((key, rowIdx) => { return new Translation() { Key = key, Translated = sheet.GetRow(rowIdx)[languageIdx] }; }) .ToArray() } }); }) .ToArray(); }
void PrintNewScore(float score, bool flash) { GetComponent <Text>().text = LocalizedTexts.GetText(LocalizedTexts.Text.Score) + ": " + score.ToString("F1"); if (flash) { m_textFlash.FlashText(Color.green); } }
void SetText(LocalizedTexts.Text text, bool flash = true) { m_textComponent.text = LocalizedTexts.GetText(text); if (flash) { m_textFlash.FlashText(Color.black); } m_currentText = text; }
void PrintGoalScore(Goal goal, bool flash) { GetComponent <Text>().text = LocalizedTexts.GetText(LocalizedTexts.Text.Goal) + ": " + goal.score + "/" + goal.max; if (flash) { FlashText(); } m_currentGoal = goal; }
private void LoadTextsData() { CreateDirectory(); string filePath = EditorUtility.OpenFilePanel("Select localization data file", LocalizationManager.languagesDirectory, "json"); if (!string.IsNullOrEmpty(filePath)) { CreateNewData(); string jsonString = File.ReadAllText(filePath); localizationData = JsonUtility.FromJson <LocalizedTexts>(jsonString); } }
void GetText(string filePath, string key, Action <string> action) { LocalizedTexts localizedTexts = null; StartCoroutine(DownloadFile.Download(filePath, (string jsonString) => { localizedTexts = JsonUtility.FromJson <LocalizedTexts>(jsonString); LocalizationItem item = localizedTexts.items.Find(o => o.key == key); string result = ""; if (item != null) { result = item.value; } action.Invoke(result); })); }
public void ChangeLanguage() { LocalizedTexts.SetLanguage(GetNextLanguage()); }
private void CreateNewData() { localizationData = new LocalizedTexts(); }
private void UpdateLanguage() { GetComponent <Text>().text = LocalizedTexts.GetText(m_text); }