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
This commit is contained in:
@@ -1,23 +1,19 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ConnectButtonUI : Button
|
||||
{
|
||||
[Export] public TextEdit AddressUi;
|
||||
[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()
|
||||
{
|
||||
if (Connection.Instance.Connect(AddressUi.Text))
|
||||
{
|
||||
GD.Print("Success!");
|
||||
GetTree().ChangeSceneToFile(BRACKET_SCENE_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorLabel.Text = "Couldn't connect to server!";
|
||||
}
|
||||
base._Pressed();
|
||||
Connection.Instance.Connect(AddressField.Text);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user