diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs index eb17bedb15..235d6013f6 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs @@ -90,6 +90,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic checkboxUPnP.OnClick = () => allowPortForward ^= true; checkboxUPnP.IsDisabled = () => !Game.Settings.Server.AllowPortForward; + var labelUPnP = panel.GetOrNull("UPNP_NOTICE"); + if (labelUPnP != null) + labelUPnP.IsVisible = () => !Game.Settings.Server.DiscoverNatDevices; + + var labelUPnPUnsupported = panel.GetOrNull("UPNP_UNSUPPORTED_NOTICE"); + if (labelUPnPUnsupported != null) + labelUPnPUnsupported.IsVisible = () => Game.Settings.Server.DiscoverNatDevices && !Game.Settings.Server.AllowPortForward; + var passwordField = panel.GetOrNull("PASSWORD"); if (passwordField != null) passwordField.Text = Game.Settings.Server.Password; diff --git a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs index ce2fc4ca65..d04dc76dda 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs @@ -26,6 +26,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic static readonly WindowMode OriginalGraphicsMode; static readonly int2 OriginalGraphicsWindowedSize; static readonly int2 OriginalGraphicsFullscreenSize; + static readonly bool OriginalServerDiscoverNatDevices; readonly Dictionary leavePanelActions = new Dictionary(); readonly Dictionary resetPanelActions = new Dictionary(); @@ -44,6 +45,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic OriginalGraphicsMode = original.Graphics.Mode; OriginalGraphicsWindowedSize = original.Graphics.WindowedSize; OriginalGraphicsFullscreenSize = original.Graphics.FullscreenSize; + OriginalServerDiscoverNatDevices = original.Server.DiscoverNatDevices; } [ObjectCreator.UseCtor] @@ -70,7 +72,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (OriginalSoundDevice != current.Sound.Device || OriginalGraphicsMode != current.Graphics.Mode || OriginalGraphicsWindowedSize != current.Graphics.WindowedSize || - OriginalGraphicsFullscreenSize != current.Graphics.FullscreenSize) + OriginalGraphicsFullscreenSize != current.Graphics.FullscreenSize || + OriginalServerDiscoverNatDevices != current.Server.DiscoverNatDevices) ConfirmationDialogs.ButtonPrompt( title: "Restart Now?", text: "Some changes will not be applied until\nthe game is restarted. Restart now?", diff --git a/mods/cnc/chrome/multiplayer-createserver.yaml b/mods/cnc/chrome/multiplayer-createserver.yaml index a247ec7155..053c080102 100644 --- a/mods/cnc/chrome/multiplayer-createserver.yaml +++ b/mods/cnc/chrome/multiplayer-createserver.yaml @@ -92,6 +92,24 @@ Container@MULTIPLAYER_CREATESERVER_PANEL: Height: 20 Font: Regular Text: Automatic port forwarding + Label@UPNP_NOTICE: + X: 130 + Y: 180 + Width: 200 + Height: 25 + Font: Tiny + Align: Left + WordWrap: True + Text: Requires Network Discovery (UPnP). Enable in Settings - Advanced. + Label@UPNP_UNSUPPORTED_NOTICE: + X: 130 + Y: 180 + Width: 220 + Height: 25 + Font: Tiny + Align: Left + WordWrap: True + Text: Your router does not seem to support UPnP. Please consult your router's manual. Container@SIDEBAR: X: PARENT_RIGHT-WIDTH Y: 30 diff --git a/mods/ra/chrome/multiplayer-createserver.yaml b/mods/ra/chrome/multiplayer-createserver.yaml index 838e762ec1..d73c31f6ea 100644 --- a/mods/ra/chrome/multiplayer-createserver.yaml +++ b/mods/ra/chrome/multiplayer-createserver.yaml @@ -92,6 +92,24 @@ Container@MULTIPLAYER_CREATESERVER_PANEL: Height: 20 Font: Regular Text: Automatic port forwarding + Label@UPNP_NOTICE: + X: 130 + Y: 180 + Width: 200 + Height: 25 + Font: Tiny + Align: Left + WordWrap: True + Text: Requires Network Discovery (UPnP). Enable in Settings - Advanced. + Label@UPNP_UNSUPPORTED_NOTICE: + X: 130 + Y: 180 + Width: 220 + Height: 25 + Font: Tiny + Align: Left + WordWrap: True + Text: Your router does not seem to support UPnP. Please consult your router's manual. Container@SIDEBAR: X: PARENT_RIGHT-WIDTH Y: 30