Fix IDE0053
This commit is contained in:
committed by
Pavel Penev
parent
37afd6094e
commit
939f715e3c
@@ -121,9 +121,12 @@ dotnet_style_predefined_type_for_member_access = true
|
|||||||
# IDE0049, IDE-only counterpart of StyleCopAnalyzers - SA1121: UseBuiltInTypeAlias.
|
# IDE0049, IDE-only counterpart of StyleCopAnalyzers - SA1121: UseBuiltInTypeAlias.
|
||||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||||
|
|
||||||
# Use expression body if a local function is a single line.
|
# Use expression body for some items if on a single line.
|
||||||
csharp_style_expression_bodied_local_functions = when_on_single_line
|
csharp_style_expression_bodied_local_functions = when_on_single_line
|
||||||
|
|
||||||
|
# This rule is buggy and not enforced for builds. ':warning' will at least enforce it in the IDE.
|
||||||
|
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
|
||||||
|
|
||||||
# Remove unused parameters on non public methods, ignore unused parameters on public methods.
|
# Remove unused parameters on non public methods, ignore unused parameters on public methods.
|
||||||
dotnet_code_quality_unused_parameters = non_public
|
dotnet_code_quality_unused_parameters = non_public
|
||||||
|
|
||||||
@@ -216,6 +219,9 @@ dotnet_diagnostic.IDE0051.severity = warning
|
|||||||
# Remove unread private member.
|
# Remove unread private member.
|
||||||
dotnet_diagnostic.IDE0052.severity = warning
|
dotnet_diagnostic.IDE0052.severity = warning
|
||||||
|
|
||||||
|
# Use expression body for lambdas.
|
||||||
|
dotnet_diagnostic.IDE0053.severity = warning
|
||||||
|
|
||||||
# Use compound assignment.
|
# Use compound assignment.
|
||||||
dotnet_diagnostic.IDE0054.severity = warning
|
dotnet_diagnostic.IDE0054.severity = warning
|
||||||
|
|
||||||
|
|||||||
@@ -56,14 +56,10 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Func<string, Type, string, object> InvalidValueAction = (s, t, f) =>
|
public static Func<string, Type, string, object> InvalidValueAction = (s, t, f) =>
|
||||||
{
|
|
||||||
throw new YamlException($"FieldLoader: Cannot parse `{s}` into `{f}.{t}` ");
|
throw new YamlException($"FieldLoader: Cannot parse `{s}` into `{f}.{t}` ");
|
||||||
};
|
|
||||||
|
|
||||||
public static Action<string, Type> UnknownFieldAction = (s, f) =>
|
public static Action<string, Type> UnknownFieldAction = (s, f) =>
|
||||||
{
|
|
||||||
throw new NotImplementedException($"FieldLoader: Missing field `{s}` on `{f.Name}`");
|
throw new NotImplementedException($"FieldLoader: Missing field `{s}` on `{f.Name}`");
|
||||||
};
|
|
||||||
|
|
||||||
static readonly ConcurrentCache<Type, FieldLoadInfo[]> TypeLoadInfo =
|
static readonly ConcurrentCache<Type, FieldLoadInfo[]> TypeLoadInfo =
|
||||||
new ConcurrentCache<Type, FieldLoadInfo[]>(BuildTypeLoadInfo);
|
new ConcurrentCache<Type, FieldLoadInfo[]>(BuildTypeLoadInfo);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var newConnection = new NetworkConnection(endpoint);
|
var newConnection = new NetworkConnection(endpoint);
|
||||||
if (recordReplay)
|
if (recordReplay)
|
||||||
newConnection.StartRecording(() => { return TimestampedFilename(); });
|
newConnection.StartRecording(() => TimestampedFilename());
|
||||||
|
|
||||||
var om = new OrderManager(newConnection);
|
var om = new OrderManager(newConnection);
|
||||||
JoinInner(om);
|
JoinInner(om);
|
||||||
@@ -618,10 +618,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
if (orderManager.TryTick())
|
if (orderManager.TryTick())
|
||||||
{
|
{
|
||||||
Sync.RunUnsynced(world, () =>
|
Sync.RunUnsynced(world, () => world.OrderGenerator.Tick(world));
|
||||||
{
|
|
||||||
world.OrderGenerator.Tick(world);
|
|
||||||
});
|
|
||||||
|
|
||||||
world.Tick();
|
world.Tick();
|
||||||
|
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ namespace OpenRA.Server
|
|||||||
|
|
||||||
if (Settings.RecordReplays && Type == ServerType.Dedicated)
|
if (Settings.RecordReplays && Type == ServerType.Dedicated)
|
||||||
{
|
{
|
||||||
recorder = new ReplayRecorder(() => { return Game.TimestampedFilename(extra: "-Server"); });
|
recorder = new ReplayRecorder(() => Game.TimestampedFilename(extra: "-Server"));
|
||||||
|
|
||||||
// We only need one handshake to initialize the replay.
|
// We only need one handshake to initialize the replay.
|
||||||
// Add it now, then ignore the redundant handshakes from each client
|
// Add it now, then ignore the redundant handshakes from each client
|
||||||
|
|||||||
@@ -97,10 +97,7 @@ namespace OpenRA.Mods.Common
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var server = args.Secret.Split('|');
|
var server = args.Secret.Split('|');
|
||||||
Game.RunAfterTick(() =>
|
Game.RunAfterTick(() => Game.RemoteDirectConnect(new ConnectionTarget(server[0], int.Parse(server[1]))));
|
||||||
{
|
|
||||||
Game.RemoteDirectConnect(new ConnectionTarget(server[0], int.Parse(server[1])));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetStatus(DiscordState state, string details = null, string secret = null, int? players = null, int? slots = null)
|
void SetStatus(DiscordState state, string details = null, string secret = null, int? players = null, int? slots = null)
|
||||||
|
|||||||
@@ -36,10 +36,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
tick = -delay;
|
tick = -delay;
|
||||||
|
|
||||||
target.World.RemoveAll(effect =>
|
target.World.RemoveAll(effect => effect is FlashTarget flashTarget && flashTarget.target == target);
|
||||||
{
|
|
||||||
return effect is FlashTarget flashTarget && flashTarget.target == target;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlashTarget(Actor target, Color color, float alpha = 0.5f, int count = 2, int interval = 2, int delay = 0)
|
public FlashTarget(Actor target, Color color, float alpha = 0.5f, int count = 2, int interval = 2, int delay = 0)
|
||||||
|
|||||||
@@ -47,10 +47,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
(actor, value) =>
|
(actor, value) => actor.ReplaceInit(new FreeActorInit(this, value), this));
|
||||||
{
|
|
||||||
actor.ReplaceInit(new FreeActorInit(this, value), this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new FreeActor(init, this); }
|
public override object Create(ActorInitializer init) { return new FreeActor(init, this); }
|
||||||
|
|||||||
@@ -125,9 +125,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
checkTerrainType = info.UnloadTerrainTypes.Count > 0;
|
checkTerrainType = info.UnloadTerrainTypes.Count > 0;
|
||||||
|
|
||||||
currentAdjacentCells = new CachedTransform<CPos, IEnumerable<CPos>>(loc =>
|
currentAdjacentCells = new CachedTransform<CPos, IEnumerable<CPos>>(loc =>
|
||||||
{
|
Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => loc != c));
|
||||||
return Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => loc != c);
|
|
||||||
});
|
|
||||||
|
|
||||||
var runtimeCargoInit = init.GetOrDefault<RuntimeCargoInit>(info);
|
var runtimeCargoInit = init.GetOrDefault<RuntimeCargoInit>(info);
|
||||||
var cargoInit = init.GetOrDefault<CargoInit>(info);
|
var cargoInit = init.GetOrDefault<CargoInit>(info);
|
||||||
|
|||||||
@@ -81,9 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
(actor, value) =>
|
(actor, value) =>
|
||||||
{
|
actor.ReplaceInit(new DeployStateInit(value ? DeployState.Deployed : DeployState.Undeployed)));
|
||||||
actor.ReplaceInit(new DeployStateInit(value ? DeployState.Deployed : DeployState.Undeployed));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new GrantConditionOnDeploy(init, this); }
|
public override object Create(ActorInitializer init) { return new GrantConditionOnDeploy(init, this); }
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
MarkFailed(player, id);
|
MarkFailed(player, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public event Action<Player, bool> ObjectiveAdded = (player, inhibitAnnouncement) => { player.HasObjectives = true; };
|
public event Action<Player, bool> ObjectiveAdded = (player, inhibitAnnouncement) => player.HasObjectives = true;
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
base.Created(self);
|
base.Created(self);
|
||||||
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
remainingTicks = Util.ApplyPercentageModifiers(Info.Delay, modifiers.Select(m => m.GetReloadAmmoModifier())));
|
||||||
remainingTicks = Util.ApplyPercentageModifiers(Info.Delay, modifiers.Select(m => m.GetReloadAmmoModifier()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel barrel)
|
void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel barrel)
|
||||||
|
|||||||
@@ -230,10 +230,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (beacon == null)
|
if (beacon == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Self.World.AddFrameEndTask(w =>
|
Self.World.AddFrameEndTask(w => w.Remove(beacon));
|
||||||
{
|
|
||||||
w.Remove(beacon);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,10 +204,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Info.BeaconDelay,
|
Info.BeaconDelay,
|
||||||
info.FlightDelay - info.BeaconRemoveAdvance);
|
info.FlightDelay - info.BeaconRemoveAdvance);
|
||||||
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w => w.Add(beacon));
|
||||||
{
|
|
||||||
w.Add(beacon);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -283,10 +283,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (beacon == null)
|
if (beacon == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Self.World.AddFrameEndTask(w =>
|
Self.World.AddFrameEndTask(w => w.Remove(beacon));
|
||||||
{
|
|
||||||
w.Remove(beacon);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,10 +284,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
|
for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
|
||||||
{
|
{
|
||||||
var blocked = previews.Any(p =>
|
var blocked = previews.Any(p => p.Footprint.TryGetValue(cell, out var s) && s == (SubCell)i);
|
||||||
{
|
|
||||||
return p.Footprint.TryGetValue(cell, out var s) && s == (SubCell)i;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!blocked)
|
if (!blocked)
|
||||||
return (SubCell)i;
|
return (SubCell)i;
|
||||||
|
|||||||
@@ -86,15 +86,11 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
Console.WriteLine(" },");
|
Console.WriteLine(" },");
|
||||||
}
|
}
|
||||||
|
|
||||||
var actorProperties = utility.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>().SelectMany(cg =>
|
var actorProperties = utility.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>()
|
||||||
{
|
.SelectMany(ScriptMemberWrapper.WrappableMembers);
|
||||||
return ScriptMemberWrapper.WrappableMembers(cg);
|
|
||||||
});
|
|
||||||
|
|
||||||
var scriptProperties = utility.ModData.ObjectCreator.GetTypesImplementing<ScriptPlayerProperties>().SelectMany(cg =>
|
var scriptProperties = utility.ModData.ObjectCreator.GetTypesImplementing<ScriptPlayerProperties>()
|
||||||
{
|
.SelectMany(ScriptMemberWrapper.WrappableMembers);
|
||||||
return ScriptMemberWrapper.WrappableMembers(cg);
|
|
||||||
});
|
|
||||||
|
|
||||||
var properties = actorProperties.Concat(scriptProperties);
|
var properties = actorProperties.Concat(scriptProperties);
|
||||||
foreach (var property in properties.OrderBy(m => m.Name))
|
foreach (var property in properties.OrderBy(m => m.Name))
|
||||||
|
|||||||
@@ -94,10 +94,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
otherButton.Visible = true;
|
otherButton.Visible = true;
|
||||||
otherButton.Bounds.Y += headerHeight;
|
otherButton.Bounds.Y += headerHeight;
|
||||||
otherButton.OnClick = () =>
|
otherButton.OnClick = onOther;
|
||||||
{
|
|
||||||
onOther();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(otherText))
|
if (!string.IsNullOrEmpty(otherText))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(template,
|
var item = ScrollItemWidget.Setup(template,
|
||||||
() => currentFilename == filepath && currentPackage == package,
|
() => currentFilename == filepath && currentPackage == package,
|
||||||
() => { LoadAsset(package, filepath); });
|
() => LoadAsset(package, filepath));
|
||||||
|
|
||||||
var label = item.Get<LabelWithTooltipWidget>("TITLE");
|
var label = item.Get<LabelWithTooltipWidget>("TITLE");
|
||||||
WidgetUtils.TruncateLabelToTooltip(label, filepath);
|
WidgetUtils.TruncateLabelToTooltip(label, filepath);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var tab = tabContainer.Get<ButtonWidget>(buttonId);
|
var tab = tabContainer.Get<ButtonWidget>(buttonId);
|
||||||
tab.IsHighlighted = () => menuType == tabType;
|
tab.IsHighlighted = () => menuType == tabType;
|
||||||
tab.OnClick = () => { menuType = tabType; };
|
tab.OnClick = () => menuType = tabType;
|
||||||
|
|
||||||
var container = widget.Parent.Get<ContainerWidget>(tabId);
|
var container = widget.Parent.Get<ContainerWidget>(tabId);
|
||||||
container.IsVisible = () => menuType == tabType;
|
container.IsVisible = () => menuType == tabType;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(template,
|
var item = ScrollItemWidget.Setup(template,
|
||||||
() => tilesetDropDown.Text == option,
|
() => tilesetDropDown.Text == option,
|
||||||
() => { tilesetDropDown.Text = option; });
|
() => tilesetDropDown.Text = option);
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => option;
|
item.Get<LabelWidget>("LABEL").GetText = () => option;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var saveButton = panel.Get<ButtonWidget>("SAVE_BUTTON");
|
var saveButton = panel.Get<ButtonWidget>("SAVE_BUTTON");
|
||||||
saveButton.IsDisabled = () => string.IsNullOrWhiteSpace(saveTextField.Text);
|
saveButton.IsDisabled = () => string.IsNullOrWhiteSpace(saveTextField.Text);
|
||||||
saveButton.OnClick = () => { Save(world); };
|
saveButton.OnClick = () => Save(world);
|
||||||
saveButton.IsVisible = () => true;
|
saveButton.IsVisible = () => true;
|
||||||
|
|
||||||
var saveWidgets = panel.Get("SAVE_WIDGETS");
|
var saveWidgets = panel.Get("SAVE_WIDGETS");
|
||||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var loadButton = panel.Get<ButtonWidget>("LOAD_BUTTON");
|
var loadButton = panel.Get<ButtonWidget>("LOAD_BUTTON");
|
||||||
loadButton.IsVisible = () => true;
|
loadButton.IsVisible = () => true;
|
||||||
loadButton.IsDisabled = () => selectedSave == null;
|
loadButton.IsDisabled = () => selectedSave == null;
|
||||||
loadButton.OnClick = () => { Load(); };
|
loadButton.OnClick = Load;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Directory.Exists(baseSavePath))
|
if (Directory.Exists(baseSavePath))
|
||||||
|
|||||||
@@ -333,9 +333,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Game.RunAfterTick(() => // run on the main thread
|
Game.RunAfterTick(() => // run on the main thread
|
||||||
{
|
SetNewsStatus(modData.Translation.GetString(NewsRetrivalFailed, Translation.Arguments("message", e.Message))));
|
||||||
SetNewsStatus(modData.Translation.GetString(NewsRetrivalFailed, Translation.Arguments("message", e.Message)));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -434,10 +434,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var fsPlayer = fullscreenVideoPlayer.Get<VideoPlayerWidget>("PLAYER");
|
var fsPlayer = fullscreenVideoPlayer.Get<VideoPlayerWidget>("PLAYER");
|
||||||
fullscreenVideoPlayer.Visible = true;
|
fullscreenVideoPlayer.Visible = true;
|
||||||
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () =>
|
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart,
|
||||||
{
|
() => Game.CreateAndStartLocalServer(selectedMap.Uid, orders));
|
||||||
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
|
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
pauseButton.IsVisible = () => Game.Sound.MusicPlaying;
|
pauseButton.IsVisible = () => Game.Sound.MusicPlaying;
|
||||||
|
|
||||||
var stopButton = panel.Get<ButtonWidget>("BUTTON_STOP");
|
var stopButton = panel.Get<ButtonWidget>("BUTTON_STOP");
|
||||||
stopButton.OnClick = () => { musicPlaylist.Stop(); };
|
stopButton.OnClick = musicPlaylist.Stop;
|
||||||
stopButton.IsDisabled = NoMusic;
|
stopButton.IsDisabled = NoMusic;
|
||||||
|
|
||||||
var nextButton = panel.Get<ButtonWidget>("BUTTON_NEXT");
|
var nextButton = panel.Get<ButtonWidget>("BUTTON_NEXT");
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var watch = panel.Get<ButtonWidget>("WATCH_BUTTON");
|
var watch = panel.Get<ButtonWidget>("WATCH_BUTTON");
|
||||||
watch.IsDisabled = () => selectedReplay == null || map.Status != MapStatus.Available;
|
watch.IsDisabled = () => selectedReplay == null || map.Status != MapStatus.Available;
|
||||||
watch.OnClick = () => { WatchReplay(); };
|
watch.OnClick = WatchReplay;
|
||||||
|
|
||||||
var mapPreviewRoot = panel.Get("MAP_PREVIEW_ROOT");
|
var mapPreviewRoot = panel.Get("MAP_PREVIEW_ROOT");
|
||||||
mapPreviewRoot.IsVisible = () => selectedReplay != null;
|
mapPreviewRoot.IsVisible = () => selectedReplay != null;
|
||||||
|
|||||||
@@ -68,10 +68,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var hotkeyValidColor = ChromeMetrics.Get<Color>("HotkeyColor");
|
var hotkeyValidColor = ChromeMetrics.Get<Color>("HotkeyColor");
|
||||||
var hotkeyInvalidColor = ChromeMetrics.Get<Color>("HotkeyColorInvalid");
|
var hotkeyInvalidColor = ChromeMetrics.Get<Color>("HotkeyColorInvalid");
|
||||||
|
|
||||||
remapButton.GetColor = () =>
|
remapButton.GetColor = () => hd.HasDuplicates ? hotkeyInvalidColor : hotkeyValidColor;
|
||||||
{
|
|
||||||
return hd.HasDuplicates ? hotkeyInvalidColor : hotkeyValidColor;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (selectedHotkeyDefinition == hd)
|
if (selectedHotkeyDefinition == hd)
|
||||||
{
|
{
|
||||||
@@ -253,9 +250,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
hotkeyEntryWidget.IsValid = () => isHotkeyValid;
|
hotkeyEntryWidget.IsValid = () => isHotkeyValid;
|
||||||
hotkeyEntryWidget.OnLoseFocus = ValidateHotkey;
|
hotkeyEntryWidget.OnLoseFocus = ValidateHotkey;
|
||||||
hotkeyEntryWidget.OnEscKey = _ =>
|
hotkeyEntryWidget.OnEscKey = _ =>
|
||||||
{
|
|
||||||
hotkeyEntryWidget.Key = modData.Hotkeys[selectedHotkeyDefinition.Name].GetValue();
|
hotkeyEntryWidget.Key = modData.Hotkeys[selectedHotkeyDefinition.Name].GetValue();
|
||||||
};
|
|
||||||
hotkeyEntryWidget.IsDisabled = () => selectedHotkeyDefinition.Readonly;
|
hotkeyEntryWidget.IsDisabled = () => selectedHotkeyDefinition.Readonly;
|
||||||
|
|
||||||
validHotkeyEntryWidth = hotkeyEntryWidget.Bounds.Width;
|
validHotkeyEntryWidth = hotkeyEntryWidget.Bounds.Width;
|
||||||
|
|||||||
@@ -285,10 +285,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
public void ScrollToItem(string itemKey, bool smooth = false)
|
public void ScrollToItem(string itemKey, bool smooth = false)
|
||||||
{
|
{
|
||||||
var item = Children.FirstOrDefault(c =>
|
var item = Children.FirstOrDefault(c => c is ScrollItemWidget si && si.ItemKey == itemKey);
|
||||||
{
|
|
||||||
return c is ScrollItemWidget si && si.ItemKey == itemKey;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
ScrollToItem(item, smooth);
|
ScrollToItem(item, smooth);
|
||||||
@@ -296,10 +293,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
public void ScrollToSelectedItem()
|
public void ScrollToSelectedItem()
|
||||||
{
|
{
|
||||||
var item = Children.FirstOrDefault(c =>
|
var item = Children.FirstOrDefault(c => c is ScrollItemWidget si && si.IsSelected());
|
||||||
{
|
|
||||||
return c is ScrollItemWidget si && si.IsSelected();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
ScrollToItem(item);
|
ScrollToItem(item);
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ namespace OpenRA.Platforms.Default
|
|||||||
var t = (ValueTuple<int, int, int, int>)tuple;
|
var t = (ValueTuple<int, int, int, int>)tuple;
|
||||||
context.EnableScissor(t.Item1, t.Item2, t.Item3, t.Item4);
|
context.EnableScissor(t.Item1, t.Item2, t.Item3, t.Item4);
|
||||||
};
|
};
|
||||||
doSetBlendMode = mode => { context.SetBlendMode((BlendMode)mode); };
|
doSetBlendMode = mode => context.SetBlendMode((BlendMode)mode);
|
||||||
doSetVSync = enabled => { context.SetVSyncEnabled((bool)enabled); };
|
doSetVSync = enabled => context.SetVSyncEnabled((bool)enabled);
|
||||||
|
|
||||||
Monitor.Pulse(syncObject);
|
Monitor.Pulse(syncObject);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user