private void SetOpenInfo()
        {
            var playerQuestRepository = new PlayerQuestRepository();

            var questRep = new QuestRepository();

            foreach (var model in questRep.GetALL())
            {
                if (model.openClearQuestID != quest.ID)
                {
                    continue;
                }
                if (playerQuestRepository.Get(model.ID).IsClear())
                {
                    continue;
                }

                this.opneInfo.text += "新クエストが開放されました。\n";

                if (!quest.ID.ToString().EndsWith("3"))
                {
                    continue;
                }

                if (quest.ID.ToString().EndsWith("3003"))
                {
                    continue;
                }

                this.opneInfo.text += "新しいキャラクタが開放されました。\n";
            }
        }
        public void Initialize(QuestResultType type, QuestGroupModel questGroup, QuestModel quest, int starCount, int score, bool isNoticeMax)
        {
            this.type          = type;
            this.questGroup    = questGroup;
            this.quest         = quest;
            this.starCount     = starCount;
            this.score         = score;
            this.isNoticeMax   = isNoticeMax;
            this.opneInfo.text = "";

            if (CanUpdateScore(score, quest, type))
            {
                // 開放状況の設定
                SetOpenInfo();

                // 値のセット
                var playerQuestRepository = new PlayerQuestRepository();
                var playerQuestModel      = playerQuestRepository.Get(quest.ID);

                playerQuestModel.CurrentStarNum = starCount;
                playerQuestModel.CurrentScore   = score;
                playerQuestRepository.Set(playerQuestModel);
            }

            // 結果によって変えてもいいかも
            SoundManager.Instance.PlayBgm("kodoku");
        }
    // Use this for initialization
    void Start()
    {
        startButton.onClick.AddListener(() =>
        {
            SceneMoveManager.Instance.MoveScene("QuestSelect", new QuestSelectSceneParamter());
        });

        skinButton.onClick.AddListener(() =>
        {
            SceneMoveManager.Instance.MoveScene("CharacterSelectScene", new CharacterSelectSceneParameter());
        });

        dataDeleteButton.onClick.AddListener(() =>
        {
            PlayerPrefs.DeleteAll();
            Application.Quit();
        });

        questClearButton.onClick.AddListener(() =>
        {
            var playerQuestRepository = new PlayerQuestRepository();
            foreach (var model in playerQuestRepository.GetALL())
            {
                model.CurrentScore   = 1000;
                model.CurrentStarNum = 1;
                playerQuestRepository.Set(model);
            }
        });

        SoundManager.Instance.PlayBgm("kodoku");
    }
        private static bool CanUpdateScore(int nextScore, QuestModel model, QuestResultType type)
        {
            if (type == QuestResultType.Fail)
            {
                return(false);
            }

            var playerQuestRepository = new PlayerQuestRepository();
            var playerQuestModel      = playerQuestRepository.Get(model.ID);

            return(playerQuestModel.CurrentScore < nextScore);
        }
        public bool IsOpen()
        {
            if (openClearQuestID == OpenValue)
            {
                return(true);
            }

            var playerQuestRepository = new PlayerQuestRepository();

            if (!playerQuestRepository.Get(openClearQuestID).IsClear())
            {
                return(false);
            }
            return(true);
        }
        public bool IsOpen()
        {
            if (openClearQuestGroupID == OpenValue)
            {
                return(true);
            }

            var playerQuestRepository = new PlayerQuestRepository();
            var questGroupRepository  = new QuestGroupRepository();

            foreach (var questID in questGroupRepository.Get(openClearQuestGroupID).questIDs)
            {
                if (!playerQuestRepository.Get(questID).IsClear())
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 7
0
        public void UpdateView(QuestGroupModel questGroup)
        {
            var questRepository       = new QuestRepository();
            var playerQuestRepository = new PlayerQuestRepository();

            var quest1       = questRepository.Get(questGroup.questIDs[0]);
            var quest2       = questRepository.Get(questGroup.questIDs[1]);
            var quest3       = questRepository.Get(questGroup.questIDs[2]);
            var playerQuest1 = playerQuestRepository.Get(questGroup.questIDs[0]);
            var playerQuest2 = playerQuestRepository.Get(questGroup.questIDs[1]);
            var playerQuest3 = playerQuestRepository.Get(questGroup.questIDs[2]);

            // シーン移動の設定をする
            MoveBattleScene(
                questViewMorning.GetComponent <Button>(),
                questGroup,
                quest1
                );
            MoveBattleScene(
                questViewEvening.GetComponent <Button>(),
                questGroup,
                quest2
                );
            MoveBattleScene(
                questViewNight.GetComponent <Button>(),
                questGroup,
                quest3
                );

            QuestGroupName.text        = questGroup.Name;
            Banner.sprite              = ResourceLoader.LoadSceneSprite(questGroup.bannerFilename);
            QuestGroupDescription.text = questGroup.Description;

            questViewMorning.UpdateView(quest1, playerQuest1);
            questViewEvening.UpdateView(quest2, playerQuest2);
            questViewNight.UpdateView(quest3, playerQuest3);

            questViewMorning.gameObject.SetActive(quest1.IsOpen());
            questViewEvening.gameObject.SetActive(quest2.IsOpen());
            questViewNight.gameObject.SetActive(quest3.IsOpen());
        }