Remove static state from ChromeProvider.
This commit is contained in:
@@ -25,23 +25,12 @@ namespace OpenRA.Graphics
|
|||||||
static Dictionary<string, Sheet> cachedSheets;
|
static Dictionary<string, Sheet> cachedSheets;
|
||||||
static Dictionary<string, Dictionary<string, Sprite>> cachedSprites;
|
static Dictionary<string, Dictionary<string, Sprite>> cachedSprites;
|
||||||
|
|
||||||
static string[] storedChromeFiles;
|
public static void Initialize(IEnumerable<string> chromeFiles)
|
||||||
|
|
||||||
public static void Initialize(params string[] chromeFiles)
|
|
||||||
{
|
{
|
||||||
collections = new Dictionary<string, Collection>();
|
collections = new Dictionary<string, Collection>();
|
||||||
cachedSheets = new Dictionary<string, Sheet>();
|
cachedSheets = new Dictionary<string, Sheet>();
|
||||||
cachedSprites = new Dictionary<string, Dictionary<string, Sprite>>();
|
cachedSprites = new Dictionary<string, Dictionary<string, Sprite>>();
|
||||||
|
|
||||||
if (chromeFiles.Length == 0)
|
|
||||||
{
|
|
||||||
chromeFiles = storedChromeFiles;
|
|
||||||
if (chromeFiles == null || chromeFiles.Length == 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
storedChromeFiles = chromeFiles;
|
|
||||||
|
|
||||||
var chrome = chromeFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal);
|
var chrome = chromeFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal);
|
||||||
|
|
||||||
foreach (var c in chrome)
|
foreach (var c in chrome)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
if (hk == Game.Settings.Keys.DevReloadChromeKey)
|
if (hk == Game.Settings.Keys.DevReloadChromeKey)
|
||||||
{
|
{
|
||||||
ChromeProvider.Initialize();
|
ChromeProvider.Initialize(Game.modData.Manifest.Chrome);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user