public void AddQuest(int questID)
    {
        if (_questSaveManager.CompletedQuest(questID) == true)
        {
            DebugOnScreen.Log("Quest has already been completed. Delete in PlayerPrefs probably");
            return;
        }

        Quest newQuest = _quest.AddQuest(questID);

        if (newQuest == null)
        {
            DebugOnScreen.Log("New Quest is null. Not adding to List!");
            return;
        }

        currentQuests.Add(newQuest);
        DebugOnScreen.Log("Added quest!");

        if (newQuest.HasTimer() == true)
        {
            StartCoroutine("StartTimer", newQuest);
        }

        return;
    }
Beispiel #2
0
    public void ButtonEvent_QuestAccept()
    {
        UIManager.Instance.ShowUI();
        Camera.main.GetComponent <FollowCamera>().StartCamera();

        Quest newCopyQuest = questArr[questArrIndex].DeepCopy();

        newCopyQuest.AddQuest();

        UI_QuestDescription.SetActive(false);
    }
Beispiel #3
0
    // 수락 버튼 이벤트
    public void ButtonEvent_QuestAccept()
    {
        // 환경 세팅
        GameUiManager.instance.ShowUI();                       // UI 보이게 하기
        Camera.main.GetComponent <CameraCtrl>().StartCamera(); // 카메라 움직이기
        GameManager.instance.HideMouseCursor();                // 커서 안 보이게 하기

        Quest newCopyQuest = questArr[questArrIndex].DeepCopy();

        newCopyQuest.AddQuest();

        UI_QuestDescription.SetActive(false);

        if (isTriggerByPlayer)
        {
            UI_TalkWithNPC.SetActive(true);
        }
    }
Beispiel #4
0
    public void QuestAceeptButtonClick()        //npc에서 퀘스트 수락 버튼
    {
        questScript.AddQuest(npcquestlist[clickslotindex]);


        for (int i = 0; i < questslotlist.Count; i++)
        {
            Destroy(questslotlist[i].questSlot);
        }

        npcquestlist.Clear();
        questslotlist.Clear();

        questScript.GetComponent <QuestUI>().completeQuestList.SetActive(true);
        questScript.GetComponent <QuestUI>().progressQuestList.SetActive(true);
        questScript.GetComponent <QuestUI>().RemovequestSlot();

        NpcQuestListSetting();

        questScript.GetComponent <QuestUI>().QuestCanvasSetting();

        npcQuestBoard.SetActive(false);
    }
Beispiel #5
0
    public void Load()
    {
        Debug.Log("loaded \'playdata.dat\' from " + Application.persistentDataPath + "/playdata.dat");
        openWorlds = new bool[Game.Instance.config.worldInfos.Count];
        stageDatas = new StageData[Game.Instance.config.stageInfos.Count];
        openBlocks = new Dictionary <string, string> ();
        adsFree    = false;
        Quest.Init();
        achievements = new Dictionary <string, Achievement> ();

        PlayData tmpPlayData = null;

        if (File.Exists(Application.persistentDataPath + "/playdata.dat"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/playdata.dat", FileMode.Open);
            tmpPlayData = (PlayData)bf.Deserialize(file);
            file.Close();
        }

        if (null != tmpPlayData)
        {
            hint    = tmpPlayData.hint;
            star    = tmpPlayData.star;
            adsFree = tmpPlayData.adsFree;
            for (int i = 0; i < tmpPlayData.openWorlds.Length; i++)
            {
                openWorlds [i] = false;
                if (i < openWorlds.Length)
                {
                    openWorlds [i] = tmpPlayData.openWorlds [i];
                }
            }

            for (int i = 0; i < tmpPlayData.stageDatas.Length; i++)
            {
                if (i < stageDatas.Length)
                {
                    stageDatas[i] = tmpPlayData.stageDatas[i];
                }
            }

            achievements = tmpPlayData.achievements;
            foreach (var itr in achievements)
            {
                Achievement achievement = itr.Value;
                achievement.Start();
                Quest.AddQuest(achievement);
            }
            openBlocks = tmpPlayData.openBlocks;
        }


        foreach (Config.AchievementInfo achievementInfo in Game.Instance.config.achievementInfos)
        {
            if (null == Quest.Find(achievementInfo.id))
            {
                Achievement achievement = new Achievement(
                    achievementInfo.id,
                    achievementInfo.name,
                    achievementInfo.description,
                    new Quest.Progress("", achievementInfo.type, achievementInfo.key, achievementInfo.goal)
                    );
                achievements.Add(achievement.id, achievement);
                Quest.AddQuest(achievement);
            }
        }

        for (int i = 0; i < stageDatas.Length; i++)
        {
            if (null == stageDatas[i])
            {
                PlayData.StageData stageData = new PlayData.StageData();
                stageData.id         = i + 1;
                stageData.clearLevel = 0;
                stageData.open       = false;
                stageDatas [i]       = stageData;
            }
        }

        foreach (Config.WorldInfo worldInfo in Game.Instance.config.worldInfos)
        {
            if (star >= worldInfo.openStar)
            {
                openWorlds[worldInfo.id - 1] = true;
                stageDatas[worldInfo.stageInfos[0].id - 1].open = true;
            }
        }
    }