Esempio n. 1
0
        private void Show(
            Nekoyume.Model.Quest.Quest quest,
            List <CountableItem> rewards,
            bool ignoreShowAnimation = false)
        {
            titleText.text     = L10nManager.Localize("UI_QUEST_COMPLETED");
            continueText.alpha = 0f;

            menuContainer.SetActive(false);
            questRewards.SetActive(true);
            recipeCellView.Hide();

            _rewards = rewards;

            for (var i = 0; i < questRewardViews.Length; ++i)
            {
                var itemView = questRewardViews[i];

                if (i < (_rewards?.Count ?? 0))
                {
                    itemView.SetData(_rewards[i]);
                }

                itemView.Hide();
            }

            AppearNPC(ignoreShowAnimation, NPCAnimation.Type.Emotion_03);
            base.Show(ignoreShowAnimation);
            PlayEffects();
            MakeNotification(quest.GetContent());
            UpdateLocalState(quest.Id, quest.Reward?.ItemMap);
        }
        public static string GetTitle(this QuestModel quest)
        {
            switch (quest)
            {
            case CollectQuest _:
            case CombinationQuest _:
            case ItemEnhancementQuest _:
            case CombinationEquipmentQuest _:
                return(L10nManager.Localize("QUEST_TITLE_CRAFT"));

            case GeneralQuest generalQuest:
                string key;
                switch (generalQuest.Event)
                {
                case QuestEventType.Create:
                case QuestEventType.Level:
                case QuestEventType.Die:
                case QuestEventType.Complete:
                    key = "ADVENTURE";
                    break;

                case QuestEventType.Enhancement:
                case QuestEventType.Equipment:
                case QuestEventType.Consumable:
                    key = "CRAFT";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                return(L10nManager.Localize($"QUEST_TITLE_{key}"));

            case ItemGradeQuest _:
            case ItemTypeCollectQuest _:
            case MonsterQuest _:
                return(L10nManager.Localize("QUEST_TITLE_ADVENTURE"));

            case GoldQuest _:
            case TradeQuest _:
                return(L10nManager.Localize("QUEST_TITLE_TRADE"));

            case WorldQuest _:
                return(L10nManager.Localize("QUEST_TITLE_ADVENTURE"));

            default:
                throw new NotSupportedException(
                          $"Given quest[{quest}] doesn't support {nameof(GetTitle)}() method."
                          );
            }
        }
Esempio n. 3
0
        public void Show(Nekoyume.Model.Quest.Quest quest, bool ignoreShowAnimation = false)
        {
            if (quest is null)
            {
                var sb = new StringBuilder($"[{nameof(CelebratesPopup)}]");
                sb.Append($"Argument {nameof(quest)} is null.");
                Debug.LogError(sb.ToString());
                return;
            }

            var rewardModels = quest.Reward.ItemMap
                               .Select(pair =>
            {
                var itemRow = Game.Game.instance.TableSheets.MaterialItemSheet.OrderedList
                              .First(row => row.Id == pair.Key);
                var material = ItemFactory.CreateMaterial(itemRow);
                return(new CountableItem(material, pair.Value));
            })
                               .ToList();

            Show(quest, rewardModels, ignoreShowAnimation);
        }
Esempio n. 4
0
 public void EnqueueCompletedQuest(QuestModel quest)
 {
     scroll.EnqueueCompletedQuest(quest);
 }
        public static string GetContent(this QuestModel quest)
        {
            switch (quest)
            {
            case CollectQuest collectQuest:
                return(string.Format(
                           L10nManager.Localize("QUEST_COLLECT_CURRENT_INFO_FORMAT"),
                           L10nManager.LocalizeItemName(collectQuest.ItemId)
                           ));

            case CombinationQuest combinationQuest:
                return(string.Format(
                           L10nManager.Localize("QUEST_COMBINATION_CURRENT_INFO_FORMAT"),
                           combinationQuest.ItemSubType.GetLocalizedString(),
                           combinationQuest.Goal
                           ));

            case GeneralQuest generalQuest:
                switch (generalQuest.Event)
                {
                case QuestEventType.Create:
                    break;

                case QuestEventType.Enhancement:
                case QuestEventType.Level:
                case QuestEventType.Die:
                case QuestEventType.Complete:
                case QuestEventType.Equipment:
                case QuestEventType.Consumable:
                    return(string.Format(
                               L10nManager.Localize($"QUEST_GENERAL_{generalQuest.Event}_FORMAT"),
                               generalQuest.Goal
                               ));

                default:
                    throw new ArgumentOutOfRangeException();
                }
                return(L10nManager.Localize($"QUEST_GENERAL_{generalQuest.Event}_FORMAT"));

            case GoldQuest goldQuest:
                return(string.Format(
                           L10nManager.Localize($"QUEST_GOLD_{goldQuest.Type}_FORMAT"),
                           goldQuest.Goal
                           ));

            case ItemEnhancementQuest itemEnhancementQuest:
                return(string.Format(
                           L10nManager.Localize("QUEST_ITEM_ENHANCEMENT_FORMAT"),
                           itemEnhancementQuest.Grade,
                           itemEnhancementQuest.Goal,
                           itemEnhancementQuest.Count
                           ));

            case ItemGradeQuest itemGradeQuest:
                return(string.Format(
                           L10nManager.Localize("QUEST_ITEM_GRADE_FORMAT"),
                           itemGradeQuest.Grade, itemGradeQuest.Goal
                           ));

            case ItemTypeCollectQuest itemTypeCollectQuest:
                return(string.Format(
                           L10nManager.Localize("QUEST_ITEM_TYPE_FORMAT"),
                           itemTypeCollectQuest.ItemType.GetLocalizedString(), itemTypeCollectQuest.Goal
                           ));

            case MonsterQuest monsterQuest:
                return(string.Format(
                           L10nManager.Localize("QUEST_MONSTER_FORMAT"),
                           L10nManager.LocalizeCharacterName(monsterQuest.MonsterId)
                           ));

            case TradeQuest tradeQuest:
                return(string.Format(
                           L10nManager.Localize("QUEST_TRADE_CURRENT_INFO_FORMAT"),
                           tradeQuest.Type.GetLocalizedString(), tradeQuest.Goal
                           ));

            case WorldQuest worldQuest:
                if (!Game.Game.instance.TableSheets.WorldSheet.TryGetByStageId(
                        worldQuest.Goal,
                        out var worldRow))
                {
                    worldRow = Game.Game.instance.TableSheets.WorldSheet.Last;
                    if (worldRow is null)
                    {
                        return(string.Empty);
                    }
                }

                if (worldQuest.Goal == worldRow.StageBegin)
                {
                    var format = L10nManager.Localize("QUEST_WORLD_FORMAT");
                    return(string.Format(format, worldRow.GetLocalizedName()));
                }
                else
                {
                    var format = L10nManager.Localize("QUEST_CLEAR_STAGE_FORMAT");
                    return(string.Format(format, worldRow.GetLocalizedName(), worldQuest.Goal));
                }

            case CombinationEquipmentQuest combinationEquipmentQuest:
                var unlockFormat = L10nManager.Localize("QUEST_COMBINATION_EQUIPMENT_FORMAT");
                var itemId       = Game.Game.instance.TableSheets.EquipmentItemRecipeSheet.Values
                                   .First(r => r.Id == combinationEquipmentQuest.RecipeId).ResultEquipmentId;
                return(string.Format(
                           unlockFormat,
                           L10nManager.LocalizeItemName(itemId)
                           ));

            default:
                throw new NotSupportedException(
                          $"Given quest[{quest}] doesn't support {nameof(GetContent)}() method."
                          );
            }
        }