fail: helplessly trying to prevent the weird state system from creating TWO savegames. down from four...
This commit is contained in:
parent
5f610241e0
commit
f8293f6974
|
|
@ -14,7 +14,7 @@ func _ready() -> void:
|
|||
get_parent().load_save(save_game))
|
||||
|
||||
func start_room():
|
||||
save_game = State.active_save_game
|
||||
save_game = State.save_game
|
||||
State.pass_stage_to(%PlayerController)
|
||||
on_first_station()
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ signal ini_room
|
|||
@onready var player: Player = %PlayerController
|
||||
|
||||
func start_room():
|
||||
save_game = State.active_save_game
|
||||
save_game = State.save_game
|
||||
save_game.current_room = State.rooms.ADULTHOOD
|
||||
Scenes.completed_sequences = save_game.mementos_complete
|
||||
Scenes.started_sequences = save_game.mementos_complete
|
||||
|
|
|
|||
|
|
@ -816,20 +816,36 @@ libraries = {
|
|||
script = SubResource("GDScript_sg0pj")
|
||||
|
||||
[node name="autism" parent="Scenes/ScenePlayer" instance=ExtResource("10_gcdra")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="burnout" parent="Scenes/ScenePlayer" instance=ExtResource("11_kmoh8")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="university_eating" parent="Scenes/ScenePlayer" instance=ExtResource("12_6rb4d")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="university_advocacy" parent="Scenes/ScenePlayer" instance=ExtResource("13_5s6pb")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="therapy_uni" parent="Scenes/ScenePlayer" instance=ExtResource("14_upyac")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="therapy_volunteer" parent="Scenes/ScenePlayer" instance=ExtResource("15_ci4rn")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="trans" parent="Scenes/ScenePlayer" instance=ExtResource("16_e1uao")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="trauma" parent="Scenes/ScenePlayer" instance=ExtResource("17_my8p4")]
|
||||
story_array = []
|
||||
paragraph_lengths = [1]
|
||||
|
||||
[node name="UI" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
uid://belkrno67sft0
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
class_name YouthRoom
|
||||
extends RoomTemplate
|
||||
|
||||
signal ini_room
|
||||
|
|
@ -8,7 +9,7 @@ signal ini_room
|
|||
@onready var card_picker: CardPicker = %Picker
|
||||
|
||||
func start_room():
|
||||
save_game = State.active_save_game
|
||||
save_game = State.save_game
|
||||
save_game.current_room = State.rooms.YOUTH
|
||||
Scenes.completed_sequences = save_game.mementos_complete
|
||||
Scenes.started_sequences = save_game.mementos_complete
|
||||
|
|
@ -25,18 +26,17 @@ func start_room():
|
|||
State.pass_stage_to(%PlayerController)
|
||||
%LightAnimation.lights_on()
|
||||
|
||||
|
||||
func get_ready():
|
||||
id = State.rooms.YOUTH
|
||||
self.show()
|
||||
$sfx/distant_rain.play()
|
||||
$"sfx/rain on window".play()
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
await get_tree().process_frame #TODO: this was 0.1s, not sure if needed at all
|
||||
%Board.hide()
|
||||
|
||||
func _ready():
|
||||
super._ready()
|
||||
Scenes.scene_finished.connect(_on_scene_finished)
|
||||
|
||||
card_picker.cards_picked.connect(card_board.populate_board)
|
||||
|
||||
func pull_save_state(save: SaveGame) -> void:
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://bsop46tqngddc
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=137 format=4 uid="uid://b3b0gyvklqn50"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://belkrno67sft0" path="res://base-environments/youth_room/room_handle.gd" id="1_aitp0"]
|
||||
[ext_resource type="Script" uid="uid://belkrno67sft0" path="youth_room.gd" id="1_aitp0"]
|
||||
[ext_resource type="AudioStream" uid="uid://1h6k2d8q1kw3" path="res://base-environments/youth_room/import/sounds/rain_on_window.mp3" id="2_3haaq"]
|
||||
[ext_resource type="Resource" uid="uid://bgplfqxa852wo" path="res://dev-util/debug_save.tres" id="2_h6j14"]
|
||||
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="3_foj4y"]
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://dkn824t1gn0km
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
class_name RoomTemplate extends Node3D
|
||||
|
||||
var initialised: bool = false
|
||||
var id: State.rooms
|
||||
var id: State.rooms = State.rooms.NULL
|
||||
|
||||
var has_stage: bool:
|
||||
set(value):
|
||||
|
|
@ -12,6 +12,25 @@ var has_stage: bool:
|
|||
|
||||
@export var save_game:SaveGame = null
|
||||
|
||||
signal proceed(next_scene_path: String)
|
||||
|
||||
func _ready() -> void:
|
||||
State.room = self
|
||||
State.current_room = id
|
||||
|
||||
func load():
|
||||
# Override this function to load the state of the chapter from State.save_game
|
||||
pass
|
||||
|
||||
func play() -> String:
|
||||
get_ready()
|
||||
start_room()
|
||||
return await proceed
|
||||
|
||||
|
||||
func get_ready():
|
||||
pass
|
||||
|
||||
func start_room():
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,22 @@ class_name SaveGame extends Resource
|
|||
|
||||
var _is_initialised: bool = false
|
||||
|
||||
var current_room_path: String:
|
||||
get():
|
||||
return Main.room_paths[current_room]
|
||||
|
||||
@export var filepath: String:
|
||||
set(value):
|
||||
print("Savegame: setting filepath: %s" % value)
|
||||
filepath = value
|
||||
if _is_initialised:
|
||||
read_save_file()
|
||||
changed.emit()
|
||||
|
||||
@export var unique_save_name: String = "frame_of_mind_%s_%s" % [Time.get_date_string_from_system(), Time.get_time_string_from_system().replace(":", "-")]:
|
||||
set(value):
|
||||
unique_save_name = value
|
||||
if _is_initialised: changed.emit()
|
||||
|
||||
@export var current_room: State.rooms = State.rooms.NULL:
|
||||
set(value):
|
||||
current_room = value
|
||||
|
|
@ -75,7 +81,7 @@ func _init(initial_filepath = "") -> void:
|
|||
if not DirAccess.dir_exists_absolute(filepath.get_base_dir()):
|
||||
DirAccess.make_dir_absolute(filepath.get_base_dir())
|
||||
|
||||
func read_save_file():
|
||||
func read_save_file() -> void:
|
||||
if filepath == "DEBUG":
|
||||
if OS.has_feature("debug") or OS.has_feature("demo"):
|
||||
push_warning("Created DEBUG savegame. Progress will not be stored!")
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func _ready():
|
|||
%SkipButton.pressed.connect(card_burned.emit)
|
||||
|
||||
func burn_cards(_id):
|
||||
var random_card_names: Array = State.active_save_game.board_state["randoms"]
|
||||
var random_card_names: Array = State.save_game.board_state["randoms"]
|
||||
|
||||
for card_name in random_card_names:
|
||||
if card_name.begins_with("p"):
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ signal cards_picked(cardnames: Array[String])
|
|||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
reset()
|
||||
return
|
||||
|
||||
#FIXME: can I make this less annoying somehow?
|
||||
if State.onready_room == State.rooms.YOUTH:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
extends Node
|
||||
extends Node
|
||||
class_name GlobalState
|
||||
|
||||
#region configuration
|
||||
signal settings_changed
|
||||
var settings_initialised
|
||||
var _settings_initialized
|
||||
|
||||
var room: RoomTemplate
|
||||
var save_game: SaveGame
|
||||
signal environment_settings_changed
|
||||
|
||||
# FIXME find a better way to switch fonts and maybe emit the theme_changed signal!
|
||||
signal theme_changed
|
||||
var current_main_theme:Theme = preload("res://logic-scenes/themes/handwriting.theme")
|
||||
|
||||
@export_file var user_settings_path:String = "user://user_settings.json"
|
||||
@export_file var user_saves_path:String = "user://savegames"
|
||||
|
|
@ -11,45 +20,45 @@ var settings_initialised
|
|||
@export var reduce_motion: bool = false:
|
||||
set(value):
|
||||
reduce_motion = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export var screen_reader_enabled:bool = false:
|
||||
set(value):
|
||||
screen_reader_enabled = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
|
||||
@export var rendering_disabled: bool = false:
|
||||
set(value):
|
||||
rendering_disabled = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export var use_simplified_navigation:bool = false:
|
||||
set(value):
|
||||
use_simplified_navigation = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export var enable_hyperacoustic_filter: bool = false:
|
||||
set(value):
|
||||
enable_hyperacoustic_filter = value
|
||||
if enable_hyperacoustic_filter:
|
||||
AudioServer.set_bus_effect_enabled(0, 0, enable_hyperacoustic_filter)
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export var show_navigation_buttons: bool = false:
|
||||
set(value):
|
||||
show_navigation_buttons = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export_enum("handwriting", "serif", "legible", "system") var font_style: int = 0:
|
||||
set(value):
|
||||
font_style = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export_enum("disabled", "text", "cc") var subtitles: int = false:
|
||||
set(value):
|
||||
subtitles = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export var ui_scaling: float = 1:
|
||||
set(value):
|
||||
|
|
@ -59,22 +68,19 @@ var settings_initialised
|
|||
@export var show_content_notes: bool = false:
|
||||
set(value):
|
||||
show_content_notes = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export var provide_summaries: bool = false:
|
||||
set(value):
|
||||
provide_summaries = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
@export var allow_skipping: bool = false:
|
||||
set(value):
|
||||
allow_skipping = value
|
||||
if settings_initialised:
|
||||
if _settings_initialized:
|
||||
settings_changed.emit()
|
||||
|
||||
# FIXME find a better way to switch fonts and maybe emit the theme_changed signal!
|
||||
var current_main_theme:Theme = preload("res://logic-scenes/themes/handwriting.theme")
|
||||
|
||||
@export_group("AudioSettings")
|
||||
@export var main_volume:float = 1:
|
||||
set(volume):
|
||||
|
|
@ -140,23 +146,18 @@ var ssil_enable:bool = false:
|
|||
set(value):
|
||||
ssil_enable = value
|
||||
environment_settings_changed.emit()
|
||||
|
||||
var sdfgi_enable:bool = false:
|
||||
set(value):
|
||||
sdfgi_enable = value
|
||||
environment_settings_changed.emit()
|
||||
|
||||
var active_save_game: SaveGame
|
||||
|
||||
signal environment_settings_changed
|
||||
signal theme_changed
|
||||
|
||||
|
||||
|
||||
func load_user_settings():
|
||||
|
||||
if FileAccess.file_exists(user_settings_path):
|
||||
var file = FileAccess.open(user_settings_path, FileAccess.READ)
|
||||
var raw_json = FileAccess.get_file_as_string(user_settings_path)
|
||||
var file := FileAccess.open(user_settings_path, FileAccess.READ)
|
||||
var raw_json := FileAccess.get_file_as_string(user_settings_path)
|
||||
file.close()
|
||||
var parsed: Dictionary = JSON.parse_string(raw_json)
|
||||
|
||||
|
|
@ -172,11 +173,11 @@ func load_user_settings():
|
|||
if out[0] == "reduce":
|
||||
reduce_motion = true
|
||||
|
||||
settings_initialised = true
|
||||
_settings_initialized = true
|
||||
settings_changed.emit()
|
||||
|
||||
func save_settings():
|
||||
var out_dict = {
|
||||
var out_dict := {
|
||||
"accessability": {
|
||||
"reduce_motion:": reduce_motion,
|
||||
"screen_reader_enabled": screen_reader_enabled,
|
||||
|
|
@ -214,11 +215,11 @@ func save_settings():
|
|||
}
|
||||
}
|
||||
|
||||
var file = FileAccess.open(user_settings_path, FileAccess.WRITE)
|
||||
var file := FileAccess.open(user_settings_path, FileAccess.WRITE)
|
||||
file.store_string(JSON.stringify(out_dict))
|
||||
file.close()
|
||||
|
||||
settings_initialised = true
|
||||
_settings_initialized = true
|
||||
settings_changed.emit()
|
||||
|
||||
var last_mode := DisplayServer.WINDOW_MODE_WINDOWED
|
||||
|
|
@ -241,10 +242,10 @@ func _ready():
|
|||
await get_tree().process_frame
|
||||
|
||||
for child in get_tree().root.get_children():
|
||||
if child is RoomTemplate and active_save_game == null:
|
||||
if child is RoomTemplate and save_game == null:
|
||||
push_warning("Room initialised without a SaveGame. Creating proxy save.")
|
||||
#TODO: make this a bit more clean maybe?
|
||||
active_save_game = ResourceLoader.load("res://dev-util/debug_save.tres")
|
||||
save_game = ResourceLoader.load("res://dev-util/debug_save.tres")
|
||||
if "has_stage" in child:
|
||||
pass_stage_to(child)
|
||||
break
|
||||
|
|
@ -286,8 +287,6 @@ func leave_stage(actor:Object) -> bool:
|
|||
|
||||
return false
|
||||
|
||||
func get_current_actor(): return stage_list.front()
|
||||
|
||||
# Used to put a new target on top of the Focus Stack.
|
||||
func pass_stage_to(target:Object, force = false, lock_focus = false) -> bool:
|
||||
if "pass_to_actor" in target:
|
||||
|
|
|
|||
|
|
@ -1,29 +1,71 @@
|
|||
extends Control
|
||||
|
||||
var has_stage: bool = false
|
||||
# set(stage):
|
||||
# has_stage = stage
|
||||
# if in_game and has_stage:
|
||||
# in_game = false
|
||||
# _return_to_menu()
|
||||
|
||||
@export_file(".tscn") var youth_room_path: String
|
||||
@export_file(".tscn") var transition_room_path: String
|
||||
@export_file(".tscn") var adulthood_room_path: String
|
||||
@export_file(".tscn") var ending_path: String
|
||||
|
||||
@onready var main_menu:MainMenu = %MainMenu
|
||||
@onready var pause_menu = %PauseMenu
|
||||
@onready var main_menu: MainMenu = %MainMenu
|
||||
@onready var pause_menu: PauseManu = %PauseMenu
|
||||
@onready var menu_animation: AnimationTree = %MenuAnimationTree
|
||||
@onready var state_machine = menu_animation["parameters/playback"]
|
||||
@onready var focus_forward = %MainMenu
|
||||
@onready var state_machine: AnimationNodeStateMachinePlayback = menu_animation["parameters/playback"]
|
||||
|
||||
@onready var room_paths := {
|
||||
State.rooms.NULL: youth_room_path, # Maybe Draeven story?
|
||||
State.rooms.YOUTH: youth_room_path,
|
||||
State.rooms.TRANSITION: transition_room_path,
|
||||
State.rooms.ADULTHOOD: adulthood_room_path,
|
||||
State.rooms.ENDING: ending_path
|
||||
}
|
||||
|
||||
func _ready() -> void:
|
||||
print("main.gd: ready()")
|
||||
# TODO: Only do this if we're not in a debug scene.
|
||||
await main_menu.execute()
|
||||
if State.room == null:
|
||||
_open()
|
||||
var path := await main_menu.execute()
|
||||
_close()
|
||||
await _load_room(path)
|
||||
else:
|
||||
hide()
|
||||
await _mainloop() # Debug functionality
|
||||
|
||||
|
||||
func _mainloop() -> void:
|
||||
while true:
|
||||
var next_scene := await State.room.play()
|
||||
if (next_scene == null):
|
||||
break
|
||||
else:
|
||||
await _load_room(youth_room_path)
|
||||
|
||||
|
||||
func _load_room(next_path: String) -> void:
|
||||
if State.room != null:
|
||||
State.room.unload()
|
||||
ResourceLoader.load_threaded_request(next_path, "PackedScene", true)
|
||||
while true:
|
||||
await get_tree().process_frame
|
||||
var state := ResourceLoader.load_threaded_get_status(next_path)
|
||||
match state:
|
||||
ResourceLoader.THREAD_LOAD_LOADED:
|
||||
var next_scene := ResourceLoader.load_threaded_get(youth_room_path) as PackedScene
|
||||
State.room = next_scene.instantiate() as RoomTemplate
|
||||
get_tree().root.add_child(State.room)
|
||||
hide()
|
||||
break
|
||||
ResourceLoader.THREAD_LOAD_FAILED:
|
||||
push_error("Failed to load youth room scene.")
|
||||
return
|
||||
|
||||
# TODO: ugh, godot tweens are the wurst
|
||||
func _open() -> void:
|
||||
show()
|
||||
menu_animation["parameters/conditions/loading_done"] = false
|
||||
menu_animation["parameters/conditions/load_save"] = false
|
||||
|
||||
func _close() -> void:
|
||||
pass
|
||||
|
||||
#
|
||||
#var in_game = false
|
||||
#
|
||||
|
|
@ -70,13 +112,15 @@ func _ready() -> void:
|
|||
# State.stage_list = [self]
|
||||
# _return_to_menu()
|
||||
#
|
||||
#func _unhandled_input(event: InputEvent) -> void:
|
||||
# if event is InputEvent and in_game:
|
||||
# if event.is_action_pressed("ui_menu"):
|
||||
# toggle_pause_menu()
|
||||
#
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event is InputEvent:
|
||||
if event.is_action_pressed("ui_menu"):
|
||||
toggle_pause_menu()
|
||||
|
||||
func toggle_pause_menu():
|
||||
print("Toggling pause menu")
|
||||
pass
|
||||
|
||||
# if not get_tree().paused:
|
||||
# get_tree().paused = true
|
||||
# var state_machine := menu_animation["parameters/playback"]
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ tracks/3/keys = {
|
|||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("../../Panel:modulate")
|
||||
tracks/4/path = NodePath("../../Background:modulate")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
|
|
@ -144,7 +144,7 @@ tracks/6/keys = {
|
|||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("../../Panel:visible")
|
||||
tracks/7/path = NodePath("../../Background:visible")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
|
|
@ -331,7 +331,7 @@ tracks/1/use_blend = true
|
|||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../../Panel:visible")
|
||||
tracks/2/path = NodePath("../../Background:visible")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
|
|
@ -343,7 +343,7 @@ tracks/2/keys = {
|
|||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("../../Panel:modulate")
|
||||
tracks/3/path = NodePath("../../Background:modulate")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
|
|
@ -471,7 +471,7 @@ length = 0.5
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../../Panel:modulate")
|
||||
tracks/0/path = NodePath("../../Background:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
|
@ -483,7 +483,7 @@ tracks/0/keys = {
|
|||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("../../Panel:visible")
|
||||
tracks/1/path = NodePath("../../Background:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
|
|
@ -559,7 +559,7 @@ tracks/2/keys = {
|
|||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("../../Panel:modulate")
|
||||
tracks/3/path = NodePath("../../Background:modulate")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
|
|
@ -571,7 +571,7 @@ tracks/3/keys = {
|
|||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("../../Panel:visible")
|
||||
tracks/4/path = NodePath("../../Background:visible")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
|
|
@ -672,7 +672,7 @@ tracks/3/keys = {
|
|||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("../../Panel:modulate")
|
||||
tracks/4/path = NodePath("../../Background:modulate")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
|
|
@ -696,7 +696,7 @@ tracks/5/keys = {
|
|||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("../../Panel:visible")
|
||||
tracks/6/path = NodePath("../../Background:visible")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
|
|
@ -797,7 +797,7 @@ tracks/3/keys = {
|
|||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("../../Panel:modulate")
|
||||
tracks/4/path = NodePath("../../Background:modulate")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
|
|
@ -809,7 +809,7 @@ tracks/4/keys = {
|
|||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("../../Panel:visible")
|
||||
tracks/5/path = NodePath("../../Background:visible")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
|
|
@ -924,7 +924,7 @@ length = 0.5
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../../Panel:modulate")
|
||||
tracks/0/path = NodePath("../../Background:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
|
@ -963,7 +963,7 @@ resource_name = "transition_load_game"
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("../../Panel:modulate")
|
||||
tracks/0/path = NodePath("../../Background:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
|
|
@ -999,7 +999,7 @@ tracks/2/keys = {
|
|||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("../../Panel:visible")
|
||||
tracks/3/path = NodePath("../../Background:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
|
|
@ -1128,11 +1128,11 @@ advance_mode = 2
|
|||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_uwcb5"]
|
||||
states/End/position = Vector2(981, 105)
|
||||
states/credits_roll/node = SubResource("AnimationNodeAnimation_2npx0")
|
||||
states/credits_roll/position = Vector2(877.91, 32)
|
||||
states/credits_roll/position = Vector2(876.91, 32)
|
||||
states/hide_pause_menu/node = SubResource("AnimationNodeAnimation_6p8we")
|
||||
states/hide_pause_menu/position = Vector2(599, -42.7336)
|
||||
states/init/node = SubResource("AnimationNodeAnimation_8b66u")
|
||||
states/init/position = Vector2(401, 100)
|
||||
states/init/position = Vector2(401, 104)
|
||||
states/load_savegame/node = SubResource("AnimationNodeAnimation_ahhta")
|
||||
states/load_savegame/position = Vector2(751.91, 242)
|
||||
states/loading/node = SubResource("AnimationNodeAnimation_v66b5")
|
||||
|
|
@ -1146,7 +1146,7 @@ states/reveal_pause_menu/position = Vector2(783.91, -112.734)
|
|||
states/start_game/node = SubResource("AnimationNodeAnimation_5umfs")
|
||||
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")]
|
||||
graph_offset = Vector2(166.75, -196.73401)
|
||||
graph_offset = Vector2(90.75, -158.73401)
|
||||
|
||||
[sub_resource type="Shader" id="Shader_cegan"]
|
||||
code = "shader_type canvas_item;
|
||||
|
|
@ -1245,11 +1245,11 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_rqkns")
|
||||
youth_room_path = "res://base-environments/youth_room/youth_room.tscn"
|
||||
youth_room_path = "uid://b3b0gyvklqn50"
|
||||
transition_room_path = "uid://fgp3s28h7msy"
|
||||
adulthood_room_path = "uid://flisupth27th"
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
[node name="Background" type="Panel" parent="."]
|
||||
visible = false
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
layout_mode = 1
|
||||
|
|
@ -1306,7 +1306,7 @@ visible = false
|
|||
layout_mode = 0
|
||||
offset_left = 100.0
|
||||
offset_top = -37.0
|
||||
offset_right = 239.99991
|
||||
offset_right = 239.99982
|
||||
offset_bottom = 9.0
|
||||
text = "loading"
|
||||
script = SubResource("GDScript_cegan")
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ class_name MainMenu extends Panel
|
|||
@onready var save_game_handle: SaveGameList = %SaveGameList
|
||||
|
||||
# Internal Signals
|
||||
signal _user_choice(result: String)
|
||||
signal _next_room(result: String)
|
||||
|
||||
func execute() -> String:
|
||||
print("main_menu.gd: execute()")
|
||||
assert(is_node_ready(), "MainMenu node not ready yet! (???)")
|
||||
|
||||
if State.active_save_game == null or State.active_save_game.current_room == 0:
|
||||
if State.save_game == null or State.save_game.current_room == 0:
|
||||
continue_button.visible = false
|
||||
continue_button.disabled = true
|
||||
new_game_button.theme_type_variation = "H1Button"
|
||||
|
|
@ -29,13 +29,13 @@ func execute() -> String:
|
|||
|
||||
save_game_handle.visible = save_game_handle.has_existing_saves()
|
||||
|
||||
if continue_button.visible:
|
||||
continue_button.grab_focus()
|
||||
else:
|
||||
new_game_button.grab_focus()
|
||||
#if continue_button.visible:
|
||||
# continue_button.grab_focus()
|
||||
#else:
|
||||
# new_game_button.grab_focus()
|
||||
|
||||
_activate()
|
||||
var result = await _user_choice
|
||||
var result = await _next_room
|
||||
_deactivate()
|
||||
|
||||
return str(result)
|
||||
|
|
@ -45,18 +45,23 @@ func _ready() -> void:
|
|||
print("main_menu.gd: ready()")
|
||||
_deactivate()
|
||||
|
||||
continue_button.pressed.connect(_choose.bind("continue"))
|
||||
new_game_button.pressed.connect(_start_new_game)
|
||||
continue_button.pressed.connect(_start_game)
|
||||
new_game_button.pressed.connect(_new_game)
|
||||
load_game_button.pressed.connect(_load_save_game)
|
||||
load_game_button.disabled = not save_game_handle.has_existing_saves()
|
||||
settings_button.pressed.connect(settings_popup.show_settings)
|
||||
credits_button.pressed.connect(_choose.bind("credits"))
|
||||
credits_button.pressed.connect(_choose.bind("credits")) #FIXME: Needs some other encoding, like path
|
||||
quit_button.pressed.connect(get_tree().quit)
|
||||
|
||||
func _start_new_game() -> void:
|
||||
func _new_game() -> void:
|
||||
print("main_menu.gd: start_new_game()")
|
||||
State.active_save_game = SaveGame.new()
|
||||
_user_choice.emit("start_game")
|
||||
State.save_game = SaveGame.new()
|
||||
_start_game()
|
||||
|
||||
|
||||
func _start_game() -> void:
|
||||
print("main_menu.gd: _start_game()")
|
||||
_next_room.emit(State.save_game.current_room_path)
|
||||
|
||||
func _load_save_game() -> void:
|
||||
print("main_menu.gd: _load_save_game()")
|
||||
|
|
@ -65,7 +70,7 @@ func _load_save_game() -> void:
|
|||
|
||||
func _choose(choice: String) -> void:
|
||||
print("main_menu.gd: _choose(", choice, ")")
|
||||
_user_choice.emit(choice)
|
||||
_next_room.emit(choice)
|
||||
|
||||
func _activate() -> void:
|
||||
save_game_handle.visible = false
|
||||
|
|
@ -86,5 +91,5 @@ func _deactivate() -> void:
|
|||
func _on_save_picked(save: SaveGame):
|
||||
print("main_menu.gd: _on_save_picked(", save, ")")
|
||||
if (save != null):
|
||||
State.active_save_game = save
|
||||
_user_choice.emit("start_game")
|
||||
State.save_game = save
|
||||
_next_room.emit("start_game")
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 0.2509804)
|
||||
color = Color(0, 0, 0, 0.5019608)
|
||||
|
||||
[node name="SaveGameList" type="CenterContainer" parent="ColorRect"]
|
||||
unique_name_in_owner = true
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ func _validate_property(property: Dictionary) -> void:
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
get_parent_control().visible = false
|
||||
_close()
|
||||
_load_games()
|
||||
|
||||
func _ensure_directory() -> void:
|
||||
|
|
@ -40,8 +40,6 @@ func _load_games():
|
|||
if path.ends_with(".json"):
|
||||
saves.append(SaveGame.new("%s/%s" % [State.user_saves_path, path.get_basename()]))
|
||||
|
||||
saves.append(SaveGame.new())
|
||||
|
||||
_sort_saves()
|
||||
_rebuild_buttons()
|
||||
|
||||
|
|
@ -75,11 +73,11 @@ func _rebuild_buttons() -> void:
|
|||
var new_button := SaveGameDisplay.new(saves[i], i+1)
|
||||
save_box.add_child(new_button)
|
||||
save_buttons.append(new_button)
|
||||
new_button.pressed.connect(func(): _on_game_picked(i))
|
||||
new_button.pressed.connect(_on_game_picked.bind(i))
|
||||
|
||||
|
||||
func _on_game_picked(id: int) -> void:
|
||||
_picked.emit(saves[id] if id >= 0 && id < saves.size() else SaveGame.new())
|
||||
_picked.emit(saves[id])
|
||||
|
||||
|
||||
func get_most_recent_save() -> SaveGame:
|
||||
|
|
@ -94,16 +92,30 @@ func _input(event: InputEvent) -> void:
|
|||
cancel()
|
||||
|
||||
func cancel()->void:
|
||||
get_parent_control().visible = false
|
||||
visible = false
|
||||
_on_game_picked(-1)
|
||||
_picked.emit(State.save_game)
|
||||
|
||||
# This function is called when the user us supposed to choose a slot to load or create a new game.
|
||||
func pick_save_slot() -> SaveGame:
|
||||
get_parent_control().visible = true
|
||||
visible = true
|
||||
save_buttons[0].grab_focus()
|
||||
await _open()
|
||||
var result = await _picked
|
||||
get_parent_control().visible = false
|
||||
visible = false
|
||||
await _close()
|
||||
return result
|
||||
|
||||
# TODO: ugh, godot tweens are the wurst
|
||||
func _open() -> void:
|
||||
get_parent_control().show()
|
||||
save_buttons[0].grab_focus()
|
||||
modulate = Color.TRANSPARENT
|
||||
visible = true
|
||||
var tween := get_tree().create_tween()
|
||||
tween.tween_property(self, "modulate", Color.WHITE, 0.5)
|
||||
await tween.finished
|
||||
set_process_input(true)
|
||||
|
||||
func _close() -> void:
|
||||
set_process_input(false)
|
||||
var tween := get_tree().create_tween()
|
||||
tween.tween_property(self, "modulate", Color.TRANSPARENT, 0.5)
|
||||
await tween.finished
|
||||
visible = false
|
||||
get_parent_control().hide()
|
||||
|
|
|
|||
Loading…
Reference in New Issue