Move inventory screen to UI folder
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://kpdmgv5ktypo"]
|
||||
|
||||
[sub_resource type="SystemFont" id="SystemFont_w2gvn"]
|
||||
|
||||
[resource]
|
||||
font = SubResource("SystemFont_w2gvn")
|
||||
font_color = Color(0, 0, 1, 1)
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://daxuhpmyxwxck"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://cb41qqmxqurj8" path="res://src/ui/fonts/FT88-Bold.ttf" id="1_r1ugn"]
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource("1_r1ugn")
|
||||
default_font_size = 32
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://bl5xpqyq8vjtv"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dit3vylt7hmmx" path="res://src/ui/fonts/FT88-Regular.ttf" id="1_1lnq2"]
|
||||
|
||||
[resource]
|
||||
font = ExtResource("1_1lnq2")
|
||||
font_size = 30
|
||||
466
Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.cs
Normal file
466
Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.cs
Normal file
@@ -0,0 +1,466 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IInventoryMenu : IControl
|
||||
{
|
||||
public Task RefreshInventoryScreen();
|
||||
|
||||
public Task DisplayMessage(string message);
|
||||
|
||||
public void RemoveItem(InventoryItem item);
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class InventoryMenu : Control, IInventoryMenu
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] private IGameRepo _gameRepo => this.DependOn<IGameRepo>();
|
||||
|
||||
[Dependency] public IGame Game => this.DependOn<IGame>();
|
||||
|
||||
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
|
||||
|
||||
[Dependency] public IMap _map => this.DependOn<IMap>();
|
||||
|
||||
[Dependency] public IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>();
|
||||
|
||||
private InventoryPageNumber _currentPageNumber = InventoryPageNumber.FirstPage;
|
||||
|
||||
private string ITEM_SLOT_SCENE = "res://src/inventory_menu/ItemSlot.tscn";
|
||||
|
||||
private const int _itemsPerPage = 10;
|
||||
|
||||
private int _currentIndex = 0;
|
||||
|
||||
private IItemSlot[] ItemSlots => ItemsPage.GetChildren().OfType<IItemSlot>().ToArray();
|
||||
|
||||
#region Control Nodes
|
||||
[Node] public Label FloorLabel { get; set; } = default!;
|
||||
[Node] public Label CurrentLevelLabel { get; set; } = default!;
|
||||
[Node] public Label EXPValue { get; set; } = default!;
|
||||
[Node] public Label HPValue { get; set; } = default!;
|
||||
[Node] public Label HPBonusLabel { get; set; } = default!;
|
||||
[Node] public Label VTValue { get; set; } = default!;
|
||||
[Node] public Label VTBonusLabel { get; set; } = default!;
|
||||
[Node] public Label ATKValue { get; set; } = default!;
|
||||
[Node] public Label ATKBonusLabel { get; set; } = default!;
|
||||
[Node] public Label DEFValue { get; set; } = default!;
|
||||
[Node] public Label DEFBonusLabel { get; set; } = default!;
|
||||
[Node] public Label ItemDescriptionTitle { get; set; } = default!;
|
||||
[Node] public Label ItemEffectLabel { get; set; } = default!;
|
||||
|
||||
// Item Menu
|
||||
[Node] public Label BackArrow { get; set; } = default!;
|
||||
[Node] public Label ForwardArrow { get; set; } = default!;
|
||||
[Node] public Control ItemsPage { get; set; } = default!;
|
||||
|
||||
// User Prompt Menu
|
||||
[Node] public Label UseItemPrompt { get; set; } = default!;
|
||||
[Node] public Button UseButton { get; set; } = default!;
|
||||
[Node] public Button ThrowButton { get; set; } = default!;
|
||||
[Node] public Button DropButton { get; set; } = default!;
|
||||
|
||||
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
#endregion
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
UseButton.Pressed += UseButtonPressed;
|
||||
ThrowButton.Pressed += ThrowButtonPressed;
|
||||
DropButton.Pressed += DropButtonPressed;
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
}
|
||||
|
||||
public async Task DisplayMessage(string message)
|
||||
{
|
||||
SetProcessInput(false);
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
ItemEffectLabel.Text = message;
|
||||
await ToSignal(GetTree().CreateTimer(1f), "timeout");
|
||||
await RefreshInventoryScreen();
|
||||
SetProcessInput(true);
|
||||
}
|
||||
|
||||
private void BonusAttack_Sync(int bonus)
|
||||
{
|
||||
ATKBonusLabel.Text = $"{bonus:+0;-#;\\.\\.\\.}";
|
||||
DEFBonusLabel.Text = $"{Player.Stats.BonusDefense.Value:+0;-#;\\.\\.\\.}";
|
||||
}
|
||||
|
||||
private void BonusDefense_Sync(int bonus)
|
||||
{
|
||||
ATKBonusLabel.Text = $"{Player.Stats.BonusAttack.Value:+0;-#;\\.\\.\\.}";
|
||||
DEFBonusLabel.Text = $"{bonus:+0;-#;\\.\\.\\.}";
|
||||
}
|
||||
|
||||
private void CurrentLevel_Sync(int obj) => CurrentLevelLabel.Text = $"Level {obj:D2}";
|
||||
|
||||
private void ExpToNextLevel_Sync(int obj) => EXPValue.Text = $"{Player.Stats.CurrentExp.Value}/{obj}";
|
||||
|
||||
private void CurrentExp_Sync(double obj) => EXPValue.Text = $"{obj}/{Player.Stats.ExpToNextLevel.Value}";
|
||||
|
||||
private void MaxDefense_Sync(int obj) => DEFValue.Text = $"{Player.Stats.CurrentDefense.Value}/{obj}";
|
||||
|
||||
private void CurrentDefense_Sync(int obj) => DEFValue.Text = $"{obj}/{Player.Stats.MaxDefense.Value}";
|
||||
|
||||
private void MaxAttack_Sync(int obj) => ATKValue.Text = $"{Player.Stats.CurrentAttack.Value}/{obj}";
|
||||
|
||||
private void CurrentAttack_Sync(int obj) => ATKValue.Text = $"{obj}/{Player.Stats.MaxAttack.Value}";
|
||||
|
||||
private void MaximumVT_Sync(int obj) => VTValue.Text = $"{Player.Stats.CurrentVT.Value}/{obj}";
|
||||
|
||||
private void CurrentVT_Sync(int obj) => VTValue.Text = $"{obj}/{Player.Stats.MaximumVT.Value}";
|
||||
|
||||
private void MaximumHP_Sync(int obj) => HPValue.Text = $"{Player.Stats.CurrentHP.Value}/{obj}";
|
||||
|
||||
private void CurrentHP_Sync(int obj) => HPValue.Text = $"{obj}/{Player.Stats.MaximumHP.Value}";
|
||||
|
||||
public async Task RefreshInventoryScreen()
|
||||
{
|
||||
Player.Stats.CurrentHP.Sync += CurrentHP_Sync;
|
||||
Player.Stats.MaximumHP.Sync += MaximumHP_Sync;
|
||||
Player.Stats.CurrentVT.Sync += CurrentVT_Sync;
|
||||
Player.Stats.MaximumVT.Sync += MaximumVT_Sync;
|
||||
Player.Stats.CurrentAttack.Sync += CurrentAttack_Sync;
|
||||
Player.Stats.MaxAttack.Sync += MaxAttack_Sync;
|
||||
Player.Stats.CurrentDefense.Sync += CurrentDefense_Sync;
|
||||
Player.Stats.MaxDefense.Sync += MaxDefense_Sync;
|
||||
Player.Stats.CurrentExp.Sync += CurrentExp_Sync;
|
||||
Player.Stats.ExpToNextLevel.Sync += ExpToNextLevel_Sync;
|
||||
Player.Stats.CurrentLevel.Sync += CurrentLevel_Sync;
|
||||
Player.Stats.BonusAttack.Sync += BonusAttack_Sync;
|
||||
Player.Stats.BonusDefense.Sync += BonusDefense_Sync;
|
||||
|
||||
await ClearItems();
|
||||
PopulateInventory();
|
||||
PopulatePlayerInfo();
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
}
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
var inventory = Player.Inventory;
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiCancel))
|
||||
{
|
||||
if (UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
|
||||
{
|
||||
HideUserActionPrompt();
|
||||
ShowInventoryInfo();
|
||||
GameEventDepot.OnMenuBackedOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.Stats.CurrentHP.Sync -= CurrentHP_Sync;
|
||||
Player.Stats.MaximumHP.Sync -= MaximumHP_Sync;
|
||||
Player.Stats.CurrentVT.Sync -= CurrentVT_Sync;
|
||||
Player.Stats.MaximumVT.Sync -= MaximumVT_Sync;
|
||||
Player.Stats.CurrentAttack.Sync -= CurrentAttack_Sync;
|
||||
Player.Stats.MaxAttack.Sync -= MaxAttack_Sync;
|
||||
Player.Stats.CurrentDefense.Sync -= CurrentDefense_Sync;
|
||||
Player.Stats.MaxDefense.Sync -= MaxDefense_Sync;
|
||||
Player.Stats.CurrentExp.Sync -= CurrentExp_Sync;
|
||||
Player.Stats.ExpToNextLevel.Sync -= ExpToNextLevel_Sync;
|
||||
Player.Stats.CurrentLevel.Sync -= CurrentLevel_Sync;
|
||||
Player.Stats.BonusAttack.Sync -= BonusAttack_Sync;
|
||||
Player.Stats.BonusDefense.Sync -= BonusDefense_Sync;
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemSlots.Length == 0 || UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
|
||||
return;
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiRight) && _currentPageNumber == InventoryPageNumber.FirstPage && inventory.Items.Count > _itemsPerPage)
|
||||
ChangeInventoryPage(InventoryPageNumber.SecondPage);
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiLeft) && _currentPageNumber == InventoryPageNumber.SecondPage)
|
||||
ChangeInventoryPage(InventoryPageNumber.FirstPage);
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiDown))
|
||||
{
|
||||
var oldIndex = _currentIndex;
|
||||
var newIndex = new[] { _currentIndex + 1, _itemsPerPage - 1, ItemSlots.Length - 1 }.Min();
|
||||
if (oldIndex == newIndex)
|
||||
return;
|
||||
|
||||
SetToUnselectedStyle(ItemSlots.ElementAt(oldIndex));
|
||||
SetToSelectedStyle(ItemSlots.ElementAt(newIndex));
|
||||
GameEventDepot.OnMenuScrolled();
|
||||
_currentIndex = newIndex;
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiUp))
|
||||
{
|
||||
var oldIndex = _currentIndex;
|
||||
var newIndex = new[] { _currentIndex - 1, 0 }.Max();
|
||||
|
||||
if (oldIndex == newIndex)
|
||||
return;
|
||||
|
||||
SetToUnselectedStyle(ItemSlots.ElementAt(oldIndex));
|
||||
SetToSelectedStyle(ItemSlots.ElementAt(newIndex));
|
||||
GameEventDepot.OnMenuScrolled();
|
||||
_currentIndex = newIndex;
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.UiAccept))
|
||||
{
|
||||
DisplayUserActionPrompt();
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.InventorySort))
|
||||
{
|
||||
inventory.Sort();
|
||||
if (_currentIndex > inventory.Items.Count - 1)
|
||||
_currentIndex = inventory.Items.Count - 1;
|
||||
GameEventDepot.OnInventorySorted();
|
||||
RefreshInventoryScreen();
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
|
||||
public async void RemoveItem(InventoryItem item)
|
||||
{
|
||||
Player.Inventory.Remove(item);
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
private void PopulateItems()
|
||||
{
|
||||
PopulateInventory();
|
||||
PopulatePlayerInfo();
|
||||
}
|
||||
|
||||
private async Task ClearItems()
|
||||
{
|
||||
foreach (var item in ItemSlots)
|
||||
ItemsPage.RemoveChildEx(item);
|
||||
|
||||
ItemDescriptionTitle.Text = string.Empty;
|
||||
ItemEffectLabel.Text = string.Empty;
|
||||
}
|
||||
|
||||
private void PopulatePlayerInfo()
|
||||
{
|
||||
FloorLabel.Text = $"Floor {_map.CurrentFloorNumber:D2}";
|
||||
|
||||
if (ItemSlots.Length != 0)
|
||||
{
|
||||
var item = ItemSlots.ElementAt(_currentIndex).Item;
|
||||
ItemDescriptionTitle.Text = $"{item.ItemName}";
|
||||
ItemEffectLabel.Text = $"{item.Description}";
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayUserActionPrompt()
|
||||
{
|
||||
ItemDescriptionTitle.Hide();
|
||||
ItemEffectLabel.Hide();
|
||||
UseItemPrompt.Show();
|
||||
UseButton.Show();
|
||||
ThrowButton.Show();
|
||||
DropButton.Show();
|
||||
|
||||
var currentItem = ItemSlots.ElementAt(_currentIndex).Item;
|
||||
|
||||
if (currentItem is EquipableItem equipable)
|
||||
{
|
||||
UseButton.Text = equipable.IsEquipped ? "Unequip" : "Equip";
|
||||
ThrowButton.Disabled = equipable.IsEquipped;
|
||||
ThrowButton.FocusMode = equipable.IsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||
DropButton.Disabled = equipable.IsEquipped;
|
||||
DropButton.FocusMode = equipable.IsEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||
}
|
||||
else
|
||||
{
|
||||
UseButton.Text = "Use";
|
||||
}
|
||||
|
||||
UseButton.CallDeferred(MethodName.GrabFocus);
|
||||
}
|
||||
|
||||
private async Task HideUserActionPrompt()
|
||||
{
|
||||
UseItemPrompt.Hide();
|
||||
UseButton.Hide();
|
||||
ThrowButton.Hide();
|
||||
DropButton.Hide();
|
||||
UseButton.ReleaseFocus();
|
||||
ThrowButton.ReleaseFocus();
|
||||
DropButton.ReleaseFocus();
|
||||
}
|
||||
|
||||
private async Task ShowInventoryInfo()
|
||||
{
|
||||
ItemDescriptionTitle.Show();
|
||||
ItemEffectLabel.Show();
|
||||
}
|
||||
|
||||
private async Task ChangeInventoryPage(InventoryPageNumber pageToChangeTo)
|
||||
{
|
||||
await ClearItems();
|
||||
await ToSignal(GetTree().CreateTimer(0.1f), "timeout");
|
||||
_currentIndex = 0;
|
||||
_currentPageNumber = pageToChangeTo;
|
||||
await RefreshInventoryScreen();
|
||||
GameEventDepot.OnMenuScrolled();
|
||||
}
|
||||
|
||||
private async void PopulateInventory()
|
||||
{
|
||||
var inventory = Player.Inventory;
|
||||
var numberOfItemsToDisplay = _currentPageNumber == InventoryPageNumber.FirstPage ? Mathf.Min(inventory.Items.Count, _itemsPerPage) : Mathf.Min(inventory.Items.Count - _itemsPerPage, _itemsPerPage);
|
||||
var indexToStart = _currentPageNumber == InventoryPageNumber.FirstPage ? 0 : _itemsPerPage;
|
||||
|
||||
ForwardArrow.Text = "";
|
||||
BackArrow.Text = "";
|
||||
|
||||
if (_currentPageNumber == InventoryPageNumber.FirstPage && inventory.Items.Count > _itemsPerPage)
|
||||
{
|
||||
ForwardArrow.Text = "►";
|
||||
BackArrow.Text = "";
|
||||
}
|
||||
if (_currentPageNumber == InventoryPageNumber.SecondPage)
|
||||
{
|
||||
ForwardArrow.Text = "";
|
||||
BackArrow.Text = "◄";
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < numberOfItemsToDisplay; i++)
|
||||
{
|
||||
var item = inventory.Items.ElementAt(i + indexToStart);
|
||||
var itemScene = GD.Load<PackedScene>(ITEM_SLOT_SCENE);
|
||||
var itemSlot = itemScene.Instantiate<IItemSlot>();
|
||||
itemSlot.Item = item;
|
||||
ItemsPage.AddChildEx(itemSlot);
|
||||
|
||||
if (itemSlot.Item is EquipableItem equipable && equipable.IsEquipped)
|
||||
itemSlot.SetEquippedItemStyle();
|
||||
}
|
||||
|
||||
if (ItemSlots.Length != 0)
|
||||
{
|
||||
ItemSlots.ElementAt(_currentIndex).SetSelectedItemStyle();
|
||||
if (ItemSlots.ElementAt(_currentIndex).Item is EquipableItem equipable && equipable.IsEquipped)
|
||||
ItemSlots.ElementAt(_currentIndex).SetEquippedSelectedItemStyle();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetToUnselectedStyle(IItemSlot itemSlot)
|
||||
{
|
||||
await ToSignal(GetTree().CreateTimer(0.1f), "timeout");
|
||||
itemSlot.SetItemStyle();
|
||||
if (itemSlot.Item is EquipableItem equipable && equipable.IsEquipped)
|
||||
itemSlot.SetEquippedItemStyle();
|
||||
}
|
||||
|
||||
private async Task SetToSelectedStyle(IItemSlot itemSlot)
|
||||
{
|
||||
await ToSignal(GetTree().CreateTimer(0.1f), "timeout");
|
||||
itemSlot.SetSelectedItemStyle();
|
||||
ItemDescriptionTitle.Text = $"{itemSlot.Item.ItemName}";
|
||||
ItemEffectLabel.Text = $"{itemSlot.Item.Description}";
|
||||
}
|
||||
|
||||
private async Task EquipOrUnequipItem()
|
||||
{
|
||||
var itemSlot = ItemSlots[_currentIndex];
|
||||
if (itemSlot.Item is EquipableItem equipableItem)
|
||||
{
|
||||
if (equipableItem.IsEquipped)
|
||||
{
|
||||
ItemEffectLabel.Text = $"{itemSlot.Item.GetType()} unequipped.";
|
||||
Player.Unequip(equipableItem);
|
||||
itemSlot.SetSelectedItemStyle();
|
||||
if (equipableItem.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Inventory.Remove(equipableItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemEffectLabel.Text = $"{itemSlot.Item.GetType()} equipped.";
|
||||
Player.Equip(equipableItem);
|
||||
itemSlot.SetEquippedSelectedItemStyle();
|
||||
}
|
||||
|
||||
RefreshUIAfterUserSelection();
|
||||
}
|
||||
}
|
||||
|
||||
private async void UseButtonPressed()
|
||||
{
|
||||
UseButton.Disabled = true;
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
if (currentItem is EquipableItem)
|
||||
await EquipOrUnequipItem();
|
||||
else
|
||||
await Game.UseItem(currentItem);
|
||||
|
||||
RefreshUIAfterUserSelection();
|
||||
UseButton.Disabled = false;
|
||||
}
|
||||
|
||||
private async void ThrowButtonPressed()
|
||||
{
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
|
||||
Game.ThrowItem(currentItem);
|
||||
Player.Inventory.Remove(currentItem);
|
||||
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
|
||||
private async void DropButtonPressed()
|
||||
{
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
Game.DropItem(currentItem);
|
||||
Player.Inventory.Remove(currentItem);
|
||||
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
|
||||
private async void RefreshUIAfterUserSelection()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
await RefreshInventoryScreen();
|
||||
await ToSignal(GetTree().CreateTimer(1f), "timeout");
|
||||
SetProcessInput(true);
|
||||
}
|
||||
|
||||
private enum InventoryPageNumber
|
||||
{
|
||||
FirstPage,
|
||||
SecondPage
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://cmtet15hi5oiy
|
||||
@@ -0,0 +1,99 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
#define iTime TIME
|
||||
#define iResolution 1.0/SCREEN_PIXEL_SIZE
|
||||
|
||||
uniform vec3 color1 = vec3(0.5, 0.5, 0.5);
|
||||
uniform vec3 color2 = vec3(0.5, 0.5, 0.5);
|
||||
uniform vec3 color3 = vec3(1., 1., 1.);
|
||||
uniform vec3 color4 = vec3(0., 0.1, 0.2);
|
||||
uniform float grandient : hint_range(0.01, 2.0, 0.01) = 0.04;
|
||||
uniform float zoom : hint_range(0, 2., 0.1) = 1.0;
|
||||
uniform vec2 disp = vec2(0.0);
|
||||
uniform vec2 rot_angle = vec2(1.0);
|
||||
uniform float wiggle : hint_range(0.0, 5.0, 0.1) = 0.35;
|
||||
uniform float speed1 : hint_range(0.0, 10.0, 0.1) = 0.2;
|
||||
uniform float speed2 : hint_range(0.0, 10.0, 0.1) = 0.2;
|
||||
uniform float speed3 : hint_range(0.0, 5.0, 0.1) = 0.4;
|
||||
|
||||
|
||||
// Box sdf function
|
||||
float sdBox ( vec3 p, vec3 b ) {
|
||||
vec3 q = abs(p) - b;
|
||||
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
|
||||
}
|
||||
|
||||
//Octahedron
|
||||
float sdOctahedron( vec3 p, float s) {
|
||||
p = abs(p);
|
||||
return (p.x+p.y+p.z-s)*0.57735027;
|
||||
}
|
||||
|
||||
float map(vec3 p) {
|
||||
p.z += iTime * speed3; // Move effect
|
||||
|
||||
// Space Repetition
|
||||
p.xy = (fract(p.xy) - .5); // Spacing by 1
|
||||
p.z = mod(p.z, .25) - 0.125; // Spacing by .25
|
||||
|
||||
float box = sdOctahedron(p, .15); // SDF
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
// Coloring
|
||||
vec3 palette(float t) {
|
||||
vec3 a = color1;
|
||||
vec3 b = color2;
|
||||
vec3 c = color3;
|
||||
vec3 d = color4;
|
||||
|
||||
return a + b * cos(6.28318 * (c * t + d));
|
||||
}
|
||||
|
||||
// 2D Rotation
|
||||
mat2 rot2D(float angle) {
|
||||
float s = sin(angle * rot_angle.x);
|
||||
float c = cos(angle * rot_angle.y);
|
||||
return mat2(vec2(c, -s), vec2(s, c));
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = UV * 2.0 - 1.0;
|
||||
//vec2 m = (iMouse.xy * 2. - iResolution.xy) / iResolution.y;
|
||||
vec2 m = uv;
|
||||
|
||||
// Initialization
|
||||
vec3 ro = vec3(disp.x, disp.y, -0); // Ray origin
|
||||
vec3 rd = normalize(vec3(uv, 1)) * zoom; // Ray zoom
|
||||
vec3 col = vec3(0);
|
||||
|
||||
float t = 0.0; // Total distance travelled
|
||||
|
||||
// Default circular motion if mouse is not clicked
|
||||
m = vec2(cos(iTime * speed1), sin(iTime * speed2));
|
||||
|
||||
// Raymarching
|
||||
int i;
|
||||
for (int i = 0; i < 80; i++) {
|
||||
vec3 p = ro + rd * t; // Posiiton along the ray
|
||||
|
||||
p.xy *= rot2D(t * 0.2 * m.x); // Rotate ray around z-axis
|
||||
|
||||
p.y += sin(t * (m.y + 1.) * 0.5) * wiggle; // Wiggle
|
||||
|
||||
float d = map(p); // Current distance to the scene
|
||||
|
||||
t += d; // March the rays
|
||||
|
||||
col = vec3(float(i)) / 80.;
|
||||
|
||||
if (d < .001 || t > 100.) break; // Early Stop
|
||||
|
||||
}
|
||||
|
||||
// Coloring
|
||||
col = palette(t * grandient + float(i) * 0.005); // Lower the float value to see further away
|
||||
|
||||
COLOR = vec4(col, 1);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://cnphwvmr05hp1
|
||||
556
Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.tscn
Normal file
556
Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.tscn
Normal file
@@ -0,0 +1,556 @@
|
||||
[gd_scene load_steps=35 format=3 uid="uid://dlj8qdg1c5048"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cmtet15hi5oiy" path="res://src/ui/inventory_menu/InventoryMenu.cs" id="1_l64wl"]
|
||||
[ext_resource type="Shader" uid="uid://cnphwvmr05hp1" path="res://src/ui/inventory_menu/InventoryMenu.gdshader" id="2_0fvsh"]
|
||||
[ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="3_lm4o1"]
|
||||
[ext_resource type="FontFile" uid="uid://cb41qqmxqurj8" path="res://src/ui/fonts/FT88-Bold.ttf" id="4_rg5yb"]
|
||||
[ext_resource type="FontFile" uid="uid://dit3vylt7hmmx" path="res://src/ui/fonts/FT88-Regular.ttf" id="5_2qnnx"]
|
||||
[ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="6_tmdno"]
|
||||
[ext_resource type="LabelSettings" uid="uid://cuuo43x72xcsc" path="res://src/ui/label_settings/MainTextBold.tres" id="7_vyrxm"]
|
||||
[ext_resource type="Theme" uid="uid://daxuhpmyxwxck" path="res://src/ui/inventory_menu/InventoryDialogueSelectionStyle.tres" id="8_khyvo"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_i55tv"]
|
||||
shader = ExtResource("2_0fvsh")
|
||||
shader_parameter/color1 = Vector3(-1.635, -0.665, 0.005)
|
||||
shader_parameter/color2 = Vector3(-0.275, 0.91, 1.005)
|
||||
shader_parameter/color3 = Vector3(1, 1, 1)
|
||||
shader_parameter/color4 = Vector3(0, 0.1, 0.2)
|
||||
shader_parameter/grandient = 0.01
|
||||
shader_parameter/zoom = 2.0
|
||||
shader_parameter/disp = Vector2(0, 0)
|
||||
shader_parameter/rot_angle = Vector2(1, 1)
|
||||
shader_parameter/wiggle = 0.35
|
||||
shader_parameter/speed1 = 0.1
|
||||
shader_parameter/speed2 = 0.1
|
||||
shader_parameter/speed3 = 0.1
|
||||
|
||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_3ynpe"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_q0afw"]
|
||||
font = ExtResource("3_lm4o1")
|
||||
font_size = 48
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_yw3yo"]
|
||||
font = ExtResource("3_lm4o1")
|
||||
font_size = 64
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_xxgnh"]
|
||||
font = ExtResource("4_rg5yb")
|
||||
font_size = 46
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_biilt"]
|
||||
font = ExtResource("5_2qnnx")
|
||||
font_size = 40
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_dot3k"]
|
||||
font = ExtResource("4_rg5yb")
|
||||
font_size = 46
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_th0sm"]
|
||||
font = ExtResource("4_rg5yb")
|
||||
font_size = 40
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ankkq"]
|
||||
font = ExtResource("4_rg5yb")
|
||||
font_size = 46
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ouwww"]
|
||||
font = ExtResource("4_rg5yb")
|
||||
font_size = 40
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_mundu"]
|
||||
font = ExtResource("5_2qnnx")
|
||||
font_size = 20
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_0kb6l"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fu7o2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_nkvce"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_545ij"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ascpt"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_abpb1"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_omlgh"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_uerb4"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_lvcf8"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ct6ql"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_x4aj3"]
|
||||
font = ExtResource("3_lm4o1")
|
||||
font_size = 80
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_31kc7"]
|
||||
font = ExtResource("3_lm4o1")
|
||||
font_size = 80
|
||||
font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dg155"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:text")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [""]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7by7u"]
|
||||
resource_name = "status_up"
|
||||
length = 2.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 2.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:text")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(2.5),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [""]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_eivo2"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_dg155"),
|
||||
&"status_up": SubResource("Animation_7by7u")
|
||||
}
|
||||
|
||||
[node name="InventoryMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_l64wl")
|
||||
|
||||
[node name="BG" type="TextureRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_i55tv")
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("PlaceholderTexture2D_3ynpe")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="InventoryInfo" type="MarginContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 1359.0
|
||||
offset_bottom = 958.0
|
||||
theme_override_constants/margin_top = 100
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="InventoryInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PlayerInfo" type="VBoxContainer" parent="InventoryInfo/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="FloorBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/FloorBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FloorLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/FloorBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "FLOOR 00"
|
||||
label_settings = SubResource("LabelSettings_q0afw")
|
||||
|
||||
[node name="LevelBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/LevelBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CurrentLevelLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/LevelBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "LEVEL 0"
|
||||
label_settings = SubResource("LabelSettings_yw3yo")
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
custom_minimum_size = Vector2(0, 12)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="EXPBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/EXPBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="EXPLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/EXPBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
text = "EXP"
|
||||
label_settings = SubResource("LabelSettings_xxgnh")
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/EXPBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="EXPValue" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/EXPBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "444/888"
|
||||
label_settings = SubResource("LabelSettings_biilt")
|
||||
|
||||
[node name="HPBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/HPBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HPLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/HPBox"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "HP"
|
||||
label_settings = SubResource("LabelSettings_dot3k")
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/HPBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HPValue" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/HPBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
text = "222/222"
|
||||
label_settings = SubResource("LabelSettings_th0sm")
|
||||
|
||||
[node name="ReferenceRect3" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/HPBox"]
|
||||
custom_minimum_size = Vector2(18, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HPBonusLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/HPBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "..."
|
||||
label_settings = ExtResource("6_tmdno")
|
||||
|
||||
[node name="VTBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/VTBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VTLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/VTBox"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "VT"
|
||||
label_settings = SubResource("LabelSettings_ankkq")
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/VTBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VTValue" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/VTBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
text = "444/444"
|
||||
label_settings = SubResource("LabelSettings_ouwww")
|
||||
|
||||
[node name="ReferenceRect4" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/VTBox"]
|
||||
custom_minimum_size = Vector2(18, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VTBonusLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/VTBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "..."
|
||||
label_settings = ExtResource("6_tmdno")
|
||||
|
||||
[node name="ATKBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ATKLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "ATK"
|
||||
label_settings = SubResource("LabelSettings_ankkq")
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ATKValue" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
text = "666/666"
|
||||
label_settings = SubResource("LabelSettings_ouwww")
|
||||
|
||||
[node name="ReferenceRect4" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"]
|
||||
custom_minimum_size = Vector2(18, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ATKBonusLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/ATKBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "..."
|
||||
label_settings = ExtResource("6_tmdno")
|
||||
|
||||
[node name="DEFBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/DEFBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DEFLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/DEFBox"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "DEF
|
||||
"
|
||||
label_settings = SubResource("LabelSettings_ankkq")
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/DEFBox"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DEFValue" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/DEFBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
text = "888/888"
|
||||
label_settings = SubResource("LabelSettings_ouwww")
|
||||
|
||||
[node name="ReferenceRect4" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/DEFBox"]
|
||||
custom_minimum_size = Vector2(18, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DEFBonusLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/DEFBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "..."
|
||||
label_settings = ExtResource("6_tmdno")
|
||||
|
||||
[node name="ReferenceRect3" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
custom_minimum_size = Vector2(0, 25)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(50, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemDescriptionTitle" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(400, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
label_settings = ExtResource("7_vyrxm")
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="UseItemPrompt" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(400, 100)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
text = "Use Item?"
|
||||
label_settings = ExtResource("6_tmdno")
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="ItemEffectLabel" type="Label" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(400, 100)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
label_settings = SubResource("LabelSettings_mundu")
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="UseButton" type="Button" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath(".")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../ThrowButton")
|
||||
theme = ExtResource("8_khyvo")
|
||||
theme_override_colors/font_disabled_color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
|
||||
theme_override_colors/font_pressed_color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_0kb6l")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_fu7o2")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_nkvce")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_545ij")
|
||||
button_mask = 0
|
||||
text = "Use"
|
||||
alignment = 0
|
||||
|
||||
[node name="ThrowButton" type="Button" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../UseButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath("../DropButton")
|
||||
theme = ExtResource("8_khyvo")
|
||||
theme_override_colors/font_disabled_color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
|
||||
theme_override_colors/font_pressed_color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_0kb6l")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_ascpt")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_abpb1")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_545ij")
|
||||
button_mask = 0
|
||||
text = "Throw"
|
||||
alignment = 0
|
||||
|
||||
[node name="DropButton" type="Button" parent="InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
focus_neighbor_left = NodePath(".")
|
||||
focus_neighbor_top = NodePath("../ThrowButton")
|
||||
focus_neighbor_right = NodePath(".")
|
||||
focus_neighbor_bottom = NodePath(".")
|
||||
theme = ExtResource("8_khyvo")
|
||||
theme_override_colors/font_disabled_color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
theme_override_colors/font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1)
|
||||
theme_override_colors/font_pressed_color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_omlgh")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_uerb4")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_lvcf8")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_ct6ql")
|
||||
button_mask = 0
|
||||
text = "Drop"
|
||||
alignment = 0
|
||||
|
||||
[node name="ItemInfo" type="VBoxContainer" parent="InventoryInfo/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(700, 0)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="ItemTitleContainer" type="MarginContainer" parent="InventoryInfo/HBoxContainer/ItemInfo"]
|
||||
custom_minimum_size = Vector2(300, 125)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="BackArrow" type="Label" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemTitleContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
text = "◄"
|
||||
label_settings = SubResource("LabelSettings_x4aj3")
|
||||
|
||||
[node name="ItemsTitle" type="Label" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemTitleContainer"]
|
||||
custom_minimum_size = Vector2(450, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = " ITEMS"
|
||||
label_settings = SubResource("LabelSettings_31kc7")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ForwardArrow" type="Label" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemTitleContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(300, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "►"
|
||||
label_settings = SubResource("LabelSettings_x4aj3")
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="ItemsPage" type="VBoxContainer" parent="InventoryInfo/HBoxContainer/ItemInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_constants/separation = 15
|
||||
alignment = 1
|
||||
|
||||
[node name="ReferenceRect3" type="ReferenceRect" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage"]
|
||||
custom_minimum_size = Vector2(0, 14)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_eivo2")
|
||||
}
|
||||
25
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemLabel.cs
Normal file
25
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemLabel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Zennysoft.Game.Ma;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class ItemLabel : Label
|
||||
{
|
||||
public ItemLabel()
|
||||
{
|
||||
LabelSettings = UnequippedItemFont;
|
||||
}
|
||||
|
||||
private static LabelSettings UnequippedItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextRegular.tres");
|
||||
private static LabelSettings EquippedItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextFontEquipped.tres");
|
||||
|
||||
public void EquipItem()
|
||||
{
|
||||
LabelSettings = EquippedItemFont;
|
||||
}
|
||||
|
||||
public void UnequipItem()
|
||||
{
|
||||
LabelSettings = UnequippedItemFont;
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemLabel.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemLabel.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0rrpkpsfdga8
|
||||
97
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemSlot.cs
Normal file
97
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemSlot.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IItemSlot : IHBoxContainer
|
||||
{
|
||||
public InventoryItem Item { get; set; }
|
||||
|
||||
public void SetItemStyle();
|
||||
|
||||
public void SetSelectedItemStyle();
|
||||
|
||||
public void SetEquippedItemStyle();
|
||||
|
||||
public void SetEquippedSelectedItemStyle();
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ItemSlot : HBoxContainer, IItemSlot
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
|
||||
|
||||
//[Node] public Label EquipBonus { get; set; } = default!;
|
||||
|
||||
[Node] public TextureRect ItemTexture { get; set; } = default!;
|
||||
|
||||
[Node] public Label ItemName { get; set; } = default!;
|
||||
|
||||
[Node] public Label ItemCount { get; set; } = default!;
|
||||
|
||||
private static LabelSettings ItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextRegular.tres");
|
||||
private static LabelSettings SelectedItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextFontItalicized.tres");
|
||||
private static LabelSettings EquippedItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextFontEquipped.tres");
|
||||
|
||||
private static LabelSettings SelectedEquippedItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextFontSelectedEquipped.tres");
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
ItemName.Text = Item.ItemName;
|
||||
ItemTexture.Texture = Item.GetTexture();
|
||||
Player.EquippedWeapon.Sync += EquipableItem_Sync;
|
||||
Player.EquippedArmor.Sync += EquipableItem_Sync;
|
||||
Player.EquippedAccessory.Sync += EquipableItem_Sync;
|
||||
|
||||
if (Item is IStackable stackableItem)
|
||||
{
|
||||
ItemCount.Text = $"{stackableItem.Count:D2}";
|
||||
ItemCount.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void EquipableItem_Sync(EquipableItem obj)
|
||||
{
|
||||
if (Item is EquipableItem equipableItem && equipableItem == obj)
|
||||
{
|
||||
SetEquippedSelectedItemStyle();
|
||||
}
|
||||
if (Item is EquipableItem unequippedItem && unequippedItem != obj)
|
||||
{
|
||||
SetItemStyle();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetItemStyle()
|
||||
{
|
||||
ItemName.LabelSettings = ItemFont;
|
||||
}
|
||||
public void SetSelectedItemStyle()
|
||||
{
|
||||
if (Item is EquipableItem equipableItem && equipableItem.IsEquipped)
|
||||
{
|
||||
ItemName.LabelSettings = SelectedEquippedItemFont;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemName.LabelSettings = SelectedItemFont;
|
||||
}
|
||||
}
|
||||
public void SetEquippedItemStyle()
|
||||
{
|
||||
ItemName.LabelSettings = EquippedItemFont;
|
||||
}
|
||||
|
||||
public void SetEquippedSelectedItemStyle()
|
||||
{
|
||||
ItemName.LabelSettings = SelectedEquippedItemFont;
|
||||
}
|
||||
|
||||
public InventoryItem Item { get; set; } = default!;
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemSlot.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemSlot.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cglxk7v8hpesn
|
||||
49
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemSlot.tscn
Normal file
49
Zennysoft.Game.Ma/src/ui/inventory_menu/ItemSlot.tscn
Normal file
@@ -0,0 +1,49 @@
|
||||
[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="Texture2D" uid="uid://0r1dws4ajhdx" path="res://src/items/accessory/textures/MASK 01.PNG" id="2_7kdbd"]
|
||||
[ext_resource type="Script" uid="uid://b0rrpkpsfdga8" path="res://src/ui/inventory_menu/ItemLabel.cs" id="3_xlgl0"]
|
||||
[ext_resource type="FontFile" uid="uid://bohbd123672ea" path="res://src/ui/fonts/FT88-Italic.ttf" id="4_vcxwm"]
|
||||
[ext_resource type="LabelSettings" uid="uid://bl5xpqyq8vjtv" path="res://src/ui/inventory_menu/InventoryLabelSettings.tres" id="5_a7hko"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_lgjx0"]
|
||||
font = ExtResource("4_vcxwm")
|
||||
font_size = 30
|
||||
font_color = Color(0, 0.682353, 0.937255, 1)
|
||||
|
||||
[node name="ItemSlot" type="HBoxContainer"]
|
||||
custom_minimum_size = Vector2(100, 60)
|
||||
offset_right = 1748.0
|
||||
offset_bottom = 85.0
|
||||
script = ExtResource("1_yttxt")
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="."]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemTexture" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_7kdbd")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="."]
|
||||
custom_minimum_size = Vector2(40, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemName" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(550, 50)
|
||||
layout_mode = 2
|
||||
text = "Mask of the Goddess of Destruction"
|
||||
label_settings = SubResource("LabelSettings_lgjx0")
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 2
|
||||
script = ExtResource("3_xlgl0")
|
||||
|
||||
[node name="ItemCount" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "x99"
|
||||
label_settings = ExtResource("5_a7hko")
|
||||
BIN
Zennysoft.Game.Ma/src/ui/inventory_menu/cursor.png
Normal file
BIN
Zennysoft.Game.Ma/src/ui/inventory_menu/cursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 474 B |
35
Zennysoft.Game.Ma/src/ui/inventory_menu/cursor.png.import
Normal file
35
Zennysoft.Game.Ma/src/ui/inventory_menu/cursor.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dr8mjn3wahdvp"
|
||||
path.s3tc="res://.godot/imported/cursor.png-bf4d36c1fce83964cd2e2be02acb4fc6.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/ui/inventory_menu/cursor.png"
|
||||
dest_files=["res://.godot/imported/cursor.png-bf4d36c1fce83964cd2e2be02acb4fc6.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
Reference in New Issue
Block a user