shoutbox with new users and message display
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
extends GridContainer
|
||||
|
||||
var storyteller
|
||||
|
||||
func update_actions(dict):
|
||||
for a in dict['actions']:
|
||||
var b = Button.new()
|
||||
b.set_text(tr(a))
|
||||
add_child(b)
|
||||
|
||||
func _ready():
|
||||
add_to_group("action_box")
|
||||
@@ -0,0 +1,9 @@
|
||||
extends Button
|
||||
|
||||
export(String) var tl
|
||||
|
||||
func translate():
|
||||
set_text(tr(tl))
|
||||
|
||||
func _ready():
|
||||
add_to_group("translate")
|
||||
@@ -0,0 +1,9 @@
|
||||
extends RichTextLabel
|
||||
|
||||
var storyteller
|
||||
|
||||
func update_dialog(dict):
|
||||
set_text(tr(dict['line']))
|
||||
|
||||
func _ready():
|
||||
add_to_group("dialog_box")
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
extends VBoxContainer
|
||||
|
||||
onready var legal_name = $Questions/Col1/HBox/Name
|
||||
onready var day = $Questions/Col1/HBox2/Day
|
||||
onready var month = $Questions/Col1/HBox2/Month
|
||||
onready var year = $Questions/Col1/HBox2/Year
|
||||
onready var gender = $Questions/Col1/HBox3/Gender
|
||||
onready var password = $Questions/Col1/HBox4/Password
|
||||
onready var password2 = $Questions/Col1/HBox5/Password2
|
||||
onready var email = $Questions/Col2/HBox/Email
|
||||
onready var secq = $Questions/Col2/HBox2/SecurityQ
|
||||
onready var seca = $Questions/Col2/HBox3/SecurityA
|
||||
onready var reason = $HBox/Reason
|
||||
onready var etc = $HBox2/Etc
|
||||
onready var submit = $Submit
|
||||
onready var message = $HBox3/VBox/Message
|
||||
onready var action = $HBox3/VBox/Action
|
||||
onready var censor = 'res://Res/Text/censor.txt'
|
||||
|
||||
func check():
|
||||
var form = collect_answers()
|
||||
# Check Name is filled
|
||||
if !form['name']:
|
||||
message.set_text(tr("foif10"))
|
||||
return false
|
||||
# Check Name has special characters
|
||||
for c in ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '{',
|
||||
'}', '\'', '\"', ':', ';']:
|
||||
if c in form['name']:
|
||||
message.set_text(tr("foifb2"))
|
||||
return false
|
||||
# Check Name is offensive
|
||||
var file = File.new()
|
||||
file.open(censor, file.READ)
|
||||
var line_counter = 0
|
||||
while not file.eof_reached():
|
||||
line_counter+=1
|
||||
if file.get_line() in form['name']:
|
||||
message.set_text(tr("foifb3"))
|
||||
file.close()
|
||||
return false
|
||||
file.close()
|
||||
# Check Name is taken
|
||||
# message.set_text(tr("foifb4"))
|
||||
# Check if >= 13
|
||||
if form['age'] < 1:
|
||||
message.set_text(tr("foifb5"))
|
||||
return false
|
||||
# Check Password is filled
|
||||
if !form['password'] or !form['password2']:
|
||||
message.set_text(tr("foif11"))
|
||||
return false
|
||||
# Check Password in top passwords
|
||||
for p in ["123456","123456789","qwerty","password","12345","qwerty123","1q2w3e","12345678","111111","1234567890"]:
|
||||
if form['password'] == p:
|
||||
message.set_text(tr("foifb6"))
|
||||
return false
|
||||
# Check Passwords match
|
||||
if form['password'] != form['password2']:
|
||||
message.set_text(tr("foifb7"))
|
||||
return false
|
||||
# Check Email is valid
|
||||
if !form['email']:
|
||||
message.set_text(tr("foifb8"))
|
||||
return false
|
||||
# Check Account Recovery filled out
|
||||
if !form['email'] and !form['secq'] and !form['seca']:
|
||||
message.set_text(tr("foifb8"))
|
||||
return false
|
||||
# Also no name, etc
|
||||
return true
|
||||
|
||||
func collect_answers():
|
||||
return {
|
||||
'name': legal_name.get_text(),
|
||||
'dob': str(month.get_selected_id() + 1) + "/" + str(day.get_selected_id() + 1),
|
||||
'age': year.get_selected_id(),
|
||||
'gender': gender.get_selected_id(),
|
||||
'password': password.get_text(),
|
||||
'password2': password2.get_text(),
|
||||
'email': email.get_text(),
|
||||
'secq': secq.get_text(),
|
||||
'seca': seca.get_text(),
|
||||
'reason': reason.get_selected_id(),
|
||||
'etc': etc.get_text()
|
||||
}
|
||||
|
||||
func create_account():
|
||||
if !check():
|
||||
return
|
||||
get_parent().get_parent().queue_free()
|
||||
|
||||
func _ready():
|
||||
submit.connect("button_up", self, "create_account")
|
||||
@@ -0,0 +1,7 @@
|
||||
extends OptionButton
|
||||
|
||||
func _ready():
|
||||
var x = 1
|
||||
while x < 32:
|
||||
add_item(str(x))
|
||||
x += 1
|
||||
@@ -0,0 +1,7 @@
|
||||
extends OptionButton
|
||||
|
||||
var keys = ["foifal","foifbo","foifgi"]
|
||||
|
||||
func _ready():
|
||||
for k in keys:
|
||||
add_item(tr(k))
|
||||
@@ -0,0 +1,370 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://UI/Form/Immigration/Gender.gd" type="Script" id=1]
|
||||
[ext_resource path="res://UI/Form.gd" type="Script" id=2]
|
||||
[ext_resource path="res://UI/Form/Immigration/Day.gd" type="Script" id=3]
|
||||
[ext_resource path="res://UI/Button.gd" type="Script" id=4]
|
||||
[ext_resource path="res://icon.png" type="Texture" id=5]
|
||||
[ext_resource path="res://UI/Form/Immigration/Month.gd" type="Script" id=6]
|
||||
[ext_resource path="res://UI/Form/Immigration/Reason.gd" type="Script" id=7]
|
||||
[ext_resource path="res://UI/Form/Immigration/Year.gd" type="Script" id=8]
|
||||
|
||||
[node name="CharCreate" type="PanelContainer"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 605.0
|
||||
margin_bottom = 579.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 591.0
|
||||
margin_bottom = 565.0
|
||||
|
||||
[node name="Form" type="VBoxContainer" parent="VBoxContainer"]
|
||||
margin_right = 584.0
|
||||
margin_bottom = 464.0
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Title" type="Label" parent="VBoxContainer/Form"]
|
||||
margin_right = 584.0
|
||||
margin_bottom = 14.0
|
||||
text = "Immigration Forms"
|
||||
|
||||
[node name="Desc" type="Label" parent="VBoxContainer/Form"]
|
||||
margin_top = 18.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 32.0
|
||||
text = "Fill out the following questions."
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Form"]
|
||||
margin_top = 36.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="Questions" type="HBoxContainer" parent="VBoxContainer/Form"]
|
||||
margin_top = 44.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 192.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Col1" type="VBoxContainer" parent="VBoxContainer/Form/Questions"]
|
||||
margin_right = 290.0
|
||||
margin_bottom = 148.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col1"]
|
||||
margin_right = 290.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col1/HBox"]
|
||||
margin_top = 5.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Name:"
|
||||
|
||||
[node name="Name" type="LineEdit" parent="VBoxContainer/Form/Questions/Col1/HBox"]
|
||||
margin_left = 147.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBox2" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col1"]
|
||||
margin_top = 28.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 48.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col1/HBox2"]
|
||||
margin_top = 3.0
|
||||
margin_right = 191.0
|
||||
margin_bottom = 17.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Date of Birth:"
|
||||
|
||||
[node name="Day" type="OptionButton" parent="VBoxContainer/Form/Questions/Col1/HBox2"]
|
||||
margin_left = 195.0
|
||||
margin_right = 224.0
|
||||
margin_bottom = 20.0
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Month" type="OptionButton" parent="VBoxContainer/Form/Questions/Col1/HBox2"]
|
||||
margin_left = 228.0
|
||||
margin_right = 257.0
|
||||
margin_bottom = 20.0
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="Year" type="OptionButton" parent="VBoxContainer/Form/Questions/Col1/HBox2"]
|
||||
margin_left = 261.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 20.0
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="HBox3" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col1"]
|
||||
margin_top = 52.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 72.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col1/HBox3"]
|
||||
margin_top = 3.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 17.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Gender:"
|
||||
|
||||
[node name="Gender" type="OptionButton" parent="VBoxContainer/Form/Questions/Col1/HBox3"]
|
||||
margin_left = 147.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="HBox4" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col1"]
|
||||
margin_top = 76.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 100.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col1/HBox4"]
|
||||
margin_top = 5.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Password:"
|
||||
|
||||
[node name="Password" type="LineEdit" parent="VBoxContainer/Form/Questions/Col1/HBox4"]
|
||||
margin_left = 147.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBox5" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col1"]
|
||||
margin_top = 104.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 128.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col1/HBox5"]
|
||||
margin_top = 5.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Password Again:"
|
||||
|
||||
[node name="Password2" type="LineEdit" parent="VBoxContainer/Form/Questions/Col1/HBox5"]
|
||||
margin_left = 147.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Col2" type="VBoxContainer" parent="VBoxContainer/Form/Questions"]
|
||||
margin_left = 294.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 148.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col2"]
|
||||
margin_right = 290.0
|
||||
margin_bottom = 48.0
|
||||
text = "You must pick either an email OR a Security Q&A, so you can retrieve your documentation when you inevitably lose it."
|
||||
autowrap = true
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Form/Questions/Col2"]
|
||||
margin_top = 52.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 56.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col2"]
|
||||
margin_top = 60.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 84.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col2/HBox"]
|
||||
margin_top = 5.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "email:"
|
||||
|
||||
[node name="Email" type="LineEdit" parent="VBoxContainer/Form/Questions/Col2/HBox"]
|
||||
margin_left = 147.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/Form/Questions/Col2"]
|
||||
margin_top = 88.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 92.0
|
||||
|
||||
[node name="HBox2" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col2"]
|
||||
margin_top = 96.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 120.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col2/HBox2"]
|
||||
margin_top = 5.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Security Question:"
|
||||
|
||||
[node name="SecurityQ" type="LineEdit" parent="VBoxContainer/Form/Questions/Col2/HBox2"]
|
||||
margin_left = 147.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBox3" type="HBoxContainer" parent="VBoxContainer/Form/Questions/Col2"]
|
||||
margin_top = 124.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 148.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/Questions/Col2/HBox3"]
|
||||
margin_top = 5.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Security Answer:"
|
||||
|
||||
[node name="SecurityA" type="LineEdit" parent="VBoxContainer/Form/Questions/Col2/HBox3"]
|
||||
margin_left = 147.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/Form"]
|
||||
margin_top = 196.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 200.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBoxContainer/Form"]
|
||||
margin_top = 204.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 224.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/HBox"]
|
||||
margin_top = 3.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 17.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Reason for Immigrating:"
|
||||
|
||||
[node name="Reason" type="OptionButton" parent="VBoxContainer/Form/HBox"]
|
||||
margin_left = 294.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="HBox2" type="HBoxContainer" parent="VBoxContainer/Form"]
|
||||
margin_top = 228.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 252.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/HBox2"]
|
||||
margin_top = 5.0
|
||||
margin_right = 290.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Additional Comments:"
|
||||
|
||||
[node name="Etc" type="LineEdit" parent="VBoxContainer/Form/HBox2"]
|
||||
margin_left = 294.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
text = "ajsdfrjosdijfosdiajfoisdjfoai hahaha"
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/Form"]
|
||||
margin_top = 256.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 260.0
|
||||
|
||||
[node name="Submit" type="Button" parent="VBoxContainer/Form"]
|
||||
margin_top = 264.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 284.0
|
||||
script = ExtResource( 4 )
|
||||
tl = "foifbs"
|
||||
|
||||
[node name="HSeparator4" type="HSeparator" parent="VBoxContainer/Form"]
|
||||
margin_top = 288.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 292.0
|
||||
|
||||
[node name="HBox3" type="HBoxContainer" parent="VBoxContainer/Form"]
|
||||
margin_top = 296.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 464.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 2
|
||||
|
||||
[node name="VBox2" type="VBoxContainer" parent="VBoxContainer/Form/HBox3"]
|
||||
margin_right = 150.0
|
||||
margin_bottom = 168.0
|
||||
alignment = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Form/HBox3/VBox2"]
|
||||
margin_right = 150.0
|
||||
margin_bottom = 150.0
|
||||
rect_min_size = Vector2( 150, 150 )
|
||||
texture = ExtResource( 5 )
|
||||
expand = true
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Form/HBox3/VBox2"]
|
||||
margin_top = 154.0
|
||||
margin_right = 150.0
|
||||
margin_bottom = 168.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "Bless the Child"
|
||||
align = 1
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="VBoxContainer/Form/HBox3"]
|
||||
margin_left = 154.0
|
||||
margin_right = 584.0
|
||||
margin_bottom = 168.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 2
|
||||
|
||||
[node name="Message" type="RichTextLabel" parent="VBoxContainer/Form/HBox3/VBox"]
|
||||
margin_top = 129.0
|
||||
margin_right = 430.0
|
||||
margin_bottom = 144.0
|
||||
size_flags_horizontal = 3
|
||||
text = "\"Fill these forms real quick. The boss will be here any minute.\""
|
||||
fit_content_height = true
|
||||
|
||||
[node name="Action" type="GridContainer" parent="VBoxContainer/Form/HBox3/VBox"]
|
||||
margin_top = 148.0
|
||||
margin_right = 430.0
|
||||
margin_bottom = 168.0
|
||||
size_flags_horizontal = 3
|
||||
columns = 3
|
||||
|
||||
[node name="Button2" type="Button" parent="VBoxContainer/Form/HBox3/VBox/Action"]
|
||||
margin_right = 248.0
|
||||
margin_bottom = 20.0
|
||||
text = "why not let me in without the forms?"
|
||||
|
||||
[node name="Button3" type="Button" parent="VBoxContainer/Form/HBox3/VBox/Action"]
|
||||
margin_left = 252.0
|
||||
margin_right = 426.0
|
||||
margin_bottom = 20.0
|
||||
text = "how do you use this info?"
|
||||
@@ -0,0 +1,7 @@
|
||||
extends OptionButton
|
||||
|
||||
var keys = ["tijanu", "tifebu", "timarc", "tiapri", "timaya", "tijune", "tijuly", "tiaugu", "tisept", "tiocto", "tinove", "tidece"]
|
||||
|
||||
func _ready():
|
||||
for k in keys:
|
||||
add_item(tr(k))
|
||||
@@ -0,0 +1,7 @@
|
||||
extends OptionButton
|
||||
|
||||
var keys = ["foifri", "foifrp", "foifrc", "foifrg", "foifrf", "foifre"]
|
||||
|
||||
func _ready():
|
||||
for k in keys:
|
||||
add_item(tr(k))
|
||||
@@ -0,0 +1,7 @@
|
||||
extends OptionButton
|
||||
|
||||
var keys = ["tiun13", "tiov13"]
|
||||
|
||||
func _ready():
|
||||
for k in keys:
|
||||
add_item(tr(k))
|
||||
@@ -0,0 +1,13 @@
|
||||
extends "res://UI/Label.gd"
|
||||
|
||||
export(String) var tl_tooltip
|
||||
|
||||
func show_tooltip():
|
||||
var label = Label.new()
|
||||
label.set_text(tr(tl_tooltip))
|
||||
label.set_global_position(get_global_position())
|
||||
add_child(label)
|
||||
|
||||
func _ready():
|
||||
tl = "?"
|
||||
connect("mouse_entered", self, "show_tooltip")
|
||||
@@ -0,0 +1,9 @@
|
||||
extends Label
|
||||
|
||||
export(String) var tl
|
||||
|
||||
func translate():
|
||||
set_text(tr(tl))
|
||||
|
||||
func _ready():
|
||||
add_to_group("translate")
|
||||
@@ -0,0 +1,9 @@
|
||||
extends LineEdit
|
||||
|
||||
export(String) var tl
|
||||
|
||||
func translate():
|
||||
placeholder_text = tr(tl)
|
||||
|
||||
func _ready():
|
||||
add_to_group("translate")
|
||||
@@ -0,0 +1,99 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
[ext_resource path="res://UI/DialogBox.gd" type="Script" id=2]
|
||||
[ext_resource path="res://UI/Action.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=2]
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 64, 64 )
|
||||
|
||||
[node name="Game" type="PanelContainer"]
|
||||
margin_right = 172.0
|
||||
margin_bottom = 40.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 315.0
|
||||
margin_bottom = 500.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBox"]
|
||||
margin_right = 308.0
|
||||
margin_bottom = 335.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="View" type="TextureRect" parent="VBox/HBox"]
|
||||
margin_right = 99.0
|
||||
margin_bottom = 335.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
||||
|
||||
[node name="PDA" type="PanelContainer" parent="VBox/HBox"]
|
||||
margin_left = 103.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 335.0
|
||||
rect_min_size = Vector2( 205, 335 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = SubResource( 1 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
|
||||
[node name="Messages" type="RichTextLabel" parent="VBox"]
|
||||
margin_top = 339.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 339.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "You are in the Customs Office.
|
||||
WARNING: You have no light source.
|
||||
Dan is hungry. You should feed him soon."
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="HBox2" type="HBoxContainer" parent="VBox"]
|
||||
margin_top = 343.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 493.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="VBox/HBox2"]
|
||||
margin_right = 154.0
|
||||
margin_bottom = 150.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="WhatNow" type="Label" parent="VBox/HBox2/VBox"]
|
||||
margin_right = 154.0
|
||||
margin_bottom = 73.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "What will you do now...?"
|
||||
|
||||
[node name="Action" type="GridContainer" parent="VBox/HBox2/VBox"]
|
||||
margin_top = 77.0
|
||||
margin_right = 154.0
|
||||
margin_bottom = 150.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
columns = 2
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Partner" type="TextureRect" parent="VBox/HBox2"]
|
||||
margin_left = 158.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 150.0
|
||||
rect_min_size = Vector2( 150, 150 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
||||
@@ -0,0 +1,33 @@
|
||||
extends Control
|
||||
|
||||
# Lemonland Shoutbox UI
|
||||
|
||||
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
|
||||
|
||||
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:
|
||||
get_parent().join_chat(username.text)
|
||||
chat_input.show()
|
||||
join_button.hide()
|
||||
username.hide()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey and get_parent().chat_name:
|
||||
if event.pressed and event.scancode == KEY_ENTER:
|
||||
get_parent().send_message(chat_input.text)
|
||||
chat_input.text = ""
|
||||
|
||||
func _ready():
|
||||
join_button.connect("button_up", self, "join_chat")
|
||||
@@ -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