public void ShowDescription(Quest quest) { //Debug.Log("QuestDetailsArea.ShowDescription()"); ClearDescription(); if (quest == null) { return; } this.quest = quest; questDescription.text = quest.GetObjectiveDescription(); experienceReward.text += LevelEquations.GetXPAmountForQuest(playerManager.MyCharacter.CharacterStats.Level, quest, systemConfigurationManager) + " XP"; // display currency rewards List <CurrencyNode> currencyNodes = quest.GetCurrencyReward(); // currencies could be different if (currencyNodes.Count > 0) { currencyHeading.gameObject.SetActive(true); currencyArea.gameObject.SetActive(true); if (currencyLootButton != null) { KeyValuePair <Sprite, string> keyValuePair = currencyConverter.RecalculateValues(currencyNodes, true); currencyLootButton.Icon.sprite = keyValuePair.Key; currencyLootButton.Title.text = keyValuePair.Value; } } else { currencyHeading.gameObject.SetActive(false); currencyArea.gameObject.SetActive(false); } // show item rewards if (quest.ItemRewards.Count > 0) { itemsHeading.gameObject.SetActive(true); if (quest.MaxItemRewards > 0) { itemsHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MaxItemRewards + " Item Rewards:"; } else { itemsHeading.GetComponent <TextMeshProUGUI>().text = "Item Rewards:"; } } for (int i = 0; i < quest.ItemRewards.Count; i++) { RewardButton rewardIcon = objectPooler.GetPooledObject(rewardIconPrefab, itemIconsArea.transform).GetComponent <RewardButton>(); rewardIcon.Configure(systemGameManager); rewardIcon.SetOptions(owner.RectTransform, quest.MaxItemRewards > 0); rewardIcon.OnAttempSelect += HandleAttemptSelect; //Debug.Log("QuestDetailsArea.ShowDescription(): setting describable (and attemptselect) for: " + quest.MyItemRewards[i]); rewardIcon.SetDescribable(quest.ItemRewards[i]); itemRewardIcons.Add(rewardIcon); //if (quest.MaxItemRewards > 0) { itemGrid.AddActiveButton(rewardIcon); //} } // show ability rewards if (quest.AbilityRewards.Count > 0) { abilitiesHeading.gameObject.SetActive(true); if (quest.MaxAbilityRewards > 0) { abilitiesHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MaxAbilityRewards + " Ability Rewards:"; } else { abilitiesHeading.GetComponent <TextMeshProUGUI>().text = "Ability Rewards:"; } } else { abilitiesHeading.GetComponent <TextMeshProUGUI>().text = ""; } for (int i = 0; i < quest.AbilityRewards.Count; i++) { RewardButton rewardIcon = objectPooler.GetPooledObject(rewardIconPrefab, abilityIconsArea.transform).GetComponent <RewardButton>(); rewardIcon.Configure(systemGameManager); rewardIcon.SetOptions(owner.RectTransform, quest.MaxAbilityRewards > 0); rewardIcon.OnAttempSelect += HandleAttemptSelect; //Debug.Log("QuestDetailsArea.ShowDescription(): setting describable (and attemptselect) for: " + quest.MyAbilityRewards[i]); rewardIcon.SetDescribable(quest.AbilityRewards[i]); abilityRewardIcons.Add(rewardIcon); //if (quest.MaxAbilityRewards > 0) { abilityGrid.AddActiveButton(rewardIcon); //} } // show faction rewards if (quest.FactionRewards.Count > 0) { factionsHeading.gameObject.SetActive(true); if (quest.MaxFactionRewards > 0) { factionsHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MaxFactionRewards + " Reputation Rewards:"; } else { factionsHeading.GetComponent <TextMeshProUGUI>().text = "Reputation Rewards:"; } } else { factionsHeading.GetComponent <TextMeshProUGUI>().text = ""; } for (int i = 0; i < quest.FactionRewards.Count; i++) { FactionRewardButton rewardIcon = objectPooler.GetPooledObject(factionRewardIconPrefab, factionIconsArea.transform).GetComponent <FactionRewardButton>(); rewardIcon.Configure(systemGameManager); rewardIcon.SetOptions(owner.RectTransform, quest.MaxFactionRewards > 0); rewardIcon.OnAttempSelect += HandleAttemptSelect; //Debug.Log("QuestDetailsArea.ShowDescription(): setting describable (and attemptselect) for: " + quest.MyFactionRewards[i]); rewardIcon.SetDescribable(quest.FactionRewards[i]); factionRewardIcons.Add(rewardIcon); //if (quest.MaxFactionRewards > 0) { factionGrid.AddActiveButton(rewardIcon); //} } // show Skill rewards if (quest.SkillRewards.Count > 0) { skillHeading.gameObject.SetActive(true); if (quest.MaxSkillRewards > 0) { skillHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MaxSkillRewards + " Skill Rewards:"; } else { skillHeading.GetComponent <TextMeshProUGUI>().text = "Skill Rewards:"; } } else { skillHeading.GetComponent <TextMeshProUGUI>().text = ""; } for (int i = 0; i < quest.SkillRewards.Count; i++) { RewardButton rewardIcon = objectPooler.GetPooledObject(rewardIconPrefab, skillIconsArea.transform).GetComponent <RewardButton>(); rewardIcon.Configure(systemGameManager); rewardIcon.SetOptions(owner.RectTransform, quest.MaxSkillRewards > 0); rewardIcon.SetDescribable(quest.SkillRewards[i]); skillRewardIcons.Add(rewardIcon); //if (quest.MaxSkillRewards > 0) { skillGrid.AddActiveButton(rewardIcon); //} } }
public void ShowDescription(Quest quest) { //Debug.Log("QuestDetailsArea.ShowDescription()"); ClearDescription(); if (quest == null) { return; } this.quest = quest; questDescription.text = quest.GetObjectiveDescription(); experienceReward.text += quest.MyExperienceReward + " XP"; // show item rewards if (quest.MyItemRewards.Count > 0) { itemsHeading.gameObject.SetActive(true); if (quest.MyMaxItemRewards > 0) { itemsHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MyMaxItemRewards + " Item Rewards:"; } else { itemsHeading.GetComponent <TextMeshProUGUI>().text = "Item Rewards:"; } } for (int i = 0; i < quest.MyItemRewards.Count; i++) { RewardButton rewardIcon = Instantiate(rewardIconPrefab, itemIconsArea.transform).GetComponent <RewardButton>(); rewardIcon.OnAttempSelect += HandleAttemptSelect; //Debug.Log("QuestDetailsArea.ShowDescription(): setting describable (and attemptselect) for: " + quest.MyItemRewards[i]); rewardIcon.SetDescribable(quest.MyItemRewards[i]); itemRewardIcons.Add(rewardIcon); } // show ability rewards if (quest.MyAbilityRewards.Count > 0) { abilitiesHeading.gameObject.SetActive(true); if (quest.MyMaxAbilityRewards > 0) { abilitiesHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MyMaxAbilityRewards + " Ability Rewards:"; } else { abilitiesHeading.GetComponent <TextMeshProUGUI>().text = "Ability Rewards:"; } } else { abilitiesHeading.GetComponent <TextMeshProUGUI>().text = ""; } for (int i = 0; i < quest.MyAbilityRewards.Count; i++) { RewardButton rewardIcon = Instantiate(rewardIconPrefab, abilityIconsArea.transform).GetComponent <RewardButton>(); rewardIcon.OnAttempSelect += HandleAttemptSelect; //Debug.Log("QuestDetailsArea.ShowDescription(): setting describable (and attemptselect) for: " + quest.MyAbilityRewards[i]); rewardIcon.SetDescribable(quest.MyAbilityRewards[i]); abilityRewardIcons.Add(rewardIcon); } // show faction rewards if (quest.MyFactionRewards.Count > 0) { factionsHeading.gameObject.SetActive(true); if (quest.MyMaxFactionRewards > 0) { factionsHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MyMaxFactionRewards + " Reputation Rewards:"; } else { factionsHeading.GetComponent <TextMeshProUGUI>().text = "Reputation Rewards:"; } } else { factionsHeading.GetComponent <TextMeshProUGUI>().text = ""; } for (int i = 0; i < quest.MyFactionRewards.Count; i++) { FactionRewardButton rewardIcon = Instantiate(factionRewardIconPrefab, factionIconsArea.transform).GetComponent <FactionRewardButton>(); rewardIcon.OnAttempSelect += HandleAttemptSelect; //Debug.Log("QuestDetailsArea.ShowDescription(): setting describable (and attemptselect) for: " + quest.MyFactionRewards[i]); rewardIcon.SetDescribable(quest.MyFactionRewards[i]); factionRewardIcons.Add(rewardIcon); } // show Skill rewards if (quest.MySkillRewards.Count > 0) { skillHeading.gameObject.SetActive(true); if (quest.MyMaxSkillRewards > 0) { skillHeading.GetComponent <TextMeshProUGUI>().text = "Choose " + quest.MyMaxSkillRewards + " Skill Rewards:"; } else { skillHeading.GetComponent <TextMeshProUGUI>().text = "Skill Rewards:"; } } else { skillHeading.GetComponent <TextMeshProUGUI>().text = ""; } for (int i = 0; i < quest.MySkillRewards.Count; i++) { RewardButton rewardIcon = Instantiate(rewardIconPrefab, skillIconsArea.transform).GetComponent <RewardButton>(); rewardIcon.SetDescribable(quest.MySkillRewards[i]); skillRewardIcons.Add(rewardIcon); } }