Exemple #1
0
    public void Refresh()
    {
        if (UIWindow.IsLoaded())
        {
            UIWindow.AddCloseAction(Refresh);
            return;
        }

        if (LobbyScene.Get().GetBattleStage().IsLoaded())
        {
            LobbyScene.Get().GetBattleStage().AddUnloadAction(Refresh);
            return;
        }

        if (Prologue.IsLoaded())
        {
            UIWindow.AddCloseAction(Refresh);
        }

        DestroyChildren(gridParent);
        RefreshVisibleQuest();

        List <MtQuest> questList = new List <MtQuest>(visibleQuestDic.Values);

        questList.Sort(new QuestIDXComparer());

        bool hasMainQuest = false;

        List <QuestProgressText> progressTextList = new List <QuestProgressText>();

        if (questList.Count > 0)
        {
            foreach (MtQuest quest in questList)
            {
                QuestProgressText questProgressText = QuestProgressText.Create(gridParent, this, quest);

                progressTextList.Add(questProgressText);

                if (pointingReserved.Contains(quest.IDX) && !UITutorial.IsLoaded() && questProgressText.gameObject.activeSelf)
                {
                    if (UIQuestConversation.IsLoaded() || UIPointingFinger.IsLoaded() || UIWindow.IsLoaded() || Prologue.IsLoaded() || UIBuildResult.IsLoaded())
                    {
                        StartCoroutine(CheckRoutin(quest, questProgressText));
                    }
                    else
                    {
                        questProgressText.StartPointingOnMission();
                        pointingReserved.Remove(quest.IDX);
                    }
                }
                else
                {
                    pointingReserved.Remove(quest.IDX);
                }

                foreach (MtQuestMission mission in quest.Missions)
                {
                    if (!mission.IsAccomplished())
                    {
                        MissionProgressText.Create(questProgressText.transform, quest, mission);
                        break;
                    }
                }

                if (quest.QuestType == MtQuestTypes.MainStory)
                {
                    hasMainQuest = true;
                }
            }
        }

        if (!hasMainQuest && !UIQuestConversation.IsLoaded())
        {
            MtQuest quest = MtDataManager.GetQuestDataFromPreRequirementIDX(AccountInfo.instance.questStep);

            if (quest != null)
            {
                QuestProgressText questProgressText = QuestProgressText.Create(gridParent, this, quest, true);
                questProgressText.transform.SetAsFirstSibling();

                questList.Add(quest);
            }
        }

        zoomButton.SetActive(questList.Count > 0);

        if (questList.Count == 0)
        {
            ZoneTerrain.Get().zoneTiles.RefreshQuestMarks();
        }
        else
        {
            foreach (MtQuest quest in questList)
            {
                foreach (MtQuestMission missionInfo in quest.Missions)
                {
                    int x = 0, y = 0;

                    if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromCastle)
                    {
                        x = missionInfo.TargetIndex1 + AccountInfo.instance.castlePositionX;
                        y = missionInfo.TargetIndex2 + AccountInfo.instance.castlePositionY;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromSherinStation)
                    {
                        x = MtStatic.SherinStationX;
                        y = MtStatic.SherinStationY;

                        MtTileInfo.GetPositionOnMyField(MtStatic.SherinStationX, MtStatic.SherinStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromWooboldVillageStation)
                    {
                        x = MtStatic.WooboldVillageStationX;
                        y = MtStatic.WooboldVillageStationY;

                        MtTileInfo.GetPositionOnLavaField(MtStatic.WooboldVillageStationX, MtStatic.WooboldVillageStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromOldCastleStation)
                    {
                        x = MtStatic.OldCastleStationX;
                        y = MtStatic.OldCastleStationY;

                        MtTileInfo.GetPositionOnMyField(MtStatic.OldCastleStationX, MtStatic.OldCastleStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromLahindelStation)
                    {
                        x = MtStatic.LahindelStationX;
                        y = MtStatic.LahindelStationY;

                        MtTileInfo.GetPositionOnMyField(MtStatic.LahindelStationX, MtStatic.LahindelStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromMarenStation)
                    {
                        x = MtStatic.MarenStationX;
                        y = MtStatic.MarenStationY;

                        MtTileInfo.GetPositionOnMyField(MtStatic.MarenStationX, MtStatic.MarenStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromDotakCastle)
                    {
                        x = MtStatic.DotakCastleStationX;
                        y = MtStatic.DotakCastleStationY;

                        MtTileInfo.GetPositionOnLavaField(MtStatic.DotakCastleStationX, MtStatic.DotakCastleStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromTitansGardenStation)
                    {
                        x = MtStatic.TitansGardenStationX;
                        y = MtStatic.TitansGardenStationY;

                        MtTileInfo.GetPositionOnLavaField(MtStatic.TitansGardenStationX, MtStatic.TitansGardenStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }
                    else if (missionInfo.ActionType == MtMissionActionTypes.GotoLocationFromLastStageStation)
                    {
                        x = MtStatic.LastStageStationX;
                        y = MtStatic.LastStageStationY;

                        MtTileInfo.GetPositionOnLavaField(MtStatic.LastStageStationX, MtStatic.LastStageStationY, out x, out y, AccountInfo.instance.castlePositionX, AccountInfo.instance.castlePositionY);

                        x += missionInfo.TargetIndex1;
                        y += missionInfo.TargetIndex2;
                    }

                    if (x != 0 || y != 0)
                    {
                        ZoneTile tile = ZoneTerrain.Get().zoneTiles.GetTileByXY(x, y);
                        if (tile != null)
                        {
                            tile.Refresh3D();
                        }
                    }
                }
            }
        }

        if (questList.Count == 0)
        {
            backPanelImg.enabled = false;
        }
        else
        {
            backPanelImg.enabled = true;
        }

        RefreshHeight();
    }