Compare commits

..

No commits in common. "3e030e2b8572a95f441c26ba2c29b57914d96b76" and "59497838fe12a0f44de5f4b4f8f9f06faae07b55" have entirely different histories.

8 changed files with 32 additions and 48 deletions

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GdProjectSettingsState">
<annotators>warn</annotators>
</component>
</project>

View File

@ -6,7 +6,6 @@ class_name ThemedButton extends Button
@onready var lower_corner_decor := load("res://import/interface-elements/lower_corner.png") @onready var lower_corner_decor := load("res://import/interface-elements/lower_corner.png")
func _ready() -> void: func _ready() -> void:
print(owner)
rebuild() rebuild()
theme_changed.connect(rebuild) theme_changed.connect(rebuild)
resized.connect(rebuild) resized.connect(rebuild)

View File

@ -215,7 +215,9 @@ func validate_board_state() -> bool:
if not (sticky is int or sticky is Vector2 or board_state.cards.keys().has(sticky)): if not (sticky is int or sticky is Vector2 or board_state.cards.keys().has(sticky)):
push_error("Save %s could not be parsed: Corrupted Sticky Notes.") push_error("Save %s could not be parsed: Corrupted Sticky Notes.")
return false return false
return true return true
return false return false
func parse_vec_from_string(string: String) -> Vector2: func parse_vec_from_string(string: String) -> Vector2:

View File

@ -1,5 +1,7 @@
extends Control extends Control
signal room_loaded
var has_stage: bool = false var has_stage: bool = false
# set(stage): # set(stage):
# has_stage = stage # has_stage = stage
@ -18,14 +20,6 @@ var has_stage: bool = false
@onready var state_machine = menu_animation["parameters/playback"] @onready var state_machine = menu_animation["parameters/playback"]
@onready var focus_forward = %MainMenu @onready var focus_forward = %MainMenu
func _ready() -> void:
await get_tree().create_timer(1.0).timeout
print("main.gd: ready()")
main_menu.has_stage = true
# TODO: Find out if we want this.
signal room_loaded
# #
#var in_game = false #var in_game = false
# #

View File

@ -1146,7 +1146,7 @@ states/reveal_pause_menu/position = Vector2(783.91, -112.734)
states/start_game/node = SubResource("AnimationNodeAnimation_5umfs") states/start_game/node = SubResource("AnimationNodeAnimation_5umfs")
states/start_game/position = Vector2(698, 32) states/start_game/position = Vector2(698, 32)
transitions = ["Start", "init", SubResource("AnimationNodeStateMachineTransition_dxdg4"), "init", "loading", SubResource("AnimationNodeStateMachineTransition_0hpxy"), "loading", "loading_done", SubResource("AnimationNodeStateMachineTransition_ipapo"), "loading_done", "start_game", SubResource("AnimationNodeStateMachineTransition_0t1lp"), "start_game", "init", SubResource("AnimationNodeStateMachineTransition_66nmg"), "loading_done", "load_savegame", SubResource("AnimationNodeStateMachineTransition_6b86u"), "load_savegame", "loading_game", SubResource("AnimationNodeStateMachineTransition_y626i"), "loading_game", "start_game", SubResource("AnimationNodeStateMachineTransition_52bss"), "start_game", "credits_roll", SubResource("AnimationNodeStateMachineTransition_x8oth"), "credits_roll", "loading_done", SubResource("AnimationNodeStateMachineTransition_5ge3a"), "loading_done", "credits_roll", SubResource("AnimationNodeStateMachineTransition_44pd3"), "start_game", "reveal_pause_menu", SubResource("AnimationNodeStateMachineTransition_pc6pe"), "reveal_pause_menu", "hide_pause_menu", SubResource("AnimationNodeStateMachineTransition_dx61n"), "hide_pause_menu", "start_game", SubResource("AnimationNodeStateMachineTransition_lp1dx"), "hide_pause_menu", "init", SubResource("AnimationNodeStateMachineTransition_mqlnh")] transitions = ["Start", "init", SubResource("AnimationNodeStateMachineTransition_dxdg4"), "init", "loading", SubResource("AnimationNodeStateMachineTransition_0hpxy"), "loading", "loading_done", SubResource("AnimationNodeStateMachineTransition_ipapo"), "loading_done", "start_game", SubResource("AnimationNodeStateMachineTransition_0t1lp"), "start_game", "init", SubResource("AnimationNodeStateMachineTransition_66nmg"), "loading_done", "load_savegame", SubResource("AnimationNodeStateMachineTransition_6b86u"), "load_savegame", "loading_game", SubResource("AnimationNodeStateMachineTransition_y626i"), "loading_game", "start_game", SubResource("AnimationNodeStateMachineTransition_52bss"), "start_game", "credits_roll", SubResource("AnimationNodeStateMachineTransition_x8oth"), "credits_roll", "loading_done", SubResource("AnimationNodeStateMachineTransition_5ge3a"), "loading_done", "credits_roll", SubResource("AnimationNodeStateMachineTransition_44pd3"), "start_game", "reveal_pause_menu", SubResource("AnimationNodeStateMachineTransition_pc6pe"), "reveal_pause_menu", "hide_pause_menu", SubResource("AnimationNodeStateMachineTransition_dx61n"), "hide_pause_menu", "start_game", SubResource("AnimationNodeStateMachineTransition_lp1dx"), "hide_pause_menu", "init", SubResource("AnimationNodeStateMachineTransition_mqlnh")]
graph_offset = Vector2(166.75, -196.73401) graph_offset = Vector2(163.75, -42.73401)
[sub_resource type="Shader" id="Shader_cegan"] [sub_resource type="Shader" id="Shader_cegan"]
code = "shader_type canvas_item; code = "shader_type canvas_item;

View File

@ -3,25 +3,25 @@ class_name MainMenu extends Panel
var has_stage: bool = false: var has_stage: bool = false:
set(value): set(value):
has_stage = value has_stage = value
assert(is_node_ready(), "MainMenu node not ready yet!") if is_node_ready():
if save_game_handle.get_most_recent_save().current_room == 0: if save_game_handle.get_most_recent_save().current_room == 0:
continue_button.visible = false continue_button.visible = false
continue_button.disabled = true continue_button.disabled = true
new_game_button.theme_type_variation = "H1Button" new_game_button.theme_type_variation = "H1Button"
else:
continue_button.visible = true
continue_button.disabled = not has_stage
new_game_button.theme_type_variation = ""
load_game_button.disabled = not save_game_handle.has_existing_saves()
for child: Control in $PanelContainer.get_children():
child.focus_mode = FOCUS_ALL if has_stage else FOCUS_NONE
child.modulate = Color.WHITE if has_stage else Color.WEB_GRAY
child.mouse_filter = Control.MOUSE_FILTER_STOP if has_stage else Control.MOUSE_FILTER_IGNORE
if has_stage:
if continue_button.visible:
continue_button.grab_focus()
else: else:
new_game_button.grab_focus() continue_button.visible = true
continue_button.disabled = not has_stage
new_game_button.theme_type_variation = ""
load_game_button.disabled = not save_game_handle.has_existing_saves()
for child: Control in $PanelContainer.get_children():
child.focus_mode = FOCUS_ALL if has_stage else FOCUS_NONE
child.modulate = Color.WHITE if has_stage else Color.WEB_GRAY
child.mouse_filter = Control.MOUSE_FILTER_STOP if has_stage else Control.MOUSE_FILTER_IGNORE
if has_stage:
if continue_button.visible:
continue_button.grab_focus()
else:
new_game_button.grab_focus()
signal start_game(savegame: SaveGame) signal start_game(savegame: SaveGame)
signal open_settings(new_game: bool) signal open_settings(new_game: bool)
@ -34,7 +34,7 @@ signal roll_credits
@onready var settings_popup: SettingsPopup = %SettingsPopup @onready var settings_popup: SettingsPopup = %SettingsPopup
@onready var credits_button: Button = $PanelContainer/CreditsButton @onready var credits_button: Button = $PanelContainer/CreditsButton
@onready var quit_button: Button = $PanelContainer/QuitButton @onready var quit_button: Button = $PanelContainer/QuitButton
@onready var save_game_handle: SaveGameList = %SaveGameList @onready var save_game_handle: SaveGameHandle = %SaveGameHandle
@export var save_game_exists: bool = false: @export var save_game_exists: bool = false:
set(value): set(value):
save_game_exists = value save_game_exists = value
@ -43,7 +43,6 @@ var await_new_game: bool = false
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
print("main_menu.gd: ready()")
save_game_handle.picked.connect(_on_save_picked) save_game_handle.picked.connect(_on_save_picked)
if save_game_handle.get_most_recent_save().current_room == 0: if save_game_handle.get_most_recent_save().current_room == 0:
continue_button.disabled = true continue_button.disabled = true
@ -57,7 +56,7 @@ func _ready() -> void:
quit_button.pressed.connect(get_tree().quit) quit_button.pressed.connect(get_tree().quit)
credits_button.pressed.connect(roll_credits.emit) credits_button.pressed.connect(roll_credits.emit)
#State.take_stage(self) State.take_stage(self)
func _on_save_picked(save: SaveGame): func _on_save_picked(save: SaveGame):
start_game.emit(save) start_game.emit(save)

View File

@ -435,7 +435,7 @@ visible = false
layout_mode = 2 layout_mode = 2
metadata/_tab_index = 4 metadata/_tab_index = 4
[node name="SaveGameList" type="CenterContainer" parent="."] [node name="SaveGameHandle" type="CenterContainer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
visible = false visible = false
layout_mode = 1 layout_mode = 1

View File

@ -1,4 +1,4 @@
class_name SaveGameList extends CenterContainer class_name SaveGameHandle extends CenterContainer
signal picked(save_game: SaveGame) signal picked(save_game: SaveGame)
@ -23,18 +23,14 @@ func _validate_property(property: Dictionary) -> void:
func _ready() -> void: func _ready() -> void:
var dir := DirAccess.open(State.user_saves_path) var dir = DirAccess.open(State.user_saves_path)
# Create dir if needed.
if DirAccess.get_open_error() == ERR_INVALID_PARAMETER:
dir = DirAccess.open("user://")
dir.make_dir_recursive(State.user_saves_path)
if DirAccess.get_open_error() != OK: if DirAccess.get_open_error() != OK:
printerr("Error while opening User Save Directory: %s" % error_string(DirAccess.get_open_error())) printerr("Error while opening User Save Directory: %s" % error_string(DirAccess.get_open_error()))
# Invalid Error being raised when Directory does not exist.
if DirAccess.get_open_error() == ERR_INVALID_PARAMETER:
dir = DirAccess.open("user://")
dir.make_dir_recursive(State.user_saves_path)
load_games() load_games()
for i in range(save_buttons.size()): for i in range(save_buttons.size()):
save_buttons[i].pressed.connect(func(): picked.emit(saves[i])) save_buttons[i].pressed.connect(func(): picked.emit(saves[i]))