feat: board screen, thinking status

This commit is contained in:
2025-12-06 01:43:18 -05:00
Unverified
parent 7f74030c14
commit ee1f44c76c
5 changed files with 46 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
public partial class BoardScreen : Node2D {
@@ -43,6 +44,22 @@ public partial class BoardScreen : Node2D {
matchData = Connection.Instance.CurrentObservingMatch;
player1Card.GetNode<Label>("Name").Text = matchData.player1;
player2Card.GetNode<Label>("Name").Text = matchData.player2;
if (Connection.Instance.PreviousMoves.Count == 0)
{
player1Card.GetNode<Label>("Status").Show();
player2Card.GetNode<Label>("Status").Hide();
}
else if (Connection.Instance.PreviousMoves.Last().Item1 == matchData.player1)
{
player1Card.GetNode<Label>("Status").Hide();
player2Card.GetNode<Label>("Status").Show();
}
else
{
player1Card.GetNode<Label>("Status").Show();
player2Card.GetNode<Label>("Status").Hide();
}
Connection.Instance.OnObserveWin += ObserveWin;
Connection.Instance.OnObserveDraw += ObserveDraw;
@@ -85,6 +102,17 @@ public partial class BoardScreen : Node2D {
private void ObserveMove(string username, int column)
{
GD.Print(username);
if (username == matchData.player1)
{
player1Card.GetNode<Label>("Status").Hide();
player2Card.GetNode<Label>("Status").Show();
}
else
{
player1Card.GetNode<Label>("Status").Show();
player2Card.GetNode<Label>("Status").Hide();
}
Connection.Instance.PreviousMoves.Add((username, column));
}