コード例 #1
0
ファイル: ModData.cs プロジェクト: wenzeslaus/OpenRA
        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);
        }
コード例 #2
0
        public void CacheRules()
        {
            if (RuleStatus != MapRuleStatus.Unknown)
            {
                return;
            }

            Map.PreloadRules();
            RuleStatus = Map.InvalidCustomRules ? MapRuleStatus.Invalid : MapRuleStatus.Cached;
        }
コード例 #3
0
ファイル: MapPreview.cs プロジェクト: philipbutkiewicz/OpenRA
        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;
            }
        }
コード例 #4
0
ファイル: ModData.cs プロジェクト: RunCraze/OpenRA
        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;
        }