Support opening monster viewer screen from main menu

This commit is contained in:
2025-09-25 03:55:20 -07:00
parent 84f0f8338f
commit 78e08bec5c
7 changed files with 36 additions and 32 deletions

View File

@@ -186,11 +186,13 @@ Interact={
Next={
"deadzone": 0.2,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
Previous={
"deadzone": 0.2,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
Save={

View File

@@ -36,7 +36,9 @@ public partial class App : Node, IApp
private Array _progress;
private AutoProp<bool> _loaded = new(false);
private AutoProp<string> _loadedScene = new(string.Empty);
private bool _loadingGame = false;
private bool _loadingEnemyViewer = false;
public void Initialize()
{
@@ -47,8 +49,9 @@ public partial class App : Node, IApp
MainMenu.NewGame += OnNewGame;
MainMenu.LoadGame += OnLoadGame;
MainMenu.EnemyViewer += OnEnemyViewer;
MainMenu.Quit += OnQuit;
_loaded.Sync += OnGameLoaded;
_loadedScene.Changed += OnGameLoaded;
Instantiator = new Instantiator(GetTree());
@@ -63,16 +66,13 @@ public partial class App : Node, IApp
this.Provide();
}
private void OnGameLoaded(bool gameLoaded)
private void OnGameLoaded(string sceneName)
{
if (gameLoaded)
{
Loading.Hide();
var gameScene = (PackedScene)ResourceLoader.LoadThreadedGet(GAME_SCENE_PATH);
var game = gameScene.Instantiate();
AddChild(game);
Instantiator.SceneTree.Paused = false;
}
Loading.Hide();
var scene = (PackedScene)ResourceLoader.LoadThreadedGet(sceneName);
var node = scene.Instantiate();
AddChild(node);
Instantiator.SceneTree.Paused = false;
}
public void OnReady()
@@ -88,7 +88,8 @@ public partial class App : Node, IApp
})
.Handle((in AppLogic.Output.SetupGameScene _) =>
{
ResourceLoader.LoadThreadedRequest(GAME_SCENE_PATH, useSubThreads: true, cacheMode: ResourceLoader.CacheMode.Ignore);
ResourceLoader.LoadThreadedRequest(GAME_SCENE_PATH);
_loadingGame = true;
MainMenu.Hide();
})
.Handle((in AppLogic.Output.ShowMainMenu _) =>
@@ -102,7 +103,9 @@ public partial class App : Node, IApp
})
.Handle((in AppLogic.Output.EnemyViewerOpened _) =>
{
Instantiator.LoadAndInstantiate<Node>(ENEMY_VIEWER_PATH);
ResourceLoader.LoadThreadedRequest(ENEMY_VIEWER_PATH);
_loadingEnemyViewer = true;
MainMenu.Hide();
})
.Handle((in AppLogic.Output.ExitGame _) =>
{
@@ -115,16 +118,25 @@ public partial class App : Node, IApp
public override void _Process(double delta)
{
if (!_loaded.Value)
if (_loadingGame)
{
ResourceLoader.LoadThreadedGetStatus(GAME_SCENE_PATH, _progress);
if ((double)_progress.Single() == 1)
_loaded.OnNext(true);
_loadedScene.OnNext(GAME_SCENE_PATH);
}
if (_loadingEnemyViewer)
{
ResourceLoader.LoadThreadedGetStatus(ENEMY_VIEWER_PATH, _progress);
if ((double)_progress.Single() == 1)
_loadedScene.OnNext(ENEMY_VIEWER_PATH);
}
}
public void OnNewGame() => AppLogic.Input(new AppLogic.Input.NewGame());
private void OnEnemyViewer() => AppLogic.Input(new AppLogic.Input.EnemyViewerOpened());
private void OnLoadGame() => AppLogic.Input(new AppLogic.Input.LoadGame());
public void OnQuit() => AppLogic.Input(new AppLogic.Input.QuitGame());

View File

@@ -152,11 +152,10 @@ offset_top = -228.0
grow_horizontal = 0
grow_vertical = 0
theme = ExtResource("2_bef6s")
text = "Switch: L1/R1
Primary Attack: X
Secondary Attack: ◻
Activate: △
Press ○ to exit"
text = "Switch: L1/R1 or <- ->
Primary Attack: X (Space)
Secondary Attack: ◻ (RMB)
Activate: △ (E)"
[node name="DataViewerRepository" parent="." instance=ExtResource("3_ejdn0")]
unique_name_in_owner = true

View File

@@ -41,8 +41,6 @@ public partial class Game : Node3D, IGame
[Node] private DeathMenu DeathMenu { get; set; } = default!;
[Node] private IPauseMenu PauseMenu { get; set; } = default!;
[Node] private Timer DoubleEXPTimer { get; set; } = default!;
#endregion
#region Save
@@ -238,8 +236,6 @@ public partial class Game : Node3D, IGame
GameRepo.RestorativePickedUp += GameEventDepot_RestorativePickedUp;
DoubleEXPTimer.Timeout += DoubleEXPTimer_Timeout;
DeathMenu.NewGame += OnContinueGame;
DeathMenu.QuitGame += OnQuit;
@@ -398,8 +394,6 @@ public partial class Game : Node3D, IGame
private void IsPaused_Sync(bool isPaused) => GetTree().Paused = isPaused;
private void DoubleEXPTimer_Timeout() => GameRepo.EndDoubleExp();
private void FinishedLoadingSaveFile() => EmitSignal(SignalName.SaveFileLoaded);
private void EnactConsumableItemEffects(ConsumableItem consumableItem)

View File

@@ -42,12 +42,6 @@ render_target_update_mode = 4
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
custom_minimum_size = Vector2(1280, 720)

View File

@@ -9,6 +9,8 @@ public interface IMainMenu : IControl
{
event MainMenu.NewGameEventHandler NewGame;
event MainMenu.LoadGameEventHandler LoadGame;
event MainMenu.EnemyViewerEventHandler EnemyViewer;
event MainMenu.GalleryEventHandler Gallery;
event MainMenu.QuitEventHandler Quit;
void FadeIn();