コード例 #1
0
        private void overview_MouseDown(object sender, MouseButtonEventArgs e)
        {
            GameOverviewUC go = LogicalTreeHelper.FindLogicalNode(App.WindowInstance.mainGrid, "gameOverview") as GameOverviewUC;

            if (go != null)
            {
                App.Instance.ClearMenus();
            }
            else
            {
                App.Instance.GetSceneMgr().Enqueue(new Action(() =>
                {
                    App.Instance.GetSceneMgr().ShowPlayerOverview();
                }));
            }
        }
コード例 #2
0
        private void OnKeyUp(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Tab:
                if (!tabDown)
                {
                    return;
                }

                tabDown = false;
                GameOverviewUC go = LogicalTreeHelper.FindLogicalNode(menuGrid, "gameOverview") as GameOverviewUC;
                if (go != null)
                {
                    menuGrid.Children.Remove(go);
                }
                break;
            }

            App.Instance.OnKeyEvent(e);
        }
コード例 #3
0
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Escape:
                UIElement uc;
                if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "botSelection") as UIElement) != null)
                {
                    ClearMenus();
                    if (GameRunning)
                    {
                        StaticMouse.Enable(true);
                    }
                }
                else if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "colorPicker") as UIElement) != null)
                {
                    AddMenu(new PlayerSettings());
                }
                else if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "mouseMenu") as UIElement) != null)
                {
                    ShowOptionsMenu();
                }
                else if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "soundMenu") as UIElement) != null)
                {
                    ShowOptionsMenu();
                }
                else if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "playerSettings") as UIElement) != null)
                {
                    ShowOptionsMenu();
                }
                else if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "keyBindingsMenu") as UIElement) != null)
                {
                    ShowOptionsMenu();
                }
                else if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "optionsUC") as UIElement) != null)
                {
                    AddMenu(new EscMenu());
                    if (GameRunning)
                    {
                        StaticMouse.Enable(false);
                    }
                }
                else if ((uc = LogicalTreeHelper.FindLogicalNode(menuGrid, "escMenu") as UIElement) != null)
                {
                    ClearMenus();
                    if (GameRunning)
                    {
                        StaticMouse.Enable(true);
                    }
                }
                else if (menuGrid.Children.Count == 0)
                {
                    AddMenu(new EscMenu());
                    if (GameRunning)
                    {
                        StaticMouse.Enable(false);
                    }
                }
                else
                {
                    ClearMenus();
                }
                break;

            case Key.Tab:
                if (tabDown)
                {
                    return;
                }

                tabDown = true;
                GameOverviewUC go = LogicalTreeHelper.FindLogicalNode(menuGrid, "gameOverview") as GameOverviewUC;
                if (go != null)
                {
                    menuGrid.Children.Remove(go);
                }
                break;
            }

            App.Instance.OnKeyEvent(e);
        }