Files
connect4-moderator-observer/scripts/ConnectButtonUI.cs
Joshua Higgins 95c3cef1be feat: theming pass, reworked connection flow...
- bracket view theming (pending rework)
- some light refactoring
- TOURNAMENT:CANCEL command (pending server side implementation)
- logic for waiting for last moves in games to wait for chip to drop
- transition back to main menu on disconnects, disconnect tolerance
2025-12-07 01:24:13 -05:00

20 lines
580 B
C#

using Godot;
public partial class ConnectButtonUI : Button
{
[Export] public TextEdit AddressField;
[Export] public Label ErrorLabel;
private const string BRACKET_SCENE_PATH = "res://scenes/bracket_view.tscn";
public override void _Ready()
{
Connection.Instance.OnWSConnectionSuccess += () => GetTree().ChangeSceneToFile(BRACKET_SCENE_PATH);
Connection.Instance.OnWSConnectionFailed += () => ErrorLabel.Text = "Couldn't connect to server! " + Connection.Instance.LastError;
}
public override void _Pressed()
{
Connection.Instance.Connect(AddressField.Text);
}
}