Exemplo n.º 1
0
 private void ConfigurePlayMode()
 {
     this._newMainWindowKeyDown = this.KeyInput_PlayMode;
     this._gameGrid.Visibility  = Visibility.Visible;
     this._gameGrid.Background  = Brushes.White;
     this._mainWindow.PauseIndicator.Visibility = Visibility.Hidden;
 }
Exemplo n.º 2
0
        //private void ConfigueRECORDSCOREMode()
        //{
        //}

        private void ConfiguePLAYMode()
        {
            New_MainWindow_KeyDown   = this.KeyInput_PlayMode;
            this.GameGrid.Visibility = Visibility.Visible;
            this.GameGrid.Background = Brushes.White;
            //this.MainWindow.PlayerName.Visibility = Visibility.Hidden;
            this.MainWindow.PauseIndicator.Visibility = Visibility.Hidden;
        }
Exemplo n.º 3
0
 private void ConfigureStartMode()
 {
     this._newMainWindowKeyDown = this.KeyInput_StartMode;
     this._dispatcher.Invoke(new Action(delegate { this._mainWindow.ScoresDataGrid.IsEnabled = false; }), DispatcherPriority.Send, null);
     this._dispatcher.Invoke(new Action(delegate { this._gameGrid.Visibility = Visibility.Visible; }), DispatcherPriority.Send, null);
     this._dispatcher.Invoke(new Action(delegate { this._mainWindow.HighScoreScreen.Visibility = Visibility.Hidden; }), DispatcherPriority.Send, null);
     this._dispatcher.Invoke(new Action(delegate { this._mainWindow.PauseIndicator.Visibility = Visibility.Visible; }), DispatcherPriority.Send, null);
 }
Exemplo n.º 4
0
 private void ConfigueHIGHSCORESMode()
 {
     New_MainWindow_KeyDown = this.KeyInput_StartMode;
     this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.ScoresDataGrid.IsEnabled = true; }), DispatcherPriority.Send, null);
     this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.ScoresDataGrid.IsReadOnly = true; }), DispatcherPriority.Send, null);
     this.Dispatcher.Invoke(new Action(delegate { this.GameGrid.Visibility = Visibility.Hidden; }), DispatcherPriority.Send, null);
     this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.HighScoreScreen.Visibility = Visibility.Visible; }), DispatcherPriority.Send, null);
     this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.PauseIndicator.Visibility = Visibility.Hidden; }), DispatcherPriority.Send, null);
 }
Exemplo n.º 5
0
 private void ConfigureRecordhighscoreMode()
 {
     this._newMainWindowKeyDown = this.KeyInput_ScoreMode;
     this.PersistScore(new Score("Player", this._game.Snake.Age, this._game.Snake.Guid));
     this._dispatcher.Invoke(new Action(delegate { this._mainWindow.ScoresDataGrid.IsEnabled = true; }), DispatcherPriority.Send, null);
     this._dispatcher.Invoke(new Action(delegate { this._mainWindow.ScoresDataGrid.IsReadOnly = true; }), DispatcherPriority.Send, null);
     this._dispatcher.Invoke(new Action(delegate { this._gameGrid.Visibility = Visibility.Hidden; }), DispatcherPriority.Send, null);
     this._dispatcher.Invoke(new Action(delegate { this._mainWindow.HighScoreScreen.Visibility = Visibility.Visible; }), DispatcherPriority.Send, null);
     this._dispatcher.Invoke(new Action(delegate { this._mainWindow.PauseIndicator.Visibility = Visibility.Hidden; }), DispatcherPriority.Send, null);
 }
Exemplo n.º 6
0
        private void ConfigueRECORDHIGHSCOREMode()
        {
            New_MainWindow_KeyDown = this.KeyInput_ScoreMode;
            //this.MainWindow.ScoresDataGrid.IsEnabled = true;
            PersistScore(new Score("Player", this.GAME.Snake.Age, this.GAME.Snake.GUID));

            this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.ScoresDataGrid.IsEnabled = true; }), DispatcherPriority.Send, null);
            this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.ScoresDataGrid.IsReadOnly = true; }), DispatcherPriority.Send, null);
            this.Dispatcher.Invoke(new Action(delegate { this.GameGrid.Visibility = Visibility.Hidden; }), DispatcherPriority.Send, null);
            this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.HighScoreScreen.Visibility = Visibility.Visible; }), DispatcherPriority.Send, null);
            this.Dispatcher.Invoke(new Action(delegate { this.MainWindow.PauseIndicator.Visibility = Visibility.Hidden; }), DispatcherPriority.Send, null);
        }
        /** Constructor
         *  @param
         *      name The name to be given to the widget (must be unique).
         *  @param
         *      dimensions The x Position, y Position, width, and height of the widget.
         *              @param
         *                      positionMode The GuiMetricsMode for the values given for the position. (absolute/relative/pixel)
         *              @param
         *                      sizeMode The GuiMetricsMode for the values given for the size. (absolute/relative/pixel)
         *              @param
         *                      material Ogre material defining the widget image.
         *              @param
         *                      overlayContainer associates the internal OverlayElement with a specified zOrder.
         *              @param
         *                      ParentWidget parent widget which created this widget.
         */
        public TextBox(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget)
            : base(name, dimensions, positionMode, sizeMode, material, overlayContainer, ParentWidget)
        {
            mWidgetType = Widget.WidgetType.QGUI_TYPE_TEXTBOX;

            mMaskUserInput         = false;
            mBackSpaceDown         = false;
            mBackSpaceTimer        = 0.0f;
            mDeleteDown            = false;
            mDeleteTimer           = 0.0f;
            mLeftArrowDown         = false;
            mRightArrowDown        = false;
            mMoveCursorTimer       = 0.0f;
            mCursorVisibilityTimer = 0.0f;
            mReadOnly  = false;
            mInputMode = false;


            // Border Overlay gives us ability to assign material to TextBox border and Panel separately.
            mOverlayElement = createPanelOverlayElement(mInstanceName + ".Background", mPixelDimensions, "");
            mOverlayContainer.AddChild(mOverlayElement);
            mOverlayElement.Show();
            setMaterial(mWidgetMaterial);

            mCharacterHeight = 0.75f;
            Mogre.Vector3 textDimensions = new Mogre.Vector3(0, 0, mCharacterHeight);
            // Label has no material, since it directly overlaps the textbox overlay element
            mTextWidget = new Text(mInstanceName + ".Text", textDimensions, QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, mChildrenContainer, this);
            mTextWidget.setTruncateMode(Text.TruncateMode.LEFT);
            mTextWidget.setTruncationFeedback("");
            mTextWidget.setZOrderOffset(1);
            _addChildWidget(mTextWidget);

            mHorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT;
            mVerticalAlignment   = GuiVerticalAlignment.GVA_CENTER;

            alignText(mHorizontalAlignment, mVerticalAlignment);

            OnDeactivate      += new DeactivateEventHandler(TextBox_OnDeactivate);
            OnCharacter       += new CharacterEventHandler(TextBox_OnCharacter);
            OnKeyDown         += new KeyDownEventHandler(TextBox_OnKeyDown);
            OnKeyUp           += new KeyUpEventHandler(TextBox_OnKeyUp);
            OnMouseButtonDown += new MouseButtonDownEventHandler(TextBox_OnMouseButtonDown);
            OnTimeElapsed     += new TimeElapsedHandler(TextBox_OnTimeElapsed);
        }
Exemplo n.º 8
0
 public static void RemoveKeyDownEventHandler(KeyDownEventHandler e) => ModBase.InputManager.RemoveKeyDownEventHandler(e);
Exemplo n.º 9
0
 public static void AddKeyDownEventHandler(KeyDownEventHandler e) => ModBase.InputManager.AddKeyDownEventHandler(e);