private void _controller_GamePhaseChanged1(object sender, GamePhaseChangedEventArgs e) { _gamePhase = e.NewPhase.Type; if (e.NewPhase.Type == GamePhaseType.LifeDeathDetermination) { grpLifeDeath.Visible = true; _inLifeDeathDeterminationPhase = true; (e.NewPhase as ILifeAndDeathPhase).LifeDeathTerritoryChanged += _controller_LifeDeathTerritoryChanged; } else { grpLifeDeath.Visible = false; _inLifeDeathDeterminationPhase = false; } if (e.PreviousPhase.Type == GamePhaseType.LifeDeathDetermination) { (e.PreviousPhase as ILifeAndDeathPhase).LifeDeathTerritoryChanged -= _controller_LifeDeathTerritoryChanged; } grpTiming.Visible = e.NewPhase.Type == GamePhaseType.Main; if (e.NewPhase.Type != GamePhaseType.Main) { groupboxMoveMaker.Visible = false; } RefreshBoard(); }
protected virtual void OnGamePhaseChanged(GamePhaseChangedEventArgs phaseState) { if (phaseState.PreviousPhase != null) { _phaseEndHandlers.ItemOrDefault(phaseState.PreviousPhase.Type)? .Invoke(phaseState.PreviousPhase); } if (phaseState.NewPhase != null) { _phaseStartHandlers.ItemOrDefault(phaseState.NewPhase.Type)? .Invoke(phaseState.NewPhase); } // Define publicly the new phase GamePhase = phaseState.NewPhase.Type; }
protected override void OnGamePhaseChanged(GamePhaseChangedEventArgs phaseState) { // Handle raising the phase handlers base.OnGamePhaseChanged(phaseState); if (phaseState.NewPhase.Type == GamePhaseType.LifeDeathDetermination || phaseState.NewPhase.Type == GamePhaseType.Finished) { BoardViewModel.BoardControlState.ShowTerritory = true; } else { BoardViewModel.BoardControlState.ShowTerritory = false; } // We are in a new Game Phase, refresh commands RefreshCommands(); }
protected override void OnGamePhaseChanged(GamePhaseChangedEventArgs phaseState) { base.OnGamePhaseChanged(phaseState); RefreshInstructionCaption(); }