コード例 #1
0
        protected override void UpdateData()
        {
            var isComplete     = CharacterQuest.isComplete;
            var isAllTasksDone = CharacterQuest.IsAllTasksDone(character);

            var titleFormat = isComplete ? questCompleteTitleFormat : (isAllTasksDone ? questTasksCompleteTitleFormat : questOnGoingTitleFormat);

            if (uiTextTitle != null)
            {
                uiTextTitle.text = string.Format(titleFormat, Quest == null ? "Unknow" : Quest.title);
            }

            if (uiTextDescription != null)
            {
                uiTextDescription.text = string.Format(descriptionFormat, Quest == null ? "N/A" : Quest.description);
            }

            if (uiTextRewardExp != null)
            {
                uiTextRewardExp.text = string.Format(rewardExpFormat, Quest == null ? "0" : Quest.rewardExp.ToString("N0"));
            }

            if (uiTextRewardGold != null)
            {
                uiTextRewardGold.text = string.Format(rewardGoldFormat, Quest == null ? "0" : Quest.rewardGold.ToString("N0"));
            }

            if (Quest != null && showRewardItemList)
            {
                CacheRewardItemList.Generate(Quest.rewardItems, (index, rewardItem, ui) =>
                {
                    var characterItem    = CharacterItem.Create(rewardItem.item);
                    characterItem.amount = rewardItem.amount;
                    var uiCharacterItem  = ui.GetComponent <UICharacterItem>();
                    uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, string.Empty), null, -1);
                    uiCharacterItem.Show();
                });
            }

            if (uiRewardItemRoot != null)
            {
                uiRewardItemRoot.SetActive(showRewardItemList && Quest.rewardItems.Length > 0);
            }

            if (uiQuestTaskRoot != null)
            {
                uiQuestTaskRoot.SetActive(showQuestTaskList && Quest.tasks.Length > 0);
            }

            if (questCompleteStatusObject != null)
            {
                questCompleteStatusObject.SetActive(isComplete);
            }

            if (questTasksCompleteStatusObject != null)
            {
                questTasksCompleteStatusObject.SetActive(!isComplete && isAllTasksDone);
            }

            if (questOnGoingStatusObject != null)
            {
                questOnGoingStatusObject.SetActive(!isComplete && !isAllTasksDone);
            }
        }
コード例 #2
0
        protected override void UpdateData()
        {
            bool isComplete     = CharacterQuest.isComplete;
            bool isAllTasksDone = CharacterQuest.IsAllTasksDone(Character);

            string titleFormat = isComplete ?
                                 LanguageManager.GetText(formatKeyTitleComplete) :
                                 (isAllTasksDone ?
                                  LanguageManager.GetText(formatKeyTitleTasksComplete) :
                                  LanguageManager.GetText(formatKeyTitleOnGoing));

            if (uiTextTitle != null)
            {
                uiTextTitle.text = string.Format(titleFormat, Quest == null ? LanguageManager.GetUnknowTitle() : Quest.Title);
            }

            if (uiTextDescription != null)
            {
                uiTextDescription.text = string.Format(
                    LanguageManager.GetText(formatKeyDescription),
                    Quest == null ? LanguageManager.GetUnknowDescription() : Quest.Description);
            }

            if (uiTextRewardExp != null)
            {
                uiTextRewardExp.text = string.Format(
                    LanguageManager.GetText(formatKeyRewardExp),
                    Quest == null ? "0" : Quest.rewardExp.ToString("N0"));
            }

            if (uiTextRewardGold != null)
            {
                uiTextRewardGold.text = string.Format(
                    LanguageManager.GetText(formatKeyRewardGold),
                    Quest == null ? "0" : Quest.rewardGold.ToString("N0"));
            }

            if (Quest != null && showRewardItemList)
            {
                CacheRewardItemList.Generate(Quest.rewardItems, (index, rewardItem, ui) =>
                {
                    CharacterItem characterItem     = CharacterItem.Create(rewardItem.item);
                    characterItem.amount            = rewardItem.amount;
                    UICharacterItem uiCharacterItem = ui.GetComponent <UICharacterItem>();
                    uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, InventoryType.NonEquipItems), null, -1);
                    uiCharacterItem.Show();
                });
            }

            if (uiRewardItemRoot != null)
            {
                uiRewardItemRoot.SetActive(showRewardItemList && Quest.rewardItems.Length > 0);
            }

            if (uiQuestTaskRoot != null)
            {
                uiQuestTaskRoot.SetActive(showQuestTaskList && Quest.tasks.Length > 0);
            }

            if (questCompleteStatusObject != null)
            {
                questCompleteStatusObject.SetActive(isComplete);
            }

            if (questTasksCompleteStatusObject != null)
            {
                questTasksCompleteStatusObject.SetActive(!isComplete && isAllTasksDone);
            }

            if (questOnGoingStatusObject != null)
            {
                questOnGoingStatusObject.SetActive(!isComplete && !isAllTasksDone);
            }
        }