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