Cleanup previous refactor, fix floor count

This commit is contained in:
2025-03-10 21:04:28 -07:00
parent a1c26ed7fb
commit ed12c1cf15
7 changed files with 48 additions and 48 deletions

View File

@@ -4,7 +4,6 @@ using Chickensoft.Introspection;
using Godot; using Godot;
using Zennysoft.Game.Abstractions; using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter; using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma; namespace Zennysoft.Game.Ma;
@@ -56,85 +55,85 @@ public partial class InGameAudio : Node
public void Setup() public void Setup()
{ {
InGameAudioLogic = new InGameAudioLogic(); InGameAudioLogic = new InGameAudioLogic();
} }
public void OnResolved() public void OnResolved()
{ {
InGameAudioLogic.Set(AppRepo); InGameAudioLogic.Set(AppRepo);
InGameAudioLogic.Set(GameEventDepot); InGameAudioLogic.Set(GameEventDepot);
InGameAudioLogic.Set(Player); InGameAudioLogic.Set(Player);
InGameAudioLogic.Set(GameRepo); InGameAudioLogic.Set(GameRepo);
InGameAudioBinding = InGameAudioLogic.Bind(); InGameAudioBinding = InGameAudioLogic.Bind();
InGameAudioBinding InGameAudioBinding
.Handle((in InGameAudioLogic.Output.PlayOverworldMusic _) => StartOverworldMusic()) .Handle((in InGameAudioLogic.Output.PlayOverworldMusic _) => StartOverworldMusic())
.Handle((in InGameAudioLogic.Output.PlayDungeonThemeAMusic _) => StartDungeonThemeA()) .Handle((in InGameAudioLogic.Output.PlayDungeonThemeAMusic _) => StartDungeonThemeA())
.Handle((in InGameAudioLogic.Output.PlayMenuScrollSound _) => PlayMenuScrollSound()) .Handle((in InGameAudioLogic.Output.PlayMenuScrollSound _) => PlayMenuScrollSound())
.Handle((in InGameAudioLogic.Output.PlayEquipSound _) => PlayEquipSound()) .Handle((in InGameAudioLogic.Output.PlayEquipSound _) => PlayEquipSound())
.Handle((in InGameAudioLogic.Output.PlayMenuBackSound _) => PlayMenuBackSound()) .Handle((in InGameAudioLogic.Output.PlayMenuBackSound _) => PlayMenuBackSound())
.Handle((in InGameAudioLogic.Output.PlayInventorySortedSound _) => PlayInventorySortedSound()) .Handle((in InGameAudioLogic.Output.PlayInventorySortedSound _) => PlayInventorySortedSound())
.Handle((in InGameAudioLogic.Output.PlayHealingItemSound _) => PlayHealingItemSound()) .Handle((in InGameAudioLogic.Output.PlayHealingItemSound _) => PlayHealingItemSound())
.Handle((in InGameAudioLogic.Output.PlayTeleportSound _) => PlayTeleportSound()) .Handle((in InGameAudioLogic.Output.PlayTeleportSound _) => PlayTeleportSound())
.Handle((in InGameAudioLogic.Output.PlayPlayerAttackSound _) => { PlayerAttackSFX.Stop(); PlayerAttackSFX.Play(); }) .Handle((in InGameAudioLogic.Output.PlayPlayerAttackSound _) => { PlayerAttackSFX.Stop(); PlayerAttackSFX.Play(); })
.Handle((in InGameAudioLogic.Output.PlayPlayerAttackWallSound _) => { PlayerAttackWallSFX.Stop(); PlayerAttackWallSFX.Play(); }); .Handle((in InGameAudioLogic.Output.PlayPlayerAttackWallSound _) => { PlayerAttackWallSFX.Stop(); PlayerAttackWallSFX.Play(); });
InGameAudioLogic.Start(); InGameAudioLogic.Start();
} }
public void OnExitTree() public void OnExitTree()
{ {
InGameAudioLogic.Stop(); InGameAudioLogic.Stop();
InGameAudioBinding.Dispose(); InGameAudioBinding.Dispose();
} }
private void StartOverworldMusic() private void StartOverworldMusic()
{ {
OverworldBgm.Stop(); OverworldBgm.Stop();
OverworldBgm.FadeIn(); OverworldBgm.FadeIn();
} }
private void StartDungeonThemeA() private void StartDungeonThemeA()
{ {
OverworldBgm.FadeOut(); OverworldBgm.FadeOut();
DungeonThemeABgm.Stop(); DungeonThemeABgm.Stop();
DungeonThemeABgm.FadeIn(); DungeonThemeABgm.FadeIn();
} }
private void PlayMenuScrollSound() private void PlayMenuScrollSound()
{ {
MenuScrollSFX.Stop(); MenuScrollSFX.Stop();
MenuScrollSFX.Play(); MenuScrollSFX.Play();
} }
private void PlayEquipSound() private void PlayEquipSound()
{ {
EquipSFX.Stop(); EquipSFX.Stop();
EquipSFX.Play(); EquipSFX.Play();
} }
private void PlayMenuBackSound() private void PlayMenuBackSound()
{ {
MenuBackSFX.Stop(); MenuBackSFX.Stop();
MenuBackSFX.Play(); MenuBackSFX.Play();
} }
private void PlayInventorySortedSound() private void PlayInventorySortedSound()
{ {
InventorySortedSFX.Stop(); InventorySortedSFX.Stop();
InventorySortedSFX.Play(); InventorySortedSFX.Play();
} }
private void PlayHealingItemSound() private void PlayHealingItemSound()
{ {
HealingItemSFX.Stop(); HealingItemSFX.Stop();
HealingItemSFX.Play(); HealingItemSFX.Play();
} }
private void PlayTeleportSound() private void PlayTeleportSound()
{ {
TeleportSFX.Stop(); TeleportSFX.Stop();
TeleportSFX.Play(); TeleportSFX.Play();
} }
} }

View File

@@ -25,6 +25,8 @@ public partial class Game : Node3D, IGame
IGameEventDepot IProvide<IGameEventDepot>.Value() => GameEventDepot; IGameEventDepot IProvide<IGameEventDepot>.Value() => GameEventDepot;
IMap IProvide<IMap>.Value() => Map;
private static SimpleInjector.Container _container; private static SimpleInjector.Container _container;
public IInstantiator Instantiator { get; set; } = default!; public IInstantiator Instantiator { get; set; } = default!;

View File

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Zennysoft.Game.Abstractions; using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter; using Zennysoft.Ma.Adapter;
public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvide<IGame>, IProvide<IPlayer>, IProvide<ISaveChunk<GameData>>, INode3D public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvide<IGame>, IProvide<IPlayer>, IProvide<IMap>, IProvide<ISaveChunk<GameData>>, INode3D
{ {
void LoadExistingGame(); void LoadExistingGame();

View File

@@ -28,6 +28,8 @@ public partial class InventoryMenu : Control, IInventoryMenu
[Dependency] public IPlayer Player => this.DependOn<IPlayer>(); [Dependency] public IPlayer Player => this.DependOn<IPlayer>();
[Dependency] public IMap _map => this.DependOn<IMap>();
[Dependency] public IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>(); [Dependency] public IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>();
private InventoryPageNumber _currentPageNumber = InventoryPageNumber.FirstPage; private InventoryPageNumber _currentPageNumber = InventoryPageNumber.FirstPage;
@@ -245,8 +247,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
private void PopulatePlayerInfo() private void PopulatePlayerInfo()
{ {
// TODO: Fix FloorLabel.Text = $"Floor {_map.CurrentFloorNumber:D2}";
FloorLabel.Text = $"Floor 01";
if (ItemSlots.Any()) if (ItemSlots.Any())
{ {

View File

@@ -22,6 +22,8 @@ public interface IMap : INode3D, IProvide<ISaveChunk<MapData>>
Transform3D GetPlayerSpawnPosition(); Transform3D GetPlayerSpawnPosition();
IDungeonRoom GetPlayersCurrentRoom(); IDungeonRoom GetPlayersCurrentRoom();
public int CurrentFloorNumber { get; }
} }
@@ -52,6 +54,8 @@ public partial class Map : Node3D, IMap
public IDungeonFloor CurrentFloor { get; private set; } public IDungeonFloor CurrentFloor { get; private set; }
public int CurrentFloorNumber { get; private set; } = 0;
public void OnResolved() public void OnResolved()
{ {
FloorScenes = []; FloorScenes = [];
@@ -95,6 +99,7 @@ public partial class Map : Node3D, IMap
Player.TeleportPlayer(transform); Player.TeleportPlayer(transform);
CurrentFloor.FloorIsLoaded = true; CurrentFloor.FloorIsLoaded = true;
Game.NextFloorLoaded(); Game.NextFloorLoaded();
CurrentFloorNumber += 1;
} }
public IDungeonRoom GetPlayersCurrentRoom() public IDungeonRoom GetPlayersCurrentRoom()

View File

@@ -1,6 +0,0 @@
namespace Zennysoft.Game.Abstractions;
public interface IKillable
{
public void Die();
}

View File

@@ -1 +0,0 @@
uid://djmmgvqb2rcde