Merge pull request #9384 from Mailaender/lint-player-palettes
Added a lint check for player palette references.
This commit is contained in:
@@ -45,9 +45,28 @@ namespace OpenRA.Traits
|
||||
public sealed class UpgradeUsedReferenceAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public sealed class PaletteDefinitionAttribute : Attribute { }
|
||||
public sealed class PaletteDefinitionAttribute : Attribute
|
||||
{
|
||||
public readonly bool IsPlayerPalette;
|
||||
public PaletteDefinitionAttribute(bool isPlayerPalette = false)
|
||||
{
|
||||
IsPlayerPalette = isPlayerPalette;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: differentiate player palettes
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public sealed class PaletteReferenceAttribute : Attribute { }
|
||||
public sealed class PaletteReferenceAttribute : Attribute
|
||||
{
|
||||
public readonly bool IsPlayerPalette;
|
||||
public PaletteReferenceAttribute(bool isPlayerPalette = false)
|
||||
{
|
||||
IsPlayerPalette = isPlayerPalette;
|
||||
}
|
||||
|
||||
public readonly string PlayerPaletteReferenceSwitch;
|
||||
public PaletteReferenceAttribute(string playerPaletteReferenceSwitch)
|
||||
{
|
||||
PlayerPaletteReferenceSwitch = playerPaletteReferenceSwitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Traits
|
||||
[PaletteReference] public readonly string BasePalette = null;
|
||||
|
||||
[Desc("The prefix for the resulting player palettes")]
|
||||
public readonly string BaseName = "player";
|
||||
[PaletteDefinition(true)] public readonly string BaseName = "player";
|
||||
|
||||
[Desc("Remap these indices to player colors.")]
|
||||
public readonly int[] RemapIndex = { };
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Traits
|
||||
public class PlayerHighlightPaletteInfo : ITraitInfo
|
||||
{
|
||||
[Desc("The prefix for the resulting player palettes")]
|
||||
public readonly string BaseName = "highlight";
|
||||
[PaletteDefinition(true)] public readonly string BaseName = "highlight";
|
||||
|
||||
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user