fix: reduce debug spam, refactor unhandled input
This commit is contained in:
parent
982c426439
commit
6c9bbe871d
|
|
@ -220,4 +220,8 @@ func _on_text_finished():
|
|||
|
||||
func _emit_thunder() -> void:
|
||||
if State.room is YouthRoom: (State.room as YouthRoom).play_thunder()
|
||||
|
||||
|
||||
func notification(what: int, _reversed: bool = false) -> void:
|
||||
if what == NOTIFICATION_VISIBILITY_CHANGED:
|
||||
self.set_process_input(visible)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ func _find_selectable_in(parent:Control) -> Control:
|
|||
for child in parent.get_children():
|
||||
var ret := _find_selectable_in(child)
|
||||
if not ret == self:
|
||||
return ret
|
||||
return ret
|
||||
return self
|
||||
|
||||
func _unhandled_input(event : InputEvent) -> void:
|
||||
|
|
@ -40,3 +40,7 @@ func previous() -> void:
|
|||
focus_list[current_tab].grab_focus()
|
||||
else:
|
||||
current_tab -= 1
|
||||
|
||||
func notification(what: int, _reversed: bool = false) -> void:
|
||||
if what == NOTIFICATION_VISIBILITY_CHANGED:
|
||||
self.set_process_input(visible)
|
||||
|
|
|
|||
|
|
@ -229,21 +229,6 @@ func save_settings():
|
|||
_settings_initialized = true
|
||||
settings_changed.emit()
|
||||
|
||||
var last_mode := DisplayServer.WINDOW_MODE_WINDOWED
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
#FIXME this can be removed when state no longer needs to be a tool
|
||||
if not Engine.is_editor_hint():
|
||||
if event.is_action_pressed("toggle_fullscreen"):
|
||||
|
||||
# I have no idea why I wrote thit as conviluted,
|
||||
# but it works(TM) so I am not gonna change it :D
|
||||
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
DisplayServer.window_set_mode(last_mode)
|
||||
else:
|
||||
last_mode = DisplayServer.window_get_mode()
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
#endregion
|
||||
|
||||
func _ready():
|
||||
await get_tree().process_frame
|
||||
music_volume = music_volume
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ var state: AppState = AppState.BOOT:
|
|||
AppState.PAUSE:
|
||||
credits_roll.hide()
|
||||
main_menu.hide()
|
||||
pause_menu.show()
|
||||
pause_menu.appear()
|
||||
AppState.CREDITS:
|
||||
main_menu.hide()
|
||||
pause_menu.hide()
|
||||
|
|
@ -106,7 +106,21 @@ func _load_room(scene_path: String) -> void:
|
|||
assert(false, "Couldn't load room %s" % scene_path)
|
||||
|
||||
|
||||
var last_mode := DisplayServer.WINDOW_MODE_WINDOWED
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_type(): print_debug("Unhandled Input", event)
|
||||
if not event.is_action_type(): return
|
||||
|
||||
if event.is_action_pressed("ui_pause"):
|
||||
state = AppState.PAUSE
|
||||
|
||||
if not Engine.is_editor_hint():
|
||||
if event.is_action_pressed("toggle_fullscreen"):
|
||||
# I have no idea why I wrote thit as convoluted,
|
||||
# but it works(TM) so I am not gonna change it :D
|
||||
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
|
||||
DisplayServer.window_set_mode(last_mode)
|
||||
else:
|
||||
last_mode = DisplayServer.window_get_mode()
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ layout_mode = 1
|
|||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="PauseMenu" type="Control" parent="."]
|
||||
[node name="PauseMenu" type="Panel" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
|
@ -139,6 +139,7 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_mode = 2
|
||||
script = ExtResource("9_ihfph")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="PauseMenu"]
|
||||
|
|
@ -160,59 +161,58 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PauseMenu" type="PanelContainer" parent="PauseMenu/PauseContainer"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PauseMenu/PauseContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PauseMenu/PauseContainer/PauseMenu"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="Label" type="Label" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "Game Paused"
|
||||
|
||||
[node name="ResumeButton" type="Button" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="ResumeButton" type="Button" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Resume"
|
||||
|
||||
[node name="BugButton" type="Button" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="BugButton" type="Button" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Bug Report"
|
||||
script = ExtResource("12_cegan")
|
||||
metadata/_custom_type_script = "uid://sa15wakvpj2e"
|
||||
|
||||
[node name="ToMenuButton" type="Button" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="ToMenuButton" type="Button" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Return to Menu"
|
||||
|
||||
[node name="ToSettingsButton" type="Button" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="ToSettingsButton" type="Button" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Open Settings"
|
||||
|
||||
[node name="ToDesktopButton" type="Button" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="ToDesktopButton" type="Button" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Quit to Desktop"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="HSeparator" type="HSeparator" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FindHelplineButton" type="Button" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="FindHelplineButton" type="Button" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Find Help-Lines"
|
||||
|
||||
[node name="Label2" type="Label" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="Label2" type="Label" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "opens findahelpline.com"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="SkipStoryButton" type="Button" parent="PauseMenu/PauseContainer/PauseMenu/VBoxContainer"]
|
||||
[node name="SkipStoryButton" type="Button" parent="PauseMenu/PauseContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
|
|
|||
|
|
@ -18,3 +18,7 @@ func _ready() -> void:
|
|||
|
||||
func _on_help_pressed():
|
||||
OS.shell_open("https://findahelpline.com/")
|
||||
|
||||
func appear():
|
||||
show()
|
||||
%ResumeButton.grab_focus.call_deferred()
|
||||
|
|
|
|||
Loading…
Reference in New Issue