2020-09-22 15:10:34 +02:00
|
|
|
extends GameModule
|
|
|
|
class_name UIWindowModule
|
|
|
|
|
2020-09-24 16:54:10 +02:00
|
|
|
export(PackedScene) var scene : PackedScene
|
2020-09-22 15:10:34 +02:00
|
|
|
export(Texture) var opener_button_texture : Texture
|
2020-09-22 16:27:44 +02:00
|
|
|
export(int) var index : int = -1
|
2020-09-24 16:54:10 +02:00
|
|
|
export(bool) var add_button : bool = true
|
2020-09-22 15:10:34 +02:00
|
|
|
|
|
|
|
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()
|
2020-09-22 15:10:34 +02:00
|
|
|
|
|
|
|
node.windows.add_child(sc)
|
|
|
|
|
2020-09-24 16:54:10 +02:00
|
|
|
if add_button:
|
2020-10-19 13:09:08 +02:00
|
|
|
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
|
2020-09-22 15:10:34 +02:00
|
|
|
|
|
|
|
sc.hide()
|
|
|
|
|