From bee64d40dea69caa287149a6903b3fa8329978a5 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 29 Apr 2017 23:44:27 +1000 Subject: [PATCH] fix it --- Launcher2/Gui/Screens/ServersScreen.cs | 3 ++- Launcher2/Gui/Views/ServersView.cs | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Launcher2/Gui/Screens/ServersScreen.cs b/Launcher2/Gui/Screens/ServersScreen.cs index 91f3edc44..0d0260c49 100644 --- a/Launcher2/Gui/Screens/ServersScreen.cs +++ b/Launcher2/Gui/Screens/ServersScreen.cs @@ -185,8 +185,9 @@ namespace Launcher.Gui.Screens { void CheckFetchStatus() { if (!game.Session.Done) return; + fetchingList = false; - view.RefreshText = "Refresh"; + view.RefreshText = game.Session.Exception == null ? "Refresh" : "&cFailed"; Resize(); } diff --git a/Launcher2/Gui/Views/ServersView.cs b/Launcher2/Gui/Views/ServersView.cs index 4372c2fbc..9140088a4 100644 --- a/Launcher2/Gui/Views/ServersView.cs +++ b/Launcher2/Gui/Views/ServersView.cs @@ -6,7 +6,7 @@ using Launcher.Drawing; using Launcher.Gui.Widgets; using OpenTK.Input; -namespace Launcher.Gui.Views { +namespace Launcher.Gui.Views { public sealed class ServersView : IView { internal int searchIndex = 0, hashIndex = 1, refreshIndex = 5; @@ -40,7 +40,7 @@ namespace Launcher.Gui.Views { .SetLocation(Anchor.LeftOrTop, Anchor.LeftOrTop, 10, 10); MakeInput(Get(1), 475, false, 32, "&gclassicube.net/server/play/...") .SetLocation(Anchor.LeftOrTop, Anchor.BottomOrRight, 10, -10); - + Makers.Button(this, "Back", 110, 30, titleFont) .SetLocation(Anchor.BottomOrRight, Anchor.LeftOrTop, -10, 10); Makers.Button(this, "Connect", 110, 30, titleFont) @@ -48,7 +48,7 @@ namespace Launcher.Gui.Views { MakeTableWidget(); Makers.Button(this, RefreshText, 110, 30, titleFont) - .SetLocation(Anchor.BottomOrRight, Anchor.LeftOrTop, -135, 10); + .SetLocation(Anchor.BottomOrRight, Anchor.LeftOrTop, -135, 10); } string Get(int index) { @@ -80,12 +80,10 @@ namespace Launcher.Gui.Views { TableWidget widget; if (widgets[tableIndex] != null) { widget = (TableWidget)widgets[tableIndex]; + if (widget.servers != game.Session.Servers) ResetTable(widget); } else { widget = new TableWidget(game); - widget.SetEntries(game.Session.Servers); - widget.SetDrawData(drawer, tableFont, textFont, - Anchor.LeftOrTop, Anchor.LeftOrTop, tableX, tableY); - widget.SortDefault(); + ResetTable(widget); widgets[widgetIndex] = widget; } @@ -93,6 +91,13 @@ namespace Launcher.Gui.Views { widgetIndex++; } + void ResetTable(TableWidget widget) { + widget.SetEntries(game.Session.Servers); + widget.SetDrawData(drawer, tableFont, textFont, + Anchor.LeftOrTop, Anchor.LeftOrTop, tableX, tableY); + widget.SortDefault(); + } + public override void Dispose() { base.Dispose(); tableFont.Dispose();