Esempio n. 1
0
    public void OpenQuestPopup(string type)
    {
        DisableAll();
        int    index       = FugoUtils.getLevelInfo(PlayerPrefsManager.GetQuestEndLevel() - 1)[0];
        int    index2      = FugoUtils.getLevelInfo(PlayerPrefsManager.GetQuestEndLevel() - 1)[1];
        string setFullName = Games.sections[index].sets[index2].SetFullName;

        if (type.ToLower() == "offer")
        {
            string newValue = "<color=#FFC687FF>" + setFullName + "</color>";
            if (PlayerPrefsManager.GetLang() == "Arabic" || PlayerPrefsManager.GetLang() == "Hebrew")
            {
                newValue = setFullName;
            }
            if (givenHours > 1)
            {
                questPopup.Find("QuestSection/QuestText").GetComponent <Text>().text = LanguageScript.AdventureQuestText.Split('/')[1].Replace("%@", givenHours.ToString()).Replace("@%", newValue);
            }
            else
            {
                questPopup.Find("QuestSection/QuestText").GetComponent <Text>().text = LanguageScript.AdventureQuestText.Split('/')[0].Replace("%@", givenHours.ToString()).Replace("@%", newValue);
            }
            questPopup.Find("QuestSection").gameObject.SetActive(value: true);
            ArabicController.MakeArabicMenu(questPopup.Find("QuestSection/QuestText"));
        }
        else if (type.ToLower() == "gift")
        {
            questPopup.Find("GiftSection").gameObject.SetActive(value: true);
        }
        else if (type.ToLower() == "info")
        {
            string text = "<color=#FFC687FF>" + setFullName + "</color>";
            if (PlayerPrefsManager.GetLang() == "Arabic" || PlayerPrefsManager.GetLang() == "Hebrew")
            {
                text = setFullName;
            }
            questPopup.Find("InfoSection/QuestSection").GetComponent <Text>().text   = text;
            questPopup.Find("InfoSection/RemainingLevel").GetComponent <Text>().text = LanguageScript.AdventureRemainingText.Replace("%@", (PlayerPrefsManager.GetQuestEndLevel() - PlayerPrefsManager.GetLevel()).ToString());
            TimeSpan ts = DateTime.Parse(PlayerPrefsManager.GetQuestEndTime()) - DateTime.Now;
            questPopup.Find("InfoSection/RemainingTime").GetComponent <Text>().text = LanguageScript.AdventureRemainingTimeText.Replace("%@", FugoUtils.DateFormatterLong(LanguageScript.DayHourText, ts));
            questPopup.Find("InfoSection").gameObject.SetActive(value: true);
            ArabicController.MakeArabicMenu(questPopup.Find("InfoSection/QuestSection"));
            ArabicController.MakeArabicMenu(questPopup.Find("InfoSection/RemainingLevel"));
            ArabicController.MakeArabicMenu(questPopup.Find("InfoSection/RemainingTime"));
        }
        else if (type.ToLower() == "reward")
        {
            questPopup.Find("RewardSection/GemRewardHolder/AmountText").GetComponent <Text>().text = PlayerPrefsManager.GetQuestRewardAmount().ToString();
            ArabicController.MakeArabicMenu(questPopup.Find("RewardSection/GemRewardHolder/AmountText"));
            questPopup.Find("RewardSection").gameObject.SetActive(value: true);
        }
        else if (type.ToLower() == "fail")
        {
            questPopup.Find("FailSection").gameObject.SetActive(value: true);
        }
        MenuController.instance.OpenQuestPopup();
    }