Пример #1
0
        public static void DeleteWorld(int worldIdentifier)
        {
            File.Delete(PATH + worldIdentifier.ToString() + ".bin");
            WorldPersistenceMetaData toDelete = default;

            foreach (WorldPersistenceMetaData metaData in MetaData)
            {
                if (metaData.WorldIdentifier == worldIdentifier)
                {
                    toDelete = metaData;
                }
            }
            MetaData.Remove(toDelete);
            SaveMetaData();
        }
Пример #2
0
        public static int CreateWorld(string name, int seed)
        {
            WorldPersistenceMetaData newMetaData = new WorldPersistenceMetaData
            {
                WorldIdentifier = NextAvailableIdentifier(),
                Version         = "alpha 0.7",
                Name            = name,
                Seed            = seed,
            };

            MetaData.Add(newMetaData);
            SaveMetaData();

            WorldManager newWorld = new WorldManager(newMetaData.WorldIdentifier, newMetaData.Seed);

            SaveWorld(newWorld);
            return(newWorld.WorldIdentifier);
        }