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

View File

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

View File

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Zennysoft.Game.Abstractions;
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();

View File

@@ -28,6 +28,8 @@ public partial class InventoryMenu : Control, IInventoryMenu
[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;
@@ -245,8 +247,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
private void PopulatePlayerInfo()
{
// TODO: Fix
FloorLabel.Text = $"Floor 01";
FloorLabel.Text = $"Floor {_map.CurrentFloorNumber:D2}";
if (ItemSlots.Any())
{

View File

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