Remove unused fields and parameters.
This commit is contained in:
committed by
abcdefg30
parent
3b5bfb4bf4
commit
a3ccc81892
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
void CheckActorReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, ActorInfo> dict, ActorReferenceAttribute attribute)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo, emitError, attribute.DictionaryReference);
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo, attribute.DictionaryReference);
|
||||
foreach (var value in values)
|
||||
{
|
||||
if (value == null)
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
void CheckWeaponReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, WeaponInfo> dict)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo, emitError);
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo);
|
||||
foreach (var value in values)
|
||||
{
|
||||
if (value == null)
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
void CheckVoiceReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, SoundInfo> dict)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo, emitError);
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo);
|
||||
foreach (var value in values)
|
||||
{
|
||||
if (value == null)
|
||||
|
||||
@@ -40,19 +40,19 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
var fieldConsumed = trait.GetType().GetFields()
|
||||
.Where(x => x.HasAttribute<ConsumedConditionReferenceAttribute>())
|
||||
.SelectMany(f => LintExts.GetFieldValues(trait, f, emitError));
|
||||
.SelectMany(f => LintExts.GetFieldValues(trait, f));
|
||||
|
||||
var propertyConsumed = trait.GetType().GetProperties()
|
||||
.Where(x => x.HasAttribute<ConsumedConditionReferenceAttribute>())
|
||||
.SelectMany(p => LintExts.GetPropertyValues(trait, p, emitError));
|
||||
.SelectMany(p => LintExts.GetPropertyValues(trait, p));
|
||||
|
||||
var fieldGranted = trait.GetType().GetFields()
|
||||
.Where(x => x.HasAttribute<GrantedConditionReferenceAttribute>())
|
||||
.SelectMany(f => LintExts.GetFieldValues(trait, f, emitError));
|
||||
.SelectMany(f => LintExts.GetFieldValues(trait, f));
|
||||
|
||||
var propertyGranted = trait.GetType().GetProperties()
|
||||
.Where(x => x.HasAttribute<GrantedConditionReferenceAttribute>())
|
||||
.SelectMany(f => LintExts.GetPropertyValues(trait, f, emitError));
|
||||
.SelectMany(f => LintExts.GetPropertyValues(trait, f));
|
||||
|
||||
foreach (var c in fieldConsumed.Concat(propertyConsumed))
|
||||
if (!string.IsNullOrEmpty(c))
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (cursorReference == null)
|
||||
continue;
|
||||
|
||||
var cursor = LintExts.GetFieldValues(traitInfo, field, emitError, cursorReference.DictionaryReference).FirstOrDefault();
|
||||
var cursor = LintExts.GetFieldValues(traitInfo, field, cursorReference.DictionaryReference).FirstOrDefault();
|
||||
if (string.IsNullOrEmpty(cursor))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<LocomotorReferenceAttribute>());
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var locomotors = LintExts.GetFieldValues(traitInfo, field, emitError);
|
||||
var locomotors = LintExts.GetFieldValues(traitInfo, field);
|
||||
foreach (var locomotor in locomotors)
|
||||
{
|
||||
if (string.IsNullOrEmpty(locomotor))
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
else
|
||||
type = notificationReference.NotificationType;
|
||||
|
||||
var notifications = LintExts.GetFieldValues(traitInfo, field, emitError);
|
||||
var notifications = LintExts.GetFieldValues(traitInfo, field);
|
||||
foreach (var notification in notifications)
|
||||
{
|
||||
if (string.IsNullOrEmpty(notification))
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
isPlayerPalette = paletteReference.IsPlayerPalette;
|
||||
}
|
||||
|
||||
var references = LintExts.GetFieldValues(traitInfo, field, emitError);
|
||||
var references = LintExts.GetFieldValues(traitInfo, field);
|
||||
foreach (var reference in references)
|
||||
{
|
||||
if (string.IsNullOrEmpty(reference))
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
isPlayerPalette = paletteReference.IsPlayerPalette;
|
||||
}
|
||||
|
||||
var references = LintExts.GetFieldValues(projectileInfo, field, emitError);
|
||||
var references = LintExts.GetFieldValues(projectileInfo, field);
|
||||
foreach (var reference in references)
|
||||
{
|
||||
if (string.IsNullOrEmpty(reference))
|
||||
@@ -131,7 +131,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var field in fields.Where(x => x.HasAttribute<PaletteDefinitionAttribute>()))
|
||||
{
|
||||
var paletteDefinition = field.GetCustomAttributes<PaletteDefinitionAttribute>(true).First();
|
||||
var values = LintExts.GetFieldValues(traitInfo, field, emitError);
|
||||
var values = LintExts.GetFieldValues(traitInfo, field);
|
||||
foreach (var value in values)
|
||||
{
|
||||
if (paletteDefinition.IsPlayerPalette)
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
sequenceImages = new[] { imageOverride.ToLowerInvariant() };
|
||||
}
|
||||
|
||||
foreach (var sequence in LintExts.GetFieldValues(traitInfo, field, emitError, sequenceReference.DictionaryReference))
|
||||
foreach (var sequence in LintExts.GetFieldValues(traitInfo, field, sequenceReference.DictionaryReference))
|
||||
{
|
||||
if (string.IsNullOrEmpty(sequence))
|
||||
continue;
|
||||
@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
|
||||
image = image.ToLowerInvariant();
|
||||
foreach (var sequence in LintExts.GetFieldValues(projectileInfo, field, emitError, sequenceReference.DictionaryReference))
|
||||
foreach (var sequence in LintExts.GetFieldValues(projectileInfo, field, sequenceReference.DictionaryReference))
|
||||
{
|
||||
if (string.IsNullOrEmpty(sequence))
|
||||
continue;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<VoiceSetReferenceAttribute>());
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var voiceSets = LintExts.GetFieldValues(traitInfo, field, emitError);
|
||||
var voiceSets = LintExts.GetFieldValues(traitInfo, field);
|
||||
foreach (var voiceSet in voiceSets)
|
||||
{
|
||||
if (string.IsNullOrEmpty(voiceSet))
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<VoiceReferenceAttribute>());
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var voices = LintExts.GetFieldValues(traitInfo, field, emitError);
|
||||
var voices = LintExts.GetFieldValues(traitInfo, field);
|
||||
foreach (var voice in voices)
|
||||
{
|
||||
if (string.IsNullOrEmpty(voice))
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
public class LintExts
|
||||
{
|
||||
public static IEnumerable<string> GetFieldValues(object ruleInfo, FieldInfo fieldInfo, Action<string> emitError,
|
||||
public static IEnumerable<string> GetFieldValues(object ruleInfo, FieldInfo fieldInfo,
|
||||
LintDictionaryReference dictionaryReference = LintDictionaryReference.None)
|
||||
{
|
||||
var type = fieldInfo.FieldType;
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
throw new InvalidOperationException($"Bad type for reference on {ruleInfo.GetType().Name}.{fieldInfo.Name}. Supported types: {supportedTypes.JoinWith(", ")}");
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetPropertyValues(object ruleInfo, PropertyInfo propertyInfo, Action<string> emitError,
|
||||
public static IEnumerable<string> GetPropertyValues(object ruleInfo, PropertyInfo propertyInfo,
|
||||
LintDictionaryReference dictionaryReference = LintDictionaryReference.None)
|
||||
{
|
||||
var type = propertyInfo.PropertyType;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Widgets;
|
||||
@@ -22,13 +21,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
readonly World world;
|
||||
readonly Widget worldRoot;
|
||||
readonly Widget menuRoot;
|
||||
readonly string clickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||
|
||||
bool disableSystemButtons;
|
||||
Widget currentWidget;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public MenuButtonsChromeLogic(Widget widget, ModData modData, World world, Dictionary<string, MiniYaml> logicArgs)
|
||||
public MenuButtonsChromeLogic(Widget widget, World world)
|
||||
{
|
||||
this.world = world;
|
||||
|
||||
@@ -82,9 +80,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "initialPanel", IngameInfoPanel.Debug }
|
||||
});
|
||||
}
|
||||
|
||||
if (logicArgs.TryGetValue("ClickSound", out var yaml))
|
||||
clickSound = yaml.Value;
|
||||
}
|
||||
|
||||
void OpenMenuPanel(MenuButtonWidget button, WidgetArgs widgetArgs = null)
|
||||
|
||||
Reference in New Issue
Block a user