private void App_ChangeThemeEvent(object sender, EventArgs e) { ApplicationThemeEventArg ae = e as ApplicationThemeEventArg; GameConstants.GameStates last = GameState; Theme = ae.Theme; GameState = GameConstants.GameStates.IN_DECISION; GameState = last; }
private void OnPlayerHazardCollision() { playerLives--; if (playerLives == 0) { _state = GameConstants.GameStates.GameOver; GameData.instance.addMoney(coins); Messenger.Broadcast(GameConstants.GameEvents.GAME_OVER); } }
private void EndGame(GameConstants.GameStates gState) { switch (gState) { case (GameConstants.GameStates.LOST): soundAdornment.Lost(); break; case (GameConstants.GameStates.WON): soundAdornment.Won(); break; } tmr.Enabled = GameBoardEnabled = false; GameState = gState; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { VisualBrush returnBrush = null; GameConstants.GameStates gs = (GameConstants.GameStates)value; try { switch (gs) { case (GameConstants.GameStates.NOT_DETERMINED): case (GameConstants.GameStates.NOT_STARTED): case (GameConstants.GameStates.IN_PLAY): returnBrush = BrushByTheme("SMILEUP", ""); break; case (GameConstants.GameStates.IN_BONUSPLAY): returnBrush = BrushByTheme("WINKUP", ""); break; case (GameConstants.GameStates.IN_DECISION): returnBrush = BrushByTheme("SURPRISEDN", ""); break; case (GameConstants.GameStates.WON): returnBrush = BrushByTheme("GRINUP", ""); break; case (GameConstants.GameStates.LOST): returnBrush = BrushByTheme("SADUP", ""); break; } }catch (Exception e) { Debug.WriteLine("GameState{" + gs + "} " + "Exception{" + e.Message); Debugger.Break(); } return(returnBrush); }
private void App_ChangeThemeEvent(object sender, EventArgs e) { GameConstants.GameStates last = GameState; GameState = GameConstants.GameStates.IN_DECISION; GameState = last; }
private void NewGame(int r, int c, int mines) { GameBoardEnabled = false; result = GameConstants.GameStates.IN_PLAY; this.ClearMessages(); redoStack.Clear(); undoStack.Clear(); busTubStack.Clear(); GameBoardEnabled = false; tmr.Enabled = false; foreach (GamePiece gp in _cells) { gp.Dispose(); } _cells.Clear(); int maxSeed = r * c; Random ra = new Random(); int n = 0; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { GameConstants.PieceValues pv = GameConstants.PieceValues.NOMINE; _cells.Add(new GamePiece(this, n++, i, j, pv)); } } // Plant the Mines int nMinesPlanted = 0; while (nMinesPlanted < mines) { int nNextMinePlace = ra.Next(0, maxSeed); GamePiece gp = (GamePiece)_cells[nNextMinePlace]; while (gp.ActualValue == GameConstants.PieceValues.MINE) { nNextMinePlace = ra.Next(0, maxSeed); gp = (GamePiece)_cells[nNextMinePlace]; } gp.ActualValue = GameConstants.PieceValues.MINE; ++nMinesPlanted; } //Set Neighbor Values for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { if (Item(i, j).ActualValue != GameConstants.PieceValues.MINE) { GameConstants.PieceValues pv = GameConstants.PieceValues.NOMINE; List <GamePiece> Lst = (List <GamePiece>)Neighbors(i, j); int nMines = Lst.Count(gp => gp.ActualValue == GameConstants.PieceValues.MINE); pv = (GameConstants.PieceValues)((int)GameConstants.PieceValues.NOMINE + nMines); GamePiece gItem = Item(i, j); gItem.ActualValue = pv; } } } Rows = r; Columns = c; Mines = thisGamesMines = mines; Time = 0; GameState = GameConstants.GameStates.NOT_STARTED; GameBoardEnabled = true; soundAdornment.NewGame(); ShowGame(); }
private void OnPlayerOutOfRoad() { _state = GameConstants.GameStates.GameOver; Messenger.Broadcast(GameConstants.GameEvents.GAME_OVER); }
private void ExecutePressSmileyCommand() { lastSmileyState = gameState; Debug.WriteLine("PressSmiley : "); GameState = GameConstants.GameStates.IN_DECISION; }