public void OnGUI() { EditorGUILayout.LabelField(new GUIContent("Insert Thai message here.")); EditorGUI.BeginChangeCheck(); message = EditorGUILayout.TextArea(message); if (EditorGUI.EndChangeCheck()) { if (!string.IsNullOrEmpty(message)) { thaiMessage = ThaiFontAdjuster.Adjust(message); } else { thaiMessage = ""; } } EditorGUILayout.LabelField(new GUIContent("Output.")); EditorGUILayout.TextArea(thaiMessage); if (GUILayout.Button("Copy")) { UnityEngine.TextEditor t = new UnityEngine.TextEditor(); t.text = thaiMessage; t.SelectAll(); t.Copy(); } }
public static string GetLocaleText(LocaleTyp key) { var localee = appli.localeData.Find((obj) => obj.key == key); if (localee.key != LocaleTyp.None) { if (Appli.SelectedLanguage == LanguageTyp.Thai) { try { return(ThaiFontAdjuster.Adjust(localee.localContents.Find((obj) => obj.languageTyp == SelectedLanguage).text)); } catch (Exception e) { Debug.Log(e.Message); return("error !"); } } else { return(localee.localContents.Find((obj) => obj.languageTyp == SelectedLanguage).text); } } else { Debug.LogError("cant find locale"); return(""); } }
public void ForceSetText(string text) { if (useThaiFontAdjuster) { text = ThaiFontAdjuster.Adjust(text); } dialogueText.text = text; }
private void ShowText(string s) { var font = Fonts[FontDropdown.value]; OriginalText.font = font; OriginalText.text = s; AdjustedText.font = font; AdjustedText.text = ThaiFontAdjuster.Adjust(s); }
public string translationSelector(string thai, string eng) { if (isThai) { return(ThaiFontAdjuster.Adjust(thai)); } else { return(eng); } }
void Start() { path = Application.persistentDataPath + "list.json"; pathCurrentIndexitem = Application.persistentDataPath + "currentIndex.json"; pathEvent = Application.persistentDataPath + "chkEventList.json"; string f1 = File.ReadAllText(path); string f2 = File.ReadAllText(pathCurrentIndexitem); string f3 = File.ReadAllText(pathEvent); int[] numbers = JsonHelper.getJsonArray <int>(f2); curentNumberItem = numbers[0]; numbers = JsonHelper.getJsonArray <int>(f1); for (int i = 0; i < 49; i++) { indexAllInventory[i] = numbers[i]; currentHaveItem[i] = listAllImgItem[numbers[i]]; Debug.Log(numbers[i]); } pageEvent = 1; countEvent = 0; numbers = JsonHelper.getJsonArray <int>(f3); for (int i = 0; i < 13; i++) { if (numbers[i] == 1) { countEvent++; } inventoryEvent[i] = numbers[i]; } if (mode == 1) { updatePageItem(); Debug.Log("Item : " + curentNumberItem); } else if (mode == 2) { Image img; img = listPage[0].GetComponent <Image>(); img.sprite = currentHaveItem[SetAllFile.indexSelected]; revFomula(); setDescription(); // indexSelected descriptionText.text = ThaiFontAdjuster.Adjust(itemDescription[indexAllInventory[indexSelected]]); } else if (mode == 3) { updatePageEvent(); } }
// Start is called before the first frame update void Start() { try { text = this.GetComponent <Text>(); text.text = ThaiFontAdjuster.Adjust(text.text); } catch { TextPro = this.GetComponent <TMPro.TextMeshProUGUI>(); TextPro.text = ThaiFontAdjuster.Adjust(TextPro.text); } }
void Display() { if (PageData.isShowYokaiDetail) { _library.SetActive(false); _detail.SetActive(true); _backLibrary.SetActive(true); if (ApplicationData.YokaiData.Exists(s => s.id == UserData.GetUserInfo().yokais.Last().yokai_id)) { var d = ApplicationData.YokaiData.Where(s => s.id == UserData.GetUserInfo().yokais.Last().yokai_id).First(); _image.GetComponent <Image>().sprite = d.image; if (d.kana != "" && ApplicationData.SelectedLanguage == LanguageType.Japanese) { _name.GetComponent <Text>().text = d.localNames[(int)ApplicationData.SelectedLanguage].text; _kana.GetComponent <Text>().text = d.kana; _name.GetComponent <Text>().fontSize = 90; } else { if (ThaiFontAdjuster.IsThaiString(d.localNames[(int)ApplicationData.SelectedLanguage].text.ToString())) { _name.GetComponent <Text>().text = ThaiFontAdjuster.Adjust(d.localNames[(int)ApplicationData.SelectedLanguage].text.ToString()); _kana.GetComponent <Text>().text = ""; _name.GetComponent <Text>().font = ApplicationData.GetFont(4); _name.GetComponent <Text>().fontSize = 110; } else { _name.GetComponent <Text>().text = d.localNames[(int)ApplicationData.SelectedLanguage].text; _kana.GetComponent <Text>().text = ""; _name.GetComponent <Text>().fontSize = 90; } } _description.GetComponent <Text>().text = d.localContents[(int)ApplicationData.SelectedLanguage].text; if (ApplicationData.SelectedLanguage == LanguageType.Thai) { _description.GetComponent <Text>().font = ApplicationData.GetFont(4); _description.GetComponent <Text>().fontSize = 62; _description.GetComponent <Text>().text = ThaiFontAdjuster.Adjust(d.localContents[(int)ApplicationData.SelectedLanguage].text); } else { _description.GetComponent <Text>().font = ApplicationData.GetFont(2); _description.GetComponent <Text>().fontSize = 42; } } } PageData.Initialize(); }
public string PreprocessText(string text) { string str = text; if (enableLexTo) { str = LexTo.Instance.ParseToString(str); } if (enableThaiFontAdjuster) { str = ThaiFontAdjuster.Adjust(str); } return(str); }
public void formula2(int x, int y, int z, int k) { if (chkItemList[z] == 0) { if (combineItem1 == x && combineItem2 == y) { currentHaveItem[curentNumberItem] = listAllImgItem[z]; chkItemList[z] = 1; indexAllInventory[curentNumberItem++] = z; popUpDescription.text = ThaiFontAdjuster.Adjust(itemDescription[z]); Debug.Log("555555555555"); paneRecieveItem.active = true; imgReceivedItem.sprite = listAllImgItem[z]; setNullItem(1); //pop up item } } if (chkItemList[k] == 0) { if (combineItem1 == x && combineItem2 == y) { currentHaveItem[curentNumberItem] = listAllImgItem[k]; chkItemList[k] = 1; indexAllInventory[curentNumberItem++] = k; popUpDescription2.text = ThaiFontAdjuster.Adjust(itemDescription[k]); paneRecieveItem2.active = true; imgReceivedItem2.sprite = listAllImgItem[k]; setNullItem(2); } } //write json path = Application.persistentDataPath + "list.json"; pathCurrentIndexitem = Application.persistentDataPath + "currentIndex.json"; json = JsonHelper.arrayToJson(indexAllInventory); File.WriteAllText(path, json); curentNumberItemJson[0] = curentNumberItem; curentNumberItemJson[1] = level; jsonCurrentIndexitem = JsonHelper.arrayToJson(curentNumberItemJson); File.WriteAllText(pathCurrentIndexitem, jsonCurrentIndexitem); }
public int getInstructionIDFromString(string thistitle) { for (int i = 0; i < changeableAmount; i++) { if (stringScript.isThai && thistitle == ThaiFontAdjuster.Adjust(title[i])) { return(i); } else if (thistitle == title[i]) { return(i); } } return(-1); }
private void Update() { if (text == null) { return; } if (string.IsNullOrEmpty(message)) { text.text = ""; } else { text.text = ThaiFontAdjuster.Adjust(message); } }
public void DisplayNextSentence() { if (sentences.Count == 0) { EndDialogue(); return; } string sentence = sentences.Dequeue(); if (useThaiFontAdjuster) { sentence = ThaiFontAdjuster.Adjust(sentence); } dialogueText.text = sentence; }
// Use this for initialization public void Detail() { var yokai = ApplicationData.YokaiData.Where(s => s.id == ButtonYokai.yokaiName).First(); this.transform.GetChild(0).GetComponent <Image>().sprite = yokai.image; if (yokai.kana != "" && ApplicationData.SelectedLanguage == LanguageType.Japanese) { _name.GetComponent <Text>().text = yokai.localNames[(int)ApplicationData.SelectedLanguage].text.ToString(); _kana.GetComponent <Text>().text = yokai.kana.ToString(); _name.GetComponent <Text>().fontSize = 90; } else { if (ApplicationData.SelectedLanguage == LanguageType.Thai) { _name.GetComponent <Text>().text = ThaiFontAdjuster.Adjust(yokai.localNames[(int)ApplicationData.SelectedLanguage].text.ToString()); _kana.GetComponent <Text>().text = ""; _name.GetComponent <Text>().font = ApplicationData.GetFont(4); _name.GetComponent <Text>().fontSize = 110; } else { _name.GetComponent <Text>().text = yokai.localNames[(int)ApplicationData.SelectedLanguage].text.ToString(); _kana.GetComponent <Text>().text = ""; _name.GetComponent <Text>().fontSize = 90; } } for (int a = 0; a < ApplicationData.YokaiData[a].localContents.Count; a++) { _description.GetComponent <Text>().text = yokai.localContents[(int)ApplicationData.SelectedLanguage].text.ToString(); if (ApplicationData.SelectedLanguage == LanguageType.Thai) { _description.GetComponent <Text> ().font = ApplicationData.GetFont(4); _description.GetComponent <Text>().fontSize = 62; _description.GetComponent <Text>().text = ThaiFontAdjuster.Adjust(yokai.localContents[(int)ApplicationData.SelectedLanguage].text.ToString()); } else { _description.GetComponent <Text> ().font = ApplicationData.GetFont(2); _description.GetComponent <Text>().fontSize = 42; } } }
public void initializeDogPopulationInput_I(float gridSize) { switchAllowInput_I(false); acceptDogPopButton_I.enabled = false; dogQuantity_I.GetComponent <InputField>().text = ""; if (PlayerPrefs.GetString("isThai") == "True") { errorDogInput_I.GetComponent <Text>().text = ThaiFontAdjuster.Adjust("จุดกึ่งกลางของที่อยู่สุนัข มีขนาด (x: " + gridSize + " m., y: " + gridSize + " m.) โปรแกรมจะสร้างขนาดของที่อยู่ในภายหลัง"); errorDogInput_I.GetComponent <Text>().font = stringScript.thaiFont; errorDogInput_I.GetComponent <Text>().fontSize = (int)(errorDogInput_I.GetComponent <Text>().fontSize * 0.8f); } else { showDogErrorInput("center of infected dog represents the size of (x: " + gridSize + "m., y: " + gridSize + "m.), coverage area will be operated after this."); } populationQuantBox_I.SetActive(true); onDoginputNotification_I = true; }
public void changeToThaiLanguage(string path) { StreamReader reader = new StreamReader(path); string line = reader.ReadLine(); int count = 0; while (!reader.EndOfStream) { if (count > textToChangeLanguage.Length) { break; } textToChangeLanguage[count].font = thaiFont; textToChangeLanguage[count].text = ThaiFontAdjuster.Adjust(reader.ReadLine()); textToChangeLanguage[count].fontSize = (int)(textToChangeLanguage[count].fontSize * 0.8f); count++; } }
public string getPicRenderText(string suspect, string exposed, string infected, string date, string frame) { if (stringScript.isThai) { return(ThaiFontAdjuster.Adjust("จำนวน Suspected: " + suspect + "\n" + "จำนวน Exposed: " + exposed + "\n" + "จำนวน Infected: " + infected + "\n" + "วันที่: " + date + "\n" + "ภาพเลขที่: " + frame)); } else { return("Suspected Amount: " + suspect + "\n" + "Exposed Amount: " + exposed + "\n" + "Infected Amount: " + infected + "\n" + "Day: " + date + "\n" + "Frame Number: " + frame); } }
private void addIAddByLatLon() { int latValid = latValidation(iAddByLatText.text); int lonValid = lonValidation(iAddByLonText.text); if (latValid == 0 && lonValid == 0) { iAddByLatLonBox.SetActive(false); iAddByText.text = stringScript.getAddText(); iAddByLatLonIsAdded = true; showDogErrorInput_I(""); } else { if (PlayerPrefs.GetString("isThai") == "True") { if (latValid == lonValid) { string additionalError = ""; if (latValid == 1) { additionalError = "อยู่นอกขอบเขตจอ"; } else { additionalError = "มีความผิดพลาดจากการกรอกค่า"; } errorDogInput_I.GetComponent <Text>().text = ThaiFontAdjuster.Adjust("lat, lon " + additionalError); } else { errorDogInput_I.GetComponent <Text>().text = ThaiFontAdjuster.Adjust("มีค่า lat และ/หรือ lon มีความผิดพลาดในการกรอก"); } errorDogInput_I.GetComponent <Text>().font = stringScript.thaiFont; errorDogInput_I.GetComponent <Text>().fontSize = (int)(errorDogInput.GetComponent <Text>().fontSize * 0.8f); } else { showDogErrorInput_I("Error input occurred on lat and/or lon."); } } }
public void notifyInstructionTextChange(int index) { int trueindex = 0; if (PlayerPrefs.GetString("isThai") == "True") { trueindex = index - (title.Length / 2); } else { trueindex = index; } for (int i = 0; i < instructiontext.Length; i++) { instructiontext[i].font = stringScript.thaiFont; instructiontext[i].fontStyle = FontStyle.Normal; instructiontext[i].fontSize = 10; instructiontext[i].text = ThaiFontAdjuster.Adjust(title[trueindex] + "\n" + instruction[index]); } }
public string TextAdjust() { string value = defaultText.Replace("\\n", "\n"); float boxwidth = GetBoxWidth(); onWrapChange = false; if (ThaiFontAdjuster.IsThaiString(value)) { if (base.horizontalOverflow == HorizontalWrapMode.Wrap) { base.text = ThaiWrappingText(value, boxwidth); } else { base.text = ThaiFontAdjuster.Adjust(value); } } base.text = System.Text.RegularExpressions.Regex.Unescape(base.text); return(base.text); }
void OnEnable() { MapPageManager.instance.SetMapPage(0, 0, -6, RenderMode.ScreenSpaceCamera); if (PageData.yokaiID != -1) { objYokai.SetActive(true); objItem.SetActive(false); } if (PageData.itemID != -1) { objItem.SetActive(true); objYokai.SetActive(false); } kindOfObject = GameObject.FindGameObjectWithTag("MapEffect").transform.Find("MapCircle").transform.Find("FireMagic").gameObject; backgroundCam.GetComponent <CameraAsBackground> ().CameraStart(); if (GameObject.FindGameObjectWithTag("ParentTutorial").transform.childCount == 0) { backgroundCam.transform.SetParent(GameObject.FindGameObjectWithTag("ParentTutorial").transform); } sprYCircle.transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); #region Enable the map effect mapEffect = GameObject.FindGameObjectWithTag("MapEffect"); mapEffect.transform.GetChild(0).gameObject.SetActive(true); #endregion #region Enable the third Camera yokaiCam = GameObject.FindGameObjectWithTag("YokaiCamera"); yokaiCam.transform.GetChild(0).gameObject.SetActive(true); #endregion #region Pinch Zoom the map map = GameObject.FindGameObjectWithTag("Map"); map.transform.GetChild(1).gameObject.SetActive(true); map.transform.GetChild(1).gameObject.GetComponent <PinchZoom> ().enabled = false; map.transform.GetChild(1).gameObject.GetComponent <lb_drag> ().enabled = false; map.transform.GetChild(1).GetComponent <MeshCollider>().enabled = false; #endregion if (objYokai.activeSelf) { kindOfObject.GetComponent <MeshRenderer> ().material = fireMat; kindOfObject.transform.localScale = new Vector3(.1f, .1f, .2f); } else if (objItem.activeSelf) { kindOfObject.GetComponent <MeshRenderer> ().material = itemMat; kindOfObject.transform.localScale = new Vector3(.2f, .1f, .2f); } FireEffect(true); for (int i = 0; i < ApplicationData.YokaiGetTutorialData.Count; i++) { if (ThaiFontAdjuster.IsThaiString(ApplicationData.YokaiGetTutorialData[i].localContents[(int)ApplicationData.SelectedLanguage].text.ToString())) { yokai[i].GetComponentsInChildren <Text>(true)[0].text = ThaiFontAdjuster.Adjust(ApplicationData.YokaiGetTutorialData[i].localContents[(int)ApplicationData.SelectedLanguage].text.ToString()); yokai[i].GetComponentsInChildren <Text>(true)[0].fontSize += 20; } else { yokai[i].GetComponentsInChildren <Text>(true)[0].text = ApplicationData.YokaiGetTutorialData[i].localContents[(int)ApplicationData.SelectedLanguage].text.ToString(); yokai[i].GetComponentsInChildren <Text>(true)[0].fontSize = 42; } yokai [i].GetComponentsInChildren <Text> (true) [0].font = ChangeFont(); yokai [i].GetComponentsInChildren <Text> (true) [0].fontSize = ApplicationData.YokaiGetTutorialData [i].localContents [(int)ApplicationData.SelectedLanguage].fontSize; } for (int j = 0; j < item.Length; j++) { item[j].GetComponentsInChildren <Text> (true) [0].text = ApplicationData.GetLocaleText(LocaleType.ItemGetTutorial); item [j].GetComponentsInChildren <Text> (true) [0].font = ChangeFont(); item [j].GetComponentsInChildren <Text> (true) [0].fontSize = ApplicationData.SetFontSize(LocaleType.ItemGetTutorial); } CircleScale(); }
private string ThaiWrappingText(string value, float boxwidth) { List <string> htmlTag; string inputText = ParserTag(value, out htmlTag); //inputText = ICU4Unity.instance.InsertLineBreaks(inputText, SEPARATOR); inputText = Lexto.LexTo.Instance.InsertLineBreaks(inputText, SEPARATOR); char[] arr = inputText.ToCharArray(); Font font = this.font; CharacterInfo characterInfo = new CharacterInfo(); if (font != null) { font.RequestCharactersInTexture(inputText, base.fontSize, base.fontStyle); } string outputText = ""; int lineLength = 0; string word = ""; int wordLength = 0; foreach (char c in arr) { if (c == SEPARATOR) { AddWordToText(outputText, lineLength, word, wordLength, boxwidth, out outputText, out lineLength); word = ""; wordLength = 0; continue; } else if (c == NEWLINE) { AddNewLineToText(outputText, lineLength, word, wordLength, boxwidth, out outputText, out lineLength); word = ""; wordLength = 0; continue; } else if (font != null && font.GetCharacterInfo(c, out characterInfo, base.fontSize)) { if (c == SPACE) { AddSpaceToText(outputText, lineLength, word, wordLength, characterInfo.advance, boxwidth, out outputText, out lineLength); word = ""; wordLength = 0; } else if (c == SPECIAL_TAG) { AddWordToText(outputText, lineLength, word, wordLength, boxwidth, out outputText, out lineLength); word = ""; wordLength = 0; outputText += htmlTag[0]; htmlTag.RemoveAt(0); } else { word += c; wordLength += characterInfo.advance; } } } AddWordToText(outputText, lineLength, word, wordLength, boxwidth, out outputText, out lineLength); // Add remaining word return(ThaiFontAdjuster.Adjust(outputText)); }
private void Start() { Instance = this; foreach (Transform i in this.transform) { string name = i.name.Remove(0, 5); TutorialData obj = ApplicationData.TutorialData.SingleOrDefault(s => s.index.ToString() == name.Trim()); if (ApplicationData.SelectedLanguage == LanguageType.Thai) { if (!obj.Equals(new TutorialData())) { i.transform.GetChild(0).GetComponent <Image>().sprite = obj.image; for (int a = 0; a < obj.localContents.Count; a++) { if (obj.localContents[a].languageType == ApplicationData.SelectedLanguage) { i.transform.GetChild(1).GetChild(0).GetComponent <Text>().font = ChangeFont(); i.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = ThaiFontAdjuster.Adjust(obj.localContents[a].text.ToString()); i.transform.GetChild(1).GetChild(0).GetComponent <Text>().fontSize = obj.localContents[a].fontSize; i.transform.GetChild(1).GetChild(0).GetComponent <Text>().lineSpacing = obj.localContents[a].lineSpacing; } i.transform.GetChild(1).GetChild(1).GetComponent <Text>().text = ApplicationData.GetLocaleText(LocaleType.TapOnPrologue); i.transform.GetChild(1).GetChild(1).GetComponent <Text>().font = ChangeFont(); i.transform.GetChild(1).GetChild(1).GetComponent <Text>().fontSize = ApplicationData.SetFontSize(LocaleType.TapOnPrologue); } } } else { if (!obj.Equals(new TutorialData())) { i.transform.GetChild(0).GetComponent <Image>().sprite = obj.image; for (int a = 0; a < obj.localContents.Count; a++) { if (obj.localContents[a].languageType == ApplicationData.SelectedLanguage) { i.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = obj.localContents[a].text.ToString(); i.transform.GetChild(1).GetChild(0).GetComponent <Text>().font = ChangeFont(); } i.transform.GetChild(1).GetChild(1).GetComponent <Text>().text = ApplicationData.GetLocaleText(LocaleType.TapOnPrologue); i.transform.GetChild(1).GetChild(1).GetComponent <Text>().font = ChangeFont(); i.transform.GetChild(1).GetChild(1).GetComponent <Text>().fontSize = ApplicationData.SetFontSize(LocaleType.TapOnPrologue); } } } } }