void LateUpdate() { if (debug && Input.GetKeyDown(KeyCode.L)) { textID++; if (textID >= 81) { textID = 0; } Debug.Log(textID + " " + TextTranslationManager.GetText(TextTranslationManager.TextCollection.npc, textID, currentLanguage).Length); } if (pivotObj != null && Camera.main != null) { pivotObj.transform.LookAt(new Vector3(Camera.main.transform.position.x, pivotObj.transform.position.y, Camera.main.transform.position.z)); pivotObj.transform.RotateAround(pivotObj.transform.position, Vector3.up, 180f); } if (textID != -1) { if (currentLanguage != PlayerPrefs.GetInt("Language") || textID != origTextID) { currentLanguage = PlayerPrefs.GetInt("Language"); origTextID = textID; UpdateText(TextTranslationManager.GetText(TextTranslationManager.TextCollection.npc, textID, currentLanguage)); } } }
void UpdateItem(MarketItemInfo mi) { if (PlayerPrefs.GetInt("PaidForItem" + mi.itemID.ToString(), 0) == 1) { mi.textMesh.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 2, PlayerPrefs.GetInt("Language")); } else { if (mi.price == -1) { mi.textMesh.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 3, PlayerPrefs.GetInt("Language")); } else { mi.textMesh.text = mi.price.ToString(); } } if (PlayerPrefs.GetInt("Language") == 11) { mi.textMesh.font = TextTranslationManager.singleton.arabicFont; mi.textMesh.fontStyle = FontStyle.Bold; } else { mi.textMesh.font = soldFont; mi.textMesh.fontStyle = soldFontStyle; } }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "Player" && !speaking) { if (textID <= 4 && textID != -1) { UpdateText(TextTranslationManager.GetText(TextTranslationManager.TextCollection.npc, textID, currentLanguage)); } EnterText(false); } }
void SetPriceText() { priceObj.GetComponent <TextMesh>().text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 2, curLang); if (curLang == 1 || curLang == 2 || curLang == 3 || curLang == 6 || curLang == 7 || curLang == 8 || curLang == 9 || curLang == 10 || curLang == 11 || curLang == 12) { priceObj.GetComponent <TextMesh>().fontSize = 50; } else { priceObj.GetComponent <TextMesh>().fontSize = 80; } if (curLang == 11) { priceObj.GetComponent <TextMesh>().font = TextTranslationManager.singleton.arabicFont; priceObj.GetComponent <TextMesh>().fontStyle = FontStyle.Bold; } else { priceObj.GetComponent <TextMesh>().font = originalFont; priceObj.GetComponent <TextMesh>().fontStyle = originalFontStyle; } }
void Start() { origTextID = textID; sound = this.gameObject.GetComponent <AudioSource>(); if (voiceClip != null) { sound.clip = voiceClip; } anim = this.gameObject.GetComponentInChildren <Animator>(); pivotObj = this.gameObject; originalFont = speech.font; originalFontStyle = speech.fontStyle; if (textID != -1) { UpdateText(TextTranslationManager.GetText(TextTranslationManager.TextCollection.npc, textID, currentLanguage)); } else { fullText = speech.text; } }
IEnumerator WaitToDisplay(int promptID, int itemID, ActivateItemsLeafs aiLeaf, ActivateBonusAbility aiBonus, ActivateItemsMasks aiMask, bool bought, bool touched) { while (displaying) { yield return(null); } if (inPromptTrigger[promptID] == true) { displaying = true; animator.ResetTrigger("nextState"); if (tpc == null) { tpc = PlayerManager.GetMainPlayer(); camF = tpc.cam.GetComponent <CameraFollower>(); } tpc.inShop = true; // Time.timeScale = 0f; // tpc.inCutscene = true; // tpc.disableControl = true; // tpc.rb.isKinematic = true; // camF.disableControl = true; yesText.fontSize = 40; promptTitle.fontSize = 300; promptInfo.fontSize = 300; promptTitle.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, (promptID * 2) + 4, PlayerPrefs.GetInt("Language")); if (promptID == 6 && PlayerPrefs.GetInt("Language") == 9) { promptTitle.fontSize = 200; } else { promptTitle.fontSize = (int)Mathf.Lerp(300, 150, Mathf.Clamp01((promptTitle.text.Length - 14) / 5f)); } promptInfo.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, (promptID * 2) + 5, PlayerPrefs.GetInt("Language")); if (PlayerPrefs.GetInt("Language") == 1) { promptInfo.fontSize = 280; } else { promptInfo.fontSize = 300; } if (PlayerPrefs.GetInt("Language") == 11) { promptInfo.alignment = TextAnchor.MiddleRight; if (promptInfo.lineSpacing > 0f) { promptInfo.lineSpacing *= -1f; } } else { promptInfo.alignment = TextAnchor.MiddleLeft; if (promptInfo.lineSpacing < 0f) { promptInfo.lineSpacing *= -1f; } } promptIcon.sprite = itemPrompts[promptID].icon; if (bought) { if (touched) { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 53, PlayerPrefs.GetInt("Language")); if (PlayerPrefs.GetInt("Language") == 8) { yesText.fontSize = 35; } else { yesText.fontSize = 40; } curYestText = YesText.unequip; } else { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 52, PlayerPrefs.GetInt("Language")); curYestText = YesText.equip; } noText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 54, PlayerPrefs.GetInt("Language")); } else { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 50, PlayerPrefs.GetInt("Language")); noText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 51, PlayerPrefs.GetInt("Language")); curYestText = YesText.buy; } if (aiLeaf == null && aiBonus == null && aiMask == null) { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.startMenu, 1, PlayerPrefs.GetInt("Language")); if (PlayerPrefs.GetInt("Language") == 1) { yesText.fontSize = 35; } else { yesText.fontSize = 40; } curYestText = YesText.cont; noText.transform.parent.gameObject.SetActive(false); priceText.transform.parent.parent.gameObject.SetActive(false); animator.SetBool("isCollectable", true); } else { if (!noText.transform.parent.gameObject.activeInHierarchy) { noText.transform.parent.gameObject.SetActive(true); } animator.SetBool("isCollectable", false); } aiLeafs = aiLeaf; aiBonuses = aiBonus; aiMasks = aiMask; foreach (MarketItemInfo mi in marketItems) { if (mi.itemID == itemID) { currentMI = mi; } } if (curYestText != YesText.cont && currentMI != null) { if (!bought) { priceText.transform.parent.parent.gameObject.SetActive(true); if (currentMI.useBlueBerries) { tpc.blueberryText.text = tpc.blueberryCount.ToString(); tpc.blueberryHUD.SetBool("function", true); priceIcon.sprite = blueBerry; } else { tpc.berryText.text = tpc.berryCount.ToString(); tpc.berryHUD.SetBool("function", true); priceIcon.sprite = redBerry; } if (currentMI.price == -1) { priceText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 3, PlayerPrefs.GetInt("Language")); } else { priceText.text = currentMI.price.ToString(); } } else { priceText.transform.parent.parent.gameObject.SetActive(false); } } if (PlayerPrefs.GetInt("Language") == 11) { promptTitle.font = TextTranslationManager.singleton.arabicFont; promptInfo.font = TextTranslationManager.singleton.arabicFont; yesText.font = TextTranslationManager.singleton.arabicFont; noText.font = TextTranslationManager.singleton.arabicFont; priceText.font = TextTranslationManager.singleton.arabicFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Russian) { promptTitle.font = TextTranslationManager.singleton.cyrillicFont; promptInfo.font = TextTranslationManager.singleton.cyrillicFont; yesText.font = TextTranslationManager.singleton.cyrillicFont; noText.font = TextTranslationManager.singleton.cyrillicFont; priceText.font = TextTranslationManager.singleton.cyrillicFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Korean) { promptTitle.font = TextTranslationManager.singleton.koreanFont; promptInfo.font = TextTranslationManager.singleton.koreanFont; yesText.font = TextTranslationManager.singleton.koreanFont; noText.font = TextTranslationManager.singleton.koreanFont; priceText.font = TextTranslationManager.singleton.koreanFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Chinese) { promptTitle.font = TextTranslationManager.singleton.chineseFont; promptInfo.font = TextTranslationManager.singleton.chineseFont; yesText.font = TextTranslationManager.singleton.chineseFont; noText.font = TextTranslationManager.singleton.chineseFont; priceText.font = TextTranslationManager.singleton.chineseFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Japanese) { promptTitle.font = TextTranslationManager.singleton.japaneseFont; promptInfo.font = TextTranslationManager.singleton.japaneseFont; yesText.font = TextTranslationManager.singleton.japaneseFont; noText.font = TextTranslationManager.singleton.japaneseFont; priceText.font = TextTranslationManager.singleton.japaneseFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else { promptTitle.font = titleFont; promptInfo.font = infoFont; yesText.font = yesFont; noText.font = noFont; priceText.font = priceFont; promptTitle.fontStyle = titleFontStyle; promptInfo.fontStyle = infoFontStyle; yesText.fontStyle = yesFontStyle; noText.fontStyle = noFontStyle; priceText.fontStyle = priceFontStyle; } PlaySound(openPromptClip); animator.SetBool("promptOn", true); } }
public void SetTextElement(Text textObject, TextMesh textMesh, TextTranslationManager.TextCollection textCollection, int textID, string addedText, bool dontIncludeAutoSpace, bool makeUpperCase, Font originalFont, FontStyle originalFontStyle) { if (textObject != null) { textObject.text = TextTranslationManager.GetText(textCollection, textID, currentLanguage); if (addedText != "") { if (!dontIncludeAutoSpace) { textObject.text += " "; } textObject.text += addedText; } if (makeUpperCase) { textObject.text = textObject.text.ToUpper(); } if (this.gameObject.name == "Pause Screen" && index > 26 && index < 34) { textObject.fontSize = (int)Mathf.Lerp(300, 200, Mathf.Clamp01((textObject.text.Length - 10) / 5f)); } if (textCollection == TextTranslationManager.TextCollection.itemPrompts && textID == 1) { if (PlayerPrefs.GetInt("Language") == 1) { textObject.fontSize = 150; } else { textObject.fontSize = 300; } } if (textCollection == TextTranslationManager.TextCollection.cutscene) { if (textID <= 21) { if (PlayerPrefs.GetInt("Language") == 11) { textObject.alignment = TextAnchor.UpperRight; if (textObject.lineSpacing > 0f) { textObject.lineSpacing *= -1f; } } else { textObject.alignment = TextAnchor.UpperLeft; if (textObject.lineSpacing < 0f) { textObject.lineSpacing *= -1f; } } } } if (textCollection == TextTranslationManager.TextCollection.startMenu && textID == 13 && textObject.gameObject.name == "TutorialTextRotCam") { if (PlayerPrefs.GetInt("Language") == 5 || PlayerPrefs.GetInt("Language") == 13) { textObject.fontSize = 100; } else { textObject.fontSize = 130; } } if (PlayerPrefs.GetInt("Language") == 11) { textObject.font = TextTranslationManager.singleton.arabicFont; textObject.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Chinese) { textObject.font = TextTranslationManager.singleton.chineseFont; textObject.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Japanese) { textObject.font = TextTranslationManager.singleton.japaneseFont; textObject.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Korean) { textObject.font = TextTranslationManager.singleton.koreanFont; textObject.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Russian) { textObject.font = TextTranslationManager.singleton.cyrillicFont; textObject.fontStyle = FontStyle.Bold; } else { textObject.font = originalFont; textObject.fontStyle = originalFontStyle; } } if (textMesh != null) { textMesh.text = TextTranslationManager.GetText(textCollection, textID, currentLanguage); if (addedText != "") { if (!dontIncludeAutoSpace) { textMesh.text += " "; } textMesh.text += addedText; } if (makeUpperCase) { textMesh.text = textMesh.text.ToUpper(); } if (PlayerPrefs.GetInt("Language") == 11) { textMesh.font = TextTranslationManager.singleton.arabicFont; textMesh.fontStyle = FontStyle.Bold; } else { textMesh.font = originalFont; textMesh.fontStyle = originalFontStyle; } } }
IEnumerator PlayAnimation(int curMiniDraw) { anim.SetBool("Activate", true); if (curMiniDraw != -1) { miniDrawParent.SetActive(true); miniDrawImage.sprite = textMiniDraws[curMiniDraw].miniDraw; yield return(null); miniDrawImage.sprite = null; yield return(null); miniDrawImage.sprite = textMiniDraws[curMiniDraw].miniDraw; } else { miniDrawParent.SetActive(false); } yield return(new WaitForSeconds(1f)); string fullText = TextTranslationManager.GetText(TextTranslationManager.TextCollection.textPrompts, textID, PlayerPrefs.GetInt("Language")); if (PlayerPrefs.GetInt("Language") == 9) { theText.fontSize = 50; } else { theText.fontSize = 60; } if (PlayerPrefs.GetInt("Language") == 11) { theText.alignment = TextAnchor.UpperRight; if (theText.lineSpacing > 0f) { theText.lineSpacing *= -1f; } // theText.font = TextTranslationManager.singleton.arabicFont; } else { // if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Chinese) { theText.font = TextTranslationManager.singleton.chineseFont; theText.fontStyle = FontStyle.Bold; theText.alignment = TextAnchor.UpperLeft; if (theText.lineSpacing < 0f) { theText.lineSpacing *= -1f; } } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Japanese) { theText.font = TextTranslationManager.singleton.japaneseFont; theText.fontStyle = FontStyle.Bold; theText.alignment = TextAnchor.UpperLeft; if (theText.lineSpacing < 0f) { theText.lineSpacing *= -1f; } } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Korean) { theText.font = TextTranslationManager.singleton.koreanFont; theText.fontStyle = FontStyle.Bold; theText.alignment = TextAnchor.UpperLeft; if (theText.lineSpacing < 0f) { theText.lineSpacing *= -1f; } } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Russian) { theText.font = TextTranslationManager.singleton.cyrillicFont; theText.alignment = TextAnchor.UpperLeft; if (theText.lineSpacing < 0f) { theText.lineSpacing *= -1f; } } else { theText.alignment = TextAnchor.UpperLeft; if (theText.lineSpacing < 0f) { theText.lineSpacing *= -1f; } theText.font = originalFont; } } for (int t = 0; t < fullText.Length; t++) { theText.text = theText.text + fullText[t]; while (Time.timeScale == 0f) { yield return(null); } if (textSpeed == 0f) { yield return(null); } else { yield return(new WaitForSeconds(textSpeed)); } } yield return(new WaitForSeconds(fullText.Length * 0.06f)); anim.SetBool("Activate", false); yield return(new WaitForSeconds(1.3f)); currentlyDisplaying = false; }