diff --git a/GameJamDungeon.csproj b/GameJamDungeon.csproj index ed82cba5..4dc29676 100644 --- a/GameJamDungeon.csproj +++ b/GameJamDungeon.csproj @@ -4,16 +4,16 @@ true - - - - - + + + + + - - - - + + + + diff --git a/src/game/Game.cs b/src/game/Game.cs index 374baf7d..c75ca1cc 100644 --- a/src/game/Game.cs +++ b/src/game/Game.cs @@ -4,8 +4,10 @@ namespace GameJamDungeon; using Chickensoft.AutoInject; using Chickensoft.GodotNodeInterfaces; using Chickensoft.Introspection; +using Chickensoft.SaveFileBuilder; using GameJamDungeon.src.item_rescue; using Godot; +using System; public interface IGame : IProvide, IProvide, IProvide, INode3D { @@ -24,6 +26,8 @@ public interface IGame : IProvide, IProvide, IProvid public void HealVT(int amountToRaise); public void RaiseVT(int amountToRaise); + + public void DoubleEXP(TimeSpan lengthOfEffect); } [Meta(typeof(IAutoNode))] @@ -66,6 +70,8 @@ public partial class Game : Node3D, IGame [Node] public IPauseMenu PauseMenu { get; set; } = default!; [Node] public InGameAudio InGameAudio { get; set; } = default!; + + [Node] public Timer DoubleEXPTimer { get; set; } = default!; #endregion public RescuedItemDatabase RescuedItems { get; set; } = default!; @@ -138,7 +144,7 @@ public partial class Game : Node3D, IGame GameRepo.PlayerData.Inventory.PickedUpItem += Inventory_PickedUpItem; GameRepo.PlayerData.Inventory.RaiseStatRequest += Inventory_RaiseStatRequest; FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor; - FloorClearMenu.ReturnToHubWorld += ReturnToHubWorld; + FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit; FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted; Player.InventoryButtonPressed += Player_InventoryButtonPressed; @@ -147,11 +153,13 @@ public partial class Game : Node3D, IGame GameEventDepot.EnemyDefeated += OnEnemyDefeated; GameEventDepot.RestorativePickedUp += GameEventDepot_RestorativePickedUp; + + DoubleEXPTimer.Timeout += DoubleEXPTimer_Timeout; } private void Inventory_PickedUpItem(string pickedUpItemName) { - InGameUI.PlayerInfoUI.DisplayPickedUpMessage(pickedUpItemName); + InGameUI.PlayerInfoUI.DisplayMessage($"{pickedUpItemName} picked up."); } public void DropItem(IInventoryItem item) @@ -174,7 +182,7 @@ public partial class Game : Node3D, IGame private void OnEnemyDefeated(Vector3 vector, EnemyStatResource resource) { - GameRepo.PlayerData.SetCurrentExp(GameRepo.PlayerData.CurrentExp.Value + resource.ExpFromDefeat); + GameRepo.PlayerData.SetCurrentExp(GameRepo.PlayerData.CurrentExp.Value + (resource.ExpFromDefeat * GameRepo.EXPRate)); DropRestorative(vector); } @@ -234,15 +242,15 @@ public partial class Game : Node3D, IGame GameLogic.Input(new GameLogic.Input.GoToNextFloor()); } - private void ReturnToHubWorld() + private void FloorClearMenu_SaveAndExit() { - // Implement a return to overworld state - // Don't carry over stats/equipment but we'll need to persist the overworld state - // Which may include rescued items and npc/questline state + // Save GameLogic.Input(new GameLogic.Input.HideFloorClearMenu()); + GameLogic.Input(new GameLogic.Input.SaveGame()); } - private void GameEventDepot_RestorativePickedUp(Restorative obj) => GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.CurrentVT.Value + obj.VTRestoreAmount); + private void GameEventDepot_RestorativePickedUp(Restorative obj) + => GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.CurrentVT.Value + obj.VTRestoreAmount); private void Inventory_RaiseStatRequest(InventoryItemStats itemStats) { @@ -290,12 +298,25 @@ public partial class Game : Node3D, IGame EmitSignal(SignalName.StatRaisedAlert, $"{raiseString}VT Restored."); } - private void PlayerInventory_InventoryAtCapacity(string rejectedItem) + public async void DoubleEXP(TimeSpan lengthOfEffect) { - InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItem); + InventoryMenu_CloseInventory(); + InGameUI.PlayerInfoUI.DisplayMessage("Experience points temporarily doubled."); + DoubleEXPTimer.Start(lengthOfEffect.Seconds); + GameRepo.EXPRate = 2; } - private void OnInventoryAtCapacity(string rejectedItemName) => InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName); + private void DoubleEXPTimer_Timeout() + { + DoubleEXPTimer.Stop(); + GameRepo.EXPRate = 1; + InGameUI.PlayerInfoUI.DisplayMessage("Experience points effect wore off."); + } + + private void PlayerInventory_InventoryAtCapacity(string rejectedItem) + { + InGameUI.PlayerInfoUI.DisplayMessage($"Could not pick up {rejectedItem}."); + } private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory()); diff --git a/src/game/Game.tscn b/src/game/Game.tscn index ab63f898..19f51d90 100644 --- a/src/game/Game.tscn +++ b/src/game/Game.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"] -[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"] -[ext_resource type="Shader" path="res://src/app/App.gdshader" id="2_6ifxs"] +[ext_resource type="Script" uid="uid://chftlu4proh3d" path="res://src/game/Game.cs" id="1_ytcii"] +[ext_resource type="Shader" uid="uid://dmjxo4k2rx1an" path="res://src/app/App.gdshader" id="2_6ifxs"] [ext_resource type="PackedScene" uid="uid://by67pn7fdsg1m" path="res://src/map/Map.tscn" id="3_d8awv"] [ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"] [ext_resource type="PackedScene" uid="uid://b1muxus5qdbeu" path="res://src/ui/in_game_ui/InGameUI.tscn" id="5_lxtnp"] [ext_resource type="PackedScene" uid="uid://b16ejcwanod72" path="res://src/audio/InGameAudio.tscn" id="6_qc71l"] -[ext_resource type="Script" path="res://src/game/DialogueController.cs" id="10_58pbt"] -[ext_resource type="Script" path="res://src/ui/pause_menu/PauseMenu.cs" id="11_5ng8c"] +[ext_resource type="Script" uid="uid://daphxl6vvsbjm" path="res://src/game/DialogueController.cs" id="10_58pbt"] +[ext_resource type="Script" uid="uid://cbal5oeaha4nx" path="res://src/ui/pause_menu/PauseMenu.cs" id="11_5ng8c"] [ext_resource type="PackedScene" uid="uid://pu6gp8de3ck4" path="res://src/ui/floor_clear/FloorClearMenu.tscn" id="11_rya1n"] [ext_resource type="PackedScene" uid="uid://dbtfgrtgpr4qg" path="res://src/ui/death_menu/DeathMenu.tscn" id="11_wypid"] [ext_resource type="PackedScene" uid="uid://blbqgw3wosc1w" path="res://src/ui/pause_menu/PauseMenu.tscn" id="12_yev8k"] @@ -54,6 +54,12 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.74459, 1.22144) unique_name_in_owner = true process_mode = 1 +[node name="StatusEffectTimers" type="Node" parent="SubViewportContainer/SubViewport/PauseContainer"] + +[node name="DoubleEXPTimer" type="Timer" parent="SubViewportContainer/SubViewport/PauseContainer/StatusEffectTimers"] +unique_name_in_owner = true +wait_time = 30.0 + [node name="InGameUI" parent="." instance=ExtResource("5_lxtnp")] unique_name_in_owner = true diff --git a/src/game/GameLogic.Input.cs b/src/game/GameLogic.Input.cs index 65ac79bb..67970b1a 100644 --- a/src/game/GameLogic.Input.cs +++ b/src/game/GameLogic.Input.cs @@ -10,6 +10,8 @@ public readonly record struct GoToOverworld; + public readonly record struct SaveGame; + public readonly record struct OpenInventory; public readonly record struct CloseInventory; @@ -32,6 +34,7 @@ public readonly record struct PauseMenuTransitioned; public readonly record struct AskForTeleport; + public readonly record struct HideAskForTeleport; } } diff --git a/src/game/GameRepo.cs b/src/game/GameRepo.cs index 8c165992..0d301378 100644 --- a/src/game/GameRepo.cs +++ b/src/game/GameRepo.cs @@ -26,6 +26,8 @@ public interface IGameRepo : IDisposable public int MaxItemSize { get; } + public int EXPRate { get; set; } + public int CurrentFloor { get; set; } } @@ -47,6 +49,8 @@ public class GameRepo : IGameRepo public int MaxItemSize => 20; + public int EXPRate { get; set; } = 1; + private bool _disposedValue; public int CurrentFloor { get; set; } = 0; diff --git a/src/inventory_menu/InventoryMenu.cs b/src/inventory_menu/InventoryMenu.cs index 450cd73d..a5d58dea 100644 --- a/src/inventory_menu/InventoryMenu.cs +++ b/src/inventory_menu/InventoryMenu.cs @@ -383,12 +383,8 @@ public partial class InventoryMenu : Control, IInventoryMenu GameRepo.PlayerData.Inventory.Equip(equipableItem); itemSlot.SetEquippedSelectedItemStyle(); } - SetProcessInput(false); - await HideUserActionPrompt(); - await ShowInventoryInfo(); - await ToSignal(GetTree().CreateTimer(1f), "timeout"); - await RedrawInventory(); - SetProcessInput(true); + + RefreshUIAfterUserSelection(); } } @@ -398,14 +394,21 @@ public partial class InventoryMenu : Control, IInventoryMenu if (currentItem is IEquipableItem) await EquipOrUnequipItem(); else if (currentItem is IUsableItem usableItem) - { usableItem.Use(); - GameRepo.PlayerData.Inventory.Remove(usableItem); - if (_currentIndex >= ItemSlots.Length - 1) - _currentIndex--; - if (_currentIndex <= 0) - _currentIndex = 0; - } + + if (currentItem is ConsumableItem consumableItem) + DestroyItem(consumableItem); + + RefreshUIAfterUserSelection(); + } + + private async void DestroyItem(IUsableItem usableItem) + { + GameRepo.PlayerData.Inventory.Remove(usableItem); + if (_currentIndex >= ItemSlots.Length - 1) + _currentIndex--; + if (_currentIndex <= 0) + _currentIndex = 0; } private async void ThrowButtonPressed() @@ -437,6 +440,16 @@ public partial class InventoryMenu : Control, IInventoryMenu EmitSignal(SignalName.ClosedMenu); } + private async void RefreshUIAfterUserSelection() + { + SetProcessInput(false); + await HideUserActionPrompt(); + await ShowInventoryInfo(); + await RedrawInventory(); + await ToSignal(GetTree().CreateTimer(1f), "timeout"); + SetProcessInput(true); + } + private enum InventoryPageNumber { FirstPage, diff --git a/src/items/throwable/PalletteSwap.gdshader b/src/items/throwable/PalletteSwap.gdshader new file mode 100644 index 00000000..8b39e031 --- /dev/null +++ b/src/items/throwable/PalletteSwap.gdshader @@ -0,0 +1,78 @@ +// Color range swap shader for Godot 4; Sprite3D version by Sithoid +// Based on 2D shader by nonunknown https://godotshaders.com/shader/color-range-swap/ +// 3d lifehacks by Anonzs https://www.reddit.com/r/godot/comments/11dklv0/sprite3d_shader/ +// Billboard projection by mrdunk https://ask.godotengine.org/152606/how-to-do-i-make-a-shader-a-billboard-face-the-player + +shader_type spatial; +render_mode depth_draw_opaque, depth_prepass_alpha; // Prepass is needed to cast a shadow + +// Set this parameter to your actual texture in script, e.g. with +// material_override.set_shader_parameter("sprite_texture", texture) +uniform sampler2D sprite_texture : source_color, filter_nearest; + +// Hue on a HSV scale (0 to 1) that will be keyed out. Defaults are set to key out bright cyan +uniform float _min = 0.49; +uniform float _max = 0.5; +// Target color (RGBA) that will appear instead of the mask (it will respect brightness) +uniform vec4 color : source_color = vec4(0.59, 0.12, 0.32, 1.0); // Dark pink by default + +uniform bool billboard = false; // Toggle billboard mode (set this in script) + +vec3 rgb2hsv(vec3 c) { + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +// All components are in the range [0…1], including hue. +vec3 hsv2rgb(vec3 c) { + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +// ===== nonunknown got those from: https://gamedev.stackexchange.com/a/75928 +vec4 to_gray(vec4 tex) { + float avg = (tex.r + tex.g + tex.b) / 3.0; + return vec4(vec3(avg),tex.a); +} + +vec4 to_color(vec4 gray, vec4 col) { + return gray * col; +} +// ===== end + +// == Billboard projection by mrdunk + +void vertex() { + if (billboard) { + mat4 modified_model_view = VIEW_MATRIX * mat4( + INV_VIEW_MATRIX[0], + INV_VIEW_MATRIX[1], + INV_VIEW_MATRIX[2], + MODEL_MATRIX[3] + ); + MODELVIEW_MATRIX = modified_model_view; + } +} + +// end === + +void fragment() { + vec4 tex = texture(sprite_texture, UV); + vec3 hsv = rgb2hsv(tex.rgb); + + // the .r here represents HUE, .g is SATURATION, .b is LUMINANCE + if (hsv.r >= _min && hsv.r <= _max) { + tex = to_gray(tex); + tex = to_color(tex, color); + } + // To replace multiple colors, just copy this "if" statement + // and repeat it with different variables (such as _min1, _min2 and color2) + ALBEDO = tex.rgb; + ALPHA = tex.a; +} \ No newline at end of file diff --git a/src/items/throwable/PalletteSwap.gdshader.uid b/src/items/throwable/PalletteSwap.gdshader.uid new file mode 100644 index 00000000..cf351576 --- /dev/null +++ b/src/items/throwable/PalletteSwap.gdshader.uid @@ -0,0 +1 @@ +uid://b1n357imav0y6 diff --git a/src/items/throwable/ThrowableItem.cs b/src/items/throwable/ThrowableItem.cs index 2cfcd179..a4b0d264 100644 --- a/src/items/throwable/ThrowableItem.cs +++ b/src/items/throwable/ThrowableItem.cs @@ -3,16 +3,17 @@ using Chickensoft.Introspection; using GameJamDungeon; using Godot; using System; +using System.ComponentModel; [Meta(typeof(IAutoNode))] public partial class ThrowableItem : Node3D, IUsableItem { public override void _Notification(int what) => this.Notify(what); - [Dependency] public IGameRepo GameRepo => this.DependOn(); - [Dependency] public IGame Game => this.DependOn(); + [Dependency] public IGameRepo GameRepo => this.DependOn(); + public InventoryItemStats Info => ThrowableItemInfo; public int Count { get; } @@ -26,10 +27,23 @@ public partial class ThrowableItem : Node3D, IUsableItem [Node] public Area3D Pickup { get; set; } = default!; + private ThrowableItemTag[] _affinityTypes; + + private int _affinityIndex = 0; + public void OnResolved() { Sprite.Texture = ThrowableItemInfo.Texture; Pickup.BodyEntered += OnEntered; + _affinityTypes = + [ + ThrowableItemTag.InflictBaseDamage, + ThrowableItemTag.InflictHydricDamage, + ThrowableItemTag.InflictIgneousDamage, + ThrowableItemTag.InflictTelluricDamage, + ThrowableItemTag.InflictAeolicDamage, + ThrowableItemTag.InflictFerrumDamage + ]; } public void Use() @@ -38,6 +52,24 @@ public partial class ThrowableItem : Node3D, IUsableItem Game.HealHP(ThrowableItemInfo.HealHPAmount); if (ThrowableItemInfo.HealVTAmount > 0) Game.HealVT(ThrowableItemInfo.HealVTAmount); + + if (ThrowableItemInfo.UsableItemTags.Contains(UsableItemTag.DoubleEXP)) + Game.DoubleEXP(TimeSpan.FromSeconds(30)); + + if (ThrowableItemInfo.ThrowableItemTags.Contains(ThrowableItemTag.CanChangeAffinity)) + ChangeAffinity(); + } + + private void ChangeAffinity() + { + ThrowableItemInfo.ThrowableItemTags.Remove(_affinityTypes[_affinityIndex]); + _affinityIndex = (_affinityIndex + 1) % (_affinityTypes.Length); + ThrowableItemInfo.ThrowableItemTags.Add(_affinityTypes[_affinityIndex]); + + // TODO: Make this an inventory animation to cycle through elements. + ThrowableItemInfo.Description = + $"{GetDescription(_affinityTypes[_affinityIndex])} when thrown." + + $"{System.Environment.NewLine}Use item to change Affinity."; } public void OnEntered(Node3D body) @@ -46,4 +78,19 @@ public partial class ThrowableItem : Node3D, IUsableItem if (isAdded) QueueFree(); } + + private static string GetDescription(ThrowableItemTag enumValue) + { + var field = enumValue.GetType().GetField(enumValue.ToString()); + if (field == null) + return enumValue.ToString(); + + var attributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false); + if (Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) is DescriptionAttribute attribute) + { + return attribute.Description; + } + + return enumValue.ToString(); + } } diff --git a/src/items/throwable/ThrowableItem.tscn b/src/items/throwable/ThrowableItem.tscn index b758450e..1ca45b4a 100644 --- a/src/items/throwable/ThrowableItem.tscn +++ b/src/items/throwable/ThrowableItem.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=3 uid="uid://1fl6s352e2ej"] -[ext_resource type="Script" path="res://src/items/throwable/ThrowableItem.cs" id="1_nac2l"] +[ext_resource type="Script" uid="uid://dj28ol2cpeiwm" path="res://src/items/throwable/ThrowableItem.cs" id="1_nac2l"] [sub_resource type="BoxShape3D" id="BoxShape3D_03cqg"] size = Vector3(0.778381, 0.929947, 0.731567) @@ -20,6 +20,7 @@ shape = SubResource("BoxShape3D_03cqg") [node name="Sprite" type="Sprite3D" parent="Pickup"] unique_name_in_owner = true +transform = Transform3D(0.999973, 0.00489444, -0.00548299, -0.00488109, 0.999985, 0.00244357, 0.00549488, -0.00241672, 0.999982, 0, 0, 0) pixel_size = 0.0005 billboard = 2 shaded = true diff --git a/src/items/throwable/ThrowableItemStats.cs b/src/items/throwable/ThrowableItemStats.cs index 81c63869..c5f527e5 100644 --- a/src/items/throwable/ThrowableItemStats.cs +++ b/src/items/throwable/ThrowableItemStats.cs @@ -7,4 +7,7 @@ public partial class ThrowableItemStats : InventoryItemStats { [Export] public Godot.Collections.Array ThrowableItemTags { get; set; } = new Godot.Collections.Array(); + + [Export] + public Godot.Collections.Array UsableItemTags { get; set; } = new Godot.Collections.Array(); } diff --git a/src/items/throwable/ThrowableItemTag.cs b/src/items/throwable/ThrowableItemTag.cs index cf84920b..ca213eed 100644 --- a/src/items/throwable/ThrowableItemTag.cs +++ b/src/items/throwable/ThrowableItemTag.cs @@ -1,11 +1,21 @@ -public enum ThrowableItemTag +using System.ComponentModel; + +public enum ThrowableItemTag { + [Description("Inflicts basic damage")] + InflictBaseDamage, + [Description("Inflicts Telluric damage")] InflictTelluricDamage, + [Description("Inflicts Aeolic damage")] InflictAeolicDamage, + [Description("Inflicts Hydric damage")] InflictHydricDamage, + [Description("Inflicts Igneous damage")] InflictIgneousDamage, + [Description("Inflicts Ferrum damage")] InflictFerrumDamage, LowerTargetTo1HP, + CanChangeAffinity } public enum UsableItemTag diff --git a/src/items/throwable/resources/GeomanticDice.tres b/src/items/throwable/resources/GeomanticDice.tres index 4a2108d4..9e4a7f73 100644 --- a/src/items/throwable/resources/GeomanticDice.tres +++ b/src/items/throwable/resources/GeomanticDice.tres @@ -1,13 +1,15 @@ [gd_resource type="Resource" script_class="ThrowableItemStats" load_steps=3 format=3 uid="uid://bph8c6by4s047"] -[ext_resource type="Script" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_ewck5"] +[ext_resource type="Script" uid="uid://d3wlunkcuv2w2" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_ewck5"] [ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="1_jhits"] [resource] script = ExtResource("1_ewck5") -ThrowableItemTags = [] +ThrowableItemTags = Array[int]([7]) +UsableItemTags = Array[int]([]) Name = "Geomantic Dice" -Description = "Inflicts Affinity damage when thrown." +Description = "Inflicts base damage when thrown. +Use item to change Affinity." Texture = ExtResource("1_jhits") SpawnRate = 0.1 ThrowSpeed = 20.0 diff --git a/src/items/throwable/resources/SpellSignKnowledge.tres b/src/items/throwable/resources/SpellSignKnowledge.tres index 0cce0aac..3ed0f442 100644 --- a/src/items/throwable/resources/SpellSignKnowledge.tres +++ b/src/items/throwable/resources/SpellSignKnowledge.tres @@ -1,13 +1,17 @@ [gd_resource type="Resource" script_class="ThrowableItemStats" load_steps=3 format=3 uid="uid://qqg0gdcb8fwg"] [ext_resource type="Texture2D" uid="uid://dhfn51smm818x" path="res://src/items/throwable/textures/spell sign - luck.PNG" id="1_3605p"] -[ext_resource type="Script" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_s3pq7"] +[ext_resource type="Script" uid="uid://d3wlunkcuv2w2" path="res://src/items/throwable/ThrowableItemStats.cs" id="1_s3pq7"] [resource] script = ExtResource("1_s3pq7") -Damage = 0 -ThrowableItemTags = [] +ThrowableItemTags = Array[int]([]) +UsableItemTags = Array[int]([0]) Name = "Spell Sign: Knowledge" Description = "Doubles experience points earned. Effect is temporary." Texture = ExtResource("1_3605p") SpawnRate = 0.1 +ThrowSpeed = 12.0 +HealHPAmount = 0 +HealVTAmount = 0 +ThrowDamage = 5 diff --git a/src/map/overworld/Floor0.tscn b/src/map/overworld/Floor0.tscn index 18bcc5a3..28805b9b 100644 --- a/src/map/overworld/Floor0.tscn +++ b/src/map/overworld/Floor0.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=7 format=3 uid="uid://dl6h1djc27ddl"] +[gd_scene load_steps=9 format=3 uid="uid://dl6h1djc27ddl"] [ext_resource type="Script" uid="uid://cuhfkyh3d7noa" path="res://src/map/dungeon/code/Overworld.cs" id="1_2ce63"] [ext_resource type="PackedScene" uid="uid://duis2vhf5ojy3" path="res://src/item_rescue/ItemRescue.tscn" id="2_4ixnb"] [ext_resource type="PackedScene" uid="uid://tc5kdfoggrng" path="res://src/item_rescue/RescuedItems.tscn" id="3_tbcl3"] +[ext_resource type="PackedScene" uid="uid://1fl6s352e2ej" path="res://src/items/throwable/ThrowableItem.tscn" id="4_wibf0"] +[ext_resource type="Resource" uid="uid://bph8c6by4s047" path="res://src/items/throwable/resources/GeomanticDice.tres" id="5_wibf0"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pb22g"] @@ -56,4 +58,8 @@ collision_mask = 3 [node name="CollisionShape3D" type="CollisionShape3D" parent="Spawn Rescued Items/Area3D"] shape = SubResource("SphereShape3D_tbcl3") +[node name="ThrowableItem" parent="." instance=ExtResource("4_wibf0")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0) +ThrowableItemInfo = ExtResource("5_wibf0") + [connection signal="body_entered" from="Spawn Rescued Items/Area3D" to="Rescued Items" method="OnSpawnItemsEntered"] diff --git a/src/player/Player.tscn b/src/player/Player.tscn index 0cb0237b..7600e090 100644 --- a/src/player/Player.tscn +++ b/src/player/Player.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=49 format=3 uid="uid://cfecvvav8kkp6"] -[ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"] -[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"] -[ext_resource type="Script" path="res://src/player/PlayerStatResource.cs" id="2_xq68d"] +[ext_resource type="Script" uid="uid://yxmiqy7i0t7r" path="res://src/player/Player.cs" id="1_xcol5"] +[ext_resource type="Script" uid="uid://6edayafleq8y" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"] +[ext_resource type="Script" uid="uid://s6ku2kyc4rbk" path="res://src/player/PlayerStatResource.cs" id="2_xq68d"] [ext_resource type="Resource" uid="uid://b7xr0l4a8g1gk" path="res://src/items/weapons/resources/SealingRod.tres" id="3_ebyyx"] [ext_resource type="Resource" uid="uid://ce2vfa2t3io67" path="res://src/items/armor/resources/AtonersAdornments.tres" id="4_bj1ma"] [ext_resource type="Texture2D" uid="uid://c6r3dhnkuw22w" path="res://src/vfx/hit_effects/FIRE_STRIKE_1.0.png" id="5_wr6lo"] diff --git a/src/ui/floor_clear/FloorClearMenu.cs b/src/ui/floor_clear/FloorClearMenu.cs index cec899a5..d35e96df 100644 --- a/src/ui/floor_clear/FloorClearMenu.cs +++ b/src/ui/floor_clear/FloorClearMenu.cs @@ -8,7 +8,7 @@ public interface IFloorClearMenu : IControl { event FloorClearMenu.GoToNextFloorEventHandler GoToNextFloor; - event FloorClearMenu.ReturnToHubWorldEventHandler ReturnToHubWorld; + event FloorClearMenu.SaveAndExitEventHandler SaveAndExit; event FloorClearMenu.TransitionCompletedEventHandler TransitionCompleted; @@ -29,7 +29,7 @@ public partial class FloorClearMenu : Control, IFloorClearMenu [Node] public Button ContinueButton { get; set; } = default!; - [Node] public Button ReturnToHubButton { get; set; } = default!; + [Node] public Button SaveAndExitButton { get; set; } = default!; public void FadeIn() => AnimationPlayer.Play("fade_in"); @@ -40,26 +40,26 @@ public partial class FloorClearMenu : Control, IFloorClearMenu [Signal] public delegate void GoToNextFloorEventHandler(); [Signal] - public delegate void ReturnToHubWorldEventHandler(); + public delegate void SaveAndExitEventHandler(); public void OnResolved() { AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished; ContinueButton.Pressed += ContinueButton_Pressed; - ReturnToHubButton.Pressed += ReturnToHubButton_Pressed; + SaveAndExitButton.Pressed += SaveAndExitButton_Pressed; } - private void ReturnToHubButton_Pressed() + private void SaveAndExitButton_Pressed() { ContinueButton.Disabled = true; - ReturnToHubButton.Disabled = true; - EmitSignal(SignalName.ReturnToHubWorld); + SaveAndExitButton.Disabled = true; + EmitSignal(SignalName.SaveAndExit); } private void ContinueButton_Pressed() { ContinueButton.Disabled = true; - ReturnToHubButton.Disabled = true; + SaveAndExitButton.Disabled = true; EmitSignal(SignalName.GoToNextFloor); } @@ -68,7 +68,7 @@ public partial class FloorClearMenu : Control, IFloorClearMenu if (animName == "fade_in") { ContinueButton.Disabled = false; - ReturnToHubButton.Disabled = false; + SaveAndExitButton.Disabled = false; ContinueButton.CallDeferred(MethodName.GrabFocus); } if (animName == "fade_out") diff --git a/src/ui/floor_clear/FloorClearMenu.tscn b/src/ui/floor_clear/FloorClearMenu.tscn index a66942c8..071f5fda 100644 --- a/src/ui/floor_clear/FloorClearMenu.tscn +++ b/src/ui/floor_clear/FloorClearMenu.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=11 format=3 uid="uid://pu6gp8de3ck4"] -[ext_resource type="Script" path="res://src/ui/floor_clear/FloorClearMenu.cs" id="1_q65kq"] +[ext_resource type="Script" uid="uid://yytomatekupe" path="res://src/ui/floor_clear/FloorClearMenu.cs" id="1_q65kq"] [ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="2_xk0dh"] [sub_resource type="Animation" id="Animation_nc1gg"] @@ -52,9 +52,9 @@ tracks/0/keys = { [sub_resource type="AnimationLibrary" id="AnimationLibrary_opfbx"] _data = { -"RESET": SubResource("Animation_nc1gg"), -"fade_in": SubResource("Animation_p616x"), -"fade_out": SubResource("Animation_dhyvw") +&"RESET": SubResource("Animation_nc1gg"), +&"fade_in": SubResource("Animation_p616x"), +&"fade_out": SubResource("Animation_dhyvw") } [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phrcj"] @@ -79,7 +79,7 @@ script = ExtResource("1_q65kq") unique_name_in_owner = true root_node = NodePath("../..") libraries = { -"": SubResource("AnimationLibrary_opfbx") +&"": SubResource("AnimationLibrary_opfbx") } [node name="BG" type="ColorRect" parent="."] @@ -109,9 +109,9 @@ layout_mode = 2 focus_neighbor_left = NodePath(".") focus_neighbor_top = NodePath(".") focus_neighbor_right = NodePath(".") -focus_neighbor_bottom = NodePath("../ReturnToHubButton") -theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 1) +focus_neighbor_bottom = NodePath("../SaveAndExitButton") 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_fonts/font = ExtResource("2_xk0dh") theme_override_font_sizes/font_size = 36 theme_override_styles/focus = SubResource("StyleBoxEmpty_phrcj") @@ -120,7 +120,7 @@ button_mask = 0 text = "Continue" flat = true -[node name="ReturnToHubButton" type="Button" parent="CenterContainer/VBoxContainer"] +[node name="SaveAndExitButton" type="Button" parent="CenterContainer/VBoxContainer"] unique_name_in_owner = true custom_minimum_size = Vector2(200, 50) layout_mode = 2 @@ -128,12 +128,12 @@ focus_neighbor_left = NodePath(".") focus_neighbor_top = NodePath("../ContinueButton") focus_neighbor_right = NodePath(".") focus_neighbor_bottom = NodePath(".") -theme_override_colors/font_focus_color = Color(1, 0.94902, 0, 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_fonts/font = ExtResource("2_xk0dh") theme_override_font_sizes/font_size = 36 theme_override_styles/focus = SubResource("StyleBoxEmpty_cyd1c") theme_override_styles/normal = SubResource("StyleBoxEmpty_4bdva") button_mask = 0 -text = "Return To Overworld" +text = "Save and Exit" flat = true diff --git a/src/ui/in_game_ui/InGameUI.cs b/src/ui/in_game_ui/InGameUI.cs index 93735a9f..afbc7e0b 100644 --- a/src/ui/in_game_ui/InGameUI.cs +++ b/src/ui/in_game_ui/InGameUI.cs @@ -15,10 +15,6 @@ public interface IInGameUI : IControl public void HideMiniMap(); - public void ShowInventoryFullMessage(string rejectedItemName); - - public void ShowPickedUpItemMessage(string pickedUpItem); - event InGameUI.MinimapButtonReleasedEventHandler MinimapButtonReleased; } @@ -47,16 +43,6 @@ public partial class InGameUI : Control, IInGameUI } } - public void ShowInventoryFullMessage(string rejectedItemName) - { - PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName); - } - - public void ShowPickedUpItemMessage(string pickedUp) - { - PlayerInfoUI.DisplayPickedUpMessage(pickedUp); - } - public void HideInventoryScreen() { InventoryMenu.Hide(); diff --git a/src/ui/player_ui/PlayerInfoUI.cs b/src/ui/player_ui/PlayerInfoUI.cs index 5349d4c5..50a8ccb7 100644 --- a/src/ui/player_ui/PlayerInfoUI.cs +++ b/src/ui/player_ui/PlayerInfoUI.cs @@ -7,9 +7,7 @@ namespace GameJamDungeon; public interface IPlayerInfoUI : IControl { - public void DisplayInventoryFullMessage(string rejectedItemName); - - public void DisplayPickedUpMessage(string pickedUpItem); + public void DisplayMessage(string message); } [Meta(typeof(IAutoNode))] @@ -80,9 +78,9 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI }; } - public async void DisplayPickedUpMessage(string pickedUpItem) + public async void DisplayMessage(string message) { - var newLabel = new Label() { Text = $"{pickedUpItem} picked up.", LabelSettings = _labelSettings }; + var newLabel = new Label() { Text = message, LabelSettings = _labelSettings }; PlayerInfo.AddChild(newLabel); GetTree().CreateTimer(3f).Timeout += () =>