Branch master was renamed to main.

bazar_alea/client/scenes/Window.gd

79 lines
1.7 KiB
GDScript3
Raw Normal View History

2023-10-22 18:42:13 +00:00
extends Window
var focus_ok:bool = false
var last_event = null
2023-11-05 14:54:21 +00:00
signal show_preference_server()
#@export var listen_ip:String = ""
#@export var listen_port:int = 33333
2023-10-22 18:42:13 +00:00
# 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 _on_button_pressed():
2023-11-05 14:54:21 +00:00
if $VBoxContainer/Account.get_text() != "":
2023-10-22 18:42:13 +00:00
self.hide()
#get_parent().get_node("CharacterBody3D").set_enable_event(true)
2023-10-26 21:19:36 +00:00
#get_parent().connect_enet($VBoxContainer/TextEdit.get_text(), listen_ip, listen_port)
2023-11-05 14:54:21 +00:00
Multi.set_username($VBoxContainer/Account.get_text())
2023-10-26 21:19:36 +00:00
#Multi.connect_server()
func check_testedit():
2023-11-05 14:54:21 +00:00
if len($VBoxContainer/Account.get_text()) == 0:
$VBoxContainer/Button.set_disabled(true)
return
2023-11-05 14:54:21 +00:00
if len($VBoxContainer/Password.get_text()) == 0:
$VBoxContainer/Button.set_disabled(true)
return
$VBoxContainer/Button.set_disabled(false)
2023-10-22 18:42:13 +00:00
2023-10-26 21:19:36 +00:00
func _on_text_edit_text_changed(_value:String):
check_testedit()
2023-10-22 18:42:13 +00:00
2023-11-05 14:54:21 +00:00
func _on_password_text_changed(_value:String):
check_testedit()
2023-10-22 18:42:13 +00:00
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
2023-11-05 14:54:21 +00:00
func _on_preference_pressed():
show_preference_server.emit()