Beispiel #1
0
        public bool LoadPlayData(string filePath, WorldManager world)
        {
            string[] worldFiles = System.IO.Directory.GetFiles(filePath, "*." + PlayData.Extension);

            if (worldFiles.Length > 0)
            {
                if (DwarfGame.COMPRESSED_BINARY_SAVES)
                {
                    PlayData = FileUtils.LoadCompressedJsonFromAbsolutePath <PlayData>(worldFiles[0], world);
                }
                else
                {
                    PlayData = FileUtils.LoadJsonFromAbsolutePath <PlayData>(worldFiles[0], world);
                }
            }
            else
            {
                Console.Error.WriteLine("Can't load world from {0}, no data file found.", filePath);
                return(false);
            }
            return(true);
        }