Add an animated reload glyph to the MP server refresh.

This commit is contained in:
Paul Chote
2017-12-27 16:25:06 +00:00
committed by reaperrr
parent 7014393211
commit 0eaec5d861
11 changed files with 108 additions and 12 deletions

View File

@@ -173,12 +173,29 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}; };
} }
var refreshButton = widget.GetOrNull<ButtonWidget>("REFRESH_BUTTON"); var reloadButton = widget.GetOrNull<ButtonWidget>("RELOAD_BUTTON");
if (refreshButton != null) if (reloadButton != null)
{ {
refreshButton.GetText = () => searchStatus == SearchStatus.Fetching ? "Refreshing..." : "Refresh"; reloadButton.IsDisabled = () => searchStatus == SearchStatus.Fetching;
refreshButton.IsDisabled = () => searchStatus == SearchStatus.Fetching; reloadButton.OnClick = RefreshServerList;
refreshButton.OnClick = RefreshServerList;
var reloadIcon = reloadButton.GetOrNull<ImageWidget>("IMAGE_RELOAD");
if (reloadIcon != null)
{
var disabledFrame = 0;
var disabledImage = "disabled-" + disabledFrame.ToString();
reloadIcon.GetImageName = () => searchStatus == SearchStatus.Fetching ? disabledImage : reloadIcon.ImageName;
var reloadTicker = reloadIcon.Get<LogicTickerWidget>("ANIMATION");
if (reloadTicker != null)
{
reloadTicker.OnTick = () =>
{
disabledFrame = searchStatus == SearchStatus.Fetching ? (disabledFrame + 1) % 12 : 0;
disabledImage = "disabled-" + disabledFrame.ToString();
};
}
}
} }
mapPreview = widget.GetOrNull<MapPreviewWidget>("SELECTED_MAP_PREVIEW"); mapPreview = widget.GetOrNull<MapPreviewWidget>("SELECTED_MAP_PREVIEW");

View File

@@ -452,6 +452,21 @@ lobby-bits: chrome.png
protected: 403,97,10,13 protected: 403,97,10,13
protected-disabled: 403,113,10,13 protected-disabled: 403,113,10,13
reload-icon: chrome.png
enabled: 256,192,16,16
disabled-0: 272,192,16,16
disabled-1: 288,192,16,16
disabled-2: 304,192,16,16
disabled-3: 320,192,16,16
disabled-4: 336,192,16,16
disabled-5: 352,192,16,16
disabled-6: 368,192,16,16
disabled-7: 384,192,16,16
disabled-8: 400,192,16,16
disabled-9: 416,192,16,16
disabled-10: 432,192,16,16
disabled-11: 448,192,16,16
checkbox-bits: chrome.png checkbox-bits: chrome.png
checked: 272,32,16,16 checked: 272,32,16,16
checked-disabled: 272,48,16,16 checked-disabled: 272,48,16,16

View File

@@ -197,12 +197,22 @@ Container@MULTIPLAYER_PANEL:
Width: 152 Width: 152
Height: 25 Height: 25
Text: Filter Games Text: Filter Games
Button@REFRESH_BUTTON: Button@RELOAD_BUTTON:
X: 172 X: 172
Y: PARENT_BOTTOM - 40 Y: PARENT_BOTTOM - 40
Width: 100 Width: 26
Height: 25 Height: 25
Text: Refresh Children:
Image@IMAGE_RELOAD:
X: 5
Y: 5
Width: 16
Height: 16
ImageCollection: reload-icon
ImageName: enabled
IgnoreMouseOver: True
Children:
LogicTicker@ANIMATION:
Button@DIRECTCONNECT_BUTTON: Button@DIRECTCONNECT_BUTTON:
X: 387 X: 387
Y: PARENT_BOTTOM - 40 Y: PARENT_BOTTOM - 40

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

@@ -191,13 +191,22 @@ Background@MULTIPLAYER_PANEL:
Height: 25 Height: 25
Text: Filter Games Text: Filter Games
Font: Bold Font: Bold
Button@REFRESH_BUTTON: Button@RELOAD_BUTTON:
X: 182 X: 182
Y: PARENT_BOTTOM - HEIGHT - 20 Y: PARENT_BOTTOM - HEIGHT - 20
Width: 100 Width: 26
Height: 25 Height: 25
Text: Refresh Children:
Font: Bold Image@IMAGE_RELOAD:
X: 5
Y: 5
Width: 16
Height: 16
ImageCollection: reload-icon
ImageName: enabled
IgnoreMouseOver: True
Children:
LogicTicker@ANIMATION:
Button@DIRECTCONNECT_BUTTON: Button@DIRECTCONNECT_BUTTON:
X: 398 X: 398
Y: PARENT_BOTTOM - HEIGHT - 20 Y: PARENT_BOTTOM - HEIGHT - 20

View File

@@ -213,6 +213,21 @@ lobby-bits: buttons.png
protected: 200,0,12,13 protected: 200,0,12,13
protected-disabled: 211,0,12,13 protected-disabled: 211,0,12,13
reload-icon: chrome.png
enabled: 416,312,16,16
disabled-0: 416,280,16,16
disabled-1: 432,280,16,16
disabled-2: 448,280,16,16
disabled-3: 464,280,16,16
disabled-4: 480,280,16,16
disabled-5: 496,280,16,16
disabled-6: 416,296,16,16
disabled-7: 432,296,16,16
disabled-8: 448,296,16,16
disabled-9: 464,296,16,16
disabled-10: 480,296,16,16
disabled-11: 496,296,16,16
strategic: buttons.png strategic: buttons.png
unowned: 127,5,23,22 unowned: 127,5,23,22
critical_unowned: 127,27,23,22 critical_unowned: 127,27,23,22

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 227 KiB

View File

@@ -531,6 +531,21 @@ lobby-bits: buttons.png
protected: 202,0,10,13 protected: 202,0,10,13
protected-disabled: 213,0,10,13 protected-disabled: 213,0,10,13
reload-icon: chrome.png
enabled: 512,80,16,16
disabled-0: 512,64,16,16
disabled-1: 528,64,16,16
disabled-2: 544,64,16,16
disabled-3: 560,64,16,16
disabled-4: 576,64,16,16
disabled-5: 592,64,16,16
disabled-6: 608,64,16,16
disabled-7: 624,64,16,16
disabled-8: 640,64,16,16
disabled-9: 656,64,16,16
disabled-10: 672,64,16,16
disabled-11: 688,64,16,16
strategic: buttons.png strategic: buttons.png
unowned: 127,5,23,22 unowned: 127,5,23,22
critical_unowned: 127,27,23,22 critical_unowned: 127,27,23,22

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 167 KiB

View File

@@ -378,6 +378,21 @@ lobby-bits: buttons.png
protected: 202,0,10,13 protected: 202,0,10,13
protected-disabled: 213,0,10,13 protected-disabled: 213,0,10,13
reload-icon: dialog.png
enabled: 160,480,16,16
disabled-0: 176,480,16,16
disabled-1: 192,480,16,16
disabled-2: 208,480,16,16
disabled-3: 224,480,16,16
disabled-4: 240,480,16,16
disabled-5: 256,480,16,16
disabled-6: 272,480,16,16
disabled-7: 288,480,16,16
disabled-8: 304,480,16,16
disabled-9: 320,480,16,16
disabled-10: 336,480,16,16
disabled-11: 352,480,16,16
strategic: buttons.png strategic: buttons.png
unowned: 127,5,23,22 unowned: 127,5,23,22
critical_unowned: 127,27,23,22 critical_unowned: 127,27,23,22

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 230 KiB