Hide top action HUD and creator pill when world editor is active
checkpoint / checkpoint (push) Successful in 6m9s
checkpoint / checkpoint (push) Successful in 6m9s
This commit is contained in:
+28
-6
@@ -46,6 +46,8 @@ var _report_modal: Control = null
|
|||||||
var _pause_menu: Control = null
|
var _pause_menu: Control = null
|
||||||
var _controls_modal: Control = null
|
var _controls_modal: Control = null
|
||||||
var _controls_pill: Control = null
|
var _controls_pill: Control = null
|
||||||
|
var _hud_panel: Control = null
|
||||||
|
var _creator_pill: Control = null
|
||||||
var _hud_layer: CanvasLayer = null
|
var _hud_layer: CanvasLayer = null
|
||||||
var _overlay_layer: CanvasLayer = null
|
var _overlay_layer: CanvasLayer = null
|
||||||
|
|
||||||
@@ -245,6 +247,7 @@ func _setup_in_game_hud() -> void:
|
|||||||
style.content_margin_bottom = 6
|
style.content_margin_bottom = 6
|
||||||
panel.add_theme_stylebox_override("panel", style)
|
panel.add_theme_stylebox_override("panel", style)
|
||||||
_hud_layer.add_child(panel)
|
_hud_layer.add_child(panel)
|
||||||
|
_hud_panel = panel
|
||||||
|
|
||||||
var bar := HBoxContainer.new()
|
var bar := HBoxContainer.new()
|
||||||
bar.name = "QuickActionBar"
|
bar.name = "QuickActionBar"
|
||||||
@@ -365,6 +368,20 @@ func _setup_in_game_hud() -> void:
|
|||||||
creator_lbl.add_theme_color_override("font_color", Color(1.0, 0.9, 0.4))
|
creator_lbl.add_theme_color_override("font_color", Color(1.0, 0.9, 0.4))
|
||||||
creator_pill.add_child(creator_lbl)
|
creator_pill.add_child(creator_lbl)
|
||||||
_hud_layer.add_child(creator_pill)
|
_hud_layer.add_child(creator_pill)
|
||||||
|
_creator_pill = creator_pill
|
||||||
|
|
||||||
|
_set_hud_visible(_build_editor == null or not is_instance_valid(_build_editor))
|
||||||
|
|
||||||
|
|
||||||
|
func _set_hud_visible(p_visible: bool) -> void:
|
||||||
|
if _hud_layer != null and is_instance_valid(_hud_layer):
|
||||||
|
_hud_layer.visible = p_visible
|
||||||
|
if _hud_panel != null and is_instance_valid(_hud_panel):
|
||||||
|
_hud_panel.visible = p_visible
|
||||||
|
if _controls_pill != null and is_instance_valid(_controls_pill):
|
||||||
|
_controls_pill.visible = p_visible
|
||||||
|
if _creator_pill != null and is_instance_valid(_creator_pill):
|
||||||
|
_creator_pill.visible = p_visible
|
||||||
|
|
||||||
|
|
||||||
static func _update_hud_sound_button(btn: Button) -> void:
|
static func _update_hud_sound_button(btn: Button) -> void:
|
||||||
@@ -689,9 +706,12 @@ func _open_build_mode() -> void:
|
|||||||
|
|
||||||
_build_editor.closed.connect(_close_build_mode)
|
_build_editor.closed.connect(_close_build_mode)
|
||||||
_build_editor.exit_browser_requested.connect(_exit_editor_to_browser)
|
_build_editor.exit_browser_requested.connect(_exit_editor_to_browser)
|
||||||
|
_build_editor.tree_exited.connect(func():
|
||||||
|
if _build_editor == null or not is_instance_valid(_build_editor):
|
||||||
|
_set_hud_visible(true)
|
||||||
|
)
|
||||||
add_child(_build_editor)
|
add_child(_build_editor)
|
||||||
if _controls_pill != null and is_instance_valid(_controls_pill):
|
_set_hud_visible(false)
|
||||||
_controls_pill.visible = false
|
|
||||||
|
|
||||||
|
|
||||||
## Shared teardown for both close paths (F2 again, or the editor's own
|
## Shared teardown for both close paths (F2 again, or the editor's own
|
||||||
@@ -702,8 +722,7 @@ func _close_build_mode() -> void:
|
|||||||
if _build_editor != null and is_instance_valid(_build_editor):
|
if _build_editor != null and is_instance_valid(_build_editor):
|
||||||
_build_editor.queue_free()
|
_build_editor.queue_free()
|
||||||
_build_editor = null
|
_build_editor = null
|
||||||
if _controls_pill != null and is_instance_valid(_controls_pill):
|
_set_hud_visible(true)
|
||||||
_controls_pill.visible = true
|
|
||||||
for child in get_children():
|
for child in get_children():
|
||||||
if child is ChunkSaveService:
|
if child is ChunkSaveService:
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
@@ -766,9 +785,12 @@ func _open_editor_for_world() -> void:
|
|||||||
_build_editor.setup_persistence(save_service, world_id_str, room_slug, coord, base_revision)
|
_build_editor.setup_persistence(save_service, world_id_str, room_slug, coord, base_revision)
|
||||||
_build_editor.closed.connect(_close_build_mode)
|
_build_editor.closed.connect(_close_build_mode)
|
||||||
_build_editor.exit_browser_requested.connect(_exit_editor_to_browser)
|
_build_editor.exit_browser_requested.connect(_exit_editor_to_browser)
|
||||||
|
_build_editor.tree_exited.connect(func():
|
||||||
|
if _build_editor == null or not is_instance_valid(_build_editor):
|
||||||
|
_set_hud_visible(true)
|
||||||
|
)
|
||||||
add_child(_build_editor)
|
add_child(_build_editor)
|
||||||
if _controls_pill != null and is_instance_valid(_controls_pill):
|
_set_hud_visible(false)
|
||||||
_controls_pill.visible = false
|
|
||||||
|
|
||||||
|
|
||||||
## Close path for the non-joined editor (ESC, or the editor's own Close
|
## Close path for the non-joined editor (ESC, or the editor's own Close
|
||||||
|
|||||||
@@ -122,18 +122,28 @@ func _run() -> void:
|
|||||||
await process_frame
|
await process_frame
|
||||||
|
|
||||||
var pill = game.find_child("ControlsPill", true, false) as Control
|
var pill = game.find_child("ControlsPill", true, false) as Control
|
||||||
|
var hud_layer = game.find_child("InGameHUD", true, false) as CanvasLayer
|
||||||
|
var hud_panel = game.find_child("HUDPanel", true, false) as Control
|
||||||
_check("ControlsPill exists in game HUD", pill != null)
|
_check("ControlsPill exists in game HUD", pill != null)
|
||||||
|
_check("InGameHUD CanvasLayer exists", hud_layer != null)
|
||||||
|
_check("HUDPanel exists in game HUD", hud_panel != null)
|
||||||
_check("ControlsPill starts visible during regular play", pill != null and pill.visible)
|
_check("ControlsPill starts visible during regular play", pill != null and pill.visible)
|
||||||
|
_check("InGameHUD starts visible during regular play", hud_layer != null and hud_layer.visible)
|
||||||
|
_check("HUDPanel starts visible during regular play", hud_panel != null and hud_panel.visible)
|
||||||
|
|
||||||
# Open build mode
|
# Open build mode
|
||||||
game._open_build_mode()
|
game._open_build_mode()
|
||||||
await process_frame
|
await process_frame
|
||||||
_check("ControlsPill is HIDDEN when in build mode", pill != null and not pill.visible)
|
_check("ControlsPill is HIDDEN when in build mode", pill != null and not pill.visible)
|
||||||
|
_check("InGameHUD is HIDDEN when in build mode", hud_layer != null and not hud_layer.visible)
|
||||||
|
_check("HUDPanel is HIDDEN when in build mode", hud_panel != null and not hud_panel.visible)
|
||||||
|
|
||||||
# Close build mode
|
# Close build mode
|
||||||
game._close_build_mode()
|
game._close_build_mode()
|
||||||
await process_frame
|
await process_frame
|
||||||
_check("ControlsPill is RESTORED when exiting build mode", pill != null and pill.visible)
|
_check("ControlsPill is RESTORED when exiting build mode", pill != null and pill.visible)
|
||||||
|
_check("InGameHUD is RESTORED when exiting build mode", hud_layer != null and hud_layer.visible)
|
||||||
|
_check("HUDPanel is RESTORED when exiting build mode", hud_panel != null and hud_panel.visible)
|
||||||
|
|
||||||
game.queue_free()
|
game.queue_free()
|
||||||
await process_frame
|
await process_frame
|
||||||
|
|||||||
Reference in New Issue
Block a user