Minor style & nit fixes
This commit is contained in:
@@ -31,11 +31,13 @@ namespace OpenRA
|
||||
readonly Dictionary<string, TileSet> tileSetCache = new Dictionary<string, TileSet>();
|
||||
readonly Dictionary<string, SequenceCache> sequenceCaches = new Dictionary<string, SequenceCache>();
|
||||
|
||||
public Action OnProgress = () => { if (Game.modData != null && Game.modData.LoadScreen != null) Game.modData.LoadScreen.Display(); };
|
||||
public Action OnProgress;
|
||||
|
||||
public RulesetCache(ModData modData)
|
||||
{
|
||||
this.modData = modData;
|
||||
|
||||
OnProgress = () => { if (modData.LoadScreen != null) modData.LoadScreen.Display(); };
|
||||
}
|
||||
|
||||
public Ruleset LoadDefaultRules()
|
||||
@@ -77,7 +79,7 @@ namespace OpenRA
|
||||
using (new PerfTimer("TileSets"))
|
||||
tileSets = LoadTileSets(tileSetCache, sequenceCaches, m.TileSets);
|
||||
|
||||
var sequences = sequenceCaches.ToDictionary((kvp) => kvp.Key, (kvp) => new SequenceProvider(kvp.Value, map));
|
||||
var sequences = sequenceCaches.ToDictionary(kvp => kvp.Key, kvp => new SequenceProvider(kvp.Value, map));
|
||||
|
||||
OnProgress();
|
||||
return new Ruleset(actors, weapons, voices, notifications, music, movies, tileSets, sequences);
|
||||
@@ -88,7 +90,7 @@ namespace OpenRA
|
||||
string[] files, List<MiniYamlNode> nodes,
|
||||
Func<MiniYamlNode, Dictionary<string, MiniYaml>, T> f)
|
||||
{
|
||||
string inputKey = string.Concat(string.Join("|", files), "|", nodes.WriteToString());
|
||||
var inputKey = string.Concat(string.Join("|", files), "|", nodes.WriteToString());
|
||||
|
||||
var mergedNodes = files
|
||||
.Select(s => MiniYaml.FromFile(s))
|
||||
@@ -120,9 +122,7 @@ namespace OpenRA
|
||||
{
|
||||
TileSet t;
|
||||
if (itemCache.TryGetValue(file, out t))
|
||||
{
|
||||
items.Add(t.Id, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = new TileSet(modData, file);
|
||||
|
||||
@@ -68,10 +68,12 @@ namespace OpenRA.Graphics
|
||||
|
||||
readonly Dictionary<string, Lazy<IReadOnlyDictionary<string, Sequence>>> sequenceCache = new Dictionary<string, Lazy<IReadOnlyDictionary<string, Sequence>>>();
|
||||
|
||||
public Action OnProgress = () => { if (Game.modData != null && Game.modData.LoadScreen != null) Game.modData.LoadScreen.Display(); };
|
||||
public Action OnProgress;
|
||||
|
||||
public SequenceCache(ModData modData, TileSet tileSet)
|
||||
{
|
||||
OnProgress = () => { if (modData.LoadScreen != null) modData.LoadScreen.Display(); };
|
||||
|
||||
this.modData = modData;
|
||||
|
||||
spriteLoader = Exts.Lazy(() => new SpriteLoader(tileSet.Extensions, new SheetBuilder(SheetType.Indexed)));
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public PipType PipColor = PipType.Yellow;
|
||||
|
||||
public object Create(ActorInitializer init) { return new ResourceType(this, init); }
|
||||
public object Create(ActorInitializer init) { return new ResourceType(this, init.world); }
|
||||
}
|
||||
|
||||
public class ResourceType : IWorldLoaded
|
||||
@@ -41,13 +41,13 @@ namespace OpenRA.Traits
|
||||
public PaletteReference Palette { get; private set; }
|
||||
public readonly Dictionary<string, Sprite[]> Variants;
|
||||
|
||||
public ResourceType(ResourceTypeInfo info, ActorInitializer init)
|
||||
public ResourceType(ResourceTypeInfo info, World world)
|
||||
{
|
||||
this.Info = info;
|
||||
Variants = new Dictionary<string, Sprite[]>();
|
||||
foreach (var v in info.Variants)
|
||||
{
|
||||
var seq = init.world.Map.SequenceProvider.GetSequence("resources", v);
|
||||
var seq = world.Map.SequenceProvider.GetSequence("resources", v);
|
||||
var sprites = Exts.MakeArray(seq.Length, x => seq.GetSprite(x));
|
||||
Variants.Add(v, sprites);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Mods.RA.Widgets.Logic;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Widgets;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.Widgets
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user