mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-21 23:20:25 +01:00
add optional property OVERLAY_PROPERTIES on overlay scenes, used for making main menu always visible
This commit is contained in:
parent
73d9d9b88b
commit
3a6d0469e5
3 changed files with 16 additions and 5 deletions
|
@ -31,6 +31,7 @@ var interaction_handler: Node
|
|||
var overlay_visible := true setget set_overlay_visible
|
||||
var path := "res://special_overlays/MainOverlay.tscn" setget set_path
|
||||
var path_invalid := false
|
||||
var OVERLAY_PROPERTIES: Dictionary
|
||||
|
||||
onready var container = $OverlayViewport/Container
|
||||
var overlay_scene: Node
|
||||
|
@ -159,6 +160,10 @@ func set_path(new: String) -> void:
|
|||
if container.get_child_count() > 0:
|
||||
container.get_child(0).queue_free()
|
||||
container.add_child(overlay_scene)
|
||||
|
||||
if overlay_scene.get("OVERLAY_PROPERTIES") != null:
|
||||
OVERLAY_PROPERTIES = overlay_scene.OVERLAY_PROPERTIES
|
||||
|
||||
emit_signal("path_changed")
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
extends Control
|
||||
|
||||
const OVERLAY_PROPERTIES = {
|
||||
"no_hide": true,
|
||||
"no_delete": true,
|
||||
}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
OverlayManager.connect("added_overlay", self, "_add_overlay_to_list")
|
||||
|
|
|
@ -31,8 +31,9 @@ func _update_warning():
|
|||
|
||||
|
||||
func _on_Visibility_toggled(state: bool) -> void:
|
||||
# TODO check always visible flag
|
||||
# if overlay.type and overlay.type != "main":
|
||||
if overlay.OVERLAY_PROPERTIES.has("no_hide") and overlay.OVERLAY_PROPERTIES.no_hide:
|
||||
overlay.overlay_visible = true
|
||||
else:
|
||||
overlay.overlay_visible = state
|
||||
|
||||
|
||||
|
@ -51,8 +52,8 @@ func _overlay_visible_changed(state: bool):
|
|||
|
||||
|
||||
func _on_Remove_pressed() -> void:
|
||||
# TODO check stay flag
|
||||
# if overlay.type and overlay.type != "main":
|
||||
if overlay.OVERLAY_PROPERTIES.has("no_delete") and overlay.OVERLAY_PROPERTIES.no_delete:
|
||||
return
|
||||
OverlayManager.remove_overlay(overlay_name)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue