private void MenuLayer_Clicked(HandledEventArgs obj) { if (_loadGameWindow == null) { var position = InputManager.GetMousePostion(true); if (position.Y < TopBoundary) { _viewSwitcher.OpenMap(null); } else if (position.Y > BottomBoundary) { // TODO: terminate game } else { _loadGameWindow = _commonGuiFactory.CreateLoadGameWindow(args => { RemoveElement(_loadGameWindow); _loadGameWindow = null; args.Handled = true; }); AddElement(_loadGameWindow); } } }
public override void Update() { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { _viewSwitcher.OpenMap(null); } }
public LoadGameWindow CreateLoadGameWindow(Action <HandledEventArgs> onExit) { var window = new LoadGameWindow(_guiServices, _texts); window.ArchiveNameClicked += (args, name) => { _viewSwitcher.OpenMenu(); //TODO: keep archives path in common place _gameArchive.LoadGame(Path.Combine("data", "archive", name)); _viewSwitcher.OpenMap(null); }; if (onExit != null) { window.ExitClicked += onExit; } return(window); }