/// <summary> /// A wrapper of the CreateAndShowCommandCenter/CreateAndShowGUI/CreateGameMap method, /// called by the Thread.QueueUserWorkItem method. /// </summary> private void InstanciateInterfaceWrapper(Object data) { if ((IOOperation)data == IOOperation.GameInterface_Instance) { preloader.Status = ((IOOperation)data); CreateAndShowGUI(); } if ((IOOperation)data == IOOperation.GameMap_Instance) { CreateGameMap(); } if ((IOOperation)data == IOOperation.CommandCenter) { ShowPreloaderTimerMode((IOOperation)data); commandCenter.Show(); ProfilesManager.LoadProfile(); } }
void CreateAndShowCommandCenter() { CameraFreeze(); commandCenter = new CommandCenter(this.Game); commandCenter.StackOrder = 5; root.AddChild(commandCenter); commandCenter.OnEnterZone += new EventHandler <CommandCenterEventArgs>(commandCenter_OnEnterZone); commandCenter.OnSaveGame += new EventHandler <CommandCenterEventArgs>(commandCenter_OnSaveGame); commandCenter.OnLogOut += new EventHandler(commandCenter_OnLogOut); commandCenter.OnExitGame += new EventHandler(commandCenter_OnExitGame); commandCenter.Show(); //the MAP button will initially be pressed, this way //loads the selected profile (if the profile already exists) //or creates and then loades the input profile (if it is a new profile) ProfilesManager.LoadProfile(); CommandCenterLoaded = true; }
/// <summary> /// The GameMap and GameInterface_Graphics instances are removed /// and the CommandCenter is shown /// </summary> public void ReturnToCommandCenter() { CameraFreeze(); SoundManager.StopBackgroundSong(); camera.ChangeResolution(1024, 768); camera.Fullscreen = false; camera.Position = new Vector2(0, 0); commandCenter.Show(); IOManager.SaveGameAndZone(this, commandCenter.GetCurrentSettings, gameMap.SlotList, GameManager.GetConsumptionCoverage(GameManager.CurrentYear), GameManager.ResearchList); root.RemoveChild(gameMap); Game.Services.RemoveService(typeof(GameMap)); gameMap = null; root.RemoveChild(gameInterface); Game.Services.RemoveService(typeof(GameInterface)); ProfilesManager.LoadProfile(); CameraFreeze(); }