Fix menus between floors
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
@startuml EnemyLogic
|
||||
state "EnemyLogic State" as Zennysoft_Game_Ma_EnemyLogic_State {
|
||||
state "Alive" as Zennysoft_Game_Ma_EnemyLogic_State_Alive {
|
||||
state "Idle" as Zennysoft_Game_Ma_EnemyLogic_State_Idle
|
||||
state "Activated" as Zennysoft_Game_Ma_EnemyLogic_State_Activated {
|
||||
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
|
||||
state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer
|
||||
state "Attacking" as Zennysoft_Game_Ma_EnemyLogic_State_Attacking
|
||||
state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer
|
||||
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
|
||||
}
|
||||
state "Idle" as Zennysoft_Game_Ma_EnemyLogic_State_Idle
|
||||
}
|
||||
state "Defeated" as Zennysoft_Game_Ma_EnemyLogic_State_Defeated
|
||||
}
|
||||
|
||||
@@ -211,14 +211,20 @@ public partial class Game : Node3D, IGame
|
||||
InGameUI.PlayerInfoUI.Show();
|
||||
GameRepo.Resume();
|
||||
})
|
||||
.Handle((in GameState.Output.OpenFloorExitScreen _) =>
|
||||
.Handle((in GameState.Output.OpenTeleportScreen _) =>
|
||||
{
|
||||
InGameUI.UseTeleportPrompt.Show();
|
||||
InGameUI.UseTeleportPrompt.FadeIn();
|
||||
})
|
||||
.Handle((in GameState.Output.LoadNextFloor _) =>
|
||||
.Handle((in GameState.Output.OpenFloorExitScreen _) =>
|
||||
{
|
||||
InGameUI.UseTeleportPrompt.FadeOut();
|
||||
FloorClearMenu.Show();
|
||||
FloorClearMenu.FadeIn();
|
||||
})
|
||||
.Handle((in GameState.Output.LoadNextFloor _) =>
|
||||
{
|
||||
FloorClearMenu.FadeOut();
|
||||
Map.SpawnNextFloor();
|
||||
if (Player.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnChange)
|
||||
{
|
||||
@@ -249,6 +255,9 @@ public partial class Game : Node3D, IGame
|
||||
GameState.Start();
|
||||
this.Provide();
|
||||
InGameUI.UseTeleportPrompt.TeleportToNextFloor += UseTeleportPrompt_TeleportToNextFloor;
|
||||
InGameUI.UseTeleportPrompt.CloseTeleportPrompt += UseTeleportPrompt_CloseTeleportPrompt;
|
||||
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
|
||||
FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit;
|
||||
FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted;
|
||||
|
||||
GameRepo.RestorativePickedUp += GameEventDepot_RestorativePickedUp;
|
||||
@@ -269,6 +278,16 @@ public partial class Game : Node3D, IGame
|
||||
MainMenu.Show();
|
||||
}
|
||||
|
||||
private void FloorClearMenu_SaveAndExit()
|
||||
{
|
||||
//SaveFile.Save();
|
||||
Player.Deactivate();
|
||||
GameState.Input(new GameState.Input.ReturnToMainMenu());
|
||||
InGameUI.Hide();
|
||||
MainMenu.FadeIn();
|
||||
}
|
||||
|
||||
private void FloorClearMenu_GoToNextFloor() => GameState.Input(new GameState.Input.LoadNextFloor());
|
||||
public void LoadExistingGame() => SaveFile.Load().ContinueWith((_) => CallDeferred(nameof(FinishedLoadingSaveFile)));
|
||||
|
||||
public void InitializeGame()
|
||||
@@ -382,16 +401,19 @@ public partial class Game : Node3D, IGame
|
||||
restorative.GlobalPosition = vector;
|
||||
}
|
||||
|
||||
private void UseTeleportPrompt_TeleportToNextFloor()
|
||||
private void UseTeleportPrompt_CloseTeleportPrompt()
|
||||
{
|
||||
InGameUI.UseTeleportPrompt.FadeIn();
|
||||
GameState.Input(new GameState.Input.LoadNextFloor());
|
||||
GameEventDepot.OnDungeonAThemeAreaEntered();
|
||||
GameState.Input(new GameState.Input.CloseTeleport());
|
||||
InGameUI.UseTeleportPrompt.FadeOut();
|
||||
GameRepo.Resume();
|
||||
}
|
||||
|
||||
private void UseTeleportPrompt_TeleportToNextFloor() => GameState.Input(new GameState.Input.UseTeleport());
|
||||
|
||||
private void FloorClearMenu_TransitionCompleted()
|
||||
{
|
||||
GameRepo.Resume();
|
||||
GameEventDepot.OnDungeonAThemeAreaEntered();
|
||||
}
|
||||
|
||||
private void GameEventDepot_RestorativePickedUp(IHealthPack obj) => Player.Stats.SetCurrentVT(Player.Stats.CurrentVT.Value + (int)obj.RestoreAmount);
|
||||
|
||||
@@ -10,6 +10,8 @@ public interface IMainMenu : IControl
|
||||
event MainMenu.NewGameEventHandler NewGame;
|
||||
event MainMenu.LoadGameEventHandler LoadGame;
|
||||
event MainMenu.QuitEventHandler Quit;
|
||||
|
||||
void FadeIn();
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -38,6 +40,12 @@ public partial class MainMenu : Control, IMainMenu
|
||||
NewGameButton.GrabFocus();
|
||||
}
|
||||
|
||||
public void FadeIn()
|
||||
{
|
||||
NewGameButton.GrabFocus();
|
||||
Show();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
NewGameButton.Pressed -= OnNewGamePressed;
|
||||
|
||||
@@ -11,6 +11,15 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_y6722")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.137255, 0.121569, 0.12549, 1)
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
|
||||
@@ -215,6 +215,13 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<ISaveChunk<Play
|
||||
HealthTimer.Start();
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
HealthTimer.Stop();
|
||||
}
|
||||
|
||||
public void Attack()
|
||||
{
|
||||
PlayerLogic.Input(new PlayerLogic.Input.Attack());
|
||||
|
||||
@@ -51,6 +51,7 @@ public partial class FloorClearMenu : Control, IFloorClearMenu
|
||||
{
|
||||
ContinueButton.Disabled = true;
|
||||
SaveAndExitButton.Disabled = true;
|
||||
FadeOut();
|
||||
EmitSignal(SignalName.SaveAndExit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user