Beispiel #1
0
        public static WorldFormat BuildEmptyWorld(string worldId)
        {
            WorldZoneFormat zone = WorldContent.BuildEmptyZone();

            WorldFormat world = new WorldFormat {
                id          = worldId.ToUpper(),
                account     = "",
                mode        = (byte)HardcoreMode.SoftCore,
                title       = "Unnamed World",
                description = "",
                lives       = 30,
                version     = 0,
                music       = 0,
                zones       = new List <WorldZoneFormat>()
                {
                    zone
                },
                //start = new StartNodeFormat {
                //	character = 0,
                //	zoneId = 0,
                //	x = 0,
                //	y = 0,
                //},
            };

            return(world);
        }
Beispiel #2
0
        public bool LoadWorldData(string worldId = "")
        {
            worldId = worldId.ToUpper();

            // Update the World ID, or use existing World ID if applicable.
            if (WorldContent.WorldExists(worldId))
            {
                this.worldId = worldId;
            }
            else
            {
                return(false);
            }

            string localPath = WorldContent.GetLocalWorldPath(this.worldId);
            string json      = Systems.filesLocal.ReadFile(localPath);

            // If there is no JSON content, end the attempt to load world:
            if (json == "")
            {
                return(false);
            }

            // Load the Data
            this.data = JsonConvert.DeserializeObject <WorldFormat>(json);

            return(true);
        }
Beispiel #3
0
 public bool LoadWorldData(WorldFormat worldData)
 {
     this.data    = worldData;
     this.worldId = worldData.id.ToUpper();
     return(true);
 }