Compare commits
2 Commits
a20c80d922
...
bf6b0d50c3
| Author | SHA1 | Date | |
|---|---|---|---|
| bf6b0d50c3 | |||
| c7603a163f |
@@ -1,14 +1,14 @@
|
|||||||
[gd_resource type="Resource" script_class="WeaponStats" load_steps=3 format=3 uid="uid://db075qhmlmrcu"]
|
[gd_resource type="Resource" script_class="WeaponStats" load_steps=4 format=3 uid="uid://db075qhmlmrcu"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cc7byqeolw5y4" path="res://src/items/weapons/WeaponStats.cs" id="1_kbje7"]
|
[ext_resource type="Script" uid="uid://cc7byqeolw5y4" path="res://src/items/weapons/WeaponStats.cs" id="1_kbje7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cb86dpkft2m03" path="res://src/items/weapons/textures/KUBEL.PNG" id="1_kwtbu"]
|
[ext_resource type="Texture2D" uid="uid://bkntmni5jxfpk" path="res://src/items/weapons/textures/KUBEL.PNG" id="1_kwtbu"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://ilf2s8ct2stt" path="res://src/audio/sfx/PLAYER_slower_slash.ogg" id="1_xfglq"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_kbje7")
|
script = ExtResource("1_kbje7")
|
||||||
AttackSpeed = 1.0
|
AttackSpeed = 1.0
|
||||||
WeaponElement = 5
|
WeaponElement = 5
|
||||||
WeaponTag = 0
|
WeaponTag = 0
|
||||||
SelfDamage = 0
|
|
||||||
SoundEffect = 4
|
SoundEffect = 4
|
||||||
Name = "Kubel"
|
Name = "Kubel"
|
||||||
Description = "+9 ATK
|
Description = "+9 ATK
|
||||||
@@ -25,9 +25,8 @@ TelluricResistance = 0
|
|||||||
HydricResistance = 0
|
HydricResistance = 0
|
||||||
IgneousResistance = 0
|
IgneousResistance = 0
|
||||||
FerrumResistance = 0
|
FerrumResistance = 0
|
||||||
HolyResistance = 0
|
|
||||||
CurseResistance = 0
|
|
||||||
ThrowSpeed = 12.0
|
ThrowSpeed = 12.0
|
||||||
ThrowDamage = 5
|
ThrowDamage = 5
|
||||||
ItemTag = 0
|
ItemTag = 0
|
||||||
Texture = ExtResource("1_kwtbu")
|
Texture = ExtResource("1_kwtbu")
|
||||||
|
AudioStream = ExtResource("1_xfglq")
|
||||||
|
|||||||
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 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;
|
public event Action<IItemSlot> ItemPressed;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Chickensoft.Introspection;
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Zennysoft.Game.Implementation;
|
|
||||||
using Zennysoft.Game.Ma;
|
using Zennysoft.Game.Ma;
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
|
|
||||||
@@ -24,33 +23,59 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
|||||||
|
|
||||||
[Node] public Label ItemStats { get; set; }
|
[Node] public Label ItemStats { get; set; }
|
||||||
|
|
||||||
[Node] public Button InteractButton { get; set; }
|
[Node] public ActionPanel ActionPanel { get; set; }
|
||||||
|
|
||||||
[Node] public Button ThrowButton { get; set; }
|
|
||||||
|
|
||||||
[Node] public Button DropButton { get; set; }
|
|
||||||
|
|
||||||
[Node] public Control ActionPanel { get; set; }
|
|
||||||
|
|
||||||
[Node] public VBoxContainer Inventory { get; set; }
|
[Node] public VBoxContainer Inventory { get; set; }
|
||||||
|
|
||||||
private List<IItemSlot> ItemSlots;
|
private List<IItemSlot> ItemSlots;
|
||||||
|
|
||||||
private IItemSlot _currentlySelected;
|
|
||||||
|
|
||||||
private bool _augmentMode = false;
|
|
||||||
|
|
||||||
private Jewel _augmentingJewel;
|
|
||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
ItemSlots = [];
|
ItemSlots = [.. Inventory.GetChildren().OfType<IItemSlot>()];
|
||||||
|
ItemSlots.ForEach(x => x.ItemPressed += ItemPressed);
|
||||||
|
ItemSlots.ForEach(x => x.ItemSelected += ItemSelected);
|
||||||
VisibilityChanged += ResetInventoryState;
|
VisibilityChanged += ResetInventoryState;
|
||||||
InteractButton.Pressed += InteractButton_Pressed;
|
ActionPanel.ActionPanelClosing += ActionPanel_ActionPanelClosing;
|
||||||
ThrowButton.Pressed += ThrowButton_Pressed;
|
|
||||||
DropButton.Pressed += DropButton_Pressed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
private void InteractButton_Pressed()
|
||||||
{
|
{
|
||||||
//if (_currentlySelected != null)
|
//if (_currentlySelected != null)
|
||||||
@@ -157,127 +182,64 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
|||||||
|
|
||||||
private void Slot_ItemPressed(IItemSlot slot)
|
private void Slot_ItemPressed(IItemSlot slot)
|
||||||
{
|
{
|
||||||
var item = slot.Item.Value;
|
//var item = slot.Item.Value;
|
||||||
|
|
||||||
InteractButton.Disabled = false;
|
//InteractButton.Disabled = false;
|
||||||
ThrowButton.Disabled = false;
|
//ThrowButton.Disabled = false;
|
||||||
DropButton.Disabled = false;
|
//DropButton.Disabled = false;
|
||||||
InteractButton.FocusMode = FocusModeEnum.All;
|
//InteractButton.FocusMode = FocusModeEnum.All;
|
||||||
ThrowButton.FocusMode = FocusModeEnum.All;
|
//ThrowButton.FocusMode = FocusModeEnum.All;
|
||||||
DropButton.FocusMode = FocusModeEnum.All;
|
//DropButton.FocusMode = FocusModeEnum.All;
|
||||||
|
|
||||||
if (_augmentMode)
|
//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)
|
|
||||||
//{
|
//{
|
||||||
// item.Hide();
|
// InteractButton.Text = "Augment";
|
||||||
// item.Disabled = true;
|
// ThrowButton.Disabled = true;
|
||||||
// item.FocusMode = FocusModeEnum.None;
|
// DropButton.Disabled = true;
|
||||||
|
// InteractButton.GrabFocus();
|
||||||
//}
|
//}
|
||||||
|
//else if (item is IEquipableItem equipable)
|
||||||
//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++)
|
|
||||||
//{
|
//{
|
||||||
// var item = _player.Inventory.Items[i];
|
// var itemIsEquipped = _player.EquipmentComponent.IsItemEquipped(equipable);
|
||||||
// ItemSlots[i].Item.OnNext(item);
|
// InteractButton.Text = itemIsEquipped ? "Unequip" : "Equip";
|
||||||
// ItemSlots[i].Show();
|
// ThrowButton.Disabled = itemIsEquipped;
|
||||||
// ItemSlots[i].SetItemEquipmentStatus(_player.EquipmentComponent.IsItemEquipped(item));
|
// ThrowButton.FocusMode = itemIsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||||
// if (item is IStackable stackable)
|
// DropButton.Disabled = itemIsEquipped;
|
||||||
// ItemCountLabels[i].Text = $"x{stackable.Count.Value:D2}";
|
// 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;
|
// InteractButton.Disabled = true;
|
||||||
// ItemSlots[i].Disabled = true;
|
// InteractButton.FocusMode = FocusModeEnum.None;
|
||||||
// }
|
// ThrowButton.GrabFocus();
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// ItemSlots[i].FocusMode = FocusModeEnum.All;
|
|
||||||
// ItemSlots[i].Disabled = false;
|
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
//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)
|
//ActionPanel.Show();
|
||||||
// _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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AugmentMode(Jewel jewel)
|
private void AugmentMode(Jewel jewel)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
[gd_scene load_steps=17 format=3 uid="uid://cbxw70qa7gifp"]
|
[gd_scene load_steps=19 format=3 uid="uid://cbxw70qa7gifp"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/ui/inventory_menu/InventoryMenu2.cs" id="1_unikd"]
|
[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="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://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="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="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"]
|
[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"]
|
[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"]
|
[sub_resource type="LabelSettings" id="LabelSettings_ejvue"]
|
||||||
line_spacing = 1.0
|
line_spacing = 1.0
|
||||||
font = ExtResource("2_7co7g")
|
font = ExtResource("6_ldqki")
|
||||||
font_size = 50
|
font_size = 50
|
||||||
outline_size = 3
|
outline_size = 3
|
||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g7ag1"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_aiji3"]
|
||||||
bg_color = Color(0, 0, 0, 0.745098)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7co7g"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7co7g"]
|
||||||
bg_color = Color(0, 0, 0, 0.745098)
|
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"]
|
[node name="TitlePanelContainer" type="PanelContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||||
custom_minimum_size = Vector2(400, 100)
|
custom_minimum_size = Vector2(400, 100)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 5
|
offset_right = 400.0
|
||||||
anchor_left = 0.5
|
offset_bottom = 100.0
|
||||||
anchor_right = 0.5
|
|
||||||
offset_left = -20.0
|
|
||||||
offset_right = 20.0
|
|
||||||
offset_bottom = 40.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
|
|
||||||
[node name="InventoryTitlePanel" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel/TitlePanelContainer"]
|
[node name="InventoryTitlePanel" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel/TitlePanelContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -136,111 +132,12 @@ anchor_bottom = 1.0
|
|||||||
offset_top = -200.0
|
offset_top = -200.0
|
||||||
offset_right = 200.0
|
offset_right = 200.0
|
||||||
grow_vertical = 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
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(200, 200)
|
visible = false
|
||||||
layout_mode = 2
|
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"]
|
[node name="ItemDescriptionPanelContainer" type="PanelContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||||
custom_minimum_size = Vector2(500, 500)
|
custom_minimum_size = Vector2(500, 500)
|
||||||
@@ -253,6 +150,10 @@ offset_right = 500.0
|
|||||||
offset_bottom = 250.0
|
offset_bottom = 250.0
|
||||||
grow_vertical = 2
|
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"]
|
[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_left = 5
|
theme_override_constants/margin_left = 5
|
||||||
@@ -266,41 +167,36 @@ border_color = Color(1, 1, 1, 1)
|
|||||||
border_width = 2.0
|
border_width = 2.0
|
||||||
editor_only = false
|
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
|
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"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemDescriptionPanelContainer/MarginContainer2"]
|
||||||
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"]
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/separation = 50
|
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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
text = "Text"
|
||||||
label_settings = ExtResource("7_we8a6")
|
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
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(500, 150)
|
custom_minimum_size = Vector2(500, 150)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
text = "More Text"
|
||||||
label_settings = ExtResource("7_we8a6")
|
label_settings = ExtResource("7_we8a6")
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
autowrap_mode = 2
|
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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
text = "Text Stats"
|
||||||
label_settings = ExtResource("7_we8a6")
|
label_settings = ExtResource("7_we8a6")
|
||||||
|
|
||||||
[node name="InventoryList" type="PanelContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
[node name="InventoryList" type="PanelContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||||
@@ -312,9 +208,9 @@ anchor_top = 0.5
|
|||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = -95.0
|
offset_left = -95.0
|
||||||
offset_top = -365.0
|
offset_top = -515.0
|
||||||
offset_right = 405.0
|
offset_right = 405.0
|
||||||
offset_bottom = 435.0
|
offset_bottom = 510.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
@@ -329,28 +225,90 @@ anchor_right = 1.0
|
|||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme_override_constants/margin_left = 10
|
theme_override_constants/margin_left = 5
|
||||||
theme_override_constants/margin_top = 10
|
theme_override_constants/margin_top = 5
|
||||||
theme_override_constants/margin_right = 10
|
theme_override_constants/margin_right = 5
|
||||||
theme_override_constants/margin_bottom = 10
|
theme_override_constants/margin_bottom = 5
|
||||||
|
|
||||||
[node name="ReferenceRect" type="ReferenceRect" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer"]
|
[node name="ReferenceRect" type="ReferenceRect" parent="Panel/MarginContainer/PanelContainer/MenuPanel/InventoryList/Panel/MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
border_color = Color(1, 1, 1, 1)
|
border_color = Color(1, 1, 1, 1)
|
||||||
border_width = 2.0
|
|
||||||
editor_only = false
|
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
|
layout_mode = 2
|
||||||
|
offset_right = 500.0
|
||||||
|
offset_bottom = 1050.0
|
||||||
theme_override_constants/margin_left = 15
|
theme_override_constants/margin_left = 15
|
||||||
theme_override_constants/margin_top = 15
|
theme_override_constants/margin_top = 15
|
||||||
theme_override_constants/margin_right = 15
|
theme_override_constants/margin_right = 15
|
||||||
theme_override_constants/margin_bottom = 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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 0
|
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"]
|
[node name="AugmentItemPanelContainer" type="Panel" parent="Panel/MarginContainer/PanelContainer/MenuPanel"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Chickensoft.Collections;
|
|||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
|
using Zennysoft.Game.Implementation;
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
|
|
||||||
namespace Zennysoft.Game.Ma;
|
namespace Zennysoft.Game.Ma;
|
||||||
@@ -35,10 +36,43 @@ public partial class ItemSlot : Control, IItemSlot
|
|||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
Item.Changed += Item_Changed;
|
Item.Changed += Item_Changed;
|
||||||
FocusEntered += ItemSlot_FocusEntered;
|
|
||||||
ItemName.Pressed += ItemSlot_Pressed;
|
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)
|
public void SetItemEquipmentStatus(bool isEquipped)
|
||||||
{
|
{
|
||||||
if (isEquipped)
|
if (isEquipped)
|
||||||
@@ -49,14 +83,14 @@ public partial class ItemSlot : Control, IItemSlot
|
|||||||
|
|
||||||
public void SetAugmentStatus(bool isAugmented) => AugmentTexture.Visible = isAugmented;
|
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();
|
ItemName.GrabFocus();
|
||||||
ItemSelected?.Invoke(this);
|
ItemSelected?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetItemCount(int count) => ItemCountLabel.Text = count > 0 ? count.ToString("D2") : string.Empty;
|
|
||||||
|
|
||||||
private void ItemSlot_Pressed()
|
private void ItemSlot_Pressed()
|
||||||
{
|
{
|
||||||
if (Item.Value == null)
|
if (Item.Value == null)
|
||||||
|
|||||||
@@ -1,62 +1,83 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://c005nd0m2eim"]
|
[gd_scene load_steps=7 format=3 uid="uid://c005nd0m2eim"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cglxk7v8hpesn" path="res://src/ui/inventory_menu/ItemSlot.cs" id="1_yttxt"]
|
[ext_resource type="Script" uid="uid://cglxk7v8hpesn" path="res://src/ui/inventory_menu/ItemSlot.cs" id="1_yttxt"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dymrg1fmwho35" path="res://src/items/weapons/textures/Cross Sword.png" id="2_rf22b"]
|
[ext_resource type="Texture2D" uid="uid://dymrg1fmwho35" path="res://src/items/weapons/textures/Cross Sword.png" id="2_rf22b"]
|
||||||
[ext_resource type="StyleBox" uid="uid://bxuy4tnftibfq" path="res://src/options/SelectedOptionsBox.tres" id="4_lt1pw"]
|
[ext_resource type="StyleBox" uid="uid://bxuy4tnftibfq" path="res://src/options/SelectedOptionsBox.tres" id="4_lt1pw"]
|
||||||
|
[ext_resource type="StyleBox" uid="uid://bl15q835s4ene" path="res://src/options/UnselectedOptionsBox.tres" id="4_rf22b"]
|
||||||
[ext_resource type="FontFile" uid="uid://0syyay37admf" path="res://src/ui/fonts/georgiab.ttf" id="4_t6dim"]
|
[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="Button"]
|
[node name="ItemSlot" type="HBoxContainer"]
|
||||||
custom_minimum_size = Vector2(100, 50)
|
anchors_preset = 5
|
||||||
anchors_preset = -1
|
anchor_left = 0.5
|
||||||
anchor_right = 0.885
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.093
|
offset_left = -215.0
|
||||||
offset_left = 123.0
|
offset_right = 215.0
|
||||||
offset_right = -1414.2
|
offset_bottom = 50.0
|
||||||
offset_bottom = -50.44
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
size_flags_horizontal = 3
|
||||||
size_flags_horizontal = 4
|
size_flags_vertical = 0
|
||||||
size_flags_vertical = 4
|
|
||||||
mouse_filter = 2
|
|
||||||
theme_override_constants/h_separation = 20
|
|
||||||
theme_override_fonts/font = ExtResource("4_t6dim")
|
|
||||||
theme_override_font_sizes/font_size = 25
|
|
||||||
theme_override_styles/focus = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/disabled_mirrored = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/disabled = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/hover_pressed_mirrored = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/hover_pressed = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/hover_mirrored = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/hover = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/pressed_mirrored = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/pressed = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/normal_mirrored = ExtResource("4_lt1pw")
|
|
||||||
theme_override_styles/normal = ExtResource("4_lt1pw")
|
|
||||||
button_mask = 0
|
|
||||||
text = "Cross Sword"
|
|
||||||
flat = true
|
|
||||||
alignment = 0
|
|
||||||
script = ExtResource("1_yttxt")
|
script = ExtResource("1_yttxt")
|
||||||
|
|
||||||
[node name="ItemTexture" type="TextureRect" parent="."]
|
[node name="ItemInfo" type="HBoxContainer" parent="."]
|
||||||
unique_name_in_owner = true
|
layout_mode = 2
|
||||||
layout_mode = 0
|
theme_override_constants/separation = 20
|
||||||
offset_left = -65.0
|
alignment = 1
|
||||||
offset_top = 6.0
|
|
||||||
offset_right = -25.0
|
|
||||||
offset_bottom = 46.0
|
|
||||||
texture = ExtResource("2_rf22b")
|
|
||||||
expand_mode = 2
|
|
||||||
stretch_mode = 4
|
|
||||||
|
|
||||||
[node name="Equipped" type="Label" parent="."]
|
[node name="EquippedLabel" type="Label" parent="ItemInfo"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(25, 50)
|
custom_minimum_size = Vector2(25, 50)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
offset_left = -122.0
|
|
||||||
offset_right = -78.0
|
|
||||||
offset_bottom = 50.0
|
|
||||||
theme_override_fonts/font = ExtResource("4_t6dim")
|
theme_override_fonts/font = ExtResource("4_t6dim")
|
||||||
theme_override_font_sizes/font_size = 25
|
theme_override_font_sizes/font_size = 25
|
||||||
text = "E"
|
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[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="ItemInfo"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ItemName" type="Button" parent="ItemInfo/Control"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
theme_override_fonts/font = ExtResource("4_t6dim")
|
||||||
|
theme_override_font_sizes/font_size = 25
|
||||||
|
theme_override_styles/focus = ExtResource("4_lt1pw")
|
||||||
|
theme_override_styles/disabled_mirrored = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/disabled = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/hover_pressed_mirrored = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/hover_pressed = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/hover_mirrored = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/hover = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/pressed_mirrored = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/pressed = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/normal_mirrored = ExtResource("4_rf22b")
|
||||||
|
theme_override_styles/normal = ExtResource("4_rf22b")
|
||||||
|
button_mask = 0
|
||||||
|
text = "Cross Sword"
|
||||||
|
|
||||||
|
[node name="AugmentTexture" type="TextureRect" parent="ItemInfo/Control"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
custom_minimum_size = Vector2(15, 20)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
texture = ExtResource("5_lt1pw")
|
||||||
|
stretch_mode = 2
|
||||||
|
|
||||||
|
[node name="ItemCountLabel" type="Label" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 10
|
||||||
|
theme_override_fonts/font = ExtResource("4_t6dim")
|
||||||
|
theme_override_font_sizes/font_size = 25
|
||||||
|
text = "x99"
|
||||||
|
horizontal_alignment = 2
|
||||||
|
vertical_alignment = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user