Fixed fields missing the readonly modifier

This commit is contained in:
penev92
2022-01-20 00:43:58 +02:00
committed by Paul Chote
parent f83e27d647
commit bf332b6619
96 changed files with 173 additions and 169 deletions

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Activities
readonly Aircraft aircraft;
readonly FallsToEarthInfo info;
int acceleration;
readonly int acceleration;
int spin;
public FallToEarth(Actor self, FallsToEarthInfo info)

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Activities
readonly INotifyIdle[] tickIdles;
readonly bool idleTurn;
int remainingTicks;
bool isIdleTurner;
readonly bool isIdleTurner;
public FlyIdle(Actor self, int ticks = -1, bool idleTurn = true)
{

View File

@@ -21,10 +21,11 @@ namespace OpenRA.Mods.Common.Activities
{
readonly IPositionable positionable;
readonly IDisabledTrait disableable;
WPos start, end;
int length;
readonly WPos start;
readonly WPos end;
readonly int length;
int ticks = 0;
WAngle? desiredFacing;
readonly WAngle? desiredFacing;
public Drag(Actor self, WPos start, WPos end, int length, WAngle? facing = null)
{

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Activities
int waitTicksRemaining;
// To work around queued activity issues while minimizing changes to legacy behaviour
bool evaluateNearestMovableCell;
readonly bool evaluateNearestMovableCell;
// Scriptable move order
// Ignores lane bias and nearby units

View File

@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Activities
return TickChild(self);
}
List<CPos> searchCells = new List<CPos>();
readonly List<CPos> searchCells = new List<CPos>();
int searchCellsTick = -1;
List<CPos> CalculatePathToTarget(Actor self, BlockedByActor check)

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Activities
readonly IHealth health;
readonly SellableInfo sellableInfo;
readonly PlayerResources playerResources;
bool showTicks;
readonly bool showTicks;
public Sell(Actor self, bool showTicks)
{

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Activities
{
public class SimpleTeleport : Activity
{
CPos destination;
readonly CPos destination;
public SimpleTeleport(CPos destination) { this.destination = destination; }

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Activities
public class WaitFor : Activity
{
Func<bool> f;
readonly Func<bool> f;
public WaitFor(Func<bool> f) { this.f = f; }
public WaitFor(Func<bool> f, bool interruptible)

View File

@@ -18,8 +18,8 @@ namespace OpenRA.Mods.Common.Effects
{
public class ContrailFader : IEffect
{
WPos pos;
ContrailRenderable trail;
readonly WPos pos;
readonly ContrailRenderable trail;
int ticks;
public ContrailFader(WPos pos, ContrailRenderable trail)

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Effects
readonly SpriteFont font;
readonly string text;
Color color;
readonly Color color;
int remaining;
WPos pos;

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Effects
readonly Animation flag;
readonly Animation circles;
List<WPos> targetLineNodes = new List<WPos> { };
readonly List<WPos> targetLineNodes = new List<WPos> { };
List<CPos> cachedLocations;
public RallyPointIndicator(Actor building, RallyPoint rp)

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.FileFormats
public static readonly int MAXBITS = 13; // maximum code length
public static readonly int MAXWIN = 4096; // maximum window size
static byte[] litlen =
static readonly byte[] litlen =
{
11, 124, 8, 7, 28, 7, 188, 13, 76, 4,
10, 8, 12, 10, 12, 10, 8, 23, 8, 9,
@@ -40,28 +40,28 @@ namespace OpenRA.Mods.Common.FileFormats
};
// bit lengths of length codes 0..15
static byte[] lenlen = { 2, 35, 36, 53, 38, 23 };
static readonly byte[] lenlen = { 2, 35, 36, 53, 38, 23 };
// bit lengths of distance codes 0..63
static byte[] distlen = { 2, 20, 53, 230, 247, 151, 248 };
static readonly byte[] distlen = { 2, 20, 53, 230, 247, 151, 248 };
// base for length codes
static short[] lengthbase =
static readonly short[] lengthbase =
{
3, 2, 4, 5, 6, 7, 8, 9, 10, 12,
16, 24, 40, 72, 136, 264
};
// extra bits for length codes
static byte[] extra =
static readonly byte[] extra =
{
0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
3, 4, 5, 6, 7, 8
};
static Huffman litcode = new Huffman(litlen, litlen.Length, 256);
static Huffman lencode = new Huffman(lenlen, lenlen.Length, 16);
static Huffman distcode = new Huffman(distlen, distlen.Length, 64);
static readonly Huffman litcode = new Huffman(litlen, litlen.Length, 256);
static readonly Huffman lencode = new Huffman(lenlen, lenlen.Length, 16);
static readonly Huffman distcode = new Huffman(distlen, distlen.Length, 64);
/// <summary>PKWare Compression Library stream.</summary>
/// <param name="input">Compressed input stream.</param>

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.FileFormats
{
public class IniFile
{
Dictionary<string, IniSection> sections = new Dictionary<string, IniSection>();
readonly Dictionary<string, IniSection> sections = new Dictionary<string, IniSection>();
public IniFile(Stream s)
{
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.FileFormats
}
}
Regex sectionPattern = new Regex(@"^\[([^]]*)\]");
readonly Regex sectionPattern = new Regex(@"^\[([^]]*)\]");
IniSection ProcessSection(string line)
{
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.FileFormats
public class IniSection : IEnumerable<KeyValuePair<string, string>>
{
public string Name { get; private set; }
Dictionary<string, string> values = new Dictionary<string, string>();
readonly Dictionary<string, string> values = new Dictionary<string, string>();
public IniSection(string name)
{

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
readonly WDist width;
int next;
int length;
int skip;
readonly int skip;
public ContrailRenderable(World world, Color color, WDist width, int length, int skip, int zOffset)
: this(world, new WPos[length], width, 0, 0, skip, color, zOffset) { }

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Orders
{
public abstract class GlobalButtonOrderGenerator<T> : OrderGenerator
{
string order;
readonly string order;
public GlobalButtonOrderGenerator(string order)
{

View File

@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Projectiles
readonly float3 shadowColor;
readonly float shadowAlpha;
ContrailRenderable contrail;
readonly ContrailRenderable contrail;
[Sync]
WPos pos, lastPos, target, source;

View File

@@ -189,16 +189,16 @@ namespace OpenRA.Mods.Common.Projectiles
int ticks;
int ticksToNextSmoke;
ContrailRenderable contrail;
string trailPalette;
readonly ContrailRenderable contrail;
readonly string trailPalette;
States state;
bool targetPassedBy;
bool lockOn;
readonly bool lockOn;
bool allowPassBy; // TODO: use this also with high minimum launch angle settings
WPos targetPosition;
WVec offset;
readonly WVec offset;
WVec tarVel;
WVec predVel;
@@ -210,7 +210,7 @@ namespace OpenRA.Mods.Common.Projectiles
int speed;
int loopRadius;
WDist distanceCovered;
WDist rangeLimit;
readonly WDist rangeLimit;
WAngle renderFacing;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptPropertyGroup("Combat")]
public class GuardProperties : ScriptActorProperties, Requires<GuardInfo>, Requires<IMoveInfo>
{
Guard guard;
readonly Guard guard;
public GuardProperties(ScriptContext context, Actor self)
: base(context, self)
{

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptPropertyGroup("General")]
public class HealthProperties : ScriptActorProperties, Requires<IHealthInfo>
{
IHealth health;
readonly IHealth health;
public HealthProperties(ScriptContext context, Actor self)
: base(context, self)
{

View File

@@ -78,12 +78,12 @@ namespace OpenRA.Mods.Common.Traits
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender
{
public new readonly AttackGarrisonedInfo Info;
Lazy<BodyOrientation> coords;
List<Armament> armaments;
List<AnimationWithOffset> muzzles;
Dictionary<Actor, IFacing> paxFacing;
Dictionary<Actor, IPositionable> paxPos;
Dictionary<Actor, RenderSprites> paxRender;
readonly Lazy<BodyOrientation> coords;
readonly List<Armament> armaments;
readonly List<AnimationWithOffset> muzzles;
readonly Dictionary<Actor, IFacing> paxFacing;
readonly Dictionary<Actor, IPositionable> paxPos;
readonly Dictionary<Actor, RenderSprites> paxRender;
public AttackGarrisoned(Actor self, AttackGarrisonedInfo info)
: base(self, info)

View File

@@ -154,7 +154,7 @@ namespace OpenRA.Mods.Common.Traits
CPos initialBaseCenter;
CPos defenseCenter;
List<BaseBuilderQueueManager> builders = new List<BaseBuilderQueueManager>();
readonly List<BaseBuilderQueueManager> builders = new List<BaseBuilderQueueManager>();
public BaseBuilderBotModule(Actor self, BaseBuilderBotModuleInfo info)
: base(info)

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
int minCaptureDelayTicks;
// Units that the bot already knows about and has given a capture order. Any unit not on this list needs to be given a new order.
List<Actor> activeCapturers = new List<Actor>();
readonly List<Actor> activeCapturers = new List<Actor>();
public CaptureManagerBotModule(Actor self, CaptureManagerBotModuleInfo info)
: base(info)

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
class CapturableProgressBar : ConditionalTrait<CapturableProgressBarInfo>, ISelectionBar, ICaptureProgressWatcher
{
Dictionary<Actor, (int Current, int Total)> progress = new Dictionary<Actor, (int, int)>();
readonly Dictionary<Actor, (int Current, int Total)> progress = new Dictionary<Actor, (int, int)>();
public CapturableProgressBar(Actor self, CapturableProgressBarInfo info)
: base(info) { }

View File

@@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.Traits
class CapturableProgressBlink : ConditionalTrait<CapturableProgressBlinkInfo>, ITick, ICaptureProgressWatcher
{
List<Player> captorOwners = new List<Player>();
HashSet<Actor> captors = new HashSet<Actor>();
readonly List<Player> captorOwners = new List<Player>();
readonly HashSet<Actor> captors = new HashSet<Actor>();
int tick = 0;
public CapturableProgressBlink(CapturableProgressBlinkInfo info)

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
int beingCapturedToken = Actor.InvalidConditionToken;
bool enteringCurrentTarget;
HashSet<Actor> currentCaptors = new HashSet<Actor>();
readonly HashSet<Actor> currentCaptors = new HashSet<Actor>();
public bool BeingCaptured { get; private set; }

View File

@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits
int reservedWeight = 0;
Aircraft aircraft;
int loadingToken = Actor.InvalidConditionToken;
Stack<int> loadedTokens = new Stack<int>();
readonly Stack<int> loadedTokens = new Stack<int>();
bool takeOffAfterLoad;
bool initialised;

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
class SupportPowerCrateAction : CrateAction
{
SupportPowerCrateActionInfo info;
readonly SupportPowerCrateActionInfo info;
public SupportPowerCrateAction(Actor self, SupportPowerCrateActionInfo info)
: base(self, info)
{

View File

@@ -46,8 +46,8 @@ namespace OpenRA.Mods.Common.Traits
}
}
List<DemolishAction> actions = new List<DemolishAction>();
List<DemolishAction> removeActions = new List<DemolishAction>();
readonly List<DemolishAction> actions = new List<DemolishAction>();
readonly List<DemolishAction> removeActions = new List<DemolishAction>();
public Demolishable(DemolishableInfo info)
: base(info) { }

View File

@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
class EngineerRepairOrderTargeter : UnitOrderTargeter
{
EngineerRepairInfo info;
readonly EngineerRepairInfo info;
public EngineerRepairOrderTargeter(EngineerRepairInfo info)
: base("EngineerRepair", 6, info.Cursor, true, true)

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
public class ExperienceTrickler : PausableConditionalTrait<ExperienceTricklerInfo>, ITick, ISync
{
readonly ExperienceTricklerInfo info;
GainsExperience gainsExperience;
readonly GainsExperience gainsExperience;
[Sync]
int ticks;

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
class GivesBounty : ConditionalTrait<GivesBountyInfo>, INotifyKilled, INotifyPassengerEntered, INotifyPassengerExited
{
Dictionary<Actor, GivesBounty[]> passengerBounties = new Dictionary<Actor, GivesBounty[]>();
readonly Dictionary<Actor, GivesBounty[]> passengerBounties = new Dictionary<Actor, GivesBounty[]>();
public GivesBounty(GivesBountyInfo info)
: base(info) { }

View File

@@ -649,7 +649,7 @@ namespace OpenRA.Mods.Common.Traits
CPos cell;
SubCell subCell;
WPos pos;
int delay;
readonly int delay;
public ReturnToCellActivity(Actor self, int delay = 0, bool recalculateSubCell = false)
{

View File

@@ -22,9 +22,9 @@ namespace OpenRA.Mods.Common.Traits
public class CloakPaletteEffect : IPaletteModifier, ITick
{
float t = 0;
string paletteName = "cloak";
readonly string paletteName = "cloak";
Color[] colors =
readonly Color[] colors =
{
Color.FromArgb(55, 205, 205, 220),
Color.FromArgb(120, 205, 205, 230),

View File

@@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Traits
readonly string[] prerequisites;
readonly ITechTreeElement watcher;
bool hasPrerequisites;
int limit;
readonly int limit;
bool hidden;
bool initialized = false;

View File

@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Traits
readonly string initialPlug;
int conditionToken = Actor.InvalidConditionToken;
Dictionary<string, bool> plugTypesAvailability = null;
readonly Dictionary<string, bool> plugTypesAvailability = null;
string active;

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits.Render
readonly Sprite sprite;
readonly VeteranProductionIconOverlayInfo info;
Dictionary<ActorInfo, bool> overlayActive = new Dictionary<ActorInfo, bool>();
readonly Dictionary<ActorInfo, bool> overlayActive = new Dictionary<ActorInfo, bool>();
public VeteranProductionIconOverlay(ActorInitializer init, VeteranProductionIconOverlayInfo info)
{

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
class AmbientSound : ConditionalTrait<AmbientSoundInfo>, ITick, INotifyRemovedFromWorld
{
readonly bool loop;
HashSet<ISound> currentSounds = new HashSet<ISound>();
readonly HashSet<ISound> currentSounds = new HashSet<ISound>();
WPos cachedPosition;
int delay;

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
bool activated;
bool dragStarted;
Arrow currentArrow;
MouseAttachmentWidget mouseAttachment;
readonly MouseAttachmentWidget mouseAttachment;
public SelectDirectionalTarget(World world, string order, SupportPowerManager manager, string cursor,
string directionArrowAnimation, string directionArrowPalette)

View File

@@ -48,16 +48,16 @@ namespace OpenRA.Mods.Common.Traits
class ThrowsParticle : ITick
{
WVec pos;
WVec initialPos;
WVec finalPos;
WAngle angle;
readonly WVec initialPos;
readonly WVec finalPos;
readonly WAngle angle;
int tick = 0;
int length;
readonly int length;
WAngle facing;
WAngle rotation;
int direction;
readonly int direction;
public ThrowsParticle(ActorInitializer init, ThrowsParticleInfo info)
{

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
class StartGameNotification : IWorldLoaded, INotifyGameLoaded, INotifyGameSaved
{
StartGameNotificationInfo info;
readonly StartGameNotificationInfo info;
public StartGameNotification(StartGameNotificationInfo info)
{
this.info = info;

View File

@@ -331,7 +331,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
// TODO: fix this -- will have bitrotted pretty badly.
static Dictionary<string, Color> namedColorMapping = new Dictionary<string, Color>()
static readonly Dictionary<string, Color> namedColorMapping = new Dictionary<string, Color>()
{
{ "gold", Color.FromArgb(246, 214, 121) },
{ "blue", Color.FromArgb(226, 230, 246) },

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Widgets
{
public class GridLayout : ILayout
{
ScrollPanelWidget widget;
readonly ScrollPanelWidget widget;
int2 pos;
public GridLayout(ScrollPanelWidget w) { widget = w; }

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Widgets
public string TooltipText;
Lazy<TooltipContainerWidget> tooltipContainer;
readonly Lazy<TooltipContainerWidget> tooltipContainer;
public Func<string> GetTooltipText;
public ImageWidget()

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Widgets
{
public class ListLayout : ILayout
{
ScrollPanelWidget widget;
readonly ScrollPanelWidget widget;
public ListLayout(ScrollPanelWidget w) { widget = w; }

View File

@@ -34,12 +34,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly World world;
readonly ModData modData;
Widget panel;
readonly Widget panel;
TextFieldWidget filenameInput;
SliderWidget frameSlider;
ScrollPanelWidget assetList;
ScrollItemWidget template;
readonly TextFieldWidget filenameInput;
readonly SliderWidget frameSlider;
readonly ScrollPanelWidget assetList;
readonly ScrollItemWidget template;
IReadOnlyPackage assetSource = null;
bool animateFrames = false;
@@ -385,7 +385,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
currentFrame = currentSprites.Length - 1;
}
Dictionary<string, bool> assetVisByName = new Dictionary<string, bool>();
readonly Dictionary<string, bool> assetVisByName = new Dictionary<string, bool>();
bool FilterAsset(string filename)
{

View File

@@ -17,8 +17,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ConnectionLogic : ChromeLogic
{
Action onConnect, onAbort;
Action<string> onRetry;
readonly Action onConnect;
readonly Action onAbort;
readonly Action<string> onRetry;
void ConnectionStateChanged(OrderManager om, string password, NetworkConnection connection)
{
@@ -81,7 +82,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class ConnectionFailedLogic : ChromeLogic
{
PasswordFieldWidget passwordField;
readonly PasswordFieldWidget passwordField;
bool passwordOffsetAdjusted;
[ObjectCreator.UseCtor]

View File

@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly ScrollPanelWidget scrollPanel;
readonly LabelWidget template;
bool showModTab;
bool showEngineTab;
readonly bool showModTab;
readonly bool showEngineTab;
bool isShowingModTab;
readonly IEnumerable<string> modLines;
readonly IEnumerable<string> engineLines;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
public class NewMapLogic : ChromeLogic
{
Widget panel;
readonly Widget panel;
[ObjectCreator.UseCtor]
public NewMapLogic(Action onExit, Action<string> onSelect, Widget widget, World world, ModData modData)

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly Action<bool> hideMenu;
readonly IObjectivesPanel iop;
IngameInfoPanel activePanel;
bool hasError;
readonly bool hasError;
[ObjectCreator.UseCtor]
public GameInfoLogic(Widget widget, ModData modData, World world, IngameInfoPanel initialPanel, Action<bool> hideMenu)

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
[ChromeLogicArgsHotkeys("CycleStatusBarsKey")]
public class CycleStatusBarsHotkeyLogic : SingleHotkeyBaseLogic
{
StatusBarsType[] options = { StatusBarsType.Standard, StatusBarsType.DamageShow, StatusBarsType.AlwaysShow };
readonly StatusBarsType[] options = { StatusBarsType.Standard, StatusBarsType.DamageShow, StatusBarsType.AlwaysShow };
[ObjectCreator.UseCtor]
public CycleStatusBarsHotkeyLogic(Widget widget, ModData modData, Dictionary<string, MiniYaml> logicArgs)

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly WorldRenderer worldRenderer;
readonly MenuPaletteEffect mpe;
readonly bool isSinglePlayer;
bool hasError;
readonly bool hasError;
bool leaving;
bool hideMenu;

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly World world;
CameraOption selected;
LabelWidget shroudLabel;
readonly LabelWidget shroudLabel;
class CameraOption
{

View File

@@ -25,9 +25,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
class SlotDropDownOption
{
public string Title;
public string Order;
public Func<bool> Selected;
public readonly string Title;
public readonly string Order;
public readonly Func<bool> Selected;
public SlotDropDownOption(string title, string order, Func<bool> selected)
{

View File

@@ -24,13 +24,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
MapClassification currentTab;
Dictionary<MapClassification, ScrollPanelWidget> scrollpanels = new Dictionary<MapClassification, ScrollPanelWidget>();
readonly Dictionary<MapClassification, ScrollPanelWidget> scrollpanels = new Dictionary<MapClassification, ScrollPanelWidget>();
Dictionary<MapClassification, MapPreview[]> tabMaps = new Dictionary<MapClassification, MapPreview[]>();
readonly Dictionary<MapClassification, MapPreview[]> tabMaps = new Dictionary<MapClassification, MapPreview[]>();
string[] visibleMaps;
string selectedUid;
Action<string> onSelect;
readonly Action<string> onSelect;
string category;
string mapFilter;

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Widgets
{
public class LogicKeyListenerWidget : Widget
{
List<Func<KeyInput, bool>> handlers = new List<Func<KeyInput, bool>>();
readonly List<Func<KeyInput, bool>> handlers = new List<Func<KeyInput, bool>>();
public override bool HandleKeyPress(KeyInput e)
{

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Widgets
public int IconHeight = 24;
public int IconSpacing = 1;
float2 iconSize;
readonly float2 iconSize;
public int MinWidth = 240;
public ArmyUnit TooltipUnit { get; private set; }

View File

@@ -39,12 +39,12 @@ namespace OpenRA.Mods.Common.Widgets
public ProductionIcon TooltipIcon { get; private set; }
public Func<ProductionIcon> GetTooltipIcon;
Dictionary<ProductionQueue, Animation> clocks;
readonly Dictionary<ProductionQueue, Animation> clocks;
readonly Lazy<TooltipContainerWidget> tooltipContainer;
readonly List<ProductionIcon> productionIcons = new List<ProductionIcon>();
readonly List<Rectangle> productionIconsBounds = new List<Rectangle>();
float2 iconSize;
readonly float2 iconSize;
int lastIconIdx;
public int MinWidth = 240;
int currentTooltipToken;

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Widgets
public int IconRowOffset = 0;
public int MaxIconRowOffset = int.MaxValue;
Lazy<TooltipContainerWidget> tooltipContainer;
readonly Lazy<TooltipContainerWidget> tooltipContainer;
ProductionQueue currentQueue;
HotkeyReference[] hotkeys;
@@ -111,7 +111,8 @@ namespace OpenRA.Mods.Common.Widgets
public override Rectangle EventBounds => eventBounds;
Dictionary<Rectangle, ProductionIcon> icons = new Dictionary<Rectangle, ProductionIcon>();
Animation cantBuild, clock;
readonly Animation cantBuild;
readonly Animation clock;
Rectangle eventBounds = Rectangle.Empty;
readonly WorldRenderer worldRenderer;

View File

@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Widgets
SpriteFont font;
Rectangle leftButtonRect;
Rectangle rightButtonRect;
Lazy<ProductionPaletteWidget> paletteWidget;
readonly Lazy<ProductionPaletteWidget> paletteWidget;
string queueGroup;
[ObjectCreator.UseCtor]

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Widgets
{
public readonly string TooltipTemplate;
public readonly string TooltipContainer;
Lazy<TooltipContainerWidget> tooltipContainer;
readonly Lazy<TooltipContainerWidget> tooltipContainer;
public string TooltipFormat = "";
public ResourceBarOrientation Orientation = ResourceBarOrientation.Vertical;
@@ -31,8 +31,8 @@ namespace OpenRA.Mods.Common.Widgets
public Func<float> GetProvided = () => 0;
public Func<float> GetUsed = () => 0;
public Func<Color> GetBarColor = () => Color.White;
EWMA providedLerp = new EWMA(0.3f);
EWMA usedLerp = new EWMA(0.3f);
readonly EWMA providedLerp = new EWMA(0.3f);
readonly EWMA usedLerp = new EWMA(0.3f);
readonly World world;
Sprite indicator;

View File

@@ -53,12 +53,12 @@ namespace OpenRA.Mods.Common.Widgets
readonly SupportPowerManager spm;
Animation icon;
Animation clock;
readonly Animation clock;
Dictionary<Rectangle, SupportPowerIcon> icons = new Dictionary<Rectangle, SupportPowerIcon>();
public SupportPowerIcon TooltipIcon { get; private set; }
public Func<SupportPowerIcon> GetTooltipIcon;
Lazy<TooltipContainerWidget> tooltipContainer;
readonly Lazy<TooltipContainerWidget> tooltipContainer;
HotkeyReference[] hotkeys;
Rectangle eventBounds;