Esempio n. 1
0
 public void SetQuestButton()
 {
     NewQuestButtonBG(condition: false);
     if (PlayerPrefsManager.GetLevel() >= PlayerPrefsManager.CountLevels() - 1)
     {
         questButton.gameObject.SetActive(value: false);
         return;
     }
     questButton.GetComponent <Button>().onClick.RemoveAllListeners();
     if (PlayerPrefsManager.GetQuestEndTime() == string.Empty)
     {
         if (DateTime.Now.ToString("yy-MM-dd") != PlayerPrefsManager.GetLastQuestTime() && DateTime.Now.Day % 2 == 0 && PlayerPrefsManager.GetLevel() > 20)
         {
             if (!MenuController.fromDaily)
             {
                 questButton.gameObject.SetActive(value: true);
             }
             questButton.Find("Frame/Text").gameObject.SetActive(value: false);
             questButton.Find("Frame/Cross").gameObject.SetActive(value: false);
             questButton.Find("Frame/Check").gameObject.SetActive(value: false);
             questButton.GetComponent <Button>().onClick.AddListener(delegate
             {
                 GiveQuest();
             });
             StartCoroutine(AnimateQuestButton());
         }
         else
         {
             questButton.gameObject.SetActive(value: false);
         }
     }
     else
     {
         if (!MenuController.fromDaily)
         {
             questButton.gameObject.SetActive(value: true);
         }
         if (DateTime.Compare(DateTime.Now, DateTime.Parse(PlayerPrefsManager.GetQuestEndTime())) < 0 && PlayerPrefsManager.GetLevel() < PlayerPrefsManager.GetQuestEndLevel())
         {
             TimeSpan ts = DateTime.Parse(PlayerPrefsManager.GetQuestEndTime()) - DateTime.Now;
             questButton.Find("Frame/Text").GetComponent <Text>().text = FugoUtils.DateFormatter(LanguageScript.DHText, ts);
             if (ThemeManager.theme == 1)
             {
                 questButton.Find("Frame/Text").GetComponent <Text>().text = FugoUtils.DateFormatterNewTheme(null, ts);
             }
             ArabicController.MakeArabicMenu(questButton.Find("Frame/Text"));
             questButton.Find("Frame/Text").gameObject.SetActive(value: true);
             questButton.Find("Frame/Cross").gameObject.SetActive(value: false);
             questButton.Find("Frame/Check").gameObject.SetActive(value: false);
             questButton.GetComponent <Button>().onClick.AddListener(delegate
             {
                 OpenQuestPopup("info");
             });
         }
         else
         {
             NewQuestButtonBG(condition: true);
             if (PlayerPrefsManager.GetQuestCompleted() == 0)
             {
                 questButton.Find("Frame/Text").gameObject.SetActive(value: false);
                 questButton.Find("Frame/Cross").gameObject.SetActive(value: true);
                 questButton.Find("Frame/Check").gameObject.SetActive(value: false);
                 questButton.GetComponent <Button>().onClick.AddListener(delegate
                 {
                     OpenQuestPopup("fail");
                 });
                 StartCoroutine(AnimateQuestButton());
             }
             else
             {
                 questButton.Find("Frame/Text").gameObject.SetActive(value: false);
                 questButton.Find("Frame/Cross").gameObject.SetActive(value: false);
                 questButton.Find("Frame/Check").gameObject.SetActive(value: true);
                 questButton.GetComponent <Button>().onClick.AddListener(delegate
                 {
                     OpenQuestPopup("reward");
                 });
                 StartCoroutine(AnimateQuestButton());
             }
         }
     }
     if (questButton.Find("Frame/BG") != null)
     {
         questButton.Find("Frame/BG").gameObject.SetActive(questButton.Find("Frame/Text").gameObject.activeSelf);
     }
     ArabicController.MakeArabicMenu(questButton.Find("Frame/Text").parent);
 }