mirror of
https://port.numenaute.org/aleajactaest/bazar_alea.git
synced 2024-11-10 01:09:53 +00:00
57 lines
1.6 KiB
GDScript3
57 lines
1.6 KiB
GDScript3
|
extends Window
|
||
|
|
||
|
|
||
|
signal send_server_config(alea_ip, alea_port, xmpp_ip, xmpp_port)
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
pass # Replace with function body.
|
||
|
|
||
|
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
func _process(delta):
|
||
|
pass
|
||
|
|
||
|
|
||
|
func show_window():
|
||
|
self._on_text_changed("")
|
||
|
self.show()
|
||
|
|
||
|
func _on_button_pressed():
|
||
|
send_server_config.emit(
|
||
|
$VBoxContainer/TabContainer/Alea/Address.get_text(),
|
||
|
int($VBoxContainer/TabContainer/Alea/Port.get_text()),
|
||
|
$VBoxContainer/TabContainer/XMPP/Address.get_text(),
|
||
|
int($VBoxContainer/TabContainer/XMPP/Port.get_text())
|
||
|
)
|
||
|
self.hide()
|
||
|
|
||
|
|
||
|
func _on_text_changed(_text):
|
||
|
var listen_port:int
|
||
|
if len($VBoxContainer/TabContainer/Alea/Address.get_text()) == 0:
|
||
|
$VBoxContainer/Button.set_disabled(true)
|
||
|
return
|
||
|
if len($VBoxContainer/TabContainer/Alea/Port.get_text()) == 0:
|
||
|
$VBoxContainer/Button.set_disabled(true)
|
||
|
return
|
||
|
if len($VBoxContainer/TabContainer/XMPP/Address.get_text()) == 0:
|
||
|
$VBoxContainer/Button.set_disabled(true)
|
||
|
return
|
||
|
if len($VBoxContainer/TabContainer/XMPP/Port.get_text()) == 0:
|
||
|
$VBoxContainer/Button.set_disabled(true)
|
||
|
return
|
||
|
listen_port = int($VBoxContainer/TabContainer/Alea/Port.get_text())
|
||
|
if listen_port <= 0 || listen_port >= 65536 :
|
||
|
$VBoxContainer/Button.set_disabled(true)
|
||
|
return
|
||
|
listen_port = int($VBoxContainer/TabContainer/XMPP/Port.get_text())
|
||
|
if listen_port <= 0 || listen_port >= 65536 :
|
||
|
$VBoxContainer/Button.set_disabled(true)
|
||
|
return
|
||
|
$VBoxContainer/Button.set_disabled(false)
|
||
|
|
||
|
|
||
|
func _on_close_requested():
|
||
|
self.hide()
|