private void ShowNavigation() { ClearContainer(); var container = _resourcePreloader.InstanceScene <DialogueOptionsContainer>(); _dialogueContent.AddChild(container); container.LoadOptions(_activeDialogueComponent.GetValidDialogueItems()); container.SetIntroductionText(_activeDialogueComponent.Introduction); container.Connect(nameof(DialogueOptionsContainer.DialogueOptionSelected), this, nameof(OnDialogueOptionSelected)); }
private QuestTrackItem AttachQuest(Quest quest, string modelId) { var item = _resourcePreloader.InstanceScene <QuestTrackItem>(); AddChild(item); item.SetQuest(quest, modelId); return(item); }
private void ShowTurnInRequirements(QuestEventModel questEventModel) { var quest = QuestTracker.GetActiveQuestContainingModelId(questEventModel.Id); var rewards = quest.GetRewards(questEventModel.Id); foreach (var child in _rewardsContainer.GetChildren <Node>()) { if (child is InventoryCell) { child.GetParent().RemoveChild(child); child.QueueFree(); } } foreach (var child in _requirementsContainer.GetChildren <Node>()) { if (child is InventoryCell) { child.GetParent().RemoveChild(child); child.QueueFree(); } } var requirementCell = _resourcePreloader.InstanceScene <InventoryCell>(); requirementCell.SizeFlagsHorizontal = (int)SizeFlags.ShrinkCenter; _requirementsContainer.AddChild(requirementCell); var requirementItem = InventoryItem.FromItemId(questEventModel.ItemId); requirementItem.Amount = questEventModel.Required; requirementCell.SetInventoryItem(requirementItem); foreach (var reward in rewards) { var rewardCell = _resourcePreloader.InstanceScene <InventoryCell>(); rewardCell.SizeFlagsHorizontal = (int)SizeFlags.ShrinkCenter; _rewardsContainer.AddChild(rewardCell); var item = InventoryItem.FromItemId(reward.ItemId); item.Amount = reward.Amount; rewardCell.SetInventoryItem(item); } }
private void CreateInventoryCells() { for (int i = 0; i < PlayerInventory.Items.Count; i++) { var inventoryCell = _resourcePreloader.InstanceScene <InventoryCell>(); _gridContainer.AddChild(inventoryCell); inventoryCell.Connect(nameof(InventoryCell.Selected), this, nameof(OnCellSelected), new Godot.Collections.Array() { i }); } }
public void LoadOptions(List <DialogueItem> items) { for (int i = 0; i < items.Count; i++) { var button = _resourcePreloader.InstanceScene <DialogueOptionButton>(); button.Text = items[i].Title; _container.AddChild(button); button.Connect("pressed", this, nameof(OnButtonPressed), new Godot.Collections.Array() { items[i] }); if (i % 2 == 0) { button.OffsetAnimation(); } } }
private QuestEventNode GetQuestEventNodeFromGuid(string guid) { switch (guid) { case GameEventDispatcher.PLAYER_INVENTORY_ITEM_UPDATED: return(_resourcePreloader.InstanceScene <QuestEventPlayerInventoryItemAdded>()); case GameEventDispatcher.ENTITY_KILLED: return(_resourcePreloader.InstanceScene <QuestEventEntityKilled>()); case GameEventDispatcher.ITEM_TURNED_IN: return(_resourcePreloader.InstanceScene <QuestEventItemTurnedIn>()); case GameEventDispatcher.ENTITY_ENGAGED: return(_resourcePreloader.InstanceScene <QuestEventEntityEngaged>()); } return(null); }