예제 #1
0
        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();
        }
예제 #2
0
        public void Dispose()
        {
            Rollback();
            foreach (var atlas in spriteAtlases)
            {
                Object.Destroy(atlas.Value.material.mainTexture);
                Object.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;
            }
        }