This commit is contained in:
UnknownShadow200 2017-04-29 23:44:27 +10:00
parent ef20661429
commit bee64d40de
2 changed files with 14 additions and 8 deletions

View File

@ -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();
}

View File

@ -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();