online multiplayer chess game (note server currently down)
-rw-r--r--Credentials.gd12
-rw-r--r--Events.gd1
-rw-r--r--ui/chat/textedit.gd2
-rw-r--r--ui/menus/account/Account.gd18
-rw-r--r--ui/menus/lobby/Disclaimer.gd9
-rw-r--r--ui/menus/lobby/Lobby.tscn25
-rw-r--r--ui/menus/startmenu/StartMenu.tscn1
7 files changed, 19 insertions, 49 deletions
diff --git a/Credentials.gd b/Credentials.gd
index 34eef5f..facbd37 100644
--- a/Credentials.gd
+++ b/Credentials.gd
@@ -10,11 +10,19 @@ var data := default_id_data
func _ready():
var lod = SaveLoad.load(file)
data = lod if Utils.dict_cmp(lod, default_id_data) else default_id_data
+ if len(data.uuid) == 0:
+ create_temporary_uuid()
+
+
+func create_temporary_uuid():
+ randomize()
+ data.uuid = "A-%02x%02x%02x%02x-N" % [randi() % 256, randi() % 256, randi() % 256, randi() % 256]
+ save()
func reset():
data = default_id_data
- save()
+ create_temporary_uuid()
func save() -> void:
@@ -25,5 +33,5 @@ func get(property: String) -> String:
return data[property]
-func get_public() -> Dictionary: # obviously the uuid is public. This actually just means ok for server: must not be used to send to other clients, directly. the id will be filtered out
+func get_public() -> Dictionary: # obviously the uuid isnt public. This actually just means ok for server: must not be used to send to other clients, directly. the id will be filtered out
return {id = data.uuid, name = data.name, country = data.country}
diff --git a/Events.gd b/Events.gd
index 512060c..c716ee4 100644
--- a/Events.gd
+++ b/Events.gd
@@ -4,4 +4,3 @@ extends Node
signal turn_over
signal game_over(reason, isok) # called when the game is over
signal go_back(reason, isok) # called when the game is over, and were ready to go back
-signal set_signed_in(signed_in)
diff --git a/ui/chat/textedit.gd b/ui/chat/textedit.gd
index 32abf00..ae30778 100644
--- a/ui/chat/textedit.gd
+++ b/ui/chat/textedit.gd
@@ -1,6 +1,6 @@
extends ExpandableTextEdit
-signal send()
+signal send
func _input(event: InputEvent) -> void:
diff --git a/ui/menus/account/Account.gd b/ui/menus/account/Account.gd
index 6ab623a..55cd1c1 100644
--- a/ui/menus/account/Account.gd
+++ b/ui/menus/account/Account.gd
@@ -10,17 +10,12 @@ onready var tabs := {
"signin": $choose/signin/usernamepass,
}
-var signed_in = false setget set_signed_in
+var signed_in = false
var autologin = true
onready var tabcontainer = $choose
-func set_signed_in(new):
- signed_in = new
- Events.emit_signal("set_signed_in", new)
-
-
func _ready():
loading.show()
tabcontainer.hide()
@@ -74,20 +69,21 @@ func _on_signup_result(result: String):
on_successful()
-func reset(reason: String, set_status := true):
- if set_status:
+func reset(reason: String, reset_creds := true):
+ if reason:
status.set_text(reason, 0)
- Creds.reset()
+ if reset_creds:
+ Creds.reset()
tabcontainer.show()
loading.hide()
- set_signed_in(false)
+ signed_in = false
func on_successful():
Creds.save()
loading.hide()
status.set_text("Signed in to " + Creds.get("name"), 0)
- set_signed_in(true) # yay
+ signed_in = true # yay
$H/LogOut.show()
tabcontainer.hide()
diff --git a/ui/menus/lobby/Disclaimer.gd b/ui/menus/lobby/Disclaimer.gd
deleted file mode 100644
index 385d4e0..0000000
--- a/ui/menus/lobby/Disclaimer.gd
+++ /dev/null
@@ -1,9 +0,0 @@
-extends Label
-
-
-func _ready():
- Events.connect("set_signed_in", self, "update_vis")
-
-
-func update_vis(newvis):
- visible = !newvis
diff --git a/ui/menus/lobby/Lobby.tscn b/ui/menus/lobby/Lobby.tscn
index 7fe87f6..bd8099e 100644
--- a/ui/menus/lobby/Lobby.tscn
+++ b/ui/menus/lobby/Lobby.tscn
@@ -1,9 +1,7 @@
-[gd_scene load_steps=6 format=2]
+[gd_scene load_steps=4 format=2]
[ext_resource path="res://ui/theme/main.theme" type="Theme" id=1]
[ext_resource path="res://ui/menus/lobby/Lobby.gd" type="Script" id=2]
-[ext_resource path="res://ui/menus/lobby/Disclaimer.gd" type="Script" id=3]
-[ext_resource path="res://ui/ubuntu-bold-small.tres" type="DynamicFont" id=4]
[ext_resource path="res://ui/menus/lobby/GameConfig.tscn" type="PackedScene" id=5]
[node name="Lobby" type="CenterContainer"]
@@ -106,27 +104,6 @@ margin_bottom = 292.0
custom_colors/font_color = Color( 0.698039, 0.415686, 0.415686, 1 )
autowrap = true
-[node name="Disclaimer" type="Label" parent="Center/VBox"]
-visible = false
-margin_top = 242.0
-margin_right = 350.0
-margin_bottom = 342.0
-rect_min_size = Vector2( 0, 100 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_fonts/font = ExtResource( 4 )
-text = " Currently logged out.
- Upon disconnect, you
- will be unable to rejoin. "
-valign = 1
-script = ExtResource( 3 )
-
-[node name="ColorRect" type="ColorRect" parent="Center/VBox/Disclaimer"]
-show_behind_parent = true
-anchor_right = 1.0
-anchor_bottom = 1.0
-margin_right = -46.0
-color = Color( 0.588235, 0.560784, 0.309804, 1 )
-
[connection signal="pressed" from="Center/VBox/stophost" to="." method="_on_stophost_pressed"]
[connection signal="pressed" from="Center/VBox/buttons/SpectateButton" to="." method="_on_spectate_pressed"]
[connection signal="pressed" from="Center/VBox/buttons/JoinButton" to="." method="_on_join_pressed"]
diff --git a/ui/menus/startmenu/StartMenu.tscn b/ui/menus/startmenu/StartMenu.tscn
index 1fadbc7..6a41599 100644
--- a/ui/menus/startmenu/StartMenu.tscn
+++ b/ui/menus/startmenu/StartMenu.tscn
@@ -67,7 +67,6 @@ margin_right = -30.0
margin_bottom = -30.0
[node name="" type="Button" parent="CenterContainer/tabs"]
-unique_name_in_owner = true
visible = false
anchor_right = 1.0
anchor_bottom = 1.0