generated from krampus/template-godot4
25 lines
694 B
GDScript3
25 lines
694 B
GDScript3
|
|
extends Node
|
||
|
|
|
||
|
|
@onready var session_label: Label = %SessionLabel
|
||
|
|
@onready var join_session_id: LineEdit = %JoinSessionId
|
||
|
|
@onready var tube_client: TubeClient = %TubeClient
|
||
|
|
@onready var chat_log: RichTextLabel = %ChatLabel
|
||
|
|
@onready var chat_text_input: LineEdit = %ChatTextInput
|
||
|
|
|
||
|
|
func handle_create_session():
|
||
|
|
tube_client.create_session()
|
||
|
|
session_label.text = tube_client.session_id
|
||
|
|
|
||
|
|
func handle_join_session():
|
||
|
|
tube_client.join_session(join_session_id.text)
|
||
|
|
session_label.text = tube_client.session_id
|
||
|
|
|
||
|
|
|
||
|
|
func handle_chat_update(new_text):
|
||
|
|
update_chat.rpc(new_text)
|
||
|
|
chat_text_input.text = ""
|
||
|
|
|
||
|
|
@rpc("any_peer", "call_local", "reliable")
|
||
|
|
func update_chat(text):
|
||
|
|
chat_log.text += text + "\n"
|