Small tweak to floor number display, increased chinthe speed, fix Return To Overworld option on floor clear menu

This commit is contained in:
2026-06-06 17:19:48 -07:00
parent 947d311f27
commit 72f8b5c050
11 changed files with 134 additions and 72 deletions
@@ -12,6 +12,8 @@ public partial class GameState
public readonly record struct LoadNextFloor; public readonly record struct LoadNextFloor;
public readonly record struct ReturnToOverworld;
public readonly record struct InventoryButtonPressed; public readonly record struct InventoryButtonPressed;
public readonly record struct InteractButtonPressed; public readonly record struct InteractButtonPressed;
@@ -20,6 +20,8 @@ public partial class GameState
public readonly record struct LoadNextFloor; public readonly record struct LoadNextFloor;
public readonly record struct ReturnToOverworld;
public readonly record struct OpenTeleportScreen; public readonly record struct OpenTeleportScreen;
public readonly record struct OpenFloorExitScreen; public readonly record struct OpenFloorExitScreen;
@@ -8,7 +8,7 @@ public partial class GameState
public partial record State public partial record State
{ {
[Meta, LogicBlock(typeof(State), Diagram = true)] [Meta, LogicBlock(typeof(State), Diagram = true)]
public partial record FloorExitScreen : State, IGet<Input.LoadNextFloor> public partial record FloorExitScreen : State, IGet<Input.LoadNextFloor>, IGet<Input.ReturnToOverworld>
{ {
public FloorExitScreen() public FloorExitScreen()
{ {
@@ -20,6 +20,12 @@ public partial class GameState
Output(new Output.LoadNextFloor()); Output(new Output.LoadNextFloor());
return To<InGame>(); return To<InGame>();
} }
public Transition On(in Input.ReturnToOverworld input)
{
Output(new Output.ReturnToOverworld());
return To<InGame>();
}
} }
} }
} }
@@ -88,7 +88,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.46013, 0)
[node name="FollowBehavior" parent="Components" instance=ExtResource("6_t7elt")] [node name="FollowBehavior" parent="Components" instance=ExtResource("6_t7elt")]
unique_name_in_owner = true unique_name_in_owner = true
_followSpeed = 500.0 FollowSpeed = 800.0
[node name="EngagePlayerBehavior" parent="Components" instance=ExtResource("7_24q6i")] [node name="EngagePlayerBehavior" parent="Components" instance=ExtResource("7_24q6i")]
unique_name_in_owner = true unique_name_in_owner = true
+7 -6
View File
@@ -415,7 +415,6 @@ public partial class Game : Node3D, IGame
}) })
.Handle((in GameState.Output.LoadNextFloor _) => .Handle((in GameState.Output.LoadNextFloor _) =>
{ {
LoadNextLevel.FadeOut();
EmitSignal(SignalName.OnLoadLevelRequest); EmitSignal(SignalName.OnLoadLevelRequest);
Task.Run(() => Save()); Task.Run(() => Save());
if (_player.EquipmentComponent.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnFloorExit) if (_player.EquipmentComponent.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnFloorExit)
@@ -438,6 +437,12 @@ public partial class Game : Node3D, IGame
} }
LoadNextLevel.FadeOut(); LoadNextLevel.FadeOut();
}) })
.Handle((in GameState.Output.ReturnToOverworld _) =>
{
LoadNextLevel.FadeOut();
Task.Run(() => Save());
InitializeGame();
})
.Handle((in GameState.Output.ExitGame _) => .Handle((in GameState.Output.ExitGame _) =>
{ {
OnQuit(); OnQuit();
@@ -453,11 +458,7 @@ public partial class Game : Node3D, IGame
public void SetAffinity(ElementType elementType) => InGameUI.SetAffinity(elementType); public void SetAffinity(ElementType elementType) => InGameUI.SetAffinity(elementType);
private void FloorClearMenu_Exit() private void FloorClearMenu_Exit() => GameState.Input(new GameState.Input.ReturnToOverworld());
{
_player.Deactivate();
InGameUI.Hide();
}
private void ExitInventoryAction() => GameState.Input(new GameState.Input.CloseInventory()); private void ExitInventoryAction() => GameState.Input(new GameState.Input.CloseInventory());
+2
View File
@@ -3,4 +3,6 @@ using Godot;
namespace Zennysoft.Game.Ma; namespace Zennysoft.Game.Ma;
public abstract partial class FloorNode : Node public abstract partial class FloorNode : Node
{ {
[Export]
public string DisplayedFloorNumber { get; set; } = string.Empty;
} }
+2
View File
@@ -28,6 +28,8 @@ public interface IMap : INode3D
public AutoProp<int> CurrentFloorNumber { get; } public AutoProp<int> CurrentFloorNumber { get; }
AutoProp<string> CurrentFloorDisplayString { get; }
public event Action<(Vector3 Rotation, Vector3 Position)> SpawnPointCreated; public event Action<(Vector3 Rotation, Vector3 Position)> SpawnPointCreated;
public event Action FloorLoaded; public event Action FloorLoaded;
+3
View File
@@ -27,6 +27,8 @@ public partial class Map : Node3D, IMap
public AutoProp<int> CurrentFloorNumber { get; private set; } = new AutoProp<int>(0); public AutoProp<int> CurrentFloorNumber { get; private set; } = new AutoProp<int>(0);
public AutoProp<string> CurrentFloorDisplayString { get; private set; } = new AutoProp<string>(string.Empty);
private readonly string _floorFilePath = @"res://src/map/dungeon/floors/"; private readonly string _floorFilePath = @"res://src/map/dungeon/floors/";
public event Action<(Vector3 Rotation, Vector3 Position)> SpawnPointCreated; public event Action<(Vector3 Rotation, Vector3 Position)> SpawnPointCreated;
@@ -60,6 +62,7 @@ public partial class Map : Node3D, IMap
var floor = MapOrder.GetChildren().OfType<FloorNode>().ElementAt(CurrentFloorNumber.Value); var floor = MapOrder.GetChildren().OfType<FloorNode>().ElementAt(CurrentFloorNumber.Value);
if (CurrentFloor is DungeonFloor dungeonFloor && floor is DungeonFloorNode dungeonFloorNode) if (CurrentFloor is DungeonFloor dungeonFloor && floor is DungeonFloorNode dungeonFloorNode)
dungeonFloor.SpawnEnemies(dungeonFloorNode); dungeonFloor.SpawnEnemies(dungeonFloorNode);
CurrentFloorDisplayString.OnNext(floor.DisplayedFloorNumber);
} }
public void FadeIn() => AnimationPlayer.Play("fade_in"); public void FadeIn() => AnimationPlayer.Play("fade_in");
+18
View File
@@ -81,6 +81,7 @@ FolderName = "Floor01"
FloorOdds = Array[float]([0.33, 0.33, 0.33]) FloorOdds = Array[float]([0.33, 0.33, 0.33])
Sproingy = 0.5 Sproingy = 0.5
Michael = 0.5 Michael = 0.5
DisplayedFloorNumber = "01"
[node name="Floor02" type="Node" parent="MapOrder"] [node name="Floor02" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -91,6 +92,7 @@ Michael = 0.5
FilthEater = 0.1 FilthEater = 0.1
GoldSproingy = 0.05 GoldSproingy = 0.05
TrueRedAmbassador = 0.3 TrueRedAmbassador = 0.3
DisplayedFloorNumber = "02"
[node name="Floor03" type="Node" parent="MapOrder"] [node name="Floor03" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -102,6 +104,7 @@ FilthEater = 0.3
Sara = 0.1 Sara = 0.1
GoldSproingy = 0.05 GoldSproingy = 0.05
TrueRedAmbassador = 0.3 TrueRedAmbassador = 0.3
DisplayedFloorNumber = "03"
[node name="Floor04" type="Node" parent="MapOrder"] [node name="Floor04" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -111,6 +114,7 @@ FilthEater = 0.5
Sara = 0.3 Sara = 0.3
AgniDemon = 0.3 AgniDemon = 0.3
GoldSproingy = 0.05 GoldSproingy = 0.05
DisplayedFloorNumber = "04"
[node name="Floor05" type="Node" parent="MapOrder"] [node name="Floor05" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -122,6 +126,7 @@ Ballos = 0.4
RedAmbassador = 0.3 RedAmbassador = 0.3
AgniDemon = 0.5 AgniDemon = 0.5
GoldSproingy = 0.05 GoldSproingy = 0.05
DisplayedFloorNumber = "05"
[node name="Floor06" type="Node" parent="MapOrder"] [node name="Floor06" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -132,6 +137,7 @@ Ballos = 0.5
RedAmbassador = 0.3 RedAmbassador = 0.3
AgniDemon = 0.5 AgniDemon = 0.5
GoldSproingy = 0.05 GoldSproingy = 0.05
DisplayedFloorNumber = "06"
[node name="Floor07" type="Node" parent="MapOrder"] [node name="Floor07" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -142,10 +148,12 @@ Ballos = 0.5
RedAmbassador = 0.3 RedAmbassador = 0.3
AgniDemon = 0.4 AgniDemon = 0.4
GoldSproingy = 0.05 GoldSproingy = 0.05
DisplayedFloorNumber = "07"
[node name="Boss Floor 1" type="Node" parent="MapOrder"] [node name="Boss Floor 1" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0") script = ExtResource("3_v14r0")
FloorName = 2 FloorName = 2
DisplayedFloorNumber = "???"
[node name="Floor09" type="Node" parent="MapOrder"] [node name="Floor09" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -153,6 +161,7 @@ FolderName = "Floor09"
FloorOdds = Array[float]([0.5, 0.5]) FloorOdds = Array[float]([0.5, 0.5])
Chinthe = 0.5 Chinthe = 0.5
GreenAmbassador = 0.1 GreenAmbassador = 0.1
DisplayedFloorNumber = "09"
[node name="Floor10" type="Node" parent="MapOrder"] [node name="Floor10" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -161,6 +170,7 @@ FloorOdds = Array[float]([0.5, 0.5])
Chinthe = 0.5 Chinthe = 0.5
GreenAmbassador = 0.5 GreenAmbassador = 0.5
ShieldOfHeaven = 0.1 ShieldOfHeaven = 0.1
DisplayedFloorNumber = "10"
[node name="Floor11" type="Node" parent="MapOrder"] [node name="Floor11" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -169,6 +179,7 @@ FloorOdds = Array[float]([0.5, 0.5])
Chinthe = 0.5 Chinthe = 0.5
GreenAmbassador = 0.5 GreenAmbassador = 0.5
ShieldOfHeaven = 0.5 ShieldOfHeaven = 0.5
DisplayedFloorNumber = "11"
[node name="Floor12" type="Node" parent="MapOrder"] [node name="Floor12" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -177,6 +188,7 @@ FloorOdds = Array[float]([0.5, 0.5])
GreenAmbassador = 0.5 GreenAmbassador = 0.5
SteelAmbassador = 0.05 SteelAmbassador = 0.05
ShieldOfHeaven = 0.5 ShieldOfHeaven = 0.5
DisplayedFloorNumber = "12"
[node name="Floor13" type="Node" parent="MapOrder"] [node name="Floor13" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -187,6 +199,7 @@ GreenAmbassador = 0.25
SteelAmbassador = 0.05 SteelAmbassador = 0.05
Palan = 0.3 Palan = 0.3
ShieldOfHeaven = 0.5 ShieldOfHeaven = 0.5
DisplayedFloorNumber = "13"
[node name="Floor14" type="Node" parent="MapOrder"] [node name="Floor14" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
@@ -196,24 +209,29 @@ SteelAmbassador = 0.05
Palan = 0.5 Palan = 0.5
ShieldOfHeaven = 0.5 ShieldOfHeaven = 0.5
GoldSproingy = 0.05 GoldSproingy = 0.05
DisplayedFloorNumber = "14"
[node name="Floor15" type="Node" parent="MapOrder"] [node name="Floor15" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7") script = ExtResource("2_00xd7")
FolderName = "Floor15" FolderName = "Floor15"
FloorOdds = Array[float]([1.0]) FloorOdds = Array[float]([1.0])
Sproingy = 1.0 Sproingy = 1.0
DisplayedFloorNumber = "15"
[node name="Boss Floor 2" type="Node" parent="MapOrder"] [node name="Boss Floor 2" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0") script = ExtResource("3_v14r0")
FloorName = 3 FloorName = 3
DisplayedFloorNumber = "???"
[node name="Goddess of Guidance Floor" type="Node" parent="MapOrder"] [node name="Goddess of Guidance Floor" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0") script = ExtResource("3_v14r0")
FloorName = 4 FloorName = 4
DisplayedFloorNumber = "???"
[node name="Final Floor" type="Node" parent="MapOrder"] [node name="Final Floor" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0") script = ExtResource("3_v14r0")
FloorName = 6 FloorName = 6
DisplayedFloorNumber = "???"
[node name="ColorRect" type="ColorRect" parent="."] [node name="ColorRect" type="ColorRect" parent="."]
anchors_preset = 15 anchors_preset = 15
+4 -4
View File
@@ -21,7 +21,7 @@ public partial class Minimap : Control
public void OnResolved() public void OnResolved()
{ {
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync; _map.CurrentFloorDisplayString.Sync += CurrentFloorNumber_Sync;
_ready = true; _ready = true;
} }
@@ -31,13 +31,13 @@ public partial class Minimap : Control
MinimapCamera.Position = new Vector3(_player.GlobalPosition.X, MinimapCamera.Position.Y, _player.GlobalPosition.Z); MinimapCamera.Position = new Vector3(_player.GlobalPosition.X, MinimapCamera.Position.Y, _player.GlobalPosition.Z);
} }
private void CurrentFloorNumber_Sync(int obj) private void CurrentFloorNumber_Sync(string obj)
{ {
LayerNumberText.Text = $"{obj:D2}"; LayerNumberText.Text = obj;
} }
public void OnExitTree() public void OnExitTree()
{ {
_map.CurrentFloorNumber.Sync -= CurrentFloorNumber_Sync; _map.CurrentFloorDisplayString.Sync -= CurrentFloorNumber_Sync;
} }
} }
@@ -43,19 +43,7 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
public void OnResolved() public void OnResolved()
{ {
_player.ExperiencePointsComponent.Level.Sync += Level_Sync; EnableUISync();
_player.ExperiencePointsComponent.CurrentExp.Sync += Exp_Sync;
_player.ExperiencePointsComponent.ExpToNextLevel.Sync += Exp_Sync;
_player.HealthComponent.CurrentHP.Sync += HP_Sync;
_player.HealthComponent.MaximumHP.Sync += HP_Sync;
_player.VTComponent.CurrentVT.Sync += VT_Sync;
_player.VTComponent.MaximumVT.Sync += VT_Sync;
_player.AttackComponent.CurrentAttack.Sync += Attack_Sync;
_player.AttackComponent.MaximumAttack.Sync += Attack_Sync;
_player.DefenseComponent.CurrentDefense.Sync += Defense_Sync;
_player.DefenseComponent.MaximumDefense.Sync += Defense_Sync;
_player.EquipmentComponent.EquipmentChanged += EquipmentComponent_EquipmentChanged;
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync;
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished; AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
AnimationPlayer.AnimationStarted += AnimationPlayer_AnimationStarted; AnimationPlayer.AnimationStarted += AnimationPlayer_AnimationStarted;
@@ -104,6 +92,7 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
} }
if (animName == "fade_out") if (animName == "fade_out")
{ {
DisableUISync();
_fadingIn = false; _fadingIn = false;
ContinueButton.CallDeferred(MethodName.ReleaseFocus); ContinueButton.CallDeferred(MethodName.ReleaseFocus);
} }
@@ -119,6 +108,43 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
ExitButton.FocusMode = FocusModeEnum.All; ExitButton.FocusMode = FocusModeEnum.All;
} }
if (animName == "fade_out") if (animName == "fade_out")
{
EnableUISync();
TransitionCompleted?.Invoke(); TransitionCompleted?.Invoke();
} }
} }
private void EnableUISync()
{
_player.ExperiencePointsComponent.Level.Sync += Level_Sync;
_player.ExperiencePointsComponent.CurrentExp.Sync += Exp_Sync;
_player.ExperiencePointsComponent.ExpToNextLevel.Sync += Exp_Sync;
_player.HealthComponent.CurrentHP.Sync += HP_Sync;
_player.HealthComponent.MaximumHP.Sync += HP_Sync;
_player.VTComponent.CurrentVT.Sync += VT_Sync;
_player.VTComponent.MaximumVT.Sync += VT_Sync;
_player.AttackComponent.CurrentAttack.Sync += Attack_Sync;
_player.AttackComponent.MaximumAttack.Sync += Attack_Sync;
_player.DefenseComponent.CurrentDefense.Sync += Defense_Sync;
_player.DefenseComponent.MaximumDefense.Sync += Defense_Sync;
_player.EquipmentComponent.EquipmentChanged += EquipmentComponent_EquipmentChanged;
_map.CurrentFloorNumber.Sync += CurrentFloorNumber_Sync;
}
private void DisableUISync()
{
_player.ExperiencePointsComponent.Level.Sync -= Level_Sync;
_player.ExperiencePointsComponent.CurrentExp.Sync -= Exp_Sync;
_player.ExperiencePointsComponent.ExpToNextLevel.Sync -= Exp_Sync;
_player.HealthComponent.CurrentHP.Sync -= HP_Sync;
_player.HealthComponent.MaximumHP.Sync -= HP_Sync;
_player.VTComponent.CurrentVT.Sync -= VT_Sync;
_player.VTComponent.MaximumVT.Sync -= VT_Sync;
_player.AttackComponent.CurrentAttack.Sync -= Attack_Sync;
_player.AttackComponent.MaximumAttack.Sync -= Attack_Sync;
_player.DefenseComponent.CurrentDefense.Sync -= Defense_Sync;
_player.DefenseComponent.MaximumDefense.Sync -= Defense_Sync;
_player.EquipmentComponent.EquipmentChanged -= EquipmentComponent_EquipmentChanged;
_map.CurrentFloorNumber.Sync -= CurrentFloorNumber_Sync;
}
}