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?",
|
||||
|
||||
Reference in New Issue
Block a user