Add an update warning to the main menu.
This commit is contained in:
@@ -37,6 +37,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
// Update news once per game launch
|
||||
static bool fetchedNews;
|
||||
|
||||
bool newsOpen;
|
||||
|
||||
// Increment the version number when adding new stats
|
||||
const int SystemInformationVersion = 3;
|
||||
Dictionary<string, Pair<string, string>> GetSystemInformation()
|
||||
@@ -242,6 +244,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (Game.Settings.Debug.CheckVersion)
|
||||
webServices.CheckModVersion();
|
||||
|
||||
var updateLabel = rootMenu.GetOrNull("UPDATE_NOTICE");
|
||||
if (updateLabel != null)
|
||||
updateLabel.IsVisible = () => !newsOpen && menuType != MenuType.None &&
|
||||
menuType != MenuType.SystemInfoPrompt &&
|
||||
webServices.ModVersionStatus == ModVersionStatus.Outdated;
|
||||
|
||||
// System information opt-out prompt
|
||||
var sysInfoPrompt = widget.Get("SYSTEM_INFO_PROMPT");
|
||||
sysInfoPrompt.IsVisible = () => menuType == MenuType.SystemInfoPrompt;
|
||||
@@ -306,14 +314,20 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
new Download(newsURL, cacheFile, e => { },
|
||||
e => NewsDownloadComplete(e, cacheFile, currentNews,
|
||||
() => newsButton.AttachPanel(newsPanel)));
|
||||
() => OpenNewsPanel(newsButton)));
|
||||
}
|
||||
|
||||
newsButton.OnClick = () => newsButton.AttachPanel(newsPanel);
|
||||
newsButton.OnClick = () => OpenNewsPanel(newsButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenNewsPanel(DropDownButtonWidget button)
|
||||
{
|
||||
newsOpen = true;
|
||||
button.AttachPanel(newsPanel, () => newsOpen = false);
|
||||
}
|
||||
|
||||
void OnRemoteDirectConnect(string host, int port)
|
||||
{
|
||||
SwitchMenu(MenuType.None);
|
||||
|
||||
@@ -281,6 +281,24 @@ Container@MENU_BACKGROUND:
|
||||
Height: 25
|
||||
Text: Battlefield News
|
||||
Font: Bold
|
||||
Container@UPDATE_NOTICE:
|
||||
X: (WINDOW_RIGHT - WIDTH) / 2
|
||||
Y: 75
|
||||
Width: 128
|
||||
Children:
|
||||
Label@A:
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Align: Center
|
||||
Shadow: true
|
||||
Text: You are running an outdated version of OpenRA.
|
||||
Label@B:
|
||||
Y: 20
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Align: Center
|
||||
Shadow: true
|
||||
Text: Download the latest version from www.openra.net
|
||||
Container@PERFORMANCE_INFO:
|
||||
Logic: PerfDebugLogic
|
||||
Children:
|
||||
|
||||
@@ -27,7 +27,7 @@ Container@MAINMENU:
|
||||
Height: 25
|
||||
Align: Center
|
||||
Font: Regular
|
||||
Contrast: True
|
||||
Shadow: true
|
||||
Container@MENUS:
|
||||
X: 13 + (WINDOW_RIGHT - 522) / 4 - WIDTH / 2
|
||||
Y: WINDOW_BOTTOM / 2 - HEIGHT / 2
|
||||
@@ -302,3 +302,21 @@ Container@MAINMENU:
|
||||
Height: 25
|
||||
Text: Battlefield News
|
||||
Font: Bold
|
||||
Container@UPDATE_NOTICE:
|
||||
X: (WINDOW_RIGHT - WIDTH) / 2
|
||||
Y: 95
|
||||
Width: 128
|
||||
Children:
|
||||
Label@A:
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Align: Center
|
||||
Shadow: true
|
||||
Text: You are running an outdated version of OpenRA.
|
||||
Label@B:
|
||||
Y: 20
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Align: Center
|
||||
Shadow: true
|
||||
Text: Download the latest version from www.openra.net
|
||||
@@ -266,6 +266,24 @@ Container@MAINMENU:
|
||||
Height: 25
|
||||
Text: Battlefield News
|
||||
Font: Bold
|
||||
Container@UPDATE_NOTICE:
|
||||
X: (WINDOW_RIGHT - WIDTH) / 2
|
||||
Y: 95
|
||||
Width: 128
|
||||
Children:
|
||||
Label@A:
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Align: Center
|
||||
Shadow: true
|
||||
Text: You are running an outdated version of OpenRA.
|
||||
Label@B:
|
||||
Y: 20
|
||||
Width: PARENT_RIGHT
|
||||
Height: 25
|
||||
Align: Center
|
||||
Shadow: true
|
||||
Text: Download the latest version from www.openra.net
|
||||
Container@PERFORMANCE_INFO:
|
||||
Logic: PerfDebugLogic
|
||||
Children:
|
||||
|
||||
Reference in New Issue
Block a user