public void LoadWorld(string name) { World.UnloadTerrain(); WorldDescription desc = WorldIO.Load(name, false); World.SetTerrain(desc.Terrain); WorldEditor.TerrainEditor.ClearUndoRedo(); Window.UpdateTitle(name); CurrentFile = name; var commandposts = desc.GetObjectsByTag("CommandPost"); foreach (WorldObjectDescription ob in commandposts) { Vector3 position = ob.GetVector3("Position"); CommandPostObject editorCommandPost = new CommandPostObject(position); Team team = (Team)(ob.GetField <byte>("Team") ?? 0); editorCommandPost.Team = team; World.AddGameObject(editorCommandPost); } var intels = desc.GetObjectsByTag("Intel"); foreach (WorldObjectDescription ob in intels) { Vector3 position = ob.GetVector3("Position"); IntelObject editorIntel = new IntelObject(position); Team team = (Team)(ob.GetField <byte>("Team") ?? 0); editorIntel.Team = team; World.AddGameObject(editorIntel); } }
protected WorldDescription LoadFromFile(string fileName) { WorldDescription desc = WorldIO.Load(fileName); SetTerrain(desc.Terrain); return(desc); }
public bool LoadFromFile(string fileName) { DashCMD.WriteImportant("[ServerWorld] Loading world '{0}'...", fileName); try { Description = WorldIO.Load(CurrentWorldName = fileName); SetTerrain(Description.Terrain); Terrain.LockBottomLayer = true; DashCMD.WriteImportant("[ServerWorld] Successfully loaded world '{0}'.", fileName); return(true); } catch (IOException ioex) { DashCMD.WriteError("[ServerWorld] Failed to load world '{0}'!", fileName); DashCMD.WriteError(ioex); return(false); } }