Compare commits

..

No commits in common. "96977ac79fa38517af73d240eb4d9ac901afceb4" and "5be84f6b845e9d8cb164145759fc81153b07c5f1" have entirely different histories.

44 changed files with 205 additions and 1014 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 B

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://vjdyrv8wp7gl"
path="res://.godot/imported/forsenLevel.png-ffd03264deccb9275d087fadbb57e56f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/forsenLevel.png"
dest_files=["res://.godot/imported/forsenLevel.png-ffd03264deccb9275d087fadbb57e56f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

View File

@ -5,6 +5,6 @@ namespace SupaLidlGame.BoundingBoxes;
public abstract partial class BoundingBox : Area2D, IFaction
{
[Export(PropertyHint.Flags)]
public FactionName Faction { get; set; }
[Export]
public ushort Faction { get; set; }
}

View File

@ -93,8 +93,8 @@ public partial class Character : CharacterBody2D, IFaction
[Export]
public BoundingBoxes.Hurtbox Hurtbox { get; set; }
[Export(PropertyHint.Flags)]
public FactionName Faction { get; set; }
[Export]
public ushort Faction { get; set; }
public AnimationPlayer MovementAnimation { get; set; }

View File

@ -573,7 +573,6 @@ Sprite = NodePath("Sprite")
Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine")
Hurtbox = NodePath("Hurtbox")
Faction = 2
[node name="Stats" type="Node" parent="."]
script = ExtResource("5_a7fiw")

View File

@ -3,7 +3,6 @@
using Godot;
using SupaLidlGame.Extensions;
using SupaLidlGame.Items;
using SupaLidlGame.Utils;
using System;
namespace SupaLidlGame.Characters;
@ -128,37 +127,6 @@ public partial class NPC : Character
return bestChar;
}
/// <summary>
/// Finds the best character whose faction aligns with this character's.
/// </summary>
public virtual Character FindBestNeutral()
{
float bestScore = float.MaxValue;
Character bestChar = null;
// NOTE: this relies on all Characters being under the Entities node
foreach (Node node in GetParent().GetChildren())
{
if (node is Character character)
{
bool isFriendly = ((IFaction)this).AlignsWith(character);
if (isFriendly || character.Health <= 0)
{
continue;
}
float score = 0;
score -= Position.DistanceTo(character.Position);
if (score < bestScore)
{
bestScore = score;
bestChar = character;
}
}
}
return bestChar;
}
public override void _Process(double delta)
{
ThinkerStateMachine.Process(delta);

View File

@ -4,14 +4,14 @@
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="2_kynkg"]
[ext_resource type="Texture2D" uid="uid://bej8thq7ruyty" path="res://Assets/Sprites/Characters/forsen2.png" id="2_s5nik"]
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="3_pcrll"]
[ext_resource type="Script" path="res://State/Thinker/IdleState.cs" id="3_rgc42"]
[ext_resource type="Script" path="res://State/Thinker/ThinkerStateMachine.cs" id="4_mo4wj"]
[ext_resource type="Script" path="res://State/Thinker/VendorIdle.cs" id="5_oau5d"]
[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="5_sjs24"]
[ext_resource type="Script" path="res://Utils/InteractionTriggerDialogue.cs" id="5_yknpw"]
[ext_resource type="Resource" uid="uid://c4n7vhoxybu70" path="res://Dialogue/snus-dealer.dialogue" id="6_isvnq"]
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_vip6b"]
[node name="SnusDealer" type="CharacterBody2D" node_paths=PackedStringArray("ThinkerStateMachine", "Sprite", "Inventory", "StateMachine")]
[node name="Character" type="CharacterBody2D" node_paths=PackedStringArray("ThinkerStateMachine", "Sprite", "Inventory", "StateMachine")]
script = ExtResource("1_04gcf")
ThinkerStateMachine = NodePath("Thinker")
Sprite = NodePath("Sprites/Sprite")
@ -32,7 +32,7 @@ script = ExtResource("4_mo4wj")
InitialState = NodePath("Idle")
[node name="Idle" type="Node" parent="Thinker" node_paths=PackedStringArray("NPC")]
script = ExtResource("5_oau5d")
script = ExtResource("3_rgc42")
NPC = NodePath("../..")
[node name="Animations" type="Node" parent="."]
@ -64,7 +64,7 @@ position = Vector2(0, -4)
script = ExtResource("5_yknpw")
InteractionTrigger = NodePath("InteractionTrigger")
DialogueResource = ExtResource("6_isvnq")
DialogueTitle = "start"
DialogueTitle = "shop"
[node name="InteractionTrigger" parent="Interaction" instance=ExtResource("5_sjs24")]

View File

@ -1,23 +1,23 @@
~ start
Snus Dealer: Hey kid, wanna buy some snus?
- Alright. => shop
- No, I don't think so. => END
- Snus? => dont_snus
Snus Dealer: d
% => test
% => dont_snus
=> END
~ test
Snus Dealer: asdadsadasd
=> END
~ dont_snus
Snus Dealer: You know what they say.
Snus Dealer: If you don't snus...
Snus Dealer: you lose.
- Pepepains
=> start
~ shop
do emit("EnterShop", "res://Items/Shops/SnusDealer.tres")
=> END
~ shop

View File

@ -51,9 +51,6 @@ public partial class EventBus : Node
[Signal]
public delegate void ExitTransitionEventHandler();
[Signal]
public delegate void EnterShopEventHandler(string shopResourcePath);
public override void _Ready()
{
ProcessMode = ProcessModeEnum.Always;

View File

@ -1,15 +0,0 @@
namespace SupaLidlGame.Items;
public interface IItemCollection
{
public System.Collections.Generic.IEnumerable<ItemMetadata> GetItems();
public int Capacity { get; }
}
public interface IItemCollection<T> : IItemCollection
{
public bool Add(T item);
public bool Remove(T item);
}

View File

@ -4,7 +4,7 @@ using Godot.Collections;
namespace SupaLidlGame.Items;
public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
public partial class Inventory : Node2D
{
public Character Character { get; private set; }
@ -23,12 +23,7 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
[Signal]
public delegate void EquippedItemEventHandler(Item newItem, Item prevItem);
[Signal]
public delegate void ItemAddedEventHandler(ItemMetadata newItemMetadata);
public int Capacity { get; set; } = 30;
public const int HotbarCapacity = 3;
public const int MaxCapacity = 3;
private Item _selectedItem;
@ -146,9 +141,8 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
return null;
}
public Item AddToHotbar(ItemMetadata metadata)
public Item AddItemToHotbar(ItemMetadata metadata)
{
//AddItemMetadata(metadata);
var item = metadata.Instance.Instantiate<Item>();
AddItem(item);
AddChild(item);
@ -158,7 +152,7 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
public Item AddItem(Item item)
{
if (Hotbar.Count >= HotbarCapacity)
if (Hotbar.Count >= MaxCapacity)
{
return null;
}
@ -169,32 +163,9 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
{
Hotbar.Add(item);
}
return item;
}
public System.Collections.Generic.IEnumerable<ItemMetadata> GetItems()
{
return Items;
}
public bool Add(ItemMetadata item)
{
if (Items.Count >= Capacity)
{
return false;
}
Items.Add(item);
EmitSignal(SignalName.ItemAdded, item);
return true;
}
public bool Remove(ItemMetadata item)
{
return Items.Remove(item);
}
public Item DropItem(Item item)
{
item.CharacterOwner = null;

View File

@ -1,45 +0,0 @@
using Godot;
using Godot.Collections;
using GodotUtilities.Collections;
using System.Linq;
using SupaLidlGame.Utils;
namespace SupaLidlGame.Items;
[GlobalClass]
public partial class Shop : Resource, IItemCollection<ShopEntry>
{
[Export]
protected Godot.Collections.Array<ShopEntry> Entries { get; private set; }
public System.Collections.Generic.IEnumerable<ItemMetadata> GetItems()
{
var mapState = World.Instance.GlobalState.MapState;
return Entries
.Where(
(entry) =>
{
var condition = entry.MapStateCondition;
if (string.IsNullOrEmpty(condition))
{
return true;
}
return mapState.GetBoolean(condition) ?? false;
}
)
.Select((entry) => entry.Item);
}
public bool Add(ShopEntry entry)
{
Entries.Add(entry);
return true;
}
public bool Remove(ShopEntry entry)
{
return Entries.Remove(entry);
}
public int Capacity => Entries.Count;
}

View File

@ -1,23 +0,0 @@
using Godot;
namespace SupaLidlGame.Items;
[GlobalClass]
public partial class ShopEntry : Resource
{
public ShopEntry() : base()
{
}
public ShopEntry(ItemMetadata item) : base()
{
Item = item;
}
[Export]
public ItemMetadata Item { get; set; }
[Export]
public string MapStateCondition { get; set; }
}

View File

@ -1,54 +0,0 @@
[gd_resource type="Resource" script_class="Shop" load_steps=16 format=3 uid="uid://djqd88vdkoi6d"]
[ext_resource type="Script" path="res://Items/Shop.cs" id="1_betbc"]
[ext_resource type="Resource" uid="uid://cjsh0dcgbfn77" path="res://Items/Weapons/Bow.tres" id="1_ntroj"]
[ext_resource type="Script" path="res://Items/ShopEntry.cs" id="2_xgvwu"]
[ext_resource type="Resource" uid="uid://iqe6rgnb3jur" path="res://Items/Weapons/Pugio.tres" id="3_nfeft"]
[ext_resource type="Resource" uid="uid://dkm216ug0vj2h" path="res://Items/Weapons/Shotgun.tres" id="4_aw0ju"]
[sub_resource type="Resource" id="Resource_jdx0p"]
script = ExtResource("2_xgvwu")
Item = ExtResource("1_ntroj")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_min4b"]
script = ExtResource("2_xgvwu")
Item = ExtResource("3_nfeft")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_t0x08"]
script = ExtResource("2_xgvwu")
Item = ExtResource("4_aw0ju")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_exmab"]
script = ExtResource("2_xgvwu")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_jlgb3"]
script = ExtResource("2_xgvwu")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_8rd47"]
script = ExtResource("2_xgvwu")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_pqgh5"]
script = ExtResource("2_xgvwu")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_8mift"]
script = ExtResource("2_xgvwu")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_4e8it"]
script = ExtResource("2_xgvwu")
MapStateCondition = ""
[sub_resource type="Resource" id="Resource_jp7ms"]
script = ExtResource("2_xgvwu")
MapStateCondition = ""
[resource]
script = ExtResource("1_betbc")
Entries = Array[Object]([SubResource("Resource_jdx0p"), SubResource("Resource_min4b"), SubResource("Resource_t0x08"), SubResource("Resource_exmab"), SubResource("Resource_jlgb3"), SubResource("Resource_8rd47"), SubResource("Resource_pqgh5"), SubResource("Resource_8mift"), SubResource("Resource_4e8it"), SubResource("Resource_jp7ms")])

View File

@ -1,6 +1,5 @@
[gd_resource type="Resource" script_class="ItemMetadata" load_steps=5 format=3 uid="uid://cjsh0dcgbfn77"]
[gd_resource type="Resource" script_class="ItemMetadata" load_steps=4 format=3 uid="uid://cjsh0dcgbfn77"]
[ext_resource type="Texture2D" uid="uid://vjdyrv8wp7gl" path="res://Assets/Sprites/forsenLevel.png" id="1_5blro"]
[ext_resource type="Script" path="res://Utils/ScenePath.cs" id="1_haiji"]
[ext_resource type="Script" path="res://Items/ItemMetadata.cs" id="2_hjbs0"]
@ -11,7 +10,6 @@ Path = "res://Items/Weapons/Bow.tscn"
[resource]
script = ExtResource("2_hjbs0")
Instance = SubResource("Resource_mjj1w")
Icon = ExtResource("1_5blro")
Name = "Bow"
Description = "A bow and arrow."
BuyPrice = 0

View File

@ -1,6 +1,5 @@
[gd_resource type="Resource" script_class="ItemMetadata" load_steps=5 format=3 uid="uid://iqe6rgnb3jur"]
[gd_resource type="Resource" script_class="ItemMetadata" load_steps=4 format=3 uid="uid://iqe6rgnb3jur"]
[ext_resource type="Texture2D" uid="uid://vjdyrv8wp7gl" path="res://Assets/Sprites/forsenLevel.png" id="1_3ptey"]
[ext_resource type="Script" path="res://Utils/ScenePath.cs" id="1_o026a"]
[ext_resource type="Script" path="res://Items/ItemMetadata.cs" id="2_j4tmu"]
@ -11,7 +10,6 @@ Path = "res://Items/Weapons/Pugio.tscn"
[resource]
script = ExtResource("2_j4tmu")
Instance = SubResource("Resource_abrg1")
Icon = ExtResource("1_3ptey")
Name = "Pugio"
Description = "A sidearm dagger."
BuyPrice = 0

View File

@ -1,18 +0,0 @@
[gd_resource type="Resource" script_class="ItemMetadata" load_steps=5 format=3 uid="uid://dkm216ug0vj2h"]
[ext_resource type="Script" path="res://Utils/ScenePath.cs" id="1_owc5r"]
[ext_resource type="Texture2D" uid="uid://vjdyrv8wp7gl" path="res://Assets/Sprites/forsenLevel.png" id="1_v76vk"]
[ext_resource type="Script" path="res://Items/ItemMetadata.cs" id="1_vtlr1"]
[sub_resource type="Resource" id="Resource_6sxq7"]
script = ExtResource("1_owc5r")
Path = "res://Items/Weapons/Shotgun.tscn"
[resource]
script = ExtResource("1_vtlr1")
Instance = SubResource("Resource_6sxq7")
Icon = ExtResource("1_v76vk")
Name = "Shotgun"
Description = ""
BuyPrice = 1887
SellPrice = 0

View File

@ -1,10 +1,9 @@
[gd_scene load_steps=27 format=3 uid="uid://d1d4vg7we5rjr"]
[gd_scene load_steps=26 format=3 uid="uid://d1d4vg7we5rjr"]
[ext_resource type="Script" path="res://Items/Weapons/ProjectileSpawner.cs" id="1_4xyyt"]
[ext_resource type="Script" path="res://State/Weapon/WeaponStateMachine.cs" id="2_ag6rd"]
[ext_resource type="PackedScene" uid="uid://da1do2r2pbayb" path="res://Entities/ShotgunPellet.tscn" id="2_p3wx2"]
[ext_resource type="Script" path="res://State/Weapon/RangedIdleState.cs" id="3_dd6bh"]
[ext_resource type="Resource" uid="uid://dkm216ug0vj2h" path="res://Items/Weapons/Shotgun.tres" id="3_ju036"]
[ext_resource type="Script" path="res://State/Weapon/RangedFireState.cs" id="4_bwqd6"]
[ext_resource type="Texture2D" uid="uid://b1omx2kdb2x1n" path="res://Assets/Sprites/Items/shotgun.png" id="5_g8d45"]
[ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="6_va8ee"]
@ -217,9 +216,11 @@ curve = SubResource("Curve_mqgo6")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_uexo4"]
particle_flag_disable_z = true
flatness = 1.0
gravity = Vector3(0, -4, 0)
initial_velocity_min = -8.0
initial_velocity_max = 24.0
gravity = Vector3(0, -4, 0)
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
scale_min = 0.75
scale_curve = SubResource("CurveTexture_3omj5")
color_ramp = SubResource("GradientTexture1D_83h4s")
@ -235,11 +236,13 @@ gradient = SubResource("Gradient_jks7f")
particle_flag_disable_z = true
direction = Vector3(-1, -2, 0)
spread = 10.0
gravity = Vector3(0, 64, 0)
initial_velocity_min = 16.0
initial_velocity_max = 32.0
angular_velocity_min = 30.0
angular_velocity_max = 60.0
gravity = Vector3(0, 64, 0)
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
scale_min = 2.0
scale_max = 2.0
color_ramp = SubResource("GradientTexture1D_eeskk")
@ -256,7 +259,6 @@ Damage = 12.0
UseTime = 1.5
InitialVelocity = 220.0
PlayerLevelGain = 0.5
Metadata = ExtResource("3_ju036")
[node name="State" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("2_ag6rd")

View File

@ -3,10 +3,11 @@
[ext_resource type="Script" path="res://Utils/World.cs" id="1_1k6ew"]
[ext_resource type="PackedScene" uid="uid://c271rdjhd1gfo" path="res://UI/Base.tscn" id="2_mm0qt"]
[node name="World" type="Node2D" node_paths=PackedStringArray("MusicPlayer")]
[node name="World" type="Node2D" node_paths=PackedStringArray("MusicPlayer", "DialogueBalloon")]
process_mode = 3
script = ExtResource("1_1k6ew")
MusicPlayer = NodePath("MusicPlayer")
DialogueBalloon = NodePath("CanvasLayer/SubViewportContainer/UIViewport/DialogBalloon")
[node name="CanvasLayer" parent="." instance=ExtResource("2_mm0qt")]
@ -20,7 +21,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
bus = &"Music"

View File

@ -45,13 +45,4 @@ public partial class MapState : Resource
}
}
}
public bool? GetBoolean(string key)
{
if (_state[key].VariantType == Variant.Type.Bool)
{
return (bool)_state[key];
}
return null;
}
}

View File

@ -1,17 +0,0 @@
using Godot;
using GodotUtilities;
namespace SupaLidlGame.State.Thinker;
public partial class VendorIdle : ThinkerState
{
public override ThinkerState Think()
{
var bestNeutral = NPC.FindBestNeutral();
if (bestNeutral is not null)
{
NPC.Target = bestNeutral.Position - NPC.Position;
}
return null;
}
}

View File

@ -1,28 +1,18 @@
[gd_scene load_steps=18 format=3 uid="uid://c271rdjhd1gfo"]
[gd_scene load_steps=14 format=3 uid="uid://c271rdjhd1gfo"]
[ext_resource type="PackedScene" uid="uid://73jm5qjy52vq" path="res://Dialogue/balloon.tscn" id="1_atjb1"]
[ext_resource type="Script" path="res://UI/UIController.cs" id="2_b4b6l"]
[ext_resource type="PackedScene" uid="uid://bxo553hblp6nf" path="res://UI/HealthBar.tscn" id="3_j1j6h"]
[ext_resource type="PackedScene" uid="uid://01d24ij5av1y" path="res://UI/BossBar.tscn" id="4_igi28"]
[ext_resource type="PackedScene" uid="uid://cr7tkxctmyags" path="res://UI/LevelBar.tscn" id="4_rcekd"]
[ext_resource type="PackedScene" uid="uid://c77754nvmckn" path="res://UI/LocationDisplay.tscn" id="5_cr6vo"]
[ext_resource type="PackedScene" uid="uid://sfs8dpfitpdu" path="res://UI/Inventory/Hotbar.tscn" id="5_mmp18"]
[ext_resource type="PackedScene" uid="uid://sfs8dpfitpdu" path="res://UI/Hotbar.tscn" id="5_mmp18"]
[ext_resource type="PackedScene" uid="uid://d3q1yu3n7cqfj" path="res://UI/SceneTransition.tscn" id="6_j0nhv"]
[ext_resource type="PackedScene" uid="uid://cyggkyqosjk36" path="res://UI/Inventory/ShopMenu.tscn" id="8_ep3ae"]
[ext_resource type="PackedScene" uid="uid://2afbrf8asy2a" path="res://UI/PostProcessing/Vignette.tscn" id="9_p1ubd"]
[ext_resource type="PackedScene" uid="uid://b1wsryv4bn0cn" path="res://UI/PostProcessing/StunEffect.tscn" id="10_646ma"]
[ext_resource type="Shader" path="res://Shaders/Grayscale.gdshader" id="11_w4gn1"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="11_wtdum"]
[ext_resource type="Texture2D" uid="uid://bw052v8ikfget" path="res://icon.svg" id="12_tyv35"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a504f"]
bg_color = Color(0.906763, 0, 0.280984, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gheod"]
bg_color = Color(1, 0.315507, 0.447521, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1nm23"]
bg_color = Color(0.951511, 0.387714, 0.416256, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_kbd61"]
shader = ExtResource("11_w4gn1")
shader_parameter/grayscale_intensity = 0.0
@ -30,35 +20,6 @@ shader_parameter/grayscale_intensity = 0.0
[node name="BaseUI" type="CanvasLayer"]
process_mode = 3
[node name="Button" type="Button" parent="."]
offset_left = 536.0
offset_right = 592.0
offset_bottom = 31.0
theme_override_styles/focus = SubResource("StyleBoxFlat_a504f")
theme_override_styles/hover = SubResource("StyleBoxFlat_gheod")
theme_override_styles/normal = SubResource("StyleBoxFlat_1nm23")
text = "sdfsdf"
[node name="PostProcessing" type="CanvasLayer" parent="."]
[node name="Vignette" parent="PostProcessing" instance=ExtResource("9_p1ubd")]
[node name="StunEffect" parent="PostProcessing" instance=ExtResource("10_646ma")]
[node name="Sprite2D" type="TextureRect" parent="PostProcessing"]
visible = false
material = SubResource("ShaderMaterial_kbd61")
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -128.0
offset_top = -128.0
grow_horizontal = 0
grow_vertical = 0
texture = ExtResource("12_tyv35")
[node name="SubViewportContainer" type="SubViewportContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
@ -75,6 +36,9 @@ handle_input_locally = false
size = Vector2i(640, 360)
render_target_update_mode = 4
[node name="DialogBalloon" parent="SubViewportContainer/UIViewport" instance=ExtResource("1_atjb1")]
layer = 4
[node name="MainUILayer" type="CanvasLayer" parent="SubViewportContainer/UIViewport"]
layer = 3
@ -88,7 +52,6 @@ grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
mouse_filter = 2
script = ExtResource("2_b4b6l")
[node name="Top" type="HBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"]
@ -115,6 +78,7 @@ layout_mode = 2
layout_mode = 2
[node name="Margin2" type="MarginContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Top/Left/VBoxContainer"]
visible = false
layout_mode = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
@ -128,21 +92,6 @@ theme_override_constants/margin_right = 16
layout_mode = 2
_slots = [NodePath("InventorySlot"), NodePath("InventorySlot2"), NodePath("InventorySlot3")]
[node name="BoxContainer" type="HBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"]
layout_mode = 1
anchors_preset = 11
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -236.0
grow_horizontal = 0
grow_vertical = 2
alignment = 2
[node name="Panel" parent="SubViewportContainer/UIViewport/MainUILayer/Main/BoxContainer" node_paths=PackedStringArray("_inventoryGrid") instance=ExtResource("8_ep3ae")]
layout_mode = 2
_inventoryGrid = NodePath("PanelContainer/VBoxContainer/ScrollContainer/InventoryGrid")
[node name="Bottom" type="HBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"]
layout_mode = 1
anchors_preset = 12
@ -158,20 +107,27 @@ alignment = 1
visible = false
layout_mode = 2
[node name="Button" type="Button" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Bottom"]
layout_mode = 2
theme = ExtResource("11_wtdum")
theme_type_variation = &"InventorySlotButton"
theme_override_styles/hover = SubResource("StyleBoxFlat_gheod")
text = "sdfsdfa"
[node name="VBoxContainer" type="VBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"]
visible = false
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="LocationDisplay" parent="SubViewportContainer/UIViewport/MainUILayer" instance=ExtResource("5_cr6vo")]
[node name="SceneTransition" parent="SubViewportContainer/UIViewport/MainUILayer" instance=ExtResource("6_j0nhv")]
z_index = 1
[node name="PostProcessing" type="CanvasLayer" parent="."]
[node name="Vignette" parent="PostProcessing" instance=ExtResource("9_p1ubd")]
[node name="StunEffect" parent="PostProcessing" instance=ExtResource("10_646ma")]
[node name="Sprite2D" type="TextureRect" parent="PostProcessing"]
visible = false
material = SubResource("ShaderMaterial_kbd61")
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -128.0
offset_top = -128.0
grow_horizontal = 0
grow_vertical = 0
texture = ExtResource("12_tyv35")

View File

@ -1,10 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://sfs8dpfitpdu"]
[gd_scene load_steps=3 format=3 uid="uid://sfs8dpfitpdu"]
[ext_resource type="Script" path="res://UI/Inventory/Hotbar.cs" id="1_2sak2"]
[ext_resource type="PackedScene" uid="uid://dmvu2hjyrwc1y" path="res://UI/Inventory/HotbarSlot.tscn" id="2_3axfe"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6jbma"]
[node name="Hotbar" type="GridContainer" node_paths=PackedStringArray("_slots")]
anchors_preset = 1
anchor_left = 1.0
@ -19,12 +17,9 @@ _slots = [NodePath("InventorySlot"), NodePath("InventorySlot2"), NodePath("Inven
[node name="InventorySlot" parent="." instance=ExtResource("2_3axfe")]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jbma")
[node name="InventorySlot2" parent="." instance=ExtResource("2_3axfe")]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jbma")
[node name="InventorySlot3" parent="." instance=ExtResource("2_3axfe")]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jbma")

View File

@ -0,0 +1,32 @@
using Godot;
using GodotUtilities;
using GodotUtilities.SourceGenerators;
namespace SupaLidlGame.UI.Inventory;
[Scene]
public partial class HotbarSlot : InventorySlot
{
[Node("TextureRect")]
private TextureRect _textureRect;
[Node("Selected")]
private NinePatchRect _selected;
private static Texture2D _placeholderTexture;
private Items.ItemMetadata _item;
private bool _isSelected = false;
public bool IsSelected
{
get => _isSelected;
set
{
_isSelected = value;
_selected.Visible = _isSelected;
_frame.Visible = !_isSelected;
}
}
}

View File

@ -1,15 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://dmvu2hjyrwc1y"]
[gd_scene load_steps=3 format=3 uid="uid://dmvu2hjyrwc1y"]
[ext_resource type="PackedScene" uid="uid://ctad0dkoyw8ad" path="res://UI/Inventory/InventorySlot.tscn" id="1_fb62b"]
[ext_resource type="Texture2D" uid="uid://dp7osg05ip5oo" path="res://Assets/Sprites/sword.png" id="2_aqbyo"]
[ext_resource type="Texture2D" uid="uid://dc1gcsbhkchvg" path="res://Assets/Sprites/UI/hotbar-active.png" id="2_bcv71"]
[node name="InventorySlot" instance=ExtResource("1_fb62b")]
[node name="TextureRect" parent="." index="0"]
texture = ExtResource("2_aqbyo")
expand_mode = 3
[node name="SelectedFrame" type="NinePatchRect" parent="." index="2"]
visible = false
layout_mode = 2

View File

@ -6,167 +6,54 @@ namespace SupaLidlGame.UI.Inventory;
public partial class InventoryGrid : GridContainer
{
private SupaLidlGame.Items.IItemCollection _source;
private SupaLidlGame.Items.Inventory _inventorySource;
[Export]
private PackedScene _slotScene;
public ButtonGroup ButtonGroup { get; private set; }
public SupaLidlGame.Items.IItemCollection Source
public SupaLidlGame.Items.Inventory InventorySource
{
get => _source;
set
{
GD.Print("Set InventoryGrid source");
_source = value;
_inventorySource = value;
Redraw();
}
}
[Signal]
public delegate void SlotFocusedEventHandler(InventorySlot slot);
[Signal]
public delegate void SlotUnfocusedEventHandler(InventorySlot slot);
[Signal]
public delegate void SlotSelectedEventHandler(InventorySlot slot);
public InventoryGrid()
{
ButtonGroup = new();
get => _inventorySource;
}
public void Redraw()
{
GD.Print("Redrawing inventory grid...");
if (_source is null)
if (_inventorySource is null)
{
this.QueueFreeChildren();
}
var children = GetChildren();
for (int i = children.Count; i < _source.Capacity; i++)
for (int i = children.Count; i < _inventorySource.InventoryCapacity; i++)
{
AddInventorySlot();
AddChild(_slotScene.Instantiate<InventorySlot>());
}
for (int i = children.Count - 1; i >= _source.Capacity; i--)
for (int i = children.Count - 1; i >= _inventorySource.InventoryCapacity; i--)
{
children[i].QueueFree();
}
children = GetChildren();
// iterate through items and update the grid
using (var items = _source.GetItems().GetEnumerator())
{
GD.Print("Updating items...");
int i;
for (i = 0; items.MoveNext(); i++)
{
InventorySlot slot = children[i] as InventorySlot;
ItemMetadata item = items.Current;
slot.Item = item;
}
// make remaining slots display empty
for (; i < _source.Capacity; i++)
{
InventorySlot slot = children[i] as InventorySlot;
slot.Item = null;
}
}
for (int i = 0; i < children.Count; i++)
{
var child = children[i] as Control;
if (i > 0)
InventorySlot slot = children[i] as InventorySlot;
if (i >= _inventorySource.Items.Count)
{
child.FocusPrevious = child.GetPathTo(children[i - 1]);
slot.Item = null;
}
if (i < children.Count - 1)
else if (slot.Item != _inventorySource.Items[i])
{
child.FocusNext = child.GetPathTo(children[i + 1]);
slot.Item = _inventorySource.Items[i];
}
}
if (children.Count > 0)
{
var button = children[0] as Button;
button.ButtonPressed = true;
button.GrabFocus();
}
}
private InventorySlot AddInventorySlot()
{
var slot = _slotScene.Instantiate<InventorySlot>();
AddChild(slot);
slot.ButtonGroup = ButtonGroup;
void focusedHandler()
{
EmitSignal(SignalName.SlotFocused, slot);
}
void unfocusedHandler()
{
EmitSignal(SignalName.SlotUnfocused, slot);
}
void toggledHandler()
{
EmitSignal(SignalName.SlotSelected, slot);
}
slot.Connect(
InventorySlot.SignalName.FocusEntered,
Callable.From(focusedHandler)
);
slot.Connect(
InventorySlot.SignalName.FocusExited,
Callable.From(unfocusedHandler)
);
slot.Connect(
InventorySlot.SignalName.MouseEntered,
Callable.From(focusedHandler)
);
slot.Connect(
InventorySlot.SignalName.MouseExited,
Callable.From(unfocusedHandler)
);
slot.Connect(
InventorySlot.SignalName.Pressed,
Callable.From(toggledHandler)
);
return slot;
}
private void RemoveInventorySlot(InventorySlot slot)
{
RemoveChild(slot);
}
public bool GrabSlotFocus()
{
var children = GetChildren();
if (children.Count > 0)
{
var button = children[0] as Button;
button.GrabFocus();
return true;
}
return false;
}
}

View File

@ -4,7 +4,7 @@ using GodotUtilities.SourceGenerators;
namespace SupaLidlGame.UI.Inventory;
public partial class InventorySlot : Button
public partial class InventorySlot : Container
{
private bool _isSelected = false;
@ -16,15 +16,12 @@ public partial class InventorySlot : Button
_isSelected = value;
if (_selectedFrame is not null)
{
//_selectedFrame.Visible = _isSelected;
//_frame.Visible = !_isSelected;
_selectedFrame.Visible = _isSelected;
_frame.Visible = !_isSelected;
}
}
}
[Export]
public bool UseFocusAsSelected { get; set; } = true;
private TextureRect _textureRect;
private NinePatchRect _frame;
@ -44,13 +41,11 @@ public partial class InventorySlot : Button
if (_item is null)
{
//_textureRect.Texture = null;
Icon = null;
_textureRect.Texture = null;
}
else
{
//_textureRect.Texture = _item.Icon;
Icon = _item.Icon;
_textureRect.Texture = _item.Icon;
}
}
}
@ -66,30 +61,5 @@ public partial class InventorySlot : Button
_textureRect = GetNode<TextureRect>("TextureRect");
_frame = GetNode<NinePatchRect>("Frame");
_selectedFrame = GetNode<NinePatchRect>("SelectedFrame");
if (Item is null)
{
// do this to reset the icon
Item = null;
}
if (UseFocusAsSelected)
{
void focusEntered()
{
IsSelected = true;
}
void focusExited()
{
IsSelected = false;
}
Connect(SignalName.FocusEntered, Callable.From(focusEntered));
Connect(SignalName.FocusExited, Callable.From(focusExited));
Connect(SignalName.MouseEntered, Callable.From(focusEntered));
Connect(SignalName.MouseExited, Callable.From(focusExited));
}
}
}

View File

@ -1,41 +1,20 @@
[gd_scene load_steps=8 format=3 uid="uid://ctad0dkoyw8ad"]
[gd_scene load_steps=4 format=3 uid="uid://ctad0dkoyw8ad"]
[ext_resource type="Script" path="res://UI/Inventory/InventorySlot.cs" id="1_fju5i"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="1_wnu7u"]
[ext_resource type="StyleBox" uid="uid://nvb4etac7ee2" path="res://UI/Themes/InventorySlotButtonFocus.tres" id="2_3wx0v"]
[ext_resource type="Texture2D" uid="uid://dc1gcsbhkchvg" path="res://Assets/Sprites/UI/hotbar-active.png" id="2_m56j3"]
[ext_resource type="StyleBox" uid="uid://pqtn0115bqtp" path="res://UI/Themes/InventorySlotButtonPressed.tres" id="3_46bp6"]
[ext_resource type="StyleBox" uid="uid://cfqp0ycwvwx7c" path="res://UI/Themes/InventorySlotButtonNormal.tres" id="4_cc2jo"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_ajutj"]
size = Vector2(24, 24)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6jbma"]
[node name="InventorySlot" type="Button"]
[node name="InventorySlot" type="PanelContainer"]
custom_minimum_size = Vector2(32, 32)
theme = ExtResource("1_wnu7u")
theme_type_variation = &"InventorySlotButton"
theme_override_styles/focus = ExtResource("2_3wx0v")
theme_override_styles/pressed = ExtResource("3_46bp6")
theme_override_styles/normal = ExtResource("4_cc2jo")
toggle_mode = true
action_mode = 0
icon_alignment = 1
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jbma")
script = ExtResource("1_fju5i")
[node name="TextureRect" type="TextureRect" parent="."]
visible = false
layout_mode = 2
offset_right = 32.0
offset_bottom = 32.0
mouse_filter = 2
texture = SubResource("PlaceholderTexture2D_ajutj")
expand_mode = 2
stretch_mode = 3
[node name="Frame" type="NinePatchRect" parent="."]
visible = false
self_modulate = Color(1, 1, 1, 0.5)
layout_mode = 2
offset_right = 32.0
offset_bottom = 32.0
texture = ExtResource("2_m56j3")

View File

@ -1,44 +0,0 @@
using Godot;
using SupaLidlGame.Items;
namespace SupaLidlGame.UI.Inventory;
public partial class ItemTooltip : Control
{
private ItemMetadata _item;
public ItemMetadata Item
{
get => _item;
set
{
_item = value;
if (IsNodeReady())
{
Render();
}
}
}
public override void _Ready()
{
Render();
}
public void Render()
{
if (_item is null)
{
GetNode<Label>("%ItemLabel").Text = "Nothing here";
GetNode<TextureRect>("%ItemTexture").Texture = null;
GetNode<RichTextLabel>("%ItemDescription").Text = "We are ready for My Summer Car";
GetNode<Label>("%Ingredients/Label").Text = "0 Shillings";
return;
}
GetNode<Label>("%ItemLabel").Text = _item.Name;
GetNode<TextureRect>("%ItemTexture").Texture = _item.Icon;
GetNode<RichTextLabel>("%ItemDescription").Text = _item.Description;
GetNode<Label>("%Ingredients/Label").Text = _item.BuyPrice + " Shillings";
}
}

View File

@ -1,127 +0,0 @@
[gd_scene load_steps=12 format=3 uid="uid://bsheehtfcdwhh"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="1_elbte"]
[ext_resource type="Script" path="res://UI/Inventory/ItemTooltip.cs" id="2_entlu"]
[ext_resource type="Texture2D" uid="uid://b16461tjso0j7" path="res://Assets/Sprites/UI/hotbar-inactive.png" id="2_mcttf"]
[ext_resource type="Texture2D" uid="uid://cd8ak8gu0104t" path="res://Assets/Sprites/UI/border.png" id="2_sxqyx"]
[ext_resource type="Texture2D" uid="uid://dc1gcsbhkchvg" path="res://Assets/Sprites/UI/hotbar-active.png" id="2_vjw5e"]
[sub_resource type="Animation" id="Animation_mmh32"]
resource_name = "wipe"
[sub_resource type="AnimationLibrary" id="AnimationLibrary_4bp3t"]
_data = {
"wipe": SubResource("Animation_mmh32")
}
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_xhduc"]
content_margin_left = 0.0
content_margin_top = 0.0
content_margin_right = 0.0
content_margin_bottom = 0.0
texture = ExtResource("2_mcttf")
texture_margin_left = 16.0
texture_margin_top = 16.0
texture_margin_right = 16.0
texture_margin_bottom = 16.0
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_rhjxi"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
texture = ExtResource("2_vjw5e")
texture_margin_left = 8.0
texture_margin_top = 8.0
texture_margin_right = 8.0
texture_margin_bottom = 8.0
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_qnr6k"]
size = Vector2(24, 24)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_idehr"]
bg_color = Color(0.976471, 0.956863, 0.956863, 1)
[node name="ItemTooltip" type="BoxContainer"]
offset_right = 92.0
offset_bottom = 161.0
theme = ExtResource("1_elbte")
script = ExtResource("2_entlu")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_4bp3t")
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 0
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_xhduc")
[node name="Margin" type="MarginContainer" parent="VBoxContainer/PanelContainer"]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/PanelContainer/Margin"]
layout_mode = 2
alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/PanelContainer/Margin/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/PanelContainer/Margin/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_vertical = 0
theme_override_styles/panel = SubResource("StyleBoxTexture_rhjxi")
[node name="ItemTexture" type="TextureRect" parent="VBoxContainer/PanelContainer/Margin/VBoxContainer/HBoxContainer/PanelContainer"]
unique_name_in_owner = true
layout_mode = 2
texture = SubResource("PlaceholderTexture2D_qnr6k")
stretch_mode = 2
[node name="ItemLabel" type="Label" parent="VBoxContainer/PanelContainer/Margin/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Really long item name"
autowrap_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/PanelContainer/Margin/VBoxContainer/HBoxContainer"]
visible = false
layout_mode = 2
size_flags_horizontal = 3
[node name="NinePatchRect" type="NinePatchRect" parent="VBoxContainer/PanelContainer/Margin/VBoxContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2
texture = ExtResource("2_sxqyx")
region_rect = Rect2(0, 6, 48, 5)
patch_margin_left = 16
patch_margin_top = 5
patch_margin_right = 16
[node name="ItemDescription" type="RichTextLabel" parent="VBoxContainer/PanelContainer/Margin/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/default_color = Color(0.937255, 0.854902, 0.854902, 1)
text = "Speed, violence, momentum"
fit_content = true
[node name="PanelContainer2" type="PanelContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_idehr")
[node name="Ingredients" type="MarginContainer" parent="VBoxContainer/PanelContainer2"]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/margin_top = 2
theme_override_constants/margin_bottom = 2
[node name="Label" type="Label" parent="VBoxContainer/PanelContainer2/Ingredients"]
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "250 Shillings"

View File

@ -0,0 +1,44 @@
[gd_scene load_steps=4 format=3 uid="uid://bsheehtfcdwhh"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="1_elbte"]
[ext_resource type="Texture2D" uid="uid://dp7osg05ip5oo" path="res://Assets/Sprites/sword.png" id="2_5jpi0"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_idehr"]
bg_color = Color(0.976471, 0.956863, 0.956863, 1)
[node name="ShopItem" type="BoxContainer"]
offset_right = 67.0
offset_bottom = 16.0
theme = ExtResource("1_elbte")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 0
[node name="Item Margin" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Item Margin"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Item Margin/HBoxContainer"]
layout_mode = 2
texture = ExtResource("2_5jpi0")
[node name="Label" type="Label" parent="VBoxContainer/Item Margin/HBoxContainer"]
layout_mode = 2
text = "Your mom's Item"
[node name="PanelContainer2" type="PanelContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_idehr")
[node name="DescriptionMargin" type="MarginContainer" parent="VBoxContainer/PanelContainer2"]
layout_mode = 2
theme_override_constants/margin_top = 2
theme_override_constants/margin_bottom = 2
[node name="Label" type="Label" parent="VBoxContainer/PanelContainer2/DescriptionMargin"]
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "250 Shillings"

View File

@ -1,84 +0,0 @@
using Godot;
using System.Collections.Generic;
namespace SupaLidlGame.UI.Inventory;
public partial class ShopMenu : Control, IModal
{
private Items.IItemCollection<Items.ShopEntry> _source;
public Items.IItemCollection<Items.ShopEntry> Source
{
get => _source;
set
{
GD.Print("Set ShopMenu source");
_source = value;
_inventoryGrid.Source = value;
}
}
[Export]
private InventoryGrid _inventoryGrid;
private InventorySlot _selected;
public void HideModal()
{
Hide();
_source = null;
}
public override void _Ready()
{
Events.EventBus.Instance.EnterShop += (string path) =>
{
var shop = ResourceLoader.Load<Items.Shop>(path);
GD.Print("Loaded shop");
Source = shop;
};
_inventoryGrid.SlotFocused += (InventorySlot slot) =>
{
GD.Print("SlotFocused " + slot.Name);
if (slot.Item is not null)
{
SetTooltipItem(slot);
}
};
_inventoryGrid.SlotUnfocused += (InventorySlot slot) =>
{
SetTooltipItem(_selected);
};
_inventoryGrid.SlotSelected += (InventorySlot slot) =>
{
_selected = slot;
SetTooltipItem(slot);
GetNode<Button>("%BuyButton").GrabFocus();
};
GetNode<Button>("%BuyButton").GuiInput += (Godot.InputEvent @event) =>
{
if (@event.IsAction("ui_cancel"))
{
_selected?.GrabFocus();
}
};
}
private void SetTooltipItem(InventorySlot slot)
{
GetNode<ItemTooltip>("%ItemTooltip").Item = slot?.Item;
if (slot == _selected)
{
GetNode<Button>("%BuyButton").Disabled = false;
}
else
{
GetNode<Button>("%BuyButton").Disabled = true;
}
}
}

View File

@ -1,27 +1,30 @@
[gd_scene load_steps=9 format=3 uid="uid://cyggkyqosjk36"]
[gd_scene load_steps=6 format=3 uid="uid://cyggkyqosjk36"]
[ext_resource type="StyleBox" uid="uid://bqhotx2ogucye" path="res://UI/Themes/Panel.tres" id="1_2ffty"]
[ext_resource type="Script" path="res://UI/Inventory/ShopMenu.cs" id="1_8c1y7"]
[ext_resource type="Texture2D" uid="uid://uhmowtsi3wfh" path="res://Assets/Sprites/UI/menu-rect-no-bg-white.png" id="2_puklu"]
[ext_resource type="FontFile" uid="uid://cgwa8bjiyv534" path="res://Assets/Fonts/alagard.ttf" id="3_aj4jx"]
[ext_resource type="PackedScene" uid="uid://bsheehtfcdwhh" path="res://UI/Inventory/ItemTooltip.tscn" id="4_n61n7"]
[ext_resource type="PackedScene" uid="uid://chmokkxsy5vas" path="res://UI/Inventory/InventoryGrid.tscn" id="4_sl632"]
[ext_resource type="PackedScene" uid="uid://baawkwo8aiwbu" path="res://UI/Inventory/ShopSlot.tscn" id="5_kfyl0"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="7_rvp1r"]
[ext_resource type="PackedScene" uid="uid://ctad0dkoyw8ad" path="res://UI/Inventory/InventorySlot.tscn" id="4_wawb8"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gm1xk"]
bg_color = Color(0, 0, 0, 0.784314)
bg_color = Color(0, 0, 0, 0.752941)
border_width_left = 16
border_width_top = 16
border_width_right = 16
border_width_bottom = 16
border_color = Color(0.145098, 0.145098, 0.145098, 0)
border_color = Color(0, 0, 0, 0)
border_blend = true
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
[node name="Panel" type="PanelContainer" node_paths=PackedStringArray("_inventoryGrid")]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bvu21"]
texture = ExtResource("2_puklu")
texture_margin_left = 32.0
texture_margin_top = 32.0
texture_margin_right = 32.0
texture_margin_bottom = 32.0
[node name="Panel" type="PanelContainer"]
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
@ -33,45 +36,43 @@ offset_bottom = 175.5
grow_horizontal = 0
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_gm1xk")
script = ExtResource("1_8c1y7")
_inventoryGrid = NodePath("PanelContainer/VBoxContainer/ScrollContainer/InventoryGrid")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 2
theme_override_styles/panel = ExtResource("1_2ffty")
theme_override_styles/panel = SubResource("StyleBoxTexture_bvu21")
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HBoxContainer"]
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("3_aj4jx")
text = "Snus Dealer"
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer"]
[node name="GridContainer" type="GridContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
follow_focus = true
horizontal_scroll_mode = 0
columns = 4
[node name="InventoryGrid" parent="PanelContainer/VBoxContainer/ScrollContainer" instance=ExtResource("4_sl632")]
layout_mode = 2
size_flags_vertical = 3
_slotScene = ExtResource("5_kfyl0")
[node name="ItemTooltip" parent="PanelContainer/VBoxContainer" instance=ExtResource("4_n61n7")]
unique_name_in_owner = true
[node name="InventorySlot" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
[node name="HBoxContainer2" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
[node name="InventorySlot2" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
[node name="BuyButton" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true
[node name="InventorySlot3" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
[node name="InventorySlot4" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
[node name="InventorySlot5" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
[node name="InventorySlot6" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
[node name="InventorySlot7" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
[node name="InventorySlot8" parent="PanelContainer/VBoxContainer/GridContainer" instance=ExtResource("4_wawb8")]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("7_rvp1r")
text = "Buy"

View File

@ -1,14 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://baawkwo8aiwbu"]
[ext_resource type="PackedScene" uid="uid://ctad0dkoyw8ad" path="res://UI/Inventory/InventorySlot.tscn" id="1_tdkv2"]
[ext_resource type="Texture2D" uid="uid://b16461tjso0j7" path="res://Assets/Sprites/UI/hotbar-inactive.png" id="2_af1qu"]
[node name="ShopSlot" instance=ExtResource("1_tdkv2")]
[node name="Frame" parent="." index="1"]
texture = ExtResource("2_af1qu")
[node name="SelectedFrame" type="NinePatchRect" parent="." index="2"]
visible = false
layout_mode = 2
texture = ExtResource("2_af1qu")

View File

@ -151,7 +151,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("1_g1mdf")
[node name="VBoxContainer" type="VBoxContainer" parent="."]

View File

@ -107,7 +107,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("1_mx0ay")
[node name="ColorRect" type="ColorRect" parent="."]
@ -118,7 +117,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 1)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]

View File

@ -1,14 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://nvb4etac7ee2"]
[ext_resource type="Texture2D" uid="uid://b16461tjso0j7" path="res://Assets/Sprites/UI/hotbar-inactive.png" id="1_el8jk"]
[resource]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
texture = ExtResource("1_el8jk")
texture_margin_left = 4.0
texture_margin_top = 4.0
texture_margin_right = 4.0
texture_margin_bottom = 4.0

View File

@ -1,15 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://cfqp0ycwvwx7c"]
[ext_resource type="Texture2D" uid="uid://b16461tjso0j7" path="res://Assets/Sprites/UI/hotbar-inactive.png" id="1_r3gsw"]
[resource]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
texture = ExtResource("1_r3gsw")
texture_margin_left = 4.0
texture_margin_top = 4.0
texture_margin_right = 4.0
texture_margin_bottom = 4.0
modulate_color = Color(1, 1, 1, 0.498039)

View File

@ -1,15 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://pqtn0115bqtp"]
[ext_resource type="Texture2D" uid="uid://b16461tjso0j7" path="res://Assets/Sprites/UI/hotbar-inactive.png" id="1_1ahpp"]
[resource]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
texture = ExtResource("1_1ahpp")
texture_margin_left = 4.0
texture_margin_top = 4.0
texture_margin_right = 4.0
texture_margin_bottom = 4.0
modulate_color = Color(0.941176, 0.843137, 0.470588, 1)

View File

@ -1,14 +0,0 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://bqhotx2ogucye"]
[ext_resource type="Texture2D" uid="uid://uhmowtsi3wfh" path="res://Assets/Sprites/UI/menu-rect-no-bg-white.png" id="1_cb20l"]
[resource]
content_margin_left = 16.0
content_margin_top = 16.0
content_margin_right = 16.0
content_margin_bottom = 16.0
texture = ExtResource("1_cb20l")
texture_margin_left = 32.0
texture_margin_top = 32.0
texture_margin_right = 32.0
texture_margin_bottom = 32.0

View File

@ -1,58 +1,10 @@
[gd_resource type="Theme" load_steps=11 format=3 uid="uid://cksjbu3vrup5"]
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cksjbu3vrup5"]
[ext_resource type="FontFile" uid="uid://6bvgjbmqovau" path="res://Assets/Fonts/calamity/calamity.ttf" id="1_334fe"]
[ext_resource type="StyleBox" uid="uid://nvb4etac7ee2" path="res://UI/Themes/InventorySlotButtonFocus.tres" id="2_3w5h1"]
[ext_resource type="Texture2D" uid="uid://b16461tjso0j7" path="res://Assets/Sprites/UI/hotbar-inactive.png" id="2_6sv27"]
[ext_resource type="StyleBox" uid="uid://bqhotx2ogucye" path="res://UI/Themes/Panel.tres" id="2_jlgx8"]
[ext_resource type="StyleBox" uid="uid://cfqp0ycwvwx7c" path="res://UI/Themes/InventorySlotButtonNormal.tres" id="3_nuiio"]
[ext_resource type="StyleBox" uid="uid://pqtn0115bqtp" path="res://UI/Themes/InventorySlotButtonPressed.tres" id="4_mllnb"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_wk5ww"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
texture = ExtResource("2_6sv27")
texture_margin_left = 16.0
texture_margin_top = 16.0
texture_margin_right = 16.0
texture_margin_bottom = 16.0
modulate_color = Color(0.105882, 0.0470588, 0.117647, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5w4ck"]
bg_color = Color(0.937255, 0.854902, 0.854902, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2qibe"]
content_margin_left = 2.0
content_margin_top = 2.0
content_margin_right = 2.0
content_margin_bottom = 2.0
bg_color = Color(0.976471, 0.956863, 0.956863, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_iyd8w"]
bg_color = Color(0.105882, 0.0470588, 0.117647, 1)
[resource]
default_font = ExtResource("1_334fe")
default_font_size = 15
/colors/background = Color(0.105882, 0.0470588, 0.117647, 1)
/font_sizes/Normal = 15
/font_sizes/Normal = 16
/fonts/Calamity = ExtResource("1_334fe")
Button/colors/font_color = Color(0.105882, 0.0470588, 0.117647, 1)
Button/colors/font_focus_color = Color(0.105882, 0.0470588, 0.117647, 1)
Button/colors/font_hover_color = Color(0.105882, 0.0470588, 0.117647, 1)
Button/colors/font_pressed_color = Color(0.976471, 0.956863, 0.956863, 1)
Button/styles/focus = SubResource("StyleBoxTexture_wk5ww")
Button/styles/hover = SubResource("StyleBoxFlat_5w4ck")
Button/styles/normal = SubResource("StyleBoxFlat_2qibe")
Button/styles/pressed = SubResource("StyleBoxFlat_iyd8w")
InventorySlotButton/base_type = &"Button"
InventorySlotButton/styles/focus = ExtResource("2_3w5h1")
InventorySlotButton/styles/hover = ExtResource("2_3w5h1")
InventorySlotButton/styles/normal = ExtResource("3_nuiio")
InventorySlotButton/styles/pressed = ExtResource("4_mllnb")
MarginContainer/constants/margin_bottom = 8
MarginContainer/constants/margin_left = 8
MarginContainer/constants/margin_right = 8
MarginContainer/constants/margin_top = 8
PanelContainer/styles/panel = ExtResource("2_jlgx8")

View File

@ -2,20 +2,13 @@ using Godot;
namespace SupaLidlGame.Utils;
[System.Flags]
public enum FactionName
{
Player = 1,
Doc = 2,
}
public interface IFaction
{
/// <summary>
/// The faction index that this entity belongs to.
/// </summary>
[Export]
public FactionName Faction { get; set; }
public ushort Faction { get; set; }
public bool AlignsWith(IFaction other)
{

View File

@ -19,6 +19,7 @@ config/icon="res://icon.svg"
GlobalState="*res://State/Global/GlobalState.cs"
EventBus="*res://Events/EventBus.cs"
BaseUI="*res://UI/Base.tscn"
World="*res://Scenes/Level.tscn"
AudioManager="*res://Audio/AudioManager.cs"
DebugUi="*res://UI/Debug/DebugUI.tscn"
@ -26,7 +27,7 @@ DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd"
[dialogue_manager]
general/states=["GlobalState", "World", "EventBus"]
general/states=["GlobalState", "World"]
general/wrap_lines=true
[display]
@ -214,10 +215,6 @@ locale/translations_pot_files=PackedStringArray("res://Assets/Dialogue/doc.dialo
2d_physics/layer_6="Interaction Receiver"
2d_physics/layer_7="Interaction Trigger"
[navigation]
2d/default_cell_size=16.0
[physics]
2d/default_gravity=0.0
@ -225,5 +222,7 @@ locale/translations_pot_files=PackedStringArray("res://Assets/Dialogue/doc.dialo
[rendering]
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
environment/defaults/default_clear_color=Color(0.301961, 0.301961, 0.301961, 1)
viewport/hdr_2d=true