online multiplayer chess game (note server currently down)
fix & disable timers
bendn 2022-05-16
parent f85cdb8 · commit 538623b
-rw-r--r--Events.gd1
-rw-r--r--ui/GameUI.tscn10
-rw-r--r--ui/Lobby.gd1
-rw-r--r--ui/Timer.gd4
-rw-r--r--ui/TimerLabels.gd2
5 files changed, 13 insertions, 5 deletions
diff --git a/Events.gd b/Events.gd
index 2c6af0d..71defa3 100644
--- a/Events.gd
+++ b/Events.gd
@@ -6,3 +6,4 @@ signal just_before_turn_over # called just before turn over
signal outoftime # called when the time is up
signal game_over # called when the game is over
signal go_back # called when the game is over, and were ready to go back
+signal data_recieved # called every time the data comes in
diff --git a/ui/GameUI.tscn b/ui/GameUI.tscn
index b12c656..b59d354 100644
--- a/ui/GameUI.tscn
+++ b/ui/GameUI.tscn
@@ -123,6 +123,7 @@ __meta__ = {
}
[node name="BlackTime" type="Label" parent="Holder/Back/VBox"]
+visible = false
margin_top = 105.0
margin_right = 400.0
margin_bottom = 188.0
@@ -169,9 +170,10 @@ custom_constants/vseparation = 0
columns = 3
[node name="WhiteTime" type="Label" parent="Holder/Back/VBox"]
-margin_top = 488.0
+visible = false
+margin_top = 421.0
margin_right = 400.0
-margin_bottom = 571.0
+margin_bottom = 504.0
custom_fonts/font = ExtResource( 2 )
text = "00:00.0"
align = 1
@@ -195,9 +197,9 @@ color = Color( 0, 0, 0, 1 )
script = ExtResource( 5 )
[node name="FENlabel" type="LineEdit" parent="Holder/Back/VBox"]
-margin_top = 621.0
+margin_top = 488.0
margin_right = 400.0
-margin_bottom = 695.0
+margin_bottom = 562.0
custom_colors/font_color_uneditable = Color( 1, 1, 1, 1 )
custom_fonts/font = SubResource( 8 )
text = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
diff --git a/ui/Lobby.gd b/ui/Lobby.gd
index a7d635b..1d314b9 100644
--- a/ui/Lobby.gd
+++ b/ui/Lobby.gd
@@ -129,6 +129,7 @@ func _on_data(data: Dictionary) -> void:
Globals.fullmove = data["fullmove"]
Globals.turn = data["turn"]
Globals.halfmove = data["halfmove"]
+ Events.emit_signal("data_recieved")
match data["movetype"]:
Network.MOVEHEADERS.passant:
# en passant
diff --git a/ui/Timer.gd b/ui/Timer.gd
index 6915862..86aa8e9 100644
--- a/ui/Timer.gd
+++ b/ui/Timer.gd
@@ -10,6 +10,10 @@ onready var blacklabel := $"../BlackTime"
func _ready() -> void:
Events.connect("turn_over", self, "turn_over")
+ # disable, because they work wierdly with laggy and stuff
+ whitelabel.hide() # disable
+ blacklabel.hide() # disable
+ set_process(false) # disable
func _process(delta) -> void:
diff --git a/ui/TimerLabels.gd b/ui/TimerLabels.gd
index 03e8aee..b04e262 100644
--- a/ui/TimerLabels.gd
+++ b/ui/TimerLabels.gd
@@ -28,7 +28,7 @@ func _ready() -> void:
set_time(TIME)
set_color()
colorrect.show_behind_parent = true
- Events.connect("turn_over", self, "set_color")
+ Events.connect("data_recieved", self, "set_color")
Events.connect("game_over", self, "_on_game_over")