Merge pull request #11535 from Mailaender/upnp-discoverability
Improved the UPnP settings discoverability
This commit is contained in:
@@ -90,6 +90,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
checkboxUPnP.OnClick = () => allowPortForward ^= true;
|
||||
checkboxUPnP.IsDisabled = () => !Game.Settings.Server.AllowPortForward;
|
||||
|
||||
var labelUPnP = panel.GetOrNull<LabelWidget>("UPNP_NOTICE");
|
||||
if (labelUPnP != null)
|
||||
labelUPnP.IsVisible = () => !Game.Settings.Server.DiscoverNatDevices;
|
||||
|
||||
var labelUPnPUnsupported = panel.GetOrNull<LabelWidget>("UPNP_UNSUPPORTED_NOTICE");
|
||||
if (labelUPnPUnsupported != null)
|
||||
labelUPnPUnsupported.IsVisible = () => Game.Settings.Server.DiscoverNatDevices && !Game.Settings.Server.AllowPortForward;
|
||||
|
||||
var passwordField = panel.GetOrNull<PasswordFieldWidget>("PASSWORD");
|
||||
if (passwordField != null)
|
||||
passwordField.Text = Game.Settings.Server.Password;
|
||||
|
||||
@@ -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<PanelType, Action> leavePanelActions = new Dictionary<PanelType, Action>();
|
||||
readonly Dictionary<PanelType, Action> resetPanelActions = new Dictionary<PanelType, Action>();
|
||||
@@ -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?",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user