public static void OnLoad() { foreach (RenderableBuilding b in Buildings.Values) { b.Dispose(); } Buildings.Clear(); foreach (RenderablePlot p in Plots.Values) { p.Dispose(); } Plots.Clear(); foreach (Plot p in Haswell.Controller.City.Grid) { if (p.Building != null) { if (p.Building is Road) { Buildings[p.Building] = new RenderableRoad((Road)p.Building); } else { Buildings[p.Building] = new RenderableBuilding(p.Building); } } Plots[p] = new RenderablePlot(p); Plots[p].Create(SceneMgr, cityNode); } GameConsole.ActiveInstance.WriteLine("Game Loaded."); GuiMgr.AddInfoPopup("Game Loaded."); }
/// <summary> /// Add a new building to the city at the specified coordinates /// </summary> /// <param name="x"></param> /// <param name="y"></param> public static void NewBuilding(int x, int y, BuildingConfiguration b) { if (Initialized) { try { Haswell.Controller.City.CreateBuilding(x, y, b); } catch (BuildingCreationFailedException e) { GameConsole.ActiveInstance.WriteLine(e.Message); GuiMgr.AddInfoPopup(e.Message); } } else { GameConsole.ActiveInstance.WriteError("Unable to create building, no city initialized!"); } }
public static void Load() { Haswell.Controller.Load(); GameConsole.ActiveInstance.WriteLine("Loading game..."); GuiMgr.AddInfoPopup("Loading game..."); }
public static void OnSave() { GameConsole.ActiveInstance.WriteLine("Game Saved."); GuiMgr.AddInfoPopup("Game Saved."); }