Пример #1
0
        private static void MapPage_LoadMapConfig(On.DevInterface.MapPage.orig_LoadMapConfig orig, MapPage self)
        {
            string mapPath   = string.Empty;
            bool   loadedMap = false;

            // Iterate backwards, leaving the first activated region as filePath, but loading the info from the rest.
            for (int i = CustomWorldMod.activatedPacks.Count - 1; i >= 0; i--)
            {
                KeyValuePair <string, string> keyValues = CustomWorldMod.activatedPacks.ElementAt(i);
                mapPath = CRExtras.BuildPath(keyValues.Value, CRExtras.CustomFolder.RegionID, regionID: self.owner.game.world.name,
                                             file: "map_" + self.owner.game.world.name + ".txt");

                if (File.Exists(mapPath))
                {
                    loadedMap = true;
                    CustomWorldMod.Log($"[DEV] New map filepath for [{keyValues.Value}]");
                    self.filePath = mapPath;
                    orig(self);
                }
            }
            if (!loadedMap)
            {
                orig(self);
            }
        }
Пример #2
0
        private static void MapPage_LoadMapConfig(On.DevInterface.MapPage.orig_LoadMapConfig orig, MapPage self)
        {
            string customFilePath = string.Empty;

            // Iterate backwards, leaving the first activated region as filePath, but loading the info from the rest.
            for (int i = CustomWorldMod.activatedPacks.Count - 1; i >= 0; i--)
            {
                KeyValuePair <string, string> keyValues = CustomWorldMod.activatedPacks.ElementAt(i);
                customFilePath = Custom.RootFolderDirectory() + CustomWorldMod.resourcePath + keyValues.Value + Path.DirectorySeparatorChar +
                                 "World" + Path.DirectorySeparatorChar + "Regions" + Path.DirectorySeparatorChar + self.owner.game.world.name;

                if (Directory.Exists(customFilePath))
                {
                    string mapPath = customFilePath + Path.DirectorySeparatorChar + "map_" + self.owner.game.world.name + ".txt";
                    if (File.Exists(mapPath))
                    {
                        CustomWorldMod.Log($"[DEV] New map filepath for [{keyValues.Value}]");
                        self.filePath = mapPath;
                        orig(self);
                    }
                }
            }
        }