public void PopulateCredits() { bool firstCategoryPassed = false; // first, loope through and organize everything into categories // this is necessary because categories may not be unique across different content directories // and so need to have their content merged foreach (CreditsCategory creditsCategory in systemDataFactory.GetResourceList <CreditsCategory>()) { if (categoriesDictionary.ContainsKey(creditsCategory.CategoryName) == false) { categoriesDictionary.Add(creditsCategory.CategoryName, creditsCategory.CreditsNodes); } else { categoriesDictionary[creditsCategory.CategoryName].AddRange(creditsCategory.CreditsNodes); } } foreach (string categoryName in categoriesDictionary.Keys) { GameObject go = null; if (firstCategoryPassed) { // add a blank line as a spacer between categories go = objectPooler.GetPooledObject(creditCategoryTemplate, creditsContainer); go.GetComponent <CreditCategoryController>().MyTitleText.text = " "; } go = objectPooler.GetPooledObject(creditCategoryTemplate, creditsContainer); go.GetComponent <CreditCategoryController>().MyTitleText.text = categoryName; firstCategoryPassed = true; foreach (CreditsNode creditsNode in categoriesDictionary[categoryName]) { go = objectPooler.GetPooledObject(creditTemplate, creditsContainer); CreditController creditController = go.GetComponent <CreditController>(); creditController.CreditNameText.text = creditsNode.CreditName; creditController.AttributionText.text = creditsNode.CreditAttribution; creditController.UserUrl = creditsNode.UserUrl; creditController.DownloadUrl = creditsNode.DownloadUrl; uINavigationControllers[1].AddActiveButton(creditController.NameHighlightButton); uINavigationControllers[1].AddActiveButton(creditController.AttributionHighlightButton); creditController.NameHighlightButton.Configure(systemGameManager); creditController.AttributionHighlightButton.Configure(systemGameManager); } //(uINavigationControllers[1] as UINavigationGrid).NumRows = Mathf.CeilToInt((float)(uINavigationControllers[1].ActiveNavigableButtonCount) / 2f); } }
public void ShowTraitRewards() { //Debug.Log("ClassChangePanelController.ShowTraitRewards()"); ClearTraitRewardIcons(); // show trait rewards CapabilityProps capabilityProps = characterClass.GetFilteredCapabilities(playerManager.ActiveCharacter); if (playerManager.MyCharacter.Faction != null) { CapabilityConsumerSnapshot capabilityConsumerSnapshot = new CapabilityConsumerSnapshot(playerManager.ActiveCharacter, systemGameManager); capabilityConsumerSnapshot.CharacterClass = characterClass; CapabilityProps capabilityPropsFaction = playerManager.MyCharacter.Faction.GetFilteredCapabilities(capabilityConsumerSnapshot, false); capabilityProps = capabilityPropsFaction.Join(capabilityProps); } List <StatusEffect> traitList = capabilityProps.TraitList.Distinct().ToList(); if (traitList.Count > 0) { traitsArea.gameObject.SetActive(true); } else { traitsArea.gameObject.SetActive(false); return; } for (int i = 0; i < traitList.Count; i++) { if (traitList[i] != null) { RewardButton rewardIcon = objectPooler.GetPooledObject(rewardIconPrefab, traitIconsArea.transform).GetComponent <RewardButton>(); rewardIcon.Configure(systemGameManager); rewardIcon.SetOptions(rectTransform, false); rewardIcon.SetDescribable(traitList[i]); traitRewardIcons.Add(rewardIcon); if (traitList[i].RequiredLevel > playerManager.MyCharacter.CharacterStats.Level) { rewardIcon.StackSizeText.text = "Level\n" + traitList[i].RequiredLevel; rewardIcon.HighlightIcon.color = new Color32(255, 255, 255, 80); } uINavigationControllers[1].AddActiveButton(rewardIcon); } } }
public NamePlateController SpawnNamePlate(NamePlateUnit namePlateUnit, bool usePositionOffset) { //Debug.Log("NamePlateManager.SpawnNamePlate(" + namePlateUnit.DisplayName + ")"); NamePlateController namePlate = objectPooler.GetPooledObject(namePlatePrefab, namePlateContainer).GetComponent <NamePlateController>(); namePlate.Configure(systemGameManager); namePlates.Add(namePlateUnit, namePlate); namePlate.SetNamePlateUnit(namePlateUnit, usePositionOffset); // testing - so nameplates spawned after setting target don't end up in front of the target namePlate.transform.SetAsFirstSibling(); return(namePlate); }
public void ShowSkillsCommon(SkillTrainerComponent skillTrainer) { //Debug.Log("SkillTrainerUI.ShowSkillsCommon(" + skillTrainer.name + ")"); ClearSkills(); SkillTrainerSkillScript firstAvailableSkill = null; foreach (Skill skill in skillTrainer.Props.Skills) { if (!playerManager.MyCharacter.CharacterSkillManager.HasSkill(skill)) { GameObject go = objectPooler.GetPooledObject(skillPrefab, availableArea.transform); SkillTrainerSkillScript qs = go.GetComponent <SkillTrainerSkillScript>(); qs.Configure(systemGameManager); qs.Text.text = skill.DisplayName; qs.Text.color = Color.white; qs.SetSkill(this, skill); skillScripts.Add(qs); skills.Add(skill); uINavigationControllers[0].AddActiveButton(qs); if (firstAvailableSkill == null) { firstAvailableSkill = qs; } } } if (firstAvailableSkill == null) { // no available skills anymore, close window uIManager.skillTrainerWindow.CloseWindow(); } if (selectedSkillTrainerSkillScript == null && firstAvailableSkill != null) { //firstAvailableSkill.Select(); uINavigationControllers[0].FocusFirstButton(); } SetNavigationController(uINavigationControllers[0]); }
public void ShowAudioProfilesCommon(MusicPlayerComponent musicPlayer) { //Debug.Log("MusicPlayerUI.ShowAudioProfilesCommon()"); ClearMusicProfiles(); MusicPlayerHighlightButton firstAvailableAudioProfile = null; foreach (AudioProfile audioProfile in musicPlayer.Props.AudioProfileList) { GameObject go = objectPooler.GetPooledObject(highlightButtonPrefab, availableArea.transform); MusicPlayerHighlightButton qs = go.GetComponent <MusicPlayerHighlightButton>(); qs.Configure(systemGameManager); qs.Text.text = audioProfile.DisplayName; qs.Text.color = Color.white; qs.SetMusicProfile(this, audioProfile); musicPlayerHighlightButtons.Add(qs); audioProfileList.Add(audioProfile); uINavigationControllers[0].AddActiveButton(qs); if (firstAvailableAudioProfile == null) { firstAvailableAudioProfile = qs; } } if (firstAvailableAudioProfile == null) { // no available skills anymore, close window uIManager.musicPlayerWindow.CloseWindow(); } //if (SelectedMusicPlayerHighlightButton == null && firstAvailableAudioProfile != null) { if (firstAvailableAudioProfile != null) { //firstAvailableAudioProfile.Select(); uINavigationControllers[0].FocusFirstButton(); } }
public void ShowOptionButtons() { //Debug.Log("NewGameMecanimCharacterPanelController.ShowOptionButtons()"); ClearOptionButtons(); for (int i = 0; i < newGameManager.UnitProfileList.Count; i++) { //Debug.Log("NewGameMecanimCharacterPanelController.ShowOptionButtonsCommon(): found valid unit profile: " + unitProfile.DisplayName); GameObject go = objectPooler.GetPooledObject(buttonPrefab, buttonArea.transform); NewGameUnitButton optionButton = go.GetComponent <NewGameUnitButton>(); optionButton.Configure(systemGameManager); optionButton.AddUnitProfile(newGameManager.UnitProfileList[i]); optionButtons.Add(optionButton); uINavigationControllers[0].AddActiveButton(optionButton); } /* * if (optionButtons.Count > 0) { * SetNavigationController(uINavigationControllers[0]); * } */ }
public void ShowQuestsCommon() { //Debug.Log("QuestTrackerUI.ShowQuestsCommon()"); if (playerManager != null && playerManager.PlayerUnitSpawned == false) { // shouldn't be doing anything without a player spawned. return; } ClearQuests(); foreach (Quest quest in questLog.Quests.Values) { //Debug.Log("QuestTrackerUI.ShowQuestsCommon(): quest: " + quest); GameObject go = objectPooler.GetPooledObject(questPrefab, questParent); QuestTrackerQuestScript qs = go.GetComponent <QuestTrackerQuestScript>(); qs.Configure(systemGameManager); qs.Quest = quest; if (qs == null) { //Debug.Log("QuestTrackerUI.ShowQuestsCommon(): QuestGiverQuestScript is null"); } qs.Text.text = "[" + quest.ExperienceLevel + "] " + quest.DisplayName; if (quest.IsComplete) { qs.Text.text += " (Complete)"; } string objectives = string.Empty; qs.Text.text += "\n<size=12>" + quest.GetUnformattedObjectiveList() + "</size>"; //Debug.Log("QuestTrackerUI.ShowQuestsCommon(" + questGiver.name + "): " + questNode.MyQuest.MyTitle); qs.Text.color = LevelEquations.GetTargetColor(playerManager.MyCharacter.CharacterStats.Level, quest.ExperienceLevel); //quests.Add(go); questScripts.Add(qs); uINavigationControllers[0].AddActiveButton(qs); } }
public void SpawnEquipmentObjects(EquipmentSlotProfile equipmentSlotProfile, Equipment newEquipment) { //Debug.Log(unitController.gameObject.name + ".MecanimModelController.SpawnEquipmentObjects()"); if (newEquipment == null || newEquipment.HoldableObjectList == null || newEquipment.HoldableObjectList.Count == 0 || equipmentSlotProfile == null) { //Debug.Log("CharacterEquipmentManager.SpawnEquipmentObjects() : FAILED TO SPAWN OBJECTS"); return; } //Dictionary<PrefabProfile, GameObject> holdableObjects = new Dictionary<PrefabProfile, GameObject>(); Dictionary <AttachmentNode, GameObject> holdableObjects = new Dictionary <AttachmentNode, GameObject>(); foreach (HoldableObjectAttachment holdableObjectAttachment in newEquipment.HoldableObjectList) { if (holdableObjectAttachment != null && holdableObjectAttachment.MyAttachmentNodes != null) { foreach (AttachmentNode attachmentNode in holdableObjectAttachment.MyAttachmentNodes) { if (attachmentNode != null && attachmentNode.MyEquipmentSlotProfile != null && equipmentSlotProfile == attachmentNode.MyEquipmentSlotProfile) { //CreateComponentReferences(); if (attachmentNode.HoldableObject != null && attachmentNode.HoldableObject.Prefab != null) { //Debug.Log("EquipmentManager.HandleWeaponSlot(): " + newItem.name + " has a physical prefab"); // attach a mesh to a bone for weapons AttachmentPointNode attachmentPointNode = GetSheathedAttachmentPointNode(attachmentNode); if (attachmentPointNode != null) { Transform targetBone = unitController.gameObject.transform.FindChildByRecursive(attachmentPointNode.TargetBone); if (targetBone != null) { //Debug.Log(unitController.gameObject.name + ".MecanimModelController.SpawnEquipmentObjects(): " + newEquipment.name + " has a physical prefab. targetbone is not null: equipSlot: " + newEquipment.EquipmentSlotType.DisplayName); GameObject newEquipmentPrefab = objectPooler.GetPooledObject(attachmentNode.HoldableObject.Prefab, targetBone); //holdableObjects.Add(attachmentNode.MyHoldableObject, newEquipmentPrefab); holdableObjects.Add(attachmentNode, newEquipmentPrefab); //currentEquipmentPhysicalObjects[equipmentSlotProfile] = newEquipmentPrefab; newEquipmentPrefab.transform.localScale = attachmentNode.HoldableObject.Scale; if (unitController?.CharacterUnit?.BaseCharacter.CharacterCombat != null && unitController?.CharacterUnit?.BaseCharacter.CharacterCombat.GetInCombat() == true) { HoldObject(newEquipmentPrefab, attachmentNode, unitController.gameObject); } else { SheathObject(newEquipmentPrefab, attachmentNode, unitController.gameObject); } } else { Debug.Log("CharacterEquipmentManager.SpawnEquipmentObjects(). We could not find the target bone " + attachmentPointNode.TargetBone + " when trying to Equip " + newEquipment.DisplayName); } } } } } } } if (holdableObjects.Count > 0) { currentEquipmentPhysicalObjects[equipmentSlotProfile] = holdableObjects; } }
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 ShowInteractablesCommon(Interactable interactable, bool suppressAutoInteract = false) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + ")"); ClearButtons(); // updated to only use valid interactables if (playerManager.PlayerUnitSpawned == false) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + ") player unit is null"); return; } List <InteractableOptionComponent> currentInteractables = interactable.GetCurrentInteractables(); if (currentInteractables.Count == 0) { // this could have been a refresh from while a quest was open overtop. close it if there are no valid interactables uIManager.interactionWindow.CloseWindow(); return; } // going to just pop the first available interaction window for now and see how that feels //bool optionOpened = false; foreach (InteractableOptionComponent _interactable in currentInteractables) { // handle questgiver if (_interactable is QuestGiverComponent) { foreach (QuestNode questNode in (_interactable as QuestGiverComponent).Props.Quests) { Quest quest = questNode.Quest; if (quest != null) { string displayText = string.Empty; string questStatus = quest.GetStatus(); if (questStatus == "complete" && questNode.EndQuest == true) { displayText = "<color=yellow>?</color> "; } else if (questNode.StartQuest == true && questStatus == "available") { displayText = "<color=yellow>!</color> "; } // only display complete and available quests here if (displayText != string.Empty) { GameObject go = objectPooler.GetPooledObject(questPrefab, availableQuestArea.transform); InteractionPanelQuestScript qs = go.GetComponent <InteractionPanelQuestScript>(); qs.Configure(systemGameManager); qs.Quest = quest; qs.QuestGiver = (_interactable as QuestGiverComponent); displayText += quest.DisplayName; qs.Text.text = displayText; //Debug.Log("QuestTrackerUI.ShowQuestsCommon(" + questGiver.name + "): " + questNode.MyQuest.MyTitle); qs.Text.color = LevelEquations.GetTargetColor(playerManager.MyCharacter.CharacterStats.Level, quest.ExperienceLevel); questScripts.Add(qs); // disabled this next bit because it was causing repeatables with no objectives to be marked as complete /* * if (quest.IsComplete && !quest.TurnedIn) { * go.transform.SetParent(completeQuestArea.transform); * } else if (!quest.IsComplete && questLog.HasQuest(quest.DisplayName) == false) { * go.transform.SetParent(availableQuestArea.transform); * } */ } } } } else { // this block used to be outside the else statement, but for now we don't want quests to show as an interaction option because they are handled separately above // handle generic stuff if (_interactable.DisplayName != null && _interactable.DisplayName != string.Empty && _interactable.GetCurrentOptionCount() > 0) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Instantiating button"); for (int i = 0; i < _interactable.GetCurrentOptionCount(); i++) { GameObject go = objectPooler.GetPooledObject(interactableButtonPrefab, interactableButtonParent); InteractionPanelScript iPS = go.GetComponent <InteractionPanelScript>(); if (iPS != null) { iPS.Configure(systemGameManager); iPS.Setup(_interactable, i); interactionPanelScripts.Add(iPS); } } } } } foreach (InteractionPanelQuestScript questScript in questScripts) { uINavigationControllers[0].AddActiveButton(questScript); } foreach (InteractionPanelScript interactionPanelScript in interactionPanelScripts) { uINavigationControllers[0].AddActiveButton(interactionPanelScript); } uINavigationControllers[0].FocusFirstButton(); if (uIManager.dialogWindow.IsOpen) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Dialog Window is open, returning to prevent other windows from popping"); // if we are mid dialog, we don't want to pop another window yet return; } // priority open - any other current interactable third, but only if there is one if (currentInteractables.Count > 1 || suppressAutoInteract == true || uINavigationControllers[0].ActiveNavigableButtonCount > 1) { //Debug.Log("InteractionPanelUI.Interact(): currentInteractables count: " + currentInteractables.Count); return; } // priority open - completed quest first foreach (InteractionPanelQuestScript questScript in questScripts) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Checking questScript for complete quest"); if (questScript.Quest.MarkedComplete) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Checking questScript: quest is complete, selecting"); questScript.Interact(); //optionOpened = true; return; } } // priority open - available quest second foreach (InteractionPanelQuestScript questScript in questScripts) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Checking questScript for available quest"); if (questScript.Quest.GetStatus() == "available") { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Checking questScript: quest is available, selecting"); questScript.Interact(); //optionOpened = true; return; } } foreach (InteractionPanelScript interactionPanelScript in interactionPanelScripts) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Checking interaction Panel Script"); if (interactionPanelScript.InteractableOption.CanInteract() && interactionPanelScript.InteractableOption.GetCurrentOptionCount() == 1) { //Debug.Log("InteractionPanelUI.ShowInteractablesCommon(" + interactable.name + "): Checking interaction Panel Script: canInteract is TRUE!!!"); interactionPanelScript.InteractableOption.Interact(playerManager.UnitController.CharacterUnit); //optionOpened = true; return; } } }