Beispiel #1
0
        private void CheckBattleResetButton()
        {
            TowerParam tower = MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID);

            if (tower == null)
            {
                return;
            }
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;

            if (towerResuponse == null)
            {
                return;
            }
            TowerFloorParam currentFloor = towerResuponse.GetCurrentFloor();

            if (currentFloor == null)
            {
                return;
            }
            if (MonoSingleton <GameManager> .Instance.Player.Coin > (int)tower.floor_reset_coin && GlobalVars.SelectedQuestID == currentFloor.iname && towerResuponse.CheckEnemyDeck())
            {
                ((Selectable)this.BattleResetButton).set_interactable(true);
            }
            else
            {
                ((Selectable)this.BattleResetButton).set_interactable(false);
            }
        }
Beispiel #2
0
        private void Start()
        {
            GameManager    instance       = MonoSingleton <GameManager> .Instance;
            TowerResuponse towerResuponse = instance.TowerResuponse;

            this.m_TowerParam    = instance.FindTower(instance.TowerResuponse.TowerID);
            this.NowScore        = new int[4];
            this.NowScore[0]     = towerResuponse.turn_num;
            this.NowScore[1]     = towerResuponse.died_num;
            this.NowScore[2]     = towerResuponse.retire_num;
            this.NowScore[3]     = towerResuponse.recover_num;
            this.OldBestScore    = new int[4];
            this.OldBestScore[0] = towerResuponse.spd_score;
            this.OldBestScore[1] = towerResuponse.tec_score;
            this.OldBestScore[2] = towerResuponse.ret_score;
            this.OldBestScore[3] = towerResuponse.rcv_score;
            this.CountupIndex    = 0;
            if (Object.op_Inequality((Object)this.NextButton, (Object)null))
            {
                // ISSUE: method pointer
                ((UnityEvent)this.NextButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(OnClickNext)));
            }
            if (this.NowScore == null || this.ScoreContents == null || (this.ScoreObj == null || this.NewRecord == null))
            {
                DebugUtility.LogWarning("Error TowerClear Param Check!!!!");
            }
            this.Icons = AssetManager.Load <SpriteSheet>("UI/TowerRankIcon");
        }
Beispiel #3
0
        public bool IsOpendTower()
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            QuestParam[] availableQuests = instance.Player.AvailableQuests;
            long         serverTime      = Network.GetServerTime();

            for (int index1 = 0; index1 < instance.Towers.Length; ++index1)
            {
                TowerParam tower = instance.Towers[index1];
                for (int index2 = 0; index2 < availableQuests.Length; ++index2)
                {
                    if (availableQuests[index2].type == QuestTypes.Tower && !(availableQuests[index2].iname != tower.iname) && availableQuests[index2].IsDateUnlock(serverTime))
                    {
                        return(true);
                    }
                }
            }
            for (int index = 0; index < availableQuests.Length; ++index)
            {
                if (availableQuests[index].IsMultiTower && availableQuests[index].IsDateUnlock(serverTime))
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #4
0
        private void Start()
        {
            GameUtility.SetGameObjectActive((Component)this.m_MissionItemTemplate, false);
            GameUtility.SetGameObjectActive((Component)this.m_MissionListTitle, false);
            GameUtility.SetGameObjectActive((Component)this.m_MissionListTitleNoItem, false);
            GameUtility.SetGameObjectActive((Component)this.m_MissionListParent, false);
            TowerParam tower = MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID);

            if (tower == null)
            {
                return;
            }
            if (tower.floor_reset_coin > (short)0)
            {
                this.TollRecovery.SetActive(true);
                this.FreeRecovery.SetActive(false);
                ((Text)this.TollRecovery.GetComponent <Text>()).set_text(string.Format(LocalizedText.Get("sys.TOWER_BATTLE_RESET_DESCRIPTION_02"), (object)tower.floor_reset_coin.ToString()));
                this.HaveItemNum.set_text(MonoSingleton <GameManager> .Instance.Player.Coin.ToString());
            }
            else
            {
                this.TollRecovery.SetActive(false);
                this.FreeRecovery.SetActive(true);
                this.HaveItemObject.SetActive(false);
            }
        }
Beispiel #5
0
        private void Initialize()
        {
            this.AddClickListener(this.RecoverButton, new Action(this.OnClick_RecoverButton));
            this.AddClickListener(this.DetailButton, new Action(this.OnClick_Detail));
            this.AddClickListener(this.ChallengeButton, new Action(this.OnClick_Challenge));
            this.AddClickListener(this.CurrentButton, new Action(this.OnClick_Current));
            this.AddClickListener(this.ResetButton, new Action(this.OnClick_Reset));
            // ISSUE: method pointer
            this.mScrollAutoFit.OnScrollBegin.AddListener(new UnityAction((object)this, __methodptr(OnScrollBegin)));
            this.mTowerParam = MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID);

            this.mRecoverTime = MonoSingleton <GameManager> .Instance.TowerResuponse.rtime;
            if (this.mTowerParam != null && Object.op_Inequality((Object)this.RankingButton, (Object)null))
            {
                this.RankingButton.SetActive(this.mTowerParam.is_view_ranking);
            }
            if (this.mTowerParam != null && Object.op_Inequality((Object)this.StatusButton, (Object)null))
            {
                this.StatusButton.SetActive(this.mTowerParam.is_view_ranking);
            }
            if (this.mTowerParam != null && !string.IsNullOrEmpty(this.mTowerParam.eventURL))
            {
                FlowNode_Variable.Set("CAPTION_TOWER_EVENT_DETAIL", this.mTowerParam.eventURL);
            }
            this.initialized = true;
            if (!this.is_reset)
            {
                return;
            }
            this.mTowerQuestList.ScrollToCurrentFloor(MonoSingleton <GameManager> .Instance.FindFirstTowerFloor(GlobalVars.SelectedTowerID));
            this.RefreshUI();
            this.mTowerQuestInfo.Refresh();
            this.is_reset = false;
            this.StartCoroutine(this.CheckLoadIcon());
        }
Beispiel #6
0
        private void OnTowerSelect(GameObject go)
        {
            TowerParam dataOfClass = DataSource.FindDataOfClass <TowerParam>(go, (TowerParam)null);

            if (dataOfClass == null)
            {
                return;
            }
            QuestParam[] availableQuests = MonoSingleton <GameManager> .Instance.Player.AvailableQuests;
            long         serverTime      = Network.GetServerTime();
            int          num1            = 0;
            int          num2            = 0;

            for (int index = 0; index < availableQuests.Length; ++index)
            {
                if (availableQuests[index].type == QuestTypes.Tower && !(availableQuests[index].ChapterID != dataOfClass.iname) && !availableQuests[index].IsMulti)
                {
                    ++num1;
                    if (availableQuests[index].IsJigen && !availableQuests[index].IsDateUnlock(serverTime))
                    {
                        ++num2;
                    }
                }
            }
            if (num1 > 0 && num1 == num2)
            {
                UIUtility.NegativeSystemMessage((string)null, LocalizedText.Get("sys.QUEST_OUT_OF_DATE"), (UIUtility.DialogResultEvent)null, (GameObject)null, false, -1);
            }
            else
            {
                GlobalVars.SelectedTowerID = dataOfClass.iname;
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 200);
            }
        }
Beispiel #7
0
        private void UpdateResultFlags()
        {
            if (this.mCurrentQuest == null)
            {
                return;
            }
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerParam     tower          = MonoSingleton <GameManager> .Instance.FindTower(MonoSingleton <GameManager> .Instance.FindTowerFloor(this.mQuestName).tower_id);

            if (this.m_QuestRecord.result == BattleCore.QuestResult.Win)
            {
                this.ResultFlags_SetOn(TowerQuestResult.eTowerResultFlags.Win);
            }
            else
            {
                this.ResultFlags_SetOn(TowerQuestResult.eTowerResultFlags.Lose);
            }
            if (this.mCurrentQuest.HasMission())
            {
                bool   flag      = true;
                bool[] flagArray = new bool[this.m_QuestRecord.bonusCount];
                for (int index = 0; index < this.m_QuestRecord.bonusCount; ++index)
                {
                    if ((this.m_QuestRecord.bonusFlags & 1 << index) != 0)
                    {
                        flagArray[index] = true;
                    }
                    if (this.mCurrentQuest.IsMissionClear(index))
                    {
                        flagArray[index] = true;
                    }
                    if (!flagArray[index])
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    this.ResultFlags_SetOn(TowerQuestResult.eTowerResultFlags.MissionComplete);
                }
                else
                {
                    this.ResultFlags_SetOn(TowerQuestResult.eTowerResultFlags.MissionFailure);
                }
            }
            if (towerResuponse.IsNotClear || towerResuponse.IsRoundClear || !tower.is_view_ranking)
            {
                this.ResultFlags_Set(TowerQuestResult.eTowerResultFlags.ShowRank, false);
            }
            else
            {
                this.ResultFlags_Set(TowerQuestResult.eTowerResultFlags.ShowRank, true);
            }
        }
Beispiel #8
0
        public int CalcRecoverCost()
        {
            TowerParam tower = MonoSingleton <GameManager> .Instance.FindTower(this.TowerID);

            if (tower == null)
            {
                return(0);
            }
            double num = Math.Ceiling((TimeManager.FromUnixTime(this.rtime).AddMinutes(-1.0) - TimeManager.ServerTime).TotalMinutes) / (double)tower.unit_recover_minute;

            return(Mathf.Clamp((int)Math.Ceiling((double)tower.unit_recover_coin * num), 0, (int)tower.unit_recover_coin));
        }
        public override void OnActivate(int pinID)
        {
            if (pinID != 0)
            {
                return;
            }
            TowerParam tower = MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID);

            if (tower == null)
            {
                this.ActivateOutputLinks(2);
            }
            else
            {
                FlowNode_Variable.Set(this.Value, this.URL + tower.URL);
                this.ActivateOutputLinks(1);
            }
        }
Beispiel #10
0
        public string ShowProgLockMessage()
        {
            if (this.Param == null || this.Param.is_unlock)
            {
                return(string.Empty);
            }
            TowerFloorParam towerFloorParam = this.GetTowerFloorParam(this.Param.unlock_quest);

            if (towerFloorParam == null)
            {
                return(string.Empty);
            }
            TowerParam towerParam = this.GetTowerParam(towerFloorParam.tower_id);

            if (towerParam == null)
            {
                return(string.Empty);
            }
            return(LocalizedText.Get("sys.UNLOCK_COND_TOWER_PROG", (object)towerParam.name, (object)towerFloorParam.name));
        }
Beispiel #11
0
        private void UpdateBestScore()
        {
            GameManager    instance       = MonoSingleton <GameManager> .Instance;
            TowerResuponse towerResuponse = instance.TowerResuponse;
            TowerParam     tower          = instance.FindTower(towerResuponse.TowerID);

            if (towerResuponse.spd_score != 0)
            {
                this.SetText(this.BestTurn, towerResuponse.spd_score.ToString());
                this.SetText(this.BestDied, towerResuponse.tec_score.ToString());
                this.SetText(this.BestRetire, towerResuponse.ret_score.ToString());
                this.SetText(this.BestRecover, towerResuponse.rcv_score.ToString());
                this.SetText(this.BestChallenge, towerResuponse.challenge_score.ToString());
                this.SetText(this.BestLose, towerResuponse.lose_score.ToString());
                this.SetText(this.BestReset, towerResuponse.reset_score.ToString());
                this.SetRankIcon(this.TurnScore, instance.ConvertTowerScoreToRank(tower, towerResuponse.spd_score, TOWER_SCORE_TYPE.TURN));
                this.SetRankIcon(this.DiedScore, instance.ConvertTowerScoreToRank(tower, towerResuponse.tec_score, TOWER_SCORE_TYPE.DIED));
                this.SetRankIcon(this.RetireScore, instance.ConvertTowerScoreToRank(tower, towerResuponse.ret_score, TOWER_SCORE_TYPE.RETIRE));
                this.SetRankIcon(this.RecoverScore, instance.ConvertTowerScoreToRank(tower, towerResuponse.rcv_score, TOWER_SCORE_TYPE.RECOVER));
                this.SetDefault(this.ChallengeScore);
                this.SetDefault(this.LoseScore);
                this.SetDefault(this.ResetScore);
            }
            else
            {
                this.SetText(this.BestTurn, this.NotSocreText);
                this.SetText(this.BestDied, this.NotSocreText);
                this.SetText(this.BestRetire, this.NotSocreText);
                this.SetText(this.BestRecover, this.NotSocreText);
                this.SetText(this.BestChallenge, this.NotSocreText);
                this.SetText(this.BestLose, this.NotSocreText);
                this.SetText(this.BestReset, this.NotSocreText);
                this.SetDefault(this.TurnScore);
                this.SetDefault(this.DiedScore);
                this.SetDefault(this.RetireScore);
                this.SetDefault(this.RecoverScore);
                this.SetDefault(this.ChallengeScore);
                this.SetDefault(this.LoseScore);
                this.SetDefault(this.ResetScore);
            }
        }
Beispiel #12
0
        public override void Activated(int pinID)
        {
            base.Activated(pinID);
            if (pinID != 11)
            {
                return;
            }
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerParam     tower          = MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID);

            if (towerResuponse.clear == 0 || towerResuponse.clear == 1 && towerResuponse.arrived_num == 0 || !tower.is_view_ranking)
            {
                this.EndTowerClear();
            }
            else
            {
                this.Window.SetActive(false);
                this.TowerClear.Refresh();
                ((Component)this.TowerClear).get_gameObject().SetActive(true);
            }
        }
Beispiel #13
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <FlowNode_ReqBtlCom.JSON_ReqBtlComResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqBtlCom.JSON_ReqBtlComResponse> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         GameManager instance = MonoSingleton <GameManager> .Instance;
         instance.Player.SetQuestListDirty();
         instance.ResetJigenQuests();
         if (!instance.Deserialize(jsonObject.body.quests))
         {
             this.Failure();
         }
         else
         {
             if (jsonObject.body.towers != null)
             {
                 for (int index = 0; index < jsonObject.body.towers.Length; ++index)
                 {
                     JSON_ReqTowerResuponse.Json_TowerProg tower1 = jsonObject.body.towers[index];
                     TowerParam tower2 = instance.FindTower(tower1.iname);
                     if (tower2 != null)
                     {
                         tower2.is_unlock = tower1.is_open == 1;
                     }
                 }
             }
             this.Success();
         }
     }
 }
Beispiel #14
0
        private void Refresh(EventQuestList.EventQuestTypes type)
        {
            GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems);
            GameManager instance = MonoSingleton <GameManager> .Instance;

            ChapterParam[]      chapters         = instance.Chapters;
            List <ChapterParam> chapterParamList = new List <ChapterParam>((IEnumerable <ChapterParam>)chapters);

            QuestParam[] availableQuests = instance.Player.AvailableQuests;
            long         serverTime      = Network.GetServerTime();
            ChapterParam chapterParam    = (ChapterParam)null;

            for (int index = chapterParamList.Count - 1; index >= 0; --index)
            {
                if ((string)GlobalVars.SelectedSection != chapterParamList[index].section)
                {
                    chapterParamList.RemoveAt(index);
                }
            }
            if (!string.IsNullOrEmpty((string)GlobalVars.SelectedChapter))
            {
                chapterParam = instance.FindArea((string)GlobalVars.SelectedChapter);
                for (int index = chapterParamList.Count - 1; index >= 0; --index)
                {
                    if (chapterParamList[index].parent == null || chapterParamList[index].parent.iname != (string)GlobalVars.SelectedChapter)
                    {
                        chapterParamList.RemoveAt(index);
                    }
                }
            }
            else
            {
                for (int index = chapterParamList.Count - 1; index >= 0; --index)
                {
                    if (chapterParamList[index].parent != null)
                    {
                        chapterParamList.RemoveAt(index);
                    }
                }
            }
            switch (type)
            {
            case EventQuestList.EventQuestTypes.Normal:
                for (int index = 0; index < chapterParamList.Count; ++index)
                {
                    if (chapterParamList[index].IsKeyQuest())
                    {
                        chapterParamList.RemoveAt(index--);
                    }
                }
                break;

            case EventQuestList.EventQuestTypes.Key:
                for (int index = 0; index < chapterParamList.Count; ++index)
                {
                    if (!chapterParamList[index].IsKeyQuest())
                    {
                        chapterParamList.RemoveAt(index--);
                    }
                }
                break;
            }
            for (int index = chapterParamList.Count - 1; index >= 0; --index)
            {
                if (!this.ChapterContainsPlayableQuest(chapterParamList[index], chapters, availableQuests, serverTime))
                {
                    chapterParamList.RemoveAt(index);
                }
            }
            if (this.Descending)
            {
                chapterParamList.Reverse();
            }
            if (type == EventQuestList.EventQuestTypes.Normal && string.IsNullOrEmpty(GlobalVars.SelectedChapter.Get()))
            {
                List <TowerParam> towerParamList = new List <TowerParam>();
                for (int index1 = 0; index1 < instance.Towers.Length; ++index1)
                {
                    TowerParam tower = instance.Towers[index1];
                    for (int index2 = 0; index2 < availableQuests.Length; ++index2)
                    {
                        if (availableQuests[index2].type == QuestTypes.Tower && !(availableQuests[index2].iname != tower.iname) && availableQuests[index2].IsDateUnlock(serverTime))
                        {
                            towerParamList.Add(tower);
                            break;
                        }
                    }
                }
                for (int index = 0; index < towerParamList.Count; ++index)
                {
                    TowerParam     data            = towerParamList[index];
                    ListItemEvents listItemEvents1 = !Object.op_Inequality((Object)this.ItemTemplate, (Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>();
                    if (!string.IsNullOrEmpty(data.prefabPath))
                    {
                        StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                        stringBuilder.Append("QuestChapters/");
                        stringBuilder.Append(data.prefabPath);
                        listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                    }
                    if (!Object.op_Equality((Object)listItemEvents1, (Object)null))
                    {
                        QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname);

                        ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                        DataSource.Bind <TowerParam>(((Component)listItemEvents2).get_gameObject(), data);
                        DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), quest);
                        ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                        ((Component)listItemEvents2).get_gameObject().SetActive(true);
                        listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnTowerSelect);
                        this.mItems.Add(listItemEvents2);
                    }
                }
            }
            for (int index = 0; index < chapterParamList.Count; ++index)
            {
                ChapterParam   data            = chapterParamList[index];
                ListItemEvents listItemEvents1 = !Object.op_Inequality((Object)this.ItemTemplate, (Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>();
                if (!string.IsNullOrEmpty(data.prefabPath))
                {
                    StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                    stringBuilder.Append("QuestChapters/");
                    stringBuilder.Append(data.prefabPath);
                    listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                }
                if (!Object.op_Equality((Object)listItemEvents1, (Object)null))
                {
                    ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                    DataSource.Bind <ChapterParam>(((Component)listItemEvents2).get_gameObject(), data);
                    DataSource.Bind <KeyItem>(((Component)listItemEvents2).get_gameObject(), data == null || data.keys.Count <= 0 ? (KeyItem)null : data.keys[0]);
                    KeyQuestBanner component = (KeyQuestBanner)((Component)listItemEvents2).get_gameObject().GetComponent <KeyQuestBanner>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        component.UpdateValue();
                    }
                    ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                    ((Component)listItemEvents2).get_gameObject().SetActive(true);
                    listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnNodeSelect);
                    this.mItems.Add(listItemEvents2);
                }
            }
            if (Object.op_Inequality((Object)this.BackButton, (Object)null))
            {
                if (chapterParam != null)
                {
                    this.BackButton.SetActive(true);
                }
                else if (!string.IsNullOrEmpty((string)GlobalVars.SelectedSection))
                {
                    this.BackButton.SetActive(!this.IsSectionHidden((string)GlobalVars.SelectedSection));
                }
            }
            if (Object.op_Inequality((Object)this.Caution, (Object)null))
            {
                this.Caution.SetActive(chapterParamList.Count == 0);
            }
            this.RefreshSwitchButton(type);
            this.RefreshQuestTypeText(type);
            this.ResetScroll();
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 50);
        }
Beispiel #15
0
        private void Refresh(EventQuestList.EventQuestTypes type)
        {
            GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems);
            this.mItems.Clear();
            GameManager instance = MonoSingleton <GameManager> .Instance;

            ChapterParam[]      chapters          = instance.Chapters;
            QuestParam[]        availableQuests   = instance.Player.AvailableQuests;
            long                serverTime        = Network.GetServerTime();
            ChapterParam        currentChapter    = (ChapterParam)null;
            List <ChapterParam> availableChapters = this.GetAvailableChapters(type, chapters, availableQuests, (string)GlobalVars.SelectedSection, (string)GlobalVars.SelectedChapter, serverTime, out currentChapter);

            if (type == EventQuestList.EventQuestTypes.Normal)
            {
                SubQuestTypes mTabIndex = (SubQuestTypes)this.mTabIndex;
                for (int index = 0; index < availableChapters.Count; ++index)
                {
                    if (availableChapters[index].GetSubQuestType() != mTabIndex)
                    {
                        availableChapters.RemoveAt(index--);
                    }
                }
            }
            if (this.Descending)
            {
                availableChapters.Reverse();
            }
            if (type == EventQuestList.EventQuestTypes.Tower && string.IsNullOrEmpty(GlobalVars.SelectedChapter.Get()))
            {
                List <TowerParam> towerParamList = new List <TowerParam>();
                for (int index1 = 0; index1 < instance.Towers.Length; ++index1)
                {
                    TowerParam tower = instance.Towers[index1];
                    for (int index2 = 0; index2 < availableQuests.Length; ++index2)
                    {
                        if (availableQuests[index2].type == QuestTypes.Tower && !(availableQuests[index2].iname != tower.iname) && availableQuests[index2].IsDateUnlock(serverTime))
                        {
                            towerParamList.Add(tower);
                            break;
                        }
                    }
                }
                for (int index = 0; index < towerParamList.Count; ++index)
                {
                    TowerParam     data            = towerParamList[index];
                    ListItemEvents listItemEvents1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>();
                    if (!string.IsNullOrEmpty(data.prefabPath))
                    {
                        StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                        stringBuilder.Append("QuestChapters/");
                        stringBuilder.Append(data.prefabPath);
                        listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                    }
                    if (!UnityEngine.Object.op_Equality((UnityEngine.Object)listItemEvents1, (UnityEngine.Object)null))
                    {
                        QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname);

                        ListItemEvents listItemEvents2 = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                        DataSource.Bind <TowerParam>(((Component)listItemEvents2).get_gameObject(), data);
                        DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), quest);
                        ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                        ((Component)listItemEvents2).get_gameObject().SetActive(true);
                        listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnTowerSelect);
                        this.mItems.Add(listItemEvents2);
                    }
                }
                for (int index = 0; index < availableQuests.Length; ++index)
                {
                    if (availableQuests[index].IsMultiTower && availableQuests[index].IsDateUnlock(serverTime))
                    {
                        ListItemEvents listItemEvents1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>();
                        ChapterParam   chapter         = availableQuests[index].Chapter;
                        if (chapter != null)
                        {
                            if (!string.IsNullOrEmpty(chapter.prefabPath))
                            {
                                StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                                stringBuilder.Append("QuestChapters/");
                                stringBuilder.Append(chapter.prefabPath);
                                listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                            }
                            if (!UnityEngine.Object.op_Equality((UnityEngine.Object)listItemEvents1, (UnityEngine.Object)null))
                            {
                                ListItemEvents listItemEvents2 = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                                DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), availableQuests[index]);
                                ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                                ((Component)listItemEvents2).get_gameObject().SetActive(true);
                                listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnMultiTowerSelect);
                                this.mItems.Add(listItemEvents2);
                            }
                        }
                    }
                }
            }
            for (int index = 0; index < availableChapters.Count; ++index)
            {
                ChapterParam   data            = availableChapters[index];
                ListItemEvents listItemEvents1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null) ? (ListItemEvents)null : (ListItemEvents)this.ItemTemplate.GetComponent <ListItemEvents>();
                if (!string.IsNullOrEmpty(data.prefabPath))
                {
                    StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                    stringBuilder.Append("QuestChapters/");
                    stringBuilder.Append(data.prefabPath);
                    listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                }
                if (!UnityEngine.Object.op_Equality((UnityEngine.Object)listItemEvents1, (UnityEngine.Object)null))
                {
                    ListItemEvents listItemEvents2 = (ListItemEvents)UnityEngine.Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                    DataSource.Bind <ChapterParam>(((Component)listItemEvents2).get_gameObject(), data);
                    DataSource.Bind <KeyItem>(((Component)listItemEvents2).get_gameObject(), data == null || data.keys.Count <= 0 ? (KeyItem)null : data.keys[0]);
                    KeyQuestBanner component = (KeyQuestBanner)((Component)listItemEvents2).get_gameObject().GetComponent <KeyQuestBanner>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        component.UpdateValue();
                    }
                    ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                    ((Component)listItemEvents2).get_gameObject().SetActive(true);
                    listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnNodeSelect);
                    this.mItems.Add(listItemEvents2);
                }
            }
            this.StableSort <ListItemEvents>(this.mItems, (Comparison <ListItemEvents>)((p1, p2) =>
            {
                ChapterParam chapterParam1 = !UnityEngine.Object.op_Inequality((UnityEngine.Object)p1, (UnityEngine.Object)null) ? (ChapterParam)null : p1.Chapter;
                ChapterParam chapterParam2 = !UnityEngine.Object.op_Inequality((UnityEngine.Object)p2, (UnityEngine.Object)null) ? (ChapterParam)null : p2.Chapter;
                return((chapterParam1 == null ? 1 : (!chapterParam1.IsGpsQuest() ? 1 : 0)).CompareTo(chapterParam2 == null ? 1 : (!chapterParam2.IsGpsQuest() ? 1 : 0)));
            }));
            for (int index = 0; index < this.mItems.Count; ++index)
            {
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mItems[index], (UnityEngine.Object)null))
                {
                    ((Component)this.mItems[index]).get_gameObject().get_transform().SetSiblingIndex(index);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BackButton, (UnityEngine.Object)null))
            {
                if (currentChapter != null)
                {
                    this.BackButton.SetActive(true);
                }
                else if (!string.IsNullOrEmpty((string)GlobalVars.SelectedSection))
                {
                    this.BackButton.SetActive(!this.IsSectionHidden((string)GlobalVars.SelectedSection));
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Caution, (UnityEngine.Object)null))
            {
                this.Caution.SetActive(availableChapters.Count == 0 && type != EventQuestList.EventQuestTypes.Tower);
            }
            this.RefreshSwitchButton(type);
            if (type == EventQuestList.EventQuestTypes.Normal)
            {
                this.EnableTab();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.QuestTypeTextFrame, (UnityEngine.Object)null))
                {
                    this.QuestTypeTextFrame.SetActive(false);
                }
                this.SetToggleIsOn();
            }
            else
            {
                this.DisableTab();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.QuestTypeTextFrame, (UnityEngine.Object)null))
                {
                    this.QuestTypeTextFrame.SetActive(true);
                }
                this.RefreshQuestTypeText(type);
            }
            this.ResetScroll();
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 50);
        }
Beispiel #16
0
 private void Start()
 {
     this.Param        = DataSource.FindDataOfClass <TowerParam>(((Component)this).get_gameObject(), (TowerParam)null);
     this.mUnlockLevel = (int)this.Param.unlock_level;
     this.UpdateLockState();
 }
Beispiel #17
0
        private void Refresh()
        {
            GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems);
            if (Object.op_Equality((Object)this.ItemTemplate, (Object)null) || Object.op_Equality((Object)this.ItemContainer, (Object)null))
            {
                return;
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;

            ChapterParam[]      chapters         = instance.Chapters;
            List <ChapterParam> chapterParamList = new List <ChapterParam>((IEnumerable <ChapterParam>)chapters);

            QuestParam[] availableQuests = instance.Player.AvailableQuests;
            long         serverTime      = Network.GetServerTime();
            ChapterParam chapterParam    = (ChapterParam)null;

            for (int index = chapterParamList.Count - 1; index >= 0; --index)
            {
                if ((string)GlobalVars.SelectedSection != chapterParamList[index].section)
                {
                    chapterParamList.RemoveAt(index);
                }
            }
            if (!string.IsNullOrEmpty((string)GlobalVars.SelectedChapter))
            {
                chapterParam = instance.FindArea((string)GlobalVars.SelectedChapter);
                for (int index = chapterParamList.Count - 1; index >= 0; --index)
                {
                    if (chapterParamList[index].parent == null || chapterParamList[index].parent.iname != (string)GlobalVars.SelectedChapter)
                    {
                        chapterParamList.RemoveAt(index);
                    }
                }
            }
            else
            {
                for (int index = chapterParamList.Count - 1; index >= 0; --index)
                {
                    if (chapterParamList[index].parent != null)
                    {
                        chapterParamList.RemoveAt(index);
                    }
                }
            }
            for (int index = chapterParamList.Count - 1; index >= 0; --index)
            {
                if (!this.ChapterContainsPlayableQuest(chapterParamList[index], chapters, availableQuests, serverTime))
                {
                    chapterParamList.RemoveAt(index);
                }
            }
            List <TowerParam> towerParamList = new List <TowerParam>();

            foreach (TowerParam tower in instance.Towers)
            {
                bool flag = false;
                for (int index = 0; index < availableQuests.Length; ++index)
                {
                    if (availableQuests[index].type == QuestTypes.Tower && availableQuests[index].IsDateUnlock(serverTime))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag && (string.IsNullOrEmpty((string)GlobalVars.SelectedSection) || "WD_DAILY" == (string)GlobalVars.SelectedSection))
                {
                    towerParamList.Add(tower);
                }
            }
            if (this.Descending)
            {
                chapterParamList.Reverse();
            }
            for (int index = 0; index < towerParamList.Count; ++index)
            {
                TowerParam     data            = towerParamList[index];
                ListItemEvents listItemEvents1 = (ListItemEvents)null;
                if (!string.IsNullOrEmpty(data.prefabPath))
                {
                    StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                    stringBuilder.Append("QuestChapters/");
                    stringBuilder.Append(data.prefabPath);
                    listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                }
                if (Object.op_Equality((Object)listItemEvents1, (Object)null))
                {
                    listItemEvents1 = this.ItemTemplate;
                }
                QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname);

                ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                DataSource.Bind <TowerParam>(((Component)listItemEvents2).get_gameObject(), data);
                DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), quest);
                ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                ((Component)listItemEvents2).get_gameObject().SetActive(true);
                listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnTowerSelect);
                this.mItems.Add(listItemEvents2);
            }
            for (int index = 0; index < chapterParamList.Count; ++index)
            {
                ChapterParam   data            = chapterParamList[index];
                ListItemEvents listItemEvents1 = (ListItemEvents)null;
                if (!string.IsNullOrEmpty(data.prefabPath))
                {
                    StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                    stringBuilder.Append("QuestChapters/");
                    stringBuilder.Append(data.prefabPath);
                    listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                }
                if (Object.op_Equality((Object)listItemEvents1, (Object)null))
                {
                    listItemEvents1 = this.ItemTemplate;
                }
                ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                DataSource.Bind <ChapterParam>(((Component)listItemEvents2).get_gameObject(), data);
                ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                ((Component)listItemEvents2).get_gameObject().SetActive(true);
                listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnNodeSelect);
                this.mItems.Add(listItemEvents2);
            }
            if (Object.op_Inequality((Object)this.BackButton, (Object)null))
            {
                if (chapterParam != null)
                {
                    this.BackButton.SetActive(true);
                }
                else if (!string.IsNullOrEmpty((string)GlobalVars.SelectedSection))
                {
                    this.BackButton.SetActive(!this.IsSectionHidden((string)GlobalVars.SelectedSection));
                }
            }
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 50);
        }
Beispiel #18
0
        private void UpdateOwnValue()
        {
            GameManager    instance       = MonoSingleton <GameManager> .Instance;
            TowerResuponse towerResuponse = instance.TowerResuponse;
            TowerParam     tower          = instance.FindTower(towerResuponse.TowerID);

            if (towerResuponse != null)
            {
                bool flag = towerResuponse.speedRank != 0 && towerResuponse.techRank != 0;
                if (Object.op_Inequality((Object)this.ClearPage, (Object)null))
                {
                    this.ClearPage.get_gameObject().SetActive(flag);
                }
                if (Object.op_Inequality((Object)this.NotClearPage, (Object)null))
                {
                    this.NotClearPage.get_gameObject().SetActive(!flag);
                }
            }
            int rank     = !this.IsSpeed ? towerResuponse.techRank : towerResuponse.speedRank;
            int sameRank = this.GetSameRank(!this.IsSpeed ? towerResuponse.tec_score : towerResuponse.spd_score, rank);

            if (Object.op_Inequality((Object)this.OwnIcon, (Object)null))
            {
                if (sameRank <= this.SHOW_VIP_RANK)
                {
                    this.OwnIcon.set_sprite(this.mSheet.GetSprite((sameRank - 1).ToString()));
                }
                else
                {
                    this.OwnIcon.set_sprite(this.mSheet.GetSprite("normal"));
                }
            }
            if (Object.op_Inequality((Object)this.Ranking, (Object)null))
            {
                ((Component)this.Ranking).get_gameObject().SetActive(sameRank > this.SHOW_VIP_RANK);
                this.Ranking.set_text(sameRank.ToString() + LocalizedText.Get("sys.TOWER_RANK_LABEL"));
            }
            if (Object.op_Inequality((Object)this.OwnObj, (Object)null))
            {
                PlayerData player       = instance.Player;
                long       unitUniqueId = player.Partys[6].GetUnitUniqueID(0);
                DataSource.Bind <UnitData>(this.OwnObj, player.FindUnitDataByUniqueID(unitUniqueId));
            }
            if (Object.op_Inequality((Object)this.OwnSpeedObj, (Object)null))
            {
                this.OwnSpeedObj.get_gameObject().SetActive(this.IsSpeed);
            }
            if (Object.op_Inequality((Object)this.OwnTechObj, (Object)null))
            {
                this.OwnTechObj.get_gameObject().SetActive(!this.IsSpeed);
            }
            if (this.IsSpeed)
            {
                if (Object.op_Inequality((Object)this.OwnSpeedScore, (Object)null))
                {
                    this.OwnSpeedScore.set_text(towerResuponse.spd_score.ToString());
                }
            }
            else if (Object.op_Inequality((Object)this.OwnSpeedScore, (Object)null))
            {
                this.OwnTechScore.set_text(towerResuponse.tec_score.ToString());
            }
            if (!Object.op_Inequality((Object)this.OwnTotalScore, (Object)null))
            {
                return;
            }
            string empty = string.Empty;

            this.OwnTotalScore.set_sprite(this.mSheet.GetSprite(!this.IsSpeed ? instance.ConvertTowerScoreToRank(tower, towerResuponse.tec_score, TOWER_SCORE_TYPE.DIED) : instance.ConvertTowerScoreToRank(tower, towerResuponse.spd_score, TOWER_SCORE_TYPE.TURN)));
        }
Beispiel #19
0
        private void UpdateValue(ListItemEvents obj, int num, TowerResuponse.TowerRankParam param, bool isSpeed)
        {
            if (Object.op_Equality((Object)this.mSheet, (Object)null))
            {
                return;
            }
            GameManager    instance       = MonoSingleton <GameManager> .Instance;
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;
            TowerParam     tower          = instance.FindTower(towerResuponse.TowerID);

            DataSource.Bind <TowerResuponse.TowerRankParam>(((Component)obj).get_gameObject(), param);
            Transform child1 = ((Component)obj).get_transform().FindChild("body");

            if (!Object.op_Inequality((Object)child1, (Object)null))
            {
                return;
            }
            Transform child2 = ((Component)child1).get_transform().FindChild("ranking");

            if (Object.op_Inequality((Object)child2, (Object)null))
            {
                Image component = (Image)((Component)child2).GetComponent <Image>();
                if (Object.op_Inequality((Object)component, (Object)null))
                {
                    if (num < this.SHOW_VIP_RANK)
                    {
                        component.set_sprite(this.mSheet.GetSprite(num.ToString()));
                    }
                    else
                    {
                        component.set_sprite(this.mSheet.GetSprite("normal"));
                    }
                }
            }
            Transform child3 = ((Component)child1).get_transform().FindChild("rank");

            if (Object.op_Inequality((Object)child3, (Object)null))
            {
                Text component = (Text)((Component)child3).GetComponent <Text>();
                if (Object.op_Inequality((Object)component, (Object)null))
                {
                    if (num < this.SHOW_VIP_RANK)
                    {
                        component.set_text(string.Empty);
                    }
                    else
                    {
                        component.set_text((num + 1).ToString() + LocalizedText.Get("sys.TOWER_RANK_LABEL"));
                    }
                }
            }
            Transform child4 = ((Component)child1).get_transform().FindChild("Text_player");

            if (Object.op_Inequality((Object)child4, (Object)null))
            {
                Text component = (Text)((Component)child4).GetComponent <Text>();
                if (Object.op_Inequality((Object)component, (Object)null))
                {
                    component.set_text(param.name);
                }
            }
            Transform child5 = ((Component)child1).get_transform().FindChild("player_level");

            if (Object.op_Inequality((Object)child5, (Object)null))
            {
                Text component = (Text)((Component)child5).GetComponent <Text>();
                if (Object.op_Inequality((Object)component, (Object)null))
                {
                    component.set_text(LocalizedText.Get("sys.TOWER_RANK_LBL_LV") + param.lv.ToString());
                }
            }
            if (isSpeed)
            {
                Transform child6 = ((Component)child1).get_transform().FindChild("speed");
                if (Object.op_Inequality((Object)child6, (Object)null))
                {
                    Transform child7 = ((Component)child6).get_transform().FindChild("speed_cnt");
                    if (Object.op_Inequality((Object)child7, (Object)null))
                    {
                        Text component = (Text)((Component)child7).GetComponent <Text>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            component.set_text(param.score.ToString());
                        }
                    }
                    ((Component)child6).get_gameObject().SetActive(true);
                }
                string    rank   = instance.ConvertTowerScoreToRank(tower, param.score, TOWER_SCORE_TYPE.TURN);
                Transform child8 = ((Component)child1).get_transform().FindChild("score_img");
                if (!Object.op_Inequality((Object)child8, (Object)null))
                {
                    return;
                }
                Image component1 = (Image)((Component)child8).GetComponent <Image>();
                if (!Object.op_Inequality((Object)component1, (Object)null))
                {
                    return;
                }
                component1.set_sprite(this.mSheet.GetSprite(rank));
            }
            else
            {
                Transform child6 = ((Component)child1).get_transform().FindChild("tech");
                if (Object.op_Inequality((Object)child6, (Object)null))
                {
                    Transform child7 = ((Component)child6).get_transform().FindChild("tech_cnt");
                    if (Object.op_Inequality((Object)child7, (Object)null))
                    {
                        Text component = (Text)((Component)child7).GetComponent <Text>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            component.set_text(param.score.ToString());
                        }
                    }
                    ((Component)child6).get_gameObject().SetActive(true);
                }
                string    rank   = instance.ConvertTowerScoreToRank(tower, param.score, TOWER_SCORE_TYPE.DIED);
                Transform child8 = ((Component)child1).get_transform().FindChild("score_img");
                if (!Object.op_Inequality((Object)child8, (Object)null))
                {
                    return;
                }
                Image component1 = (Image)((Component)child8).GetComponent <Image>();
                if (!Object.op_Inequality((Object)component1, (Object)null))
                {
                    return;
                }
                component1.set_sprite(this.mSheet.GetSprite(rank));
            }
        }
        private void Refresh()
        {
            TowerParam tower = MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID);

            if (tower == null)
            {
                return;
            }
            TowerFloorParam towerFloor = MonoSingleton <GameManager> .Instance.FindTowerFloor(GlobalVars.SelectedQuestID);

            if (towerFloor == null)
            {
                return;
            }
            QuestParam questParam = towerFloor.GetQuestParam();

            if (questParam == null || questParam.bonusObjective == null)
            {
                return;
            }
            int clearMissionNum = questParam.GetClearMissionNum();
            int length          = questParam.bonusObjective.Length;

            if (questParam.IsMissionCompleteALL())
            {
                this.ClearConditionText01.set_text(string.Format(LocalizedText.Get("sys.TOWER_CLEAR_CINDITION_01_CLEAR"), (object)clearMissionNum, (object)length));
                this.ClearConditionImage01.ImageIndex = 0;
            }
            else
            {
                this.ClearConditionText01.set_text(string.Format(LocalizedText.Get("sys.TOWER_CLEAR_CINDITION_01"), (object)clearMissionNum, (object)length));
                this.ClearConditionImage01.ImageIndex = 1;
            }
            if (questParam.state == QuestStates.Cleared)
            {
                this.ClearConditionText02.set_text(LocalizedText.Get("sys.TOWER_CLEAR_CINDITION_02_CLEAR"));
                this.ClearConditionImage02.ImageIndex = 0;
            }
            else
            {
                this.ClearConditionText02.set_text(LocalizedText.Get("sys.TOWER_CLEAR_CINDITION_02"));
                this.ClearConditionImage02.ImageIndex = 1;
            }
            if (Object.op_Inequality((Object)this.TowerName, (Object)null))
            {
                this.TowerName.set_text(tower.name);
            }
            if (Object.op_Inequality((Object)this.TowerFloorNum, (Object)null))
            {
                this.TowerFloorNum.set_text(towerFloor.name);
            }
            this.CreateResetMissionItems(questParam);
            if (this.m_MissionListItems != null && this.m_MissionListItems.Count > 0)
            {
                GameUtility.SetGameObjectActive((Component)this.m_MissionListTitle, true);
            }
            else
            {
                GameUtility.SetGameObjectActive((Component)this.m_MissionListTitleNoItem, true);
                GameUtility.SetGameObjectActive((Component)this.m_MissionListParent, false);
            }
        }
Beispiel #21
0
        private void Refresh()
        {
            GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems);
            if (Object.op_Equality((Object)this.ItemTemplate, (Object)null) || Object.op_Equality((Object)this.ItemContainer, (Object)null))
            {
                return;
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;

            ChapterParam[]      chapters         = instance.Chapters;
            List <ChapterParam> chapterParamList = new List <ChapterParam>((IEnumerable <ChapterParam>)chapters);

            QuestParam[] availableQuests = instance.Player.AvailableQuests;
            long         serverTime      = Network.GetServerTime();
            ChapterParam chapterParam    = (ChapterParam)null;

            for (int index = chapterParamList.Count - 1; index >= 0; --index)
            {
                if ((string)GlobalVars.SelectedSection != chapterParamList[index].section)
                {
                    chapterParamList.RemoveAt(index);
                }
            }
            if (!string.IsNullOrEmpty((string)GlobalVars.SelectedChapter))
            {
                chapterParam = instance.FindArea((string)GlobalVars.SelectedChapter);
                for (int index = chapterParamList.Count - 1; index >= 0; --index)
                {
                    if (chapterParamList[index].parent == null || chapterParamList[index].parent.iname != (string)GlobalVars.SelectedChapter)
                    {
                        chapterParamList.RemoveAt(index);
                    }
                }
            }
            else
            {
                for (int index = chapterParamList.Count - 1; index >= 0; --index)
                {
                    if (chapterParamList[index].parent != null)
                    {
                        chapterParamList.RemoveAt(index);
                    }
                }
            }
            for (int index = chapterParamList.Count - 1; index >= 0; --index)
            {
                if (!this.ChapterContainsPlayableQuest(chapterParamList[index], chapters, availableQuests, serverTime))
                {
                    chapterParamList.RemoveAt(index);
                }
            }
            List <TowerParam> towerParamList = new List <TowerParam>();

            foreach (TowerParam tower in instance.Towers)
            {
                bool flag = false;
                for (int index = 0; index < availableQuests.Length; ++index)
                {
                    if (availableQuests[index].type == QuestTypes.Tower && availableQuests[index].IsDateUnlock(serverTime))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag && (string.IsNullOrEmpty((string)GlobalVars.SelectedSection) || "WD_DAILY" == (string)GlobalVars.SelectedSection))
                {
                    towerParamList.Add(tower);
                }
            }
            if (this.Descending)
            {
                chapterParamList.Reverse();
            }
            for (int index = 0; index < towerParamList.Count; ++index)
            {
                TowerParam     data            = towerParamList[index];
                ListItemEvents listItemEvents1 = (ListItemEvents)null;
                if (!string.IsNullOrEmpty(data.prefabPath))
                {
                    StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                    stringBuilder.Append("QuestChapters/");
                    stringBuilder.Append(data.prefabPath);
                    listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                }
                if (Object.op_Equality((Object)listItemEvents1, (Object)null))
                {
                    listItemEvents1 = this.ItemTemplate;
                }
                QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname);

                ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                DataSource.Bind <TowerParam>(((Component)listItemEvents2).get_gameObject(), data);
                DataSource.Bind <QuestParam>(((Component)listItemEvents2).get_gameObject(), quest);
                ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                ((Component)listItemEvents2).get_gameObject().SetActive(true);
                listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnTowerSelect);
                this.mItems.Add(listItemEvents2);
            }
            int num = 0;

            for (int index1 = 0; index1 < chapterParamList.Count; ++index1)
            {
                ChapterParam   data            = chapterParamList[index1];
                ListItemEvents listItemEvents1 = (ListItemEvents)null;
                if (!string.IsNullOrEmpty(data.prefabPath))
                {
                    StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                    stringBuilder.Append("QuestChapters/");
                    stringBuilder.Append(data.prefabPath);
                    listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                }
                if (Object.op_Equality((Object)listItemEvents1, (Object)null))
                {
                    listItemEvents1 = this.ItemTemplate;
                }
                ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                DataSource.Bind <ChapterParam>(((Component)listItemEvents2).get_gameObject(), data);
                int total     = 0;
                int completed = 0;
                foreach (QuestParam availableQuest in MonoSingleton <GameManager> .Instance.Player.AvailableQuests)
                {
                    if (!(availableQuest.ChapterID != data.iname) && availableQuest.bonusObjective != null)
                    {
                        if (availableQuest.difficulty == QuestDifficulties.Elite)
                        {
                            ++num;
                        }
                        if (availableQuest.difficulty == GlobalVars.QuestDifficulty)
                        {
                            total += availableQuest.bonusObjective.Length;
                            for (int index2 = 0; index2 < availableQuest.bonusObjective.Length; ++index2)
                            {
                                if (((int)availableQuest.clear_missions & 1 << index2) != 0)
                                {
                                    ++completed;
                                }
                            }
                        }
                    }
                }
                SGChapterItem component = (SGChapterItem)((Component)listItemEvents2).GetComponent <SGChapterItem>();
                if (Object.op_Inequality((Object)component, (Object)null))
                {
                    component.SetProgress(total, completed);
                }
                ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                ((Component)listItemEvents2).get_gameObject().SetActive(true);
                listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnNodeSelect);
                this.mItems.Add(listItemEvents2);
            }
            this.RefreshButtons(GlobalVars.QuestDifficulty);
            if (num == 0)
            {
                ((Selectable)this.BtnNormal.GetComponentInChildren <Button>()).set_interactable(false);
                ((Behaviour)this.BtnNormal.GetComponentInChildren <Button>()).set_enabled(false);
                M0         componentInChildren = this.BtnNormal.GetComponentInChildren <Image>();
                ColorBlock colors = ((Selectable)this.BtnNormal.GetComponentInChildren <Button>()).get_colors();
                // ISSUE: explicit reference operation
                Color normalColor = ((ColorBlock)@colors).get_normalColor();
                ((Graphic)componentInChildren).set_color(normalColor);
            }
            if (Object.op_Inequality((Object)this.BackButton, (Object)null))
            {
                if (chapterParam != null)
                {
                    this.BackButton.SetActive(true);
                }
                else if (!string.IsNullOrEmpty((string)GlobalVars.SelectedSection))
                {
                    this.BackButton.SetActive(!this.IsSectionHidden((string)GlobalVars.SelectedSection));
                }
            }
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 50);
        }