public Map PrepareMap(string uid) { if (LoadScreen != null) { LoadScreen.Display(); } if (MapCache[uid].Status != MapStatus.Available) { throw new InvalidDataException("Invalid map uid: {0}".F(uid)); } // Operate on a copy of the map to avoid gameplay state leaking into the cache var map = new Map(MapCache[uid].Map.Path); LoadTranslations(map); // Reinit all our assets InitializeLoaders(); GlobalFileSystem.LoadFromManifest(Manifest); // Mount map package so custom assets can be used. TODO: check priority. GlobalFileSystem.Mount(GlobalFileSystem.OpenPackage(map.Path, null, int.MaxValue)); using (new Support.PerfTimer("Map.PreloadRules")) map.PreloadRules(); using (new Support.PerfTimer("Map.SequenceProvider.Preload")) map.SequenceProvider.Preload(); VoxelProvider.Initialize(Manifest.VoxelSequences, map.VoxelSequenceDefinitions); VoxelLoader.Finish(); return(map); }
public void CacheRules() { if (RuleStatus != MapRuleStatus.Unknown) { return; } Map.PreloadRules(); RuleStatus = Map.InvalidCustomRules ? MapRuleStatus.Invalid : MapRuleStatus.Cached; }
public void CacheRules() { if (RuleStatus != MapRuleStatus.Unknown) { return; } try { Map.PreloadRules(); RuleStatus = MapRuleStatus.Cached; } catch (Exception e) { Log.Write("debug", "Map {0} failed validation with an exception:\n{1}", Uid, e.Message); RuleStatus = MapRuleStatus.Invalid; } }
public Map PrepareMap(string uid) { LoadScreen.Display(); if (MapCache[uid].Status != MapStatus.Available) throw new InvalidDataException("Invalid map uid: {0}".F(uid)); // Operate on a copy of the map to avoid gameplay state leaking into the cache var map = new Map(MapCache[uid].Map.Path); LoadTranslations(map); // Reinit all our assets InitializeLoaders(); GlobalFileSystem.LoadFromManifest(Manifest); // Mount map package so custom assets can be used. TODO: check priority. GlobalFileSystem.Mount(GlobalFileSystem.OpenPackage(map.Path, null, int.MaxValue)); using (new Support.PerfTimer("Map.PreloadRules")) map.PreloadRules(); using (new Support.PerfTimer("Map.SequenceProvider.Preload")) map.SequenceProvider.Preload(); VoxelProvider.Initialize(Manifest.VoxelSequences, map.VoxelSequenceDefinitions); return map; }