public void LoadState() { this.State = UIState.Deserialize(); if (!string.IsNullOrEmpty(this.State.EditorState.Scene)) { var scene = this.SceneSelector.Scenes.FirstOrDefault(s => s.Name.Equals(this.State.EditorState.Scene, System.StringComparison.OrdinalIgnoreCase)); if (scene != null && this.SceneSelector.CurrentScene != scene) { this.SceneSelector.SwitchScenes(scene); } } if (this.SceneSelector.CurrentScene == null) { this.SceneSelector.SwitchScenes(this.SceneSelector.Scenes.First()); } if (this.State.EntityState.SelectedEntity.Id > 0) { this.State.EntityState.SelectedEntity = this.EntityController.GetAllEntities().FirstOrDefault(e => e.Id == this.State.EntityState.SelectedEntity.Id); } this.setCamera = true; for (var i = 0; i < this.Menus.Count; i++) { this.Menus[i].State = this.State; } this.EntityWindow.State = this.State; this.NetWindow.State = this.State; GraphicsDeviceExtensions.ForceWireFrame = this.State.DebugState.ForceWireFrame; }
public UIManager(Game game, SpriteBatch spriteBatch, ImGuiRenderer gui, RenderTargetDescriber renderTargetDescriber, SceneSelector sceneSelector, CameraController cameraController, Editors editors, IList <IMenu> menus, EntityWindow entityWindow, KeyboardInput keyboardInput, MouseInput mouseInput) { this.Gui = gui; this.KeyboardInput = keyboardInput; this.MouseInput = mouseInput; this.GameLoop = game; this.SpriteBatch = spriteBatch; this.CameraController = cameraController; this.RenderTargetDescriber = renderTargetDescriber; this.Menus = menus; this.EntityWindow = entityWindow; this.Editors = editors; this.State = UIState.Deserialize(); if (!string.IsNullOrEmpty(this.State.EditorState.Scene)) { var scene = sceneSelector.Scenes.FirstOrDefault(s => s.Name.Equals(this.State.EditorState.Scene, System.StringComparison.OrdinalIgnoreCase)); if (scene != null && sceneSelector.CurrentScene != scene) { sceneSelector.SwitchScenes(scene); } } if (sceneSelector.CurrentScene == null) { sceneSelector.SwitchScenes(sceneSelector.Scenes.First()); } this.setCamera = true; for (var i = 0; i < this.Menus.Count; i++) { this.Menus[i].State = this.State; } this.EntityWindow.State = this.State; }