push project up sabs assets
This commit is contained in:
58
scenes/screens/lobby_screen/lobby_base.gd
Normal file
58
scenes/screens/lobby_screen/lobby_base.gd
Normal file
@@ -0,0 +1,58 @@
|
||||
class_name LobbyBase extends Node
|
||||
|
||||
|
||||
const MATCH_ENTRY = preload("res://scenes/screens/lobby_screen/match_entry.tscn")
|
||||
|
||||
@onready var host_address_input: LineEdit = $ui/body/left_body/server_host_hbox/host_address_input
|
||||
@onready var host_port_range: SpinBox = $ui/body/left_body/server_host_hbox/host_port_range
|
||||
@onready var host_connect_bttn: Button = $ui/body/left_body/server_host_hbox/host_connect_bttn
|
||||
@onready var host_disconnect_bttn: Button = $ui/body/left_body/server_host_hbox/host_disconnect_bttn
|
||||
|
||||
@onready var search_vbox: VBoxContainer = $ui/body/left_body/search_vbox
|
||||
@onready var match_search_input: LineEdit = $ui/body/left_body/search_vbox/search_hbox/match_search_input
|
||||
@onready var match_list: VBoxContainer = $ui/body/left_body/search_vbox/scroll_container/match_list
|
||||
|
||||
@onready var match_create_vbox: VBoxContainer = $ui/body/right_body
|
||||
@onready var new_match_name_input: LineEdit = $ui/body/right_body/create_match_hbox/new_match_name_input
|
||||
|
||||
@onready var rpc_signals: Node = $rpc_signals
|
||||
@onready var client: Node = $client
|
||||
|
||||
var active_mode: String = "snooker"
|
||||
var active_match: HBoxContainer = null
|
||||
|
||||
|
||||
func _on_home_bttn_pressed() -> void:
|
||||
Globals.game_state.set_game_scene(
|
||||
"res://scenes/screens/start_screen/start.tscn"
|
||||
)
|
||||
|
||||
func _on_host_connect_bttn_pressed() -> void:
|
||||
client.start_client(host_address_input.text, int(host_port_range.value))
|
||||
|
||||
func _on_host_disconnect_bttn_pressed() -> void:
|
||||
match_create_vbox.visible = false
|
||||
search_vbox.visible = false
|
||||
host_disconnect_bttn.visible = false
|
||||
host_connect_bttn.visible = true
|
||||
|
||||
for match_block in match_list.get_children():
|
||||
match_block.queue_free()
|
||||
|
||||
client.close_connection()
|
||||
|
||||
func _on_match_search_bttn_pressed() -> void:
|
||||
pass
|
||||
|
||||
func _on_match_create_bttn_pressed() -> void:
|
||||
if active_match: return
|
||||
|
||||
var match_entry: Dictionary = {
|
||||
"name": new_match_name_input.text,
|
||||
"type": active_mode
|
||||
}
|
||||
|
||||
Globals.lobby_data.rpc_id(1, "match_list_add_entry", match_entry)
|
||||
|
||||
func _on_mode_bttn_pressed(button: Button) -> void:
|
||||
active_mode = button.text.remove_chars("-").to_lower()
|
||||
Reference in New Issue
Block a user