From 59ce30f5ff8baee0842ef06019b96f15b1780a12 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sat, 18 May 2019 17:44:50 +0300 Subject: [PATCH] (bc3a19f61) One more missing connection name --- .../Source/Screens/ServerListScreen.cs | 68 ++++++------------- 1 file changed, 20 insertions(+), 48 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs index 9826e5d9c..705c6c32c 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs @@ -66,6 +66,26 @@ namespace Barotrauma ForceUpperCase = true, AutoScale = true }; + clientNameBox.OnTextChanged += RefreshJoinButtonState; + + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("ServerIP")); + ipBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), ""); + ipBox.OnTextChanged += RefreshJoinButtonState; + ipBox.OnSelected += (sender, key) => + { + if (sender.UserData is ServerInfo) + { + sender.Text = ""; + sender.UserData = null; + } + }; + + var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f }; + + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), filterHolder.RectTransform), TextManager.Get("FilterServers")); + searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), filterHolder.RectTransform), ""); + + var tickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), filterHolder.RectTransform)); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("YourName")); clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "") @@ -198,44 +218,6 @@ namespace Barotrauma UserData = "noresults" }; } - - return true; - } - - private bool RefreshJoinButtonState(GUIComponent component, object obj) - { - if (obj == null || waitingForRefresh) { return false; } - - if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text)) - { - joinButton.Enabled = true; - } - else - { - joinButton.Enabled = false; - } - - return true; - } - - private bool SelectServer(GUIComponent component, object obj) - { - if (obj == null || waitingForRefresh) { return false; } - - if (!string.IsNullOrWhiteSpace(clientNameBox.Text)) - { - joinButton.Enabled = true; - } - else - { - clientNameBox.Flash(); - joinButton.Enabled = false; - } - - if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text)) - { - joinButton.Enabled = true; - } else { joinButton.Enabled = false; @@ -274,16 +256,6 @@ namespace Barotrauma joinButton.Enabled = false; } - if (!string.IsNullOrWhiteSpace(clientNameBox.Text)) - { - joinButton.Enabled = true; - } - else - { - clientNameBox.Flash(); - joinButton.Enabled = false; - } - ServerInfo serverInfo; try {