Add developer shortcut to reload chrome files

Hitting Ctrl+Shift+C will re-initialize the chrome provider,
reloading all chrome files instantly. Useful when changing the
UI.

Note: A new "RootWidget" was created to trap top-level (global)
shortcuts instead of putting everything in Widget.
This commit is contained in:
Pavlos Touboulidis
2014-06-05 01:32:15 +03:00
parent b8cdb224d1
commit db53f8e648
6 changed files with 130 additions and 57 deletions

View File

@@ -27,6 +27,8 @@ namespace OpenRA.Graphics
static Dictionary<string, Sheet> cachedSheets;
static Dictionary<string, Dictionary<string, Sprite>> cachedSprites;
static string[] storedChromeFiles;
public static void Initialize(params string[] chromeFiles)
{
collections = new Dictionary<string, Collection>();
@@ -34,7 +36,13 @@ namespace OpenRA.Graphics
cachedSprites = new Dictionary<string, Dictionary<string, Sprite>>();
if (chromeFiles.Length == 0)
return;
{
chromeFiles = storedChromeFiles;
if (chromeFiles == null || chromeFiles.Length == 0)
return;
}
else
storedChromeFiles = chromeFiles;
var chrome = chromeFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal);