public QuestInformation(EzQuestModel model, EzCompletedQuestList currentCompletedQuestList)
        {
            Id         = model.QuestModelId;
            Name       = model.Name;
            ScreenName = model.Metadata;
            var action = QuestController.GetConsumeAction <ConsumeStaminaByUserIdRequest>(
                model,
                "Gs2Stamina:ConsumeStaminaByUserId"
                );

            if (action != null)
            {
                consumeStamina = action.consumeValue;
            }

            if (currentCompletedQuestList == null)
            {
                currentCompletedQuestList = new EzCompletedQuestList
                {
                    CompleteQuestNames = new List <string>()
                };
            }

            var premiseQuestNames = new HashSet <string>(model.PremiseQuestNames);

            premiseQuestNames.ExceptWith(currentCompletedQuestList.CompleteQuestNames);
            open      = premiseQuestNames.Count == 0;
            completed = currentCompletedQuestList.CompleteQuestNames.Contains(model.Name);
        }
Exemplo n.º 2
0
        /// <summary>
        /// クエストを取得
        /// </summary>
        /// <returns></returns>
        public IEnumerator CheckStaminaTask(EzQuestModel quest)
        {
            if (_animator)
            {
                {
                    AsyncResult <EzGetStaminaResult> result = null;
                    yield return(staminaController.GetStamina(
                                     r => result = r
                                     ));

                    if (result.Error != null)
                    {
                        _animator.SetTrigger(Trigger.GetStaminaFailed.ToString());
                        yield break;
                    }

                    var action = QuestController.GetConsumeAction <ConsumeStaminaByUserIdRequest>(
                        quest,
                        "Gs2Stamina:ConsumeStaminaByUserId"
                        );
                    if (action != null)
                    {
                        if (result.Result.Item.Value < action.ConsumeValue)
                        {
                            GameObject.Find("Gs2QuestInternalSetting").GetComponent <Gs2QuestInternalSetting>().onFewStamina.Invoke();
                            _animator.SetTrigger(Trigger.CheckStaminaFailed.ToString());
                            yield break;
                        }
                    }
                }

                GameObject.Find("Gs2QuestInternalSetting").GetComponent <Gs2QuestInternalSetting>().selectedQuestGroup = selectQuestGroup;
                GameObject.Find("Gs2QuestInternalSetting").GetComponent <Gs2QuestInternalSetting>().selectedQuest      = selectQuest;
                GameObject.Find("Gs2QuestInternalSetting").GetComponent <Gs2QuestInternalSetting>().progress           = null;
                GameObject.Find("Gs2QuestInternalSetting").GetComponent <Gs2QuestInternalSetting>().onStartQuest.Invoke(
                    selectQuestGroup,
                    selectQuest
                    );

                _animator.SetTrigger(Trigger.CheckStaminaSucceed.ToString());
            }
        }