Lemonland Game Window blocked out
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
extends Control
|
||||
|
||||
# UI Shoutbox
|
||||
|
||||
onready var chat_display = $VBox/ChatDisplay
|
||||
onready var chat_input = $VBox/ChatInput
|
||||
onready var leave_button = $VBox/VBox/HBox/LeaveButton
|
||||
onready var join_button = $VBox/VBox/HBox/JoinButton
|
||||
onready var username = $VBox/VBox/HBox/Name
|
||||
var shoutbox_pr
|
||||
|
||||
func display_message(packet): # shout, alert, server_message, user_joined, user_left
|
||||
if packet['type'] == "shout":
|
||||
chat_display.text += packet['name'] + ": " + packet['message'] + "\n"
|
||||
else:
|
||||
chat_display.text += packet['message'] + "\n"
|
||||
|
||||
func join_chat():
|
||||
if !username.text:
|
||||
display_message({'type': "alert", "message": "!!! Enter your username before joining chat."})
|
||||
else:
|
||||
shoutbox_pr.join_chat(username.text)
|
||||
chat_input.show()
|
||||
join_button.hide()
|
||||
username.hide()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey:
|
||||
if event.pressed and event.scancode == KEY_ENTER:
|
||||
shoutbox_pr.send_message(chat_input.text)
|
||||
chat_input.text = ""
|
||||
|
||||
func setup():
|
||||
#join_button.connect("button_up", shoutbox_pr, "join_chat")
|
||||
join_button.connect("button_up", self, "join_chat")
|
||||
|
||||
func _ready():
|
||||
add_to_group("shoutbox_ui")
|
||||
add_to_group("setup")
|
||||
|
||||
|
||||
#func get_username():
|
||||
# return username.text
|
||||
|
||||
#func _server_disconnected():
|
||||
# chat_display.text += "Disconnected from Server\n"
|
||||
|
||||
#func user_entered(id):
|
||||
# chat_display.text += str(id) + " joined the room\n"
|
||||
|
||||
#func user_exited(id):
|
||||
# chat_display.text += str(id) + " left the room\n"
|
||||
|
||||
#func enter_room():
|
||||
# chat_display.text = "Successfully joined room\n"
|
||||
# leave_button.show()
|
||||
# chat_input.show()
|
||||
# join_button.hide()
|
||||
# username.hide()
|
||||
|
||||
#func leave_room():
|
||||
# chat_display.text += "Left Room\n"
|
||||
# leave_button.hide()
|
||||
# join_button.show()
|
||||
# chat_input.hide()
|
||||
# username.show()
|
||||
|
||||
#func _input(event):
|
||||
# if event is InputEventKey:
|
||||
# if event.pressed and event.scancode == KEY_ENTER:
|
||||
# shoutbox_programmatic.send_message(username.text, chat_input.text)
|
||||
# chat_input.text = ""
|
||||
|
||||
#func display_message(id, msg):
|
||||
# chat_display.text += id + ": " + msg + "\n"
|
||||
@@ -0,0 +1,87 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://UI/Shoutbox/Shoutbox.gd" type="Script" id=1]
|
||||
[ext_resource path="res://UI/Label.gd" type="Script" id=2]
|
||||
[ext_resource path="res://UI/Button.gd" type="Script" id=3]
|
||||
[ext_resource path="res://UI/LineEdit.gd" type="Script" id=4]
|
||||
|
||||
[node name="Shoutbox" type="PanelContainer"]
|
||||
margin_left = 502.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 586.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 579.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBox"]
|
||||
margin_right = 270.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
align = 1
|
||||
script = ExtResource( 2 )
|
||||
tl = "sbshou"
|
||||
|
||||
[node name="ChatDisplay" type="TextEdit" parent="VBox"]
|
||||
margin_top = 18.0
|
||||
margin_right = 270.0
|
||||
margin_bottom = 568.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
readonly = true
|
||||
show_line_numbers = true
|
||||
wrap_enabled = true
|
||||
|
||||
[node name="ChatInput" type="LineEdit" parent="VBox"]
|
||||
visible = false
|
||||
margin_top = 520.0
|
||||
margin_right = 270.0
|
||||
margin_bottom = 544.0
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 4 )
|
||||
tl = "sbchin"
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="VBox"]
|
||||
margin_top = 572.0
|
||||
margin_right = 270.0
|
||||
margin_bottom = 572.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBox/VBox"]
|
||||
margin_right = 270.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Name" type="LineEdit" parent="VBox/VBox/HBox"]
|
||||
visible = false
|
||||
margin_right = 270.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
expand_to_text_length = true
|
||||
placeholder_text = "Username"
|
||||
|
||||
[node name="JoinButton" type="Button" parent="VBox/VBox/HBox"]
|
||||
visible = false
|
||||
margin_left = 137.0
|
||||
margin_right = 270.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
text = "join"
|
||||
script = ExtResource( 3 )
|
||||
tl = "sbjoin"
|
||||
|
||||
[node name="LeaveButton" type="Button" parent="VBox/VBox/HBox"]
|
||||
visible = false
|
||||
margin_left = 118.0
|
||||
margin_right = 645.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Leave"
|
||||
script = ExtResource( 3 )
|
||||
tl = "sbleav"
|
||||
Reference in New Issue
Block a user