void _DisplayPrompt(int promptID, int itemID, ActivateItemsLeafs aiLeaf, ActivateBonusAbility aiBonus, ActivateItemsMasks aiMask, bool bought, bool touched) { inPromptTrigger[promptID] = true; StartCoroutine(WaitToDisplay(promptID, itemID, aiLeaf, aiBonus, aiMask, bought, touched)); }
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 static void DisplayPrompt(int promptID, int itemID, ActivateItemsLeafs aiLeaf, ActivateBonusAbility aiBonus, ActivateItemsMasks aiMask, bool bought, bool touched) { if (singleton == null) { Debug.LogError("Singleton is null! Aborting."); return; } if (promptID >= singleton.itemPrompts.Count) { Debug.LogError("Prompt ID " + promptID.ToString() + " doesn't exist."); return; } singleton._DisplayPrompt(promptID, itemID, aiLeaf, aiBonus, aiMask, bought, touched); }