From bcde443c6572ca230dc67c2ef8c3060cca7c6108 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Wed, 15 Apr 2026 17:25:16 -0400 Subject: [PATCH] misc: fmt --- scripts/AddressUI.cs | 2 +- scripts/AdminControls.cs | 196 +++++----- scripts/BackButton.cs | 6 +- scripts/BoardScreen.cs | 266 ++++++------- scripts/BracketScene.cs | 106 ++--- scripts/ConnectButtonUI.cs | 48 +-- scripts/Connection.cs | 710 +++++++++++++++++----------------- scripts/TournamentType.cs.uid | 1 + 8 files changed, 665 insertions(+), 670 deletions(-) create mode 100644 scripts/TournamentType.cs.uid diff --git a/scripts/AddressUI.cs b/scripts/AddressUI.cs index 6e0f1f3..c40968b 100644 --- a/scripts/AddressUI.cs +++ b/scripts/AddressUI.cs @@ -3,4 +3,4 @@ using System; public partial class AddressUI : TextEdit { public override void _Ready() { Text = Connection.WS_DEFAULT_ADDRESS; } -} \ No newline at end of file +} diff --git a/scripts/AdminControls.cs b/scripts/AdminControls.cs index 7f39d43..b603105 100644 --- a/scripts/AdminControls.cs +++ b/scripts/AdminControls.cs @@ -8,126 +8,126 @@ public partial class AdminControls : HBoxContainer { [Export] public Slider Timeout; public override void _Ready() { - Connection.Instance.OnBecomeAdmin += UpdateUI; - Connection.Instance.OnTournamentEnd += UpdateUI; - Connection.Instance.OnStartTournament += UpdateUI; - Connection.Instance.OnCancelTournamentAck += UpdateUI; - Connection.Instance.OnGetDataAcks += UpdateUI; - Connection.Instance.OnSetDataAcks += UpdateUI; + Connection.Instance.OnBecomeAdmin += UpdateUI; + Connection.Instance.OnTournamentEnd += UpdateUI; + Connection.Instance.OnStartTournament += UpdateUI; + Connection.Instance.OnCancelTournamentAck += UpdateUI; + Connection.Instance.OnGetDataAcks += UpdateUI; + Connection.Instance.OnSetDataAcks += UpdateUI; - StartTournament.Pressed += () => Connection.Instance.StartTournament(); - CancelTournament.Pressed += () => Connection.Instance.CancelTournament(); + StartTournament.Pressed += () => Connection.Instance.StartTournament(); + CancelTournament.Pressed += () => Connection.Instance.CancelTournament(); - UpdateUI(); + UpdateUI(); - Timeout.ValueChanged += value => - { - Connection.Instance.SetMoveWait((float)value); - var time = Connection.Instance.CurrentWaitTimeout.ToString(); - if (time.Length > 3) { - time = time.Substring(0, 3); - } - Label.Text = "Wait To Move: " + time + "s "; - }; + Timeout.ValueChanged += value => + { + Connection.Instance.SetMoveWait((float)value); + var time = Connection.Instance.CurrentWaitTimeout.ToString(); + if (time.Length > 3) { + time = time.Substring(0, 3); + } + Label.Text = "Wait To Move: " + time + "s "; + }; - BecomeAdmin.Pressed += showAuthPopup; + BecomeAdmin.Pressed += showAuthPopup; } public override void _ExitTree() { - Connection.Instance.OnBecomeAdmin -= UpdateUI; - Connection.Instance.OnTournamentEnd -= UpdateUI; - Connection.Instance.OnStartTournament -= UpdateUI; - Connection.Instance.OnCancelTournamentAck -= UpdateUI; - Connection.Instance.OnGetDataAcks -= UpdateUI; - Connection.Instance.OnSetDataAcks -= UpdateUI; + Connection.Instance.OnBecomeAdmin -= UpdateUI; + Connection.Instance.OnTournamentEnd -= UpdateUI; + Connection.Instance.OnStartTournament -= UpdateUI; + Connection.Instance.OnCancelTournamentAck -= UpdateUI; + Connection.Instance.OnGetDataAcks -= UpdateUI; + Connection.Instance.OnSetDataAcks -= UpdateUI; } private void UpdateUI() { - if (!Connection.Instance.IsAdmin) { - BecomeAdmin.Show(); - StartTournament.Hide(); - CancelTournament.Hide(); - Label.Hide(); - Timeout.Hide(); - } else { - BecomeAdmin.Hide(); - Label.Show(); - Timeout.Show(); - } + if (!Connection.Instance.IsAdmin) { + BecomeAdmin.Show(); + StartTournament.Hide(); + CancelTournament.Hide(); + Label.Hide(); + Timeout.Hide(); + } else { + BecomeAdmin.Hide(); + Label.Show(); + Timeout.Show(); + } - if (Connection.Instance.IsAdmin && Connection.Instance.DemoMode) { - StartTournament.Hide(); - CancelTournament.Hide(); - } else if (Connection.Instance.IsAdmin && Connection.Instance.ActiveTournament != TournamentType.None) { - StartTournament.Hide(); - CancelTournament.Show(); - } else if (Connection.Instance.IsAdmin) { - StartTournament.Show(); - CancelTournament.Hide(); - } + if (Connection.Instance.IsAdmin && Connection.Instance.DemoMode) { + StartTournament.Hide(); + CancelTournament.Hide(); + } else if (Connection.Instance.IsAdmin && Connection.Instance.ActiveTournament != TournamentType.None) { + StartTournament.Hide(); + CancelTournament.Show(); + } else if (Connection.Instance.IsAdmin) { + StartTournament.Show(); + CancelTournament.Hide(); + } - Timeout.Value = Connection.Instance.CurrentWaitTimeout; - var time = Connection.Instance.CurrentWaitTimeout.ToString(); - if (time.Length > 3) { - time = time.Substring(0, 3); - } + Timeout.Value = Connection.Instance.CurrentWaitTimeout; + var time = Connection.Instance.CurrentWaitTimeout.ToString(); + if (time.Length > 3) { + time = time.Substring(0, 3); + } - Label.Text = "Wait To Move: " + time + "s "; + Label.Text = "Wait To Move: " + time + "s "; } private void showAuthPopup() { - var authWindow = new Window(); - authWindow.Theme = GD.Load("res://assets/theme.tres"); - authWindow.AlwaysOnTop = true; - authWindow.MaximizeDisabled = true; - authWindow.Unresizable = true; - authWindow.InitialPosition = Window.WindowInitialPosition.CenterMainWindowScreen; - authWindow.Size = new Vector2I(256, 128); - authWindow.CloseRequested += () => - { - GetTree().Root.CallDeferred(Node.MethodName.RemoveChild, authWindow); - }; + var authWindow = new Window(); + authWindow.Theme = GD.Load("res://assets/theme.tres"); + authWindow.AlwaysOnTop = true; + authWindow.MaximizeDisabled = true; + authWindow.Unresizable = true; + authWindow.InitialPosition = Window.WindowInitialPosition.CenterMainWindowScreen; + authWindow.Size = new Vector2I(256, 128); + authWindow.CloseRequested += () => + { + GetTree().Root.CallDeferred(Node.MethodName.RemoveChild, authWindow); + }; - var vbox = new VBoxContainer(); - vbox.LayoutMode = 1; - vbox.AnchorBottom = 1.0f; - vbox.AnchorRight = 1.0f; - vbox.GrowHorizontal = GrowDirection.Both; - vbox.GrowVertical = GrowDirection.Both; - vbox.Alignment = AlignmentMode.Center; + var vbox = new VBoxContainer(); + vbox.LayoutMode = 1; + vbox.AnchorBottom = 1.0f; + vbox.AnchorRight = 1.0f; + vbox.GrowHorizontal = GrowDirection.Both; + vbox.GrowVertical = GrowDirection.Both; + vbox.Alignment = AlignmentMode.Center; - var passwordBox = new TextEdit(); - passwordBox.PlaceholderText = "Password"; - passwordBox.SetCustomMinimumSize(new Vector2(32, 32)); + var passwordBox = new TextEdit(); + passwordBox.PlaceholderText = "Password"; + passwordBox.SetCustomMinimumSize(new Vector2(32, 32)); - passwordBox.GuiInput += e => - { - if (passwordBox.HasFocus() && e is InputEventKey inputEventKey && inputEventKey.IsPressed()) { - if (inputEventKey.KeyLabel == Key.Enter) { - Connection.Instance.AdminAuth(passwordBox.Text); - GetTree().Root.CallDeferred(Node.MethodName.RemoveChild, authWindow); - GetViewport().SetInputAsHandled(); - } + passwordBox.GuiInput += e => + { + if (passwordBox.HasFocus() && e is InputEventKey inputEventKey && inputEventKey.IsPressed()) { + if (inputEventKey.KeyLabel == Key.Enter) { + Connection.Instance.AdminAuth(passwordBox.Text); + GetTree().Root.CallDeferred(Node.MethodName.RemoveChild, authWindow); + GetViewport().SetInputAsHandled(); + } - if (inputEventKey.KeyLabel == Key.Space) { - GetViewport().SetInputAsHandled(); - } - } - }; + if (inputEventKey.KeyLabel == Key.Space) { + GetViewport().SetInputAsHandled(); + } + } + }; - var button = new Button(); - button.Text = "Login"; - button.Pressed += () => - { - Connection.Instance.AdminAuth(passwordBox.Text); - GetTree().Root.CallDeferred(Node.MethodName.RemoveChild, authWindow); - }; + var button = new Button(); + button.Text = "Login"; + button.Pressed += () => + { + Connection.Instance.AdminAuth(passwordBox.Text); + GetTree().Root.CallDeferred(Node.MethodName.RemoveChild, authWindow); + }; - vbox.AddChild(passwordBox); - vbox.AddChild(button); + vbox.AddChild(passwordBox); + vbox.AddChild(button); - authWindow.AddChild(vbox); + authWindow.AddChild(vbox); - GetTree().Root.AddChild(authWindow); + GetTree().Root.AddChild(authWindow); } -} \ No newline at end of file +} diff --git a/scripts/BackButton.cs b/scripts/BackButton.cs index 8be710e..99f82ff 100644 --- a/scripts/BackButton.cs +++ b/scripts/BackButton.cs @@ -5,9 +5,9 @@ public partial class BackButton : TextureButton { private const string BRACKET_SCENE_PATH = "res://scenes/bracket_view.tscn"; public override void _Pressed() { - transitionToBracket(); - base._Pressed(); + transitionToBracket(); + base._Pressed(); } private void transitionToBracket() { GetTree().ChangeSceneToFile(BRACKET_SCENE_PATH); } -} \ No newline at end of file +} diff --git a/scripts/BoardScreen.cs b/scripts/BoardScreen.cs index d90804d..caaa530 100644 --- a/scripts/BoardScreen.cs +++ b/scripts/BoardScreen.cs @@ -33,131 +33,131 @@ public partial class BoardScreen : Node2D { // Called when the node enters the scene tree for the first time. public override void _Ready() { - // Node initialization - player1Card = GetNode("Player1Card"); - player2Card = GetNode("Player2Card"); + // Node initialization + player1Card = GetNode("Player1Card"); + player2Card = GetNode("Player2Card"); - player1Card.GetNode