示例#1
0
        private static bool ProcessArchives()
        {
            try
            {
                entries.Clear();
                nameToEntry.Clear();
                pathToEntry.Clear();
                TextureManager.Clear();
                TextureDefinitionManager.Clear();
                SpriteManager.Clear();
                DecorateManager.Clear();

                foreach (IArchive archive in Archives)
                {
                    Log.Info("Loading ", archive.Uri);

                    // We want every entry to be tracked before processing any
                    // definition files.
                    foreach (IEntry entry in archive)
                    {
                        entries.Add(entry.Name, entry.Namespace, entry);
                        nameToEntry[entry.Name]            = entry;
                        pathToEntry[entry.Path.ToString()] = entry;
                    }

                    foreach (IEntry entry in archive)
                    {
                        switch (entry.Name.String)
                        {
                        case "DECORATE":
                            DecorateManager.HandleDefinitionsOrThrow(entry, archive);
                            continue;

                        case "PLAYPAL":
                            TextureManager.TrackPalette(entry);
                            continue;

                        case "PNAMES":
                        case "TEXTURE1":
                        case "TEXTURE2":
                            TextureDefinitionManager.TrackVanillaDefinition(entry);
                            continue;
                        }
                    }

                    TextureDefinitionManager.CompileAnyNewVanillaDefinitions();
                }

                DecorateManager.AttachSpriteRotationsToFrames();

                return(true);
            }
            catch (Exception e)
            {
                Log.Error($"Unexpected error when reading archive: {e.Message}");
                return(false);
            }
        }
示例#2
0
 protected override void OnUnload(EventArgs e)
 {
     _gameState?.Dispose();
     _gameState = null;
     FontManager.Clear();
     ShaderManager.Clear();
     TextureManager.Clear();
     base.OnUnload(e);
 }