diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index 5b1cad113e..dd850aa13a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -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> 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); diff --git a/mods/cnc/chrome/mainmenu.yaml b/mods/cnc/chrome/mainmenu.yaml index 8a471e5f8e..5841b20ed9 100644 --- a/mods/cnc/chrome/mainmenu.yaml +++ b/mods/cnc/chrome/mainmenu.yaml @@ -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: diff --git a/mods/common/chrome/mainmenu.yaml b/mods/common/chrome/mainmenu.yaml index 0e6c992ce4..70cbf00644 100644 --- a/mods/common/chrome/mainmenu.yaml +++ b/mods/common/chrome/mainmenu.yaml @@ -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 \ No newline at end of file diff --git a/mods/d2k/chrome/mainmenu.yaml b/mods/d2k/chrome/mainmenu.yaml index 3d015b2b8a..e39aff208b 100644 --- a/mods/d2k/chrome/mainmenu.yaml +++ b/mods/d2k/chrome/mainmenu.yaml @@ -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: