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 _controls_modal: Control = null
|
||||
var _controls_pill: Control = null
|
||||
var _hud_panel: Control = null
|
||||
var _creator_pill: Control = null
|
||||
var _hud_layer: CanvasLayer = null
|
||||
var _overlay_layer: CanvasLayer = null
|
||||
|
||||
@@ -245,6 +247,7 @@ func _setup_in_game_hud() -> void:
|
||||
style.content_margin_bottom = 6
|
||||
panel.add_theme_stylebox_override("panel", style)
|
||||
_hud_layer.add_child(panel)
|
||||
_hud_panel = panel
|
||||
|
||||
var bar := HBoxContainer.new()
|
||||
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_pill.add_child(creator_lbl)
|
||||
_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:
|
||||
@@ -689,9 +706,12 @@ func _open_build_mode() -> void:
|
||||
|
||||
_build_editor.closed.connect(_close_build_mode)
|
||||
_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)
|
||||
if _controls_pill != null and is_instance_valid(_controls_pill):
|
||||
_controls_pill.visible = false
|
||||
_set_hud_visible(false)
|
||||
|
||||
|
||||
## 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):
|
||||
_build_editor.queue_free()
|
||||
_build_editor = null
|
||||
if _controls_pill != null and is_instance_valid(_controls_pill):
|
||||
_controls_pill.visible = true
|
||||
_set_hud_visible(true)
|
||||
for child in get_children():
|
||||
if child is ChunkSaveService:
|
||||
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.closed.connect(_close_build_mode)
|
||||
_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)
|
||||
if _controls_pill != null and is_instance_valid(_controls_pill):
|
||||
_controls_pill.visible = false
|
||||
_set_hud_visible(false)
|
||||
|
||||
|
||||
## Close path for the non-joined editor (ESC, or the editor's own Close
|
||||
|
||||
Reference in New Issue
Block a user