public void HandleMouseInput() { if ((isOpened == true || isEnlarged == true) && isMovingRight == false) { curMouseState = Mouse.GetState(); if (panelRect.Contains(curMouseState.X, curMouseState.Y) == true) { if (curMouseState.RightButton == ButtonState.Pressed && oldMouseState.RightButton == ButtonState.Released) { panelIsFocused = !panelIsFocused; } } if (panelIsFocused == true) { ActionScene ags = (ActionScene)Game.Services.GetService(typeof(ActionScene)); ags.blockControls(); this.controlsAreBlocked = false; if (curMouseState.ScrollWheelValue < oldMouseState.ScrollWheelValue - 100) { curLevel--; } if (curMouseState.ScrollWheelValue > oldMouseState.ScrollWheelValue + 100) { curLevel++; } HandlemouseWheel(); } else { //reset controls curLevel = vChessboard.CurrentLevel; ActionScene ags = (ActionScene)Game.Services.GetService(typeof(ActionScene)); ags.unblockControls(); for (short y = 0; y < 8; y++) { vChessboard.SetPlaneVisibility(y, true); } } oldMouseState = curMouseState; } }
void mainMenu_onClick() { ((ActionScene)parent).hideScene(); for (int i = 0; i < Game.Components.Count; i++) { if (Game.Components[i] is ActionScene) { Game.Services.RemoveService(typeof(ActionScene)); ActionScene gc = (ActionScene)Game.Components[i]; Game.Components.RemoveAt(i); gc.Dispose(); gc = null; break; } } for (int i = 0; i < Game.Components.Count; i++) { if (Game.Components[i] is MainMenuScene) { ((MainMenuScene)Game.Components[i]).showScene(); } } }
void rMiddle_Click() { this.hideScene(); Game.GraphicsDevice.Clear(Color.White); for (int i = 0; i < Game.Components.Count; i++) { if (Game.Components[i] is ActionScene) { Game.Services.RemoveService(typeof(ActionScene)); Game.Components.RemoveAt(i); } } //The parameters should be read from Settings menu! ActionScene actionScene = new ActionScene( Game, typeof(BasicChessboardFactory), timersPanel.TimeScheme, player1Name, player2Name); Game.Components.Add(actionScene); Game.Services.AddService(typeof(ActionScene), actionScene); actionScene.showScene(); }