Additional in progress changes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cb86dpkft2m03"
|
||||
path.bptc="res://.godot/imported/Kubel.png-c9f101c338fbe11a0030ed91a86239ab.bptc.ctex"
|
||||
path.bptc="res://.godot/imported/KUBEL.PNG-bd6eff6ed8307de491529365dab55876.bptc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
@@ -11,8 +11,8 @@ metadata={
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/items/weapons/textures/Kubel.png"
|
||||
dest_files=["res://.godot/imported/Kubel.png-c9f101c338fbe11a0030ed91a86239ab.bptc.ctex"]
|
||||
source_file="res://src/items/weapons/textures/KUBEL.PNG"
|
||||
dest_files=["res://.godot/imported/KUBEL.PNG-bd6eff6ed8307de491529365dab55876.bptc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -336,7 +336,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
PersuaderCrosshair.Hide();
|
||||
}
|
||||
|
||||
public void ApplyNewAugment(Jewel jewel, IAugmentableItem augmentableItem)
|
||||
public void ApplyNewAugment(IAugmentItem jewel, IAugmentableItem augmentableItem)
|
||||
{
|
||||
Inventory.Remove(jewel);
|
||||
|
||||
|
||||
96
Zennysoft.Game.Ma/src/ui/inventory_menu/ActionPanel.cs
Normal file
96
Zennysoft.Game.Ma/src/ui/inventory_menu/ActionPanel.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ActionPanel : Panel
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
private IBaseInventoryItem _currentlySelected;
|
||||
|
||||
[Dependency] private IPlayer _player => this.DependOn<IPlayer>();
|
||||
|
||||
[Node] public Button InteractButton { get; set; }
|
||||
|
||||
[Node] public Button ThrowButton { get; set; }
|
||||
|
||||
[Node] public Button DropButton { get; set; }
|
||||
|
||||
public event Action ActionPanelClosing;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
InteractButton.Pressed += InteractButton_Pressed;
|
||||
ThrowButton.Pressed += ThrowButton_Pressed;
|
||||
DropButton.Pressed += DropButton_Pressed;
|
||||
}
|
||||
|
||||
public void ShowPanel(IBaseInventoryItem selectedItem)
|
||||
{
|
||||
_currentlySelected = selectedItem;
|
||||
SetOptions(selectedItem);
|
||||
Show();
|
||||
}
|
||||
|
||||
public void FocusActionPanel()
|
||||
{
|
||||
InteractButton.GrabFocus();
|
||||
}
|
||||
private void InteractButton_Pressed()
|
||||
{
|
||||
if (_currentlySelected is IEquipableItem equipable)
|
||||
PerformAction(equipable);
|
||||
_currentlySelected = null;
|
||||
ActionPanelClosing?.Invoke();
|
||||
}
|
||||
|
||||
private void ThrowButton_Pressed()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private void DropButton_Pressed()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private void SetOptions(IBaseInventoryItem item)
|
||||
{
|
||||
SetOptionsInternal((dynamic)item);
|
||||
}
|
||||
|
||||
private void SetOptionsInternal(IEquipableItem equipable)
|
||||
{
|
||||
InteractButton.Text = _player.EquipmentComponent.IsItemEquipped(equipable) ? "Unequip" : "Equip";
|
||||
InteractButton.Disabled = equipable.Glued;
|
||||
ThrowButton.Disabled = equipable.Glued;
|
||||
DropButton.Disabled = equipable.Glued;
|
||||
}
|
||||
|
||||
private void SetOptionsInternal(IAugmentItem equipable)
|
||||
{
|
||||
InteractButton.Text = "Augment";
|
||||
}
|
||||
|
||||
private void SetOptionsInternal(IBaseInventoryItem baseItem)
|
||||
{
|
||||
InteractButton.Text = "Use";
|
||||
}
|
||||
|
||||
private void PerformAction(IEquipableItem equipable)
|
||||
{
|
||||
if (_player.EquipmentComponent.IsItemEquipped(equipable))
|
||||
{
|
||||
_player.EquipmentComponent.Unequip(equipable);
|
||||
SfxDatabase.Instance.Play(SoundEffect.Unequip);
|
||||
}
|
||||
else
|
||||
{
|
||||
_player.EquipmentComponent.Equip(equipable);
|
||||
SfxDatabase.Instance.Play(SoundEffect.Equip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dmbykkr6oev1q
|
||||
112
Zennysoft.Game.Ma/src/ui/inventory_menu/ActionPanel.tscn
Normal file
112
Zennysoft.Game.Ma/src/ui/inventory_menu/ActionPanel.tscn
Normal file
@@ -0,0 +1,112 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b648lhohtue70"]
|
||||
|
||||
[ext_resource type="StyleBox" uid="uid://bxuy4tnftibfq" path="res://src/options/SelectedOptionsBox.tres" id="1_kxuil"]
|
||||
[ext_resource type="Script" uid="uid://dmbykkr6oev1q" path="res://src/ui/inventory_menu/ActionPanel.cs" id="1_r13ox"]
|
||||
[ext_resource type="StyleBox" uid="uid://bl15q835s4ene" path="res://src/options/UnselectedOptionsBox.tres" id="2_r13ox"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g7ag1"]
|
||||
bg_color = Color(0, 0, 0, 0.745098)
|
||||
|
||||
[node name="ActionPanel" type="Panel"]
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
focus_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_g7ag1")
|
||||
script = ExtResource("1_r13ox")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
border_width = 2.0
|
||||
editor_only = false
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="InteractButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../ThrowButton")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
theme_override_styles/focus = ExtResource("1_kxuil")
|
||||
theme_override_styles/disabled_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/disabled = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_pressed_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_pressed = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover = ExtResource("2_r13ox")
|
||||
theme_override_styles/pressed_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/pressed = ExtResource("2_r13ox")
|
||||
theme_override_styles/normal_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/normal = ExtResource("2_r13ox")
|
||||
text = "Interact"
|
||||
alignment = 0
|
||||
|
||||
[node name="ThrowButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../InteractButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../DropButton")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
theme_override_styles/focus = ExtResource("1_kxuil")
|
||||
theme_override_styles/disabled_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/disabled = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_pressed_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_pressed = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover = ExtResource("2_r13ox")
|
||||
theme_override_styles/pressed_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/pressed = ExtResource("2_r13ox")
|
||||
theme_override_styles/normal_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/normal = ExtResource("2_r13ox")
|
||||
text = "Throw"
|
||||
alignment = 0
|
||||
|
||||
[node name="DropButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../ThrowButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath(".")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
theme_override_styles/focus = ExtResource("1_kxuil")
|
||||
theme_override_styles/disabled_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/disabled = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_pressed_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_pressed = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/hover = ExtResource("2_r13ox")
|
||||
theme_override_styles/pressed_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/pressed = ExtResource("2_r13ox")
|
||||
theme_override_styles/normal_mirrored = ExtResource("2_r13ox")
|
||||
theme_override_styles/normal = ExtResource("2_r13ox")
|
||||
text = "Drop"
|
||||
alignment = 0
|
||||
@@ -8,11 +8,11 @@ public interface IItemSlot : IControl
|
||||
{
|
||||
public AutoProp<IBaseInventoryItem> Item { get; }
|
||||
|
||||
public void SetItemEquipmentStatus(bool isEquipped);
|
||||
public void SetEmpty();
|
||||
|
||||
public void SetAugmentStatus(bool isAugmented);
|
||||
public void SetItemToSlot(IBaseInventoryItem item);
|
||||
|
||||
public void SetItemCount(int count);
|
||||
public void FocusItem();
|
||||
|
||||
public event Action<IItemSlot> ItemPressed;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using Zennysoft.Game.Ma;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
@@ -24,33 +23,59 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
|
||||
[Node] public Label ItemStats { get; set; }
|
||||
|
||||
[Node] public Button InteractButton { get; set; }
|
||||
|
||||
[Node] public Button ThrowButton { get; set; }
|
||||
|
||||
[Node] public Button DropButton { get; set; }
|
||||
|
||||
[Node] public Control ActionPanel { get; set; }
|
||||
[Node] public ActionPanel ActionPanel { get; set; }
|
||||
|
||||
[Node] public VBoxContainer Inventory { get; set; }
|
||||
|
||||
private List<IItemSlot> ItemSlots;
|
||||
|
||||
private IItemSlot _currentlySelected;
|
||||
|
||||
private bool _augmentMode = false;
|
||||
|
||||
private Jewel _augmentingJewel;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
ItemSlots = [];
|
||||
ItemSlots = [.. Inventory.GetChildren().OfType<IItemSlot>()];
|
||||
ItemSlots.ForEach(x => x.ItemPressed += ItemPressed);
|
||||
ItemSlots.ForEach(x => x.ItemSelected += ItemSelected);
|
||||
VisibilityChanged += ResetInventoryState;
|
||||
InteractButton.Pressed += InteractButton_Pressed;
|
||||
ThrowButton.Pressed += ThrowButton_Pressed;
|
||||
DropButton.Pressed += DropButton_Pressed;
|
||||
ActionPanel.ActionPanelClosing += ActionPanel_ActionPanelClosing;
|
||||
}
|
||||
|
||||
private void ItemPressed(IItemSlot selectedItem)
|
||||
{
|
||||
ActionPanel.ShowPanel(selectedItem.Item.Value);
|
||||
ActionPanel.FocusActionPanel();
|
||||
}
|
||||
|
||||
private void ItemSelected(IItemSlot selectedItem)
|
||||
{
|
||||
ItemName.Text = selectedItem.Item.Value.ItemName;
|
||||
ItemFlavor.Text = selectedItem.Item.Value.Description;
|
||||
}
|
||||
|
||||
private void ResetInventoryState()
|
||||
{
|
||||
var inventory = _player.Inventory.Items;
|
||||
ItemSlots.ForEach(x => x.SetEmpty());
|
||||
|
||||
for (var i = 0; i < inventory.Count; i++)
|
||||
ItemSlots[i].SetItemToSlot(inventory[i]);
|
||||
|
||||
if (inventory.Any())
|
||||
ItemSlots.First().FocusItem();
|
||||
}
|
||||
|
||||
private void ActionPanel_ActionPanelClosing()
|
||||
{
|
||||
ActionPanel.Hide();
|
||||
ResetInventoryState();
|
||||
}
|
||||
|
||||
private void Slot_FocusEntered(IItemSlot slot)
|
||||
{
|
||||
var item = slot.Item.Value;
|
||||
ItemName.Text = item.ItemName;
|
||||
ItemFlavor.Text = item.Description;
|
||||
}
|
||||
|
||||
|
||||
private void InteractButton_Pressed()
|
||||
{
|
||||
//if (_currentlySelected != null)
|
||||
@@ -157,127 +182,64 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
|
||||
private void Slot_ItemPressed(IItemSlot slot)
|
||||
{
|
||||
var item = slot.Item.Value;
|
||||
//var item = slot.Item.Value;
|
||||
|
||||
InteractButton.Disabled = false;
|
||||
ThrowButton.Disabled = false;
|
||||
DropButton.Disabled = false;
|
||||
InteractButton.FocusMode = FocusModeEnum.All;
|
||||
ThrowButton.FocusMode = FocusModeEnum.All;
|
||||
DropButton.FocusMode = FocusModeEnum.All;
|
||||
//InteractButton.Disabled = false;
|
||||
//ThrowButton.Disabled = false;
|
||||
//DropButton.Disabled = false;
|
||||
//InteractButton.FocusMode = FocusModeEnum.All;
|
||||
//ThrowButton.FocusMode = FocusModeEnum.All;
|
||||
//DropButton.FocusMode = FocusModeEnum.All;
|
||||
|
||||
if (_augmentMode)
|
||||
{
|
||||
InteractButton.Text = "Augment";
|
||||
ThrowButton.Disabled = true;
|
||||
DropButton.Disabled = true;
|
||||
InteractButton.GrabFocus();
|
||||
}
|
||||
else if (item is IEquipableItem equipable)
|
||||
{
|
||||
var itemIsEquipped = _player.EquipmentComponent.IsItemEquipped(equipable);
|
||||
InteractButton.Text = itemIsEquipped ? "Unequip" : "Equip";
|
||||
ThrowButton.Disabled = itemIsEquipped;
|
||||
ThrowButton.FocusMode = itemIsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||
DropButton.Disabled = itemIsEquipped;
|
||||
DropButton.FocusMode = itemIsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||
InteractButton.GrabFocus();
|
||||
|
||||
if ((item is Weapon weapon && _player.EquipmentComponent.EquippedWeapon.Value.Glued) ||
|
||||
(item is Armor && _player.EquipmentComponent.EquippedArmor.Value.Glued) ||
|
||||
(item is Accessory && _player.EquipmentComponent.EquippedAccessory.Value.Glued))
|
||||
{
|
||||
InteractButton.Disabled = true;
|
||||
InteractButton.FocusMode = FocusModeEnum.None;
|
||||
ThrowButton.GrabFocus();
|
||||
}
|
||||
}
|
||||
else if (item is Plastique plastique)
|
||||
{
|
||||
InteractButton.Text = "Set";
|
||||
InteractButton.GrabFocus();
|
||||
}
|
||||
else if (item is ThrowableItem throwable)
|
||||
{
|
||||
InteractButton.Disabled = true;
|
||||
InteractButton.FocusMode = FocusModeEnum.None;
|
||||
ThrowButton.GrabFocus();
|
||||
}
|
||||
else if (item is Jewel jewel)
|
||||
{
|
||||
InteractButton.Text = "Augment";
|
||||
InteractButton.GrabFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
InteractButton.Text = "Use";
|
||||
InteractButton.GrabFocus();
|
||||
}
|
||||
|
||||
ActionPanel.Show();
|
||||
}
|
||||
|
||||
private void ResetInventoryState()
|
||||
{
|
||||
var inventory = _player.Inventory.Items;
|
||||
foreach (var item in inventory)
|
||||
{
|
||||
var itemSlot = new ItemSlot();
|
||||
Inventory.AddChild(itemSlot);
|
||||
itemSlot.Item.OnNext(item);
|
||||
ItemSlots.Add(itemSlot);
|
||||
}
|
||||
//foreach (var item in ItemSlots)
|
||||
//if (_augmentMode)
|
||||
//{
|
||||
// item.Hide();
|
||||
// item.Disabled = true;
|
||||
// item.FocusMode = FocusModeEnum.None;
|
||||
// InteractButton.Text = "Augment";
|
||||
// ThrowButton.Disabled = true;
|
||||
// DropButton.Disabled = true;
|
||||
// InteractButton.GrabFocus();
|
||||
//}
|
||||
|
||||
//foreach (var item in ItemCountLabels)
|
||||
// item.Text = string.Empty;
|
||||
|
||||
//ItemName.Text = string.Empty;
|
||||
//ItemFlavor.Text = string.Empty;
|
||||
//ItemStats.Text = string.Empty;
|
||||
|
||||
|
||||
//for (var i = 0; i < _player.Inventory.Items.Count; i++)
|
||||
//else if (item is IEquipableItem equipable)
|
||||
//{
|
||||
// var item = _player.Inventory.Items[i];
|
||||
// ItemSlots[i].Item.OnNext(item);
|
||||
// ItemSlots[i].Show();
|
||||
// ItemSlots[i].SetItemEquipmentStatus(_player.EquipmentComponent.IsItemEquipped(item));
|
||||
// if (item is IStackable stackable)
|
||||
// ItemCountLabels[i].Text = $"x{stackable.Count.Value:D2}";
|
||||
// var itemIsEquipped = _player.EquipmentComponent.IsItemEquipped(equipable);
|
||||
// InteractButton.Text = itemIsEquipped ? "Unequip" : "Equip";
|
||||
// ThrowButton.Disabled = itemIsEquipped;
|
||||
// ThrowButton.FocusMode = itemIsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||
// DropButton.Disabled = itemIsEquipped;
|
||||
// DropButton.FocusMode = itemIsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||
// InteractButton.GrabFocus();
|
||||
|
||||
// if (item is EquipableItem equipable && equipable.Glued)
|
||||
// if ((item is Weapon weapon && _player.EquipmentComponent.EquippedWeapon.Value.Glued) ||
|
||||
// (item is Armor && _player.EquipmentComponent.EquippedArmor.Value.Glued) ||
|
||||
// (item is Accessory && _player.EquipmentComponent.EquippedAccessory.Value.Glued))
|
||||
// {
|
||||
// ItemSlots[i].FocusMode = FocusModeEnum.None;
|
||||
// ItemSlots[i].Disabled = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ItemSlots[i].FocusMode = FocusModeEnum.All;
|
||||
// ItemSlots[i].Disabled = false;
|
||||
// InteractButton.Disabled = true;
|
||||
// InteractButton.FocusMode = FocusModeEnum.None;
|
||||
// ThrowButton.GrabFocus();
|
||||
// }
|
||||
//}
|
||||
//else if (item is Plastique plastique)
|
||||
//{
|
||||
// InteractButton.Text = "Set";
|
||||
// InteractButton.GrabFocus();
|
||||
//}
|
||||
//else if (item is ThrowableItem throwable)
|
||||
//{
|
||||
// InteractButton.Disabled = true;
|
||||
// InteractButton.FocusMode = FocusModeEnum.None;
|
||||
// ThrowButton.GrabFocus();
|
||||
//}
|
||||
//else if (item is Jewel jewel)
|
||||
//{
|
||||
// InteractButton.Text = "Augment";
|
||||
// InteractButton.GrabFocus();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// InteractButton.Text = "Use";
|
||||
// InteractButton.GrabFocus();
|
||||
//}
|
||||
|
||||
//if (_currentlySelected == null || _currentlySelected.Disabled || _currentlySelected.FocusMode == FocusModeEnum.None)
|
||||
// _currentlySelected = ItemSlots.FirstOrDefault(x => !x.Disabled);
|
||||
|
||||
//if (_currentlySelected != null)
|
||||
// _currentlySelected.GrabFocus();
|
||||
}
|
||||
|
||||
private void Slot_FocusEntered(IItemSlot slot)
|
||||
{
|
||||
if (_currentlySelected.Item.Value == null)
|
||||
return;
|
||||
_currentlySelected = slot;
|
||||
var item = slot.Item.Value;
|
||||
ItemName.Text = item.ItemName;
|
||||
ItemFlavor.Text = item.Description;
|
||||
//ActionPanel.Show();
|
||||
}
|
||||
|
||||
private void AugmentMode(Jewel jewel)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://c3e6hbctay1us"]
|
||||
[gd_scene load_steps=19 format=3 uid="uid://cbxw70qa7gifp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://yh8qxmn058w2" path="res://src/ui/inventory_menu/InventoryMenu.cs" id="1_unikd"]
|
||||
[ext_resource type="FontFile" uid="uid://beh6d5lo5ihq0" path="res://src/ui/fonts/georgiai.ttf" id="2_7co7g"]
|
||||
[ext_resource type="PackedScene" uid="uid://b648lhohtue70" path="res://src/ui/inventory_menu/ActionPanel.tscn" id="3_7co7g"]
|
||||
[ext_resource type="StyleBox" uid="uid://bxuy4tnftibfq" path="res://src/options/SelectedOptionsBox.tres" id="3_b6rkr"]
|
||||
[ext_resource type="StyleBox" uid="uid://bl15q835s4ene" path="res://src/options/UnselectedOptionsBox.tres" id="4_l0byb"]
|
||||
[ext_resource type="FontFile" uid="uid://0syyay37admf" path="res://src/ui/fonts/georgiab.ttf" id="6_ldqki"]
|
||||
[ext_resource type="PackedScene" uid="uid://c005nd0m2eim" path="res://src/ui/inventory_menu/ItemSlot.tscn" id="6_unikd"]
|
||||
[ext_resource type="LabelSettings" uid="uid://b6f8ggy3ulonb" path="res://src/ui/label_settings/GeorgiaItalic.tres" id="7_we8a6"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7co7g"]
|
||||
@@ -21,13 +23,12 @@ bg_color = Color(0, 0, 0, 0.745098)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ejvue"]
|
||||
line_spacing = 1.0
|
||||
font = ExtResource("2_7co7g")
|
||||
font = ExtResource("6_ldqki")
|
||||
font_size = 50
|
||||
outline_size = 3
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g7ag1"]
|
||||
bg_color = Color(0, 0, 0, 0.745098)
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_aiji3"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7co7g"]
|
||||
bg_color = Color(0, 0, 0, 0.745098)
|
||||
@@ -79,13 +80,8 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_unikd")
|
||||
[node name="TitlePanelContainer" type="PanelContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||
custom_minimum_size = Vector2(400, 100)
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 40.0
|
||||
grow_horizontal = 2
|
||||
offset_right = 400.0
|
||||
offset_bottom = 100.0
|
||||
|
||||
[node name="InventoryTitlePanel" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel/TitlePanelContainer"]
|
||||
layout_mode = 2
|
||||
@@ -136,111 +132,12 @@ anchor_bottom = 1.0
|
||||
offset_top = -200.0
|
||||
offset_right = 200.0
|
||||
grow_vertical = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_aiji3")
|
||||
|
||||
[node name="ActionPanel" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer"]
|
||||
[node name="ActionPanel" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer" instance=ExtResource("3_7co7g")]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
focus_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_g7ag1")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer/ActionPanel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer/ActionPanel/MarginContainer"]
|
||||
layout_mode = 2
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
border_width = 2.0
|
||||
editor_only = false
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer/ActionPanel/MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer/ActionPanel/MarginContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="InteractButton" type="Button" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer/ActionPanel/MarginContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../ThrowButton")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
theme_override_styles/focus = ExtResource("3_b6rkr")
|
||||
theme_override_styles/disabled_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/disabled = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_pressed_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_pressed = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover = ExtResource("4_l0byb")
|
||||
theme_override_styles/pressed_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/pressed = ExtResource("4_l0byb")
|
||||
theme_override_styles/normal_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/normal = ExtResource("4_l0byb")
|
||||
text = "Interact"
|
||||
alignment = 0
|
||||
|
||||
[node name="ThrowButton" type="Button" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer/ActionPanel/MarginContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../InteractButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../DropButton")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
theme_override_styles/focus = ExtResource("3_b6rkr")
|
||||
theme_override_styles/disabled_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/disabled = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_pressed_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_pressed = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover = ExtResource("4_l0byb")
|
||||
theme_override_styles/pressed_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/pressed = ExtResource("4_l0byb")
|
||||
theme_override_styles/normal_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/normal = ExtResource("4_l0byb")
|
||||
text = "Throw"
|
||||
alignment = 0
|
||||
|
||||
[node name="DropButton" type="Button" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ActionPanelContainer/ActionPanel/MarginContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../ThrowButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath(".")
|
||||
theme_override_font_sizes/font_size = 25
|
||||
theme_override_styles/focus = ExtResource("3_b6rkr")
|
||||
theme_override_styles/disabled_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/disabled = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_pressed_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_pressed = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/hover = ExtResource("4_l0byb")
|
||||
theme_override_styles/pressed_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/pressed = ExtResource("4_l0byb")
|
||||
theme_override_styles/normal_mirrored = ExtResource("4_l0byb")
|
||||
theme_override_styles/normal = ExtResource("4_l0byb")
|
||||
text = "Drop"
|
||||
alignment = 0
|
||||
|
||||
[node name="ItemDescriptionPanelContainer" type="PanelContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||
custom_minimum_size = Vector2(500, 500)
|
||||
@@ -253,6 +150,10 @@ offset_right = 500.0
|
||||
offset_bottom = 250.0
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ItemDescriptionBox" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_cq2sk")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
@@ -266,41 +167,36 @@ border_color = Color(1, 1, 1, 1)
|
||||
border_width = 2.0
|
||||
editor_only = false
|
||||
|
||||
[node name="ItemDescriptionBox" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer"]
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_cq2sk")
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 20
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 20
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer/ItemDescriptionBox"]
|
||||
layout_mode = 2
|
||||
offset_left = -15.0
|
||||
offset_top = 10.0
|
||||
offset_right = 515.0
|
||||
offset_bottom = 490.0
|
||||
theme_override_constants/margin_left = 15
|
||||
theme_override_constants/margin_top = 15
|
||||
theme_override_constants/margin_right = 15
|
||||
theme_override_constants/margin_bottom = 15
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer/ItemDescriptionBox/MarginContainer2"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer2"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 50
|
||||
|
||||
[node name="ItemName" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer/ItemDescriptionBox/MarginContainer2/VBoxContainer"]
|
||||
[node name="ItemName" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer2/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Text"
|
||||
label_settings = ExtResource("7_we8a6")
|
||||
|
||||
[node name="ItemFlavor" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer/ItemDescriptionBox/MarginContainer2/VBoxContainer"]
|
||||
[node name="ItemFlavor" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer2/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(500, 150)
|
||||
layout_mode = 2
|
||||
text = "More Text"
|
||||
label_settings = ExtResource("7_we8a6")
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="ItemStats" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer/ItemDescriptionBox/MarginContainer2/VBoxContainer"]
|
||||
[node name="ItemStats" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer2/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Text Stats"
|
||||
label_settings = ExtResource("7_we8a6")
|
||||
|
||||
[node name="InventoryList" type="PanelContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||
@@ -312,9 +208,9 @@ anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -95.0
|
||||
offset_top = -365.0
|
||||
offset_top = -515.0
|
||||
offset_right = 405.0
|
||||
offset_bottom = 435.0
|
||||
offset_bottom = 510.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
@@ -329,28 +225,90 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer"]
|
||||
layout_mode = 2
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
border_width = 2.0
|
||||
editor_only = false
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer"]
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel"]
|
||||
layout_mode = 2
|
||||
offset_right = 500.0
|
||||
offset_bottom = 1050.0
|
||||
theme_override_constants/margin_left = 15
|
||||
theme_override_constants/margin_top = 15
|
||||
theme_override_constants/margin_right = 15
|
||||
theme_override_constants/margin_bottom = 15
|
||||
|
||||
[node name="Inventory" type="VBoxContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer/MarginContainer"]
|
||||
[node name="Inventory" type="VBoxContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="ItemSlot" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot2" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot3" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot4" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot5" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot6" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot7" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot8" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot9" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot10" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot11" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot12" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot13" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot14" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot15" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot16" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot17" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot18" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot19" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot20" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer2/Inventory" instance=ExtResource("6_unikd")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AugmentItemPanelContainer" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -3,6 +3,7 @@ using Chickensoft.Collections;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
@@ -35,10 +36,43 @@ public partial class ItemSlot : Control, IItemSlot
|
||||
public void OnResolved()
|
||||
{
|
||||
Item.Changed += Item_Changed;
|
||||
FocusEntered += ItemSlot_FocusEntered;
|
||||
ItemName.Pressed += ItemSlot_Pressed;
|
||||
}
|
||||
|
||||
public void SetItemToSlot(IBaseInventoryItem item)
|
||||
{
|
||||
Item.OnNext(item);
|
||||
ItemTexture.Texture = item.GetTexture();
|
||||
ItemName.Disabled = false;
|
||||
ItemName.Text = item.ItemName;
|
||||
|
||||
if (item is IStackable stackable)
|
||||
SetItemCount(stackable.Count.Value);
|
||||
|
||||
if (item is IEquipableItem equipableItem)
|
||||
{
|
||||
SetItemEquipmentStatus(_player.EquipmentComponent.IsItemEquipped(equipableItem));
|
||||
ItemName.Disabled = equipableItem.Glued;
|
||||
}
|
||||
|
||||
if (item is IAugmentableItem augmentableItem)
|
||||
SetAugmentStatus(augmentableItem.Augment != null);
|
||||
|
||||
Show();
|
||||
}
|
||||
|
||||
public void SetEmpty()
|
||||
{
|
||||
Hide();
|
||||
ItemName.Disabled = true;
|
||||
ItemName.Text = string.Empty;
|
||||
Item.Clear();
|
||||
ItemTexture.Texture = null;
|
||||
SetItemEquipmentStatus(false);
|
||||
SetAugmentStatus(false);
|
||||
SetItemCount(0);
|
||||
}
|
||||
|
||||
public void SetItemEquipmentStatus(bool isEquipped)
|
||||
{
|
||||
if (isEquipped)
|
||||
@@ -49,14 +83,14 @@ public partial class ItemSlot : Control, IItemSlot
|
||||
|
||||
public void SetAugmentStatus(bool isAugmented) => AugmentTexture.Visible = isAugmented;
|
||||
|
||||
private void ItemSlot_FocusEntered()
|
||||
public void SetItemCount(int count) => ItemCountLabel.Text = count > 0 ? $"x{count:D2}" : string.Empty;
|
||||
|
||||
public void FocusItem()
|
||||
{
|
||||
ItemName.GrabFocus();
|
||||
ItemSelected?.Invoke(this);
|
||||
}
|
||||
|
||||
public void SetItemCount(int count) => ItemCountLabel.Text = count > 0 ? count.ToString("D2") : string.Empty;
|
||||
|
||||
private void ItemSlot_Pressed()
|
||||
{
|
||||
if (Item.Value == null)
|
||||
|
||||
@@ -7,17 +7,7 @@
|
||||
[ext_resource type="FontFile" uid="uid://0syyay37admf" path="res://src/ui/fonts/georgiab.ttf" id="4_t6dim"]
|
||||
[ext_resource type="Texture2D" uid="uid://d3bx1j5irhdes" path="res://src/items/jewels/texture/Igneous Jewel.png" id="5_lt1pw"]
|
||||
|
||||
[node name="ItemSlot" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_yttxt")
|
||||
|
||||
[node name="Row" type="HBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
[node name="ItemSlot" type="HBoxContainer"]
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
@@ -25,15 +15,16 @@ offset_left = -215.0
|
||||
offset_right = 215.0
|
||||
offset_bottom = 50.0
|
||||
grow_horizontal = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 10
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
script = ExtResource("1_yttxt")
|
||||
|
||||
[node name="ItemInfo" type="HBoxContainer" parent="Row"]
|
||||
[node name="ItemInfo" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
alignment = 1
|
||||
|
||||
[node name="EquippedLabel" type="Label" parent="Row/ItemInfo"]
|
||||
[node name="EquippedLabel" type="Label" parent="ItemInfo"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(25, 50)
|
||||
layout_mode = 2
|
||||
@@ -42,16 +33,16 @@ theme_override_font_sizes/font_size = 25
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ItemTexture" type="TextureRect" parent="Row/ItemInfo"]
|
||||
[node name="ItemTexture" type="TextureRect" parent="ItemInfo"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(50, 50)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_rf22b")
|
||||
|
||||
[node name="Control" type="HBoxContainer" parent="Row/ItemInfo"]
|
||||
[node name="Control" type="HBoxContainer" parent="ItemInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemName" type="Button" parent="Row/ItemInfo/Control"]
|
||||
[node name="ItemName" type="Button" parent="ItemInfo/Control"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
@@ -71,7 +62,7 @@ theme_override_styles/normal = ExtResource("4_rf22b")
|
||||
button_mask = 0
|
||||
text = "Cross Sword"
|
||||
|
||||
[node name="AugmentTexture" type="TextureRect" parent="Row/ItemInfo/Control"]
|
||||
[node name="AugmentTexture" type="TextureRect" parent="ItemInfo/Control"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(15, 20)
|
||||
@@ -81,7 +72,7 @@ size_flags_vertical = 4
|
||||
texture = ExtResource("5_lt1pw")
|
||||
stretch_mode = 2
|
||||
|
||||
[node name="ItemCountLabel" type="Label" parent="Row"]
|
||||
[node name="ItemCountLabel" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 10
|
||||
|
||||
Reference in New Issue
Block a user