public override void TestCollision(Cursor cursor) { if (cursor.PrimaryPush) { mStateBeforePrimaryPush = ButtonPushedState; if (ButtonPushedState == ButtonPushedState.Up) { ButtonPushedState = ButtonPushedState.Down; } else { ButtonPushedState = ButtonPushedState.Up; } } if (cursor.WindowPushed == this && cursor.PrimaryClick) { if (ButtonPushedState == ButtonPushedState.Up && oneAlwaysDown == false) { ButtonPushedState = ButtonPushedState.Up; } else { ButtonPushedState = ButtonPushedState.Down; } if (IsPressed) { base.Text = this.pressedText; } else { base.Text = this.unpressedText; } for (int i = 0; i < radioGroup.Count; i++) { if (radioGroup[i] != this) { ((ToggleButton)radioGroup[i]).Unpress(); } } if (IsPressed && mDownTexture != null) { mOverlayTexture = mDownTexture; } else if (!IsPressed && mUpTexture != null) { mOverlayTexture = mUpTexture; } } // The base class is Button - we don't want that behavior. TestCollisionBase(cursor); if (cursor.WindowOver == this && ShowsToolTip) { GuiManager.ToolTipText = this.Text; } }
public override void TestCollision(Cursor cursor) { if(cursor.PrimaryPush) { mStateBeforePrimaryPush = ButtonPushedState; if (ButtonPushedState == ButtonPushedState.Up) { ButtonPushedState = ButtonPushedState.Down; } else { ButtonPushedState = ButtonPushedState.Up; } } if(cursor.WindowPushed == this && cursor.PrimaryClick) { if (ButtonPushedState == ButtonPushedState.Up && oneAlwaysDown == false) { ButtonPushedState = ButtonPushedState.Up; } else { ButtonPushedState = ButtonPushedState.Down; } if(IsPressed) base.Text = this.pressedText; else base.Text = this.unpressedText; for(int i = 0; i < radioGroup.Count; i++) { if(radioGroup[i] != this) ((ToggleButton)radioGroup[i]).Unpress(); } if (IsPressed && mDownTexture != null) { mOverlayTexture = mDownTexture; } else if (!IsPressed && mUpTexture != null) { mOverlayTexture = mUpTexture; } } // The base class is Button - we don't want that behavior. TestCollisionBase(cursor); if (cursor.WindowOver == this && ShowsToolTip) { GuiManager.ToolTipText = this.Text; } }