Added debug overlay support
This commit is contained in:
parent
9cba437ee2
commit
0e83bfd634
1 changed files with 23 additions and 5 deletions
28
smgr.gd
28
smgr.gd
|
@ -15,6 +15,7 @@ var ccr_menu_names = []
|
|||
var ccr_cutscene = null
|
||||
var ccr_cutscene_inuse = false
|
||||
var ccr_debug = null
|
||||
var ccr_debug_names = []
|
||||
|
||||
func add_game(scene:PackedScene) -> bool:
|
||||
Logger.info("smgr","Adding game scene")
|
||||
|
@ -78,6 +79,28 @@ func remove_cutscene() -> bool:
|
|||
Logger.info("smgr","Removed cutscene scene")
|
||||
return true
|
||||
|
||||
func add_debug(scene_name:String,scene:PackedScene) -> bool:
|
||||
Logger.info("smgr","Adding debug scene \"" + scene_name + "\"")
|
||||
if ccr_debug_names.has(scene_name):
|
||||
Logger.error("smgr","Failed adding debug scene: Debug scene with name \"" + scene_name + "\" already exists")
|
||||
return false
|
||||
ccr_debug.add_child(scene.instantiate())
|
||||
ccr_debug_names.append(scene_name)
|
||||
Logger.info("smgr","Added debug scene \"" + scene_name + "\"")
|
||||
return true
|
||||
|
||||
func remove_debug(scene_name:String) -> bool:
|
||||
Logger.info("smgr","Removing debug scene \"" + scene_name + "\"")
|
||||
if !ccr_menu_names.has(scene_name):
|
||||
Logger.error("smgr","Failed removing debug scene: Debug scene with name \"" + scene_name + "\" does not exist")
|
||||
return false
|
||||
for i in ccr_debug.get_children():
|
||||
if i.name == scene_name:
|
||||
ccr_debug.remove_child(i)
|
||||
break
|
||||
ccr_debug_names.erase(scene_name)
|
||||
return true
|
||||
|
||||
func _ready() -> void:
|
||||
Logger.info("smgr","Constructing CORE Scene Root (CCR)")
|
||||
ccr = Control.new()
|
||||
|
@ -97,7 +120,6 @@ func _ready() -> void:
|
|||
Logger.info("smgr","COREBackground migration complete.")
|
||||
Logger.info("smgr","Adding overlays")
|
||||
add_overlays()
|
||||
add_debug()
|
||||
available = true
|
||||
|
||||
func add_overlays() -> void:
|
||||
|
@ -117,7 +139,3 @@ func add_overlays() -> void:
|
|||
ccr_debug = Control.new()
|
||||
ccr_debug.name = "DebugOverlay"
|
||||
ccr.add_child(ccr_debug)
|
||||
|
||||
func add_debug() -> void:
|
||||
Logger.info("smgr","No debug scenes are available.")
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue