broken_seals/game/scripts/game_modules/ui_window_module.gd

23 lines
568 B
GDScript3
Raw Normal View History

extends GameModule
class_name UIWindowModule
2020-09-24 16:54:10 +02:00
export(PackedScene) var scene : PackedScene
export(Texture) var opener_button_texture : Texture
export(int) var index : int = -1
2020-09-24 16:54:10 +02:00
export(bool) var add_button : bool = true
func on_request_instance(what : int, node : Node) -> void:
if what == DataManager.PLAYER_UI_INSTANCE:
2020-09-24 16:54:10 +02:00
var sc = scene.instance()
node.windows.add_child(sc)
2020-09-24 16:54:10 +02:00
if add_button:
var b = node.buttons.add_image_button(opener_button_texture, index)
2020-09-24 16:54:10 +02:00
b.connect("toggled", sc, "_on_button_toggled")
sc.opener_button = b
sc.hide()