mirror of
https://port.numenaute.org/aleajactaest/bazar_alea.git
synced 2024-11-22 07:06:13 +00:00
71 lines
1.6 KiB
GDScript
71 lines
1.6 KiB
GDScript
extends Window
|
|
|
|
var focus_ok:bool = false
|
|
var last_event = null
|
|
|
|
@export var listen_ip:String = ""
|
|
@export var listen_port:int = 33333
|
|
|
|
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
|
|
func _on_button_pressed():
|
|
if $VBoxContainer/TextEdit.get_text() != "":
|
|
self.hide()
|
|
#get_parent().get_node("CharacterBody3D").set_enable_event(true)
|
|
#get_parent().connect_enet($VBoxContainer/TextEdit.get_text(), listen_ip, listen_port)
|
|
Multi.set_username($VBoxContainer/TextEdit.get_text())
|
|
#Multi.connect_server()
|
|
|
|
|
|
func check_testedit():
|
|
if len($VBoxContainer/TextEdit.get_text()) == 0:
|
|
$VBoxContainer/Button.set_disabled(true)
|
|
return
|
|
if len($VBoxContainer/Address.get_text()) == 0:
|
|
$VBoxContainer/Button.set_disabled(true)
|
|
return
|
|
listen_ip = $VBoxContainer/Address.get_text()
|
|
listen_port = int($VBoxContainer/Port.get_text())
|
|
if listen_port <= 0 || listen_port >= 65536 :
|
|
$VBoxContainer/Button.set_disabled(true)
|
|
return
|
|
$VBoxContainer/Button.set_disabled(false)
|
|
Multi.set_ip(listen_ip)
|
|
Multi.set_port(listen_port)
|
|
|
|
func _on_text_edit_text_changed(_value:String):
|
|
check_testedit()
|
|
|
|
|
|
func _on_focus_entered():
|
|
focus_ok = true
|
|
|
|
|
|
func _on_focus_exited():
|
|
focus_ok = false
|
|
|
|
|
|
func _on_mouse_entered():
|
|
focus_ok = true
|
|
#self.get_parent().CharacterBody3D.disabled = true
|
|
|
|
|
|
func _on_mouse_exited():
|
|
focus_ok = false
|
|
#self.get_parent().CharacterBody3D.disabled = false
|
|
|
|
func open_windows():
|
|
focus_ok = false
|
|
get_parent().get_node("CharacterBody3D").set_enable_event(false)
|
|
self.show()
|
|
|
|
#func _on_window_input(event):
|
|
# if event.is_pressed() == false:
|
|
# return
|
|
# if focus_ok:
|
|
# return
|
|
# if (event is InputEventKey) && (self.type_event == 1):
|
|
# last_event = event
|