private void Reload(bool autoReloadOnChange) { isValid = true; Dispose(); modules[ModuleClass.MainMenu] = new List <SkinModule>(); modules[ModuleClass.InGame] = new List <SkinModule>(); modules[ModuleClass.MapEditor] = new List <SkinModule>(); modules[ModuleClass.AssetEditor] = new List <SkinModule>(); document = new XmlDocument(); document.LoadXml(File.ReadAllText(skinXmlPath)); if (fileWatcher != null) { fileWatcher.Dispose(); fileWatcher = null; } if (autoReloadOnChange) { fileWatcher = new FileWatcher(sapphirePath); fileWatcher.WatchFile("skin.xml"); } root = document.SelectSingleNode("/SapphireSkin"); if (root == null) { isValid = false; throw new ParseException("Skin missing root SapphireSkin node at " + sapphirePath, null); } name = XmlUtil.GetStringAttribute(root, "name"); author = XmlUtil.GetStringAttribute(root, "author"); LoadSkinSettings(); LoadSprites(); LoadColors(); LoadModules(); }
public void Dispose() { Rollback(); foreach (var atlas in spriteAtlases) { GameObject.Destroy(atlas.Value.material.mainTexture); GameObject.Destroy(atlas.Value); } colorDefinitions.Clear(); spriteAtlases.Clear(); renderArea = new Rect(0.0f, 0.0f, 1.0f, 1.0f); if (fileWatcher != null) { fileWatcher.Dispose(); fileWatcher = null; } }