Exemple #1
0
        private void RefreshUI()
        {
            QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

            this.mRecoverTime = MonoSingleton <GameManager> .Instance.TowerResuponse.rtime;
            if (quest != null && Object.op_Inequality((Object)this.ChallengeButton, (Object)null))
            {
                DataSource.Bind <QuestParam>(((Component)this.ChallengeButton).get_gameObject(), quest);
                ((Selectable)this.ChallengeButton).set_interactable(quest.IsQuestCondition() && quest.state != QuestStates.Cleared);
                GameParameter.UpdateAll(((Component)this.ChallengeButton).get_gameObject());
            }
            if (Object.op_Inequality((Object)this.RecoverButton, (Object)null))
            {
                TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
                bool           flag           = towerResuponse.GetAvailableUnits().Count > 0 && towerResuponse.ExistDamagedUnit() || towerResuponse.GetDiedUnitNum() > 0;
                ((Selectable)this.RecoverButton).set_interactable(flag && !towerResuponse.is_reset);
                if (Object.op_Inequality((Object)this.RecoverTimer, (Object)null))
                {
                    this.RecoverTimer.SetActive(flag);
                }
            }
            if (Object.op_Inequality((Object)this.ResetButton, (Object)null))
            {
                TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
                ((Component)this.ResetButton).get_gameObject().SetActive(towerResuponse.is_reset);
                ((Component)this.ChallengeButton).get_gameObject().SetActive(!towerResuponse.is_reset);
                this.ResetText.set_text(towerResuponse.reset_cost.ToString());
                bool flag = (int)towerResuponse.reset_cost == 0;
                ((Component)this.ResetText).get_gameObject().SetActive(!flag);
                ((Component)this.ResetTextFree).get_gameObject().SetActive(flag);
            }
            this.SetAliveUnitsText();
            this.SetRecoverText();
        }
Exemple #2
0
        private void SetAliveUnitsText()
        {
            if (Object.op_Equality((Object)this.AliveUnits, (Object)null))
            {
                return;
            }
            TowerResuponse  towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
            List <UnitData> availableUnits = towerResuponse.GetAvailableUnits();
            int             diedUnitNum    = towerResuponse.GetDiedUnitNum();

            this.AliveUnits.set_text(string.Format("{0}/{1}", (object)Mathf.Max(0, availableUnits.Count - diedUnitNum), (object)availableUnits.Count));
        }