Fix RCS1061

This commit is contained in:
RoosterDragon
2023-03-18 12:16:52 +00:00
committed by Gustas
parent 5d91b678bb
commit 4dd787be13
32 changed files with 167 additions and 210 deletions

View File

@@ -97,15 +97,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var palettePresetRows = 2;
var paletteCustomRows = 1;
if (logicArgs.TryGetValue("PaletteColumns", out var yaml))
if (!int.TryParse(yaml.Value, out paletteCols))
throw new YamlException($"Invalid value for PaletteColumns: {yaml.Value}");
if (logicArgs.TryGetValue("PalettePresetRows", out yaml))
if (!int.TryParse(yaml.Value, out palettePresetRows))
throw new YamlException($"Invalid value for PalettePresetRows: {yaml.Value}");
if (logicArgs.TryGetValue("PaletteCustomRows", out yaml))
if (!int.TryParse(yaml.Value, out paletteCustomRows))
throw new YamlException($"Invalid value for PaletteCustomRows: {yaml.Value}");
if (logicArgs.TryGetValue("PaletteColumns", out var yaml) && !int.TryParse(yaml.Value, out paletteCols))
throw new YamlException($"Invalid value for PaletteColumns: {yaml.Value}");
if (logicArgs.TryGetValue("PalettePresetRows", out yaml) && !int.TryParse(yaml.Value, out palettePresetRows))
throw new YamlException($"Invalid value for PalettePresetRows: {yaml.Value}");
if (logicArgs.TryGetValue("PaletteCustomRows", out yaml) && !int.TryParse(yaml.Value, out paletteCustomRows))
throw new YamlException($"Invalid value for PaletteCustomRows: {yaml.Value}");
var presetColors = colorManager.PresetColors;
for (var j = 0; j < palettePresetRows; j++)

View File

@@ -140,15 +140,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
// Check for duplicate actor ID
if (!CurrentActor.ID.Equals(actorId, StringComparison.OrdinalIgnoreCase))
if (!CurrentActor.ID.Equals(actorId, StringComparison.OrdinalIgnoreCase) && editorActorLayer[actorId] != null)
{
if (editorActorLayer[actorId] != null)
{
nextActorIDStatus = ActorIDStatus.Duplicate;
actorIDErrorLabel.Text = TranslationProvider.GetString(DuplicateActorId);
actorIDErrorLabel.Visible = true;
return;
}
nextActorIDStatus = ActorIDStatus.Duplicate;
actorIDErrorLabel.Text = TranslationProvider.GetString(DuplicateActorId);
actorIDErrorLabel.Visible = true;
return;
}
SetActorID(actorId);

View File

@@ -100,27 +100,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
badgesVisible = false;
if (localProfile.State == LocalPlayerProfile.LinkState.Linked)
if (localProfile.State == LocalPlayerProfile.LinkState.Linked && localProfile.ProfileData.Badges.Count > 0)
{
if (localProfile.ProfileData.Badges.Count > 0)
{
Func<int, int> negotiateWidth = _ => widget.Get("PROFILE_HEADER").Bounds.Width;
Func<int, int> negotiateWidth = _ => widget.Get("PROFILE_HEADER").Bounds.Width;
// Remove any stale badges that may be left over from a previous session
badgeContainer.RemoveChildren();
// Remove any stale badges that may be left over from a previous session
badgeContainer.RemoveChildren();
var badges = Ui.LoadWidget("PLAYER_PROFILE_BADGES_INSERT", badgeContainer, new WidgetArgs()
var badges = Ui.LoadWidget("PLAYER_PROFILE_BADGES_INSERT", badgeContainer, new WidgetArgs()
{
{ "worldRenderer", worldRenderer },
{ "profile", localProfile.ProfileData },
{ "negotiateWidth", negotiateWidth }
});
if (badges.Bounds.Height > 0)
{
badgeContainer.Bounds.Height = badges.Bounds.Height;
badgesVisible = true;
}
if (badges.Bounds.Height > 0)
{
badgeContainer.Bounds.Height = badges.Bounds.Height;
badgesVisible = true;
}
}

View File

@@ -25,9 +25,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var keyhandler = widget.Get<LogicKeyListenerWidget>(parentName);
keyhandler.AddHandler(e =>
{
if (e.Event == KeyInputEvent.Down)
if (namedKey.IsActivatedBy(e))
return OnHotkeyActivated(e);
if (e.Event == KeyInputEvent.Down && namedKey.IsActivatedBy(e))
return OnHotkeyActivated(e);
return false;
});

View File

@@ -107,16 +107,15 @@ namespace OpenRA.Mods.Common.Widgets
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)
{
if (useClassicMouseStyle && HasMouseFocus)
if (useClassicMouseStyle && HasMouseFocus &&
!IsValidDragbox && World.Selection.Actors.Count != 0 &&
!multiClick && uog.InputOverridesSelection(World, mousePos, mi))
{
if (!IsValidDragbox && World.Selection.Actors.Count != 0 && !multiClick && uog.InputOverridesSelection(World, mousePos, mi))
{
// Order units instead of selecting
ApplyOrders(World, mi);
isDragging = false;
YieldMouseFocus(mi);
return true;
}
// Order units instead of selecting
ApplyOrders(World, mi);
isDragging = false;
YieldMouseFocus(mi);
return true;
}
if (multiClick)