misc: fmt

This commit is contained in:
2026-04-15 17:25:16 -04:00
Unverified
parent 5b4cd944c1
commit bcde443c65
8 changed files with 665 additions and 670 deletions

View File

@@ -6,35 +6,35 @@ public partial class ConnectButtonUI : Button {
private const string BRACKET_SCENE_PATH = "res://scenes/bracket_view.tscn";
public override void _Ready() {
Connection.Instance.OnWsConnectionSuccess += OnConnectionSuccess;
Connection.Instance.OnWsConnectionFailed += OnConnectionFailed;
Connection.Instance.OnWsConnectionSuccess += OnConnectionSuccess;
Connection.Instance.OnWsConnectionFailed += OnConnectionFailed;
if (Connection.Instance.LastUsedConnectionAddress.Length > 0) {
AddressField.Text = Connection.Instance.LastUsedConnectionAddress;
}
if (Connection.Instance.LastUsedConnectionAddress.Length > 0) {
AddressField.Text = Connection.Instance.LastUsedConnectionAddress;
}
if (Connection.Instance.LastError.Length > 0) {
ErrorLabel.Text = Connection.Instance.LastError;
}
if (Connection.Instance.LastError.Length > 0) {
ErrorLabel.Text = Connection.Instance.LastError;
}
AddressField.GuiInput += e =>
{
if (AddressField.HasFocus() && e is InputEventKey inputEventKey && inputEventKey.IsPressed()) {
if (inputEventKey.KeyLabel == Key.Enter) {
Connection.Instance.Connect(AddressField.Text);
GetViewport().SetInputAsHandled();
}
AddressField.GuiInput += e =>
{
if (AddressField.HasFocus() && e is InputEventKey inputEventKey && inputEventKey.IsPressed()) {
if (inputEventKey.KeyLabel == Key.Enter) {
Connection.Instance.Connect(AddressField.Text);
GetViewport().SetInputAsHandled();
}
if (inputEventKey.KeyLabel == Key.Space) {
GetViewport().SetInputAsHandled();
}
}
};
if (inputEventKey.KeyLabel == Key.Space) {
GetViewport().SetInputAsHandled();
}
}
};
}
public override void _ExitTree() {
Connection.Instance.OnWsConnectionSuccess -= OnConnectionSuccess;
Connection.Instance.OnWsConnectionFailed -= OnConnectionFailed;
Connection.Instance.OnWsConnectionSuccess -= OnConnectionSuccess;
Connection.Instance.OnWsConnectionFailed -= OnConnectionFailed;
}
public override void _Pressed() { Connection.Instance.Connect(AddressField.Text); }
@@ -42,6 +42,6 @@ public partial class ConnectButtonUI : Button {
private void OnConnectionSuccess() { GetTree().ChangeSceneToFile(BRACKET_SCENE_PATH); }
private void OnConnectionFailed() {
ErrorLabel.Text = "Couldn't connect to server! " + Connection.Instance.LastError;
ErrorLabel.Text = "Couldn't connect to server! " + Connection.Instance.LastError;
}
}
}