コード例 #1
0
        protected override async void OnGameEnded(GameEndInformation endInformation)
        {
            _gameEndInformation = endInformation;

            await DialogService.ShowAsync(GameEndTranslator.TranslateDetails(endInformation, Localizer),
                                          GameEndTranslator.TranslateCaption(endInformation, Localizer));
        }
コード例 #2
0
        private string GenerateInstructionCaption()
        {
            // This happens during every phase change until first OnTurnPlayerChanged when TurnPlayer is filled properly.
            if (Game.Controller.TurnPlayer == null)
            {
                return("");
            }

            bool youAreTurnPlayer = Game.Controller.TurnPlayer.IsHuman &&
                                    !Game.Controller.Players.GetOpponentOf(Game.Controller.TurnPlayer).IsHuman;

            switch (Game.Controller.Phase.Type)
            {
            case GamePhaseType.HandicapPlacement:
            case GamePhaseType.Main:
                string mainCaption = "";
                if (youAreTurnPlayer)
                {
                    mainCaption = Localizer.YourMove;
                }
                else if (Game.Controller.TurnPlayer.Info.Color == StoneColor.Black)
                {
                    mainCaption = Localizer.BlackToPlay;
                }
                else if (Game.Controller.TurnPlayer.Info.Color == StoneColor.White)
                {
                    mainCaption = Localizer.WhiteToPlay;
                }
                if (this.Game.Controller.GameTree?.LastNode?.Move?.Kind == MoveKind.Pass)
                {
                    mainCaption += " - " + this.Localizer.OpponentPassed;
                }
                return(mainCaption);

            case GamePhaseType.LifeDeathDetermination:
                return(Localizer.StoneRemovalPhase);

            case GamePhaseType.Finished:
                return(GameEndTranslator.TranslateCaption(_gameEndInformation, Localizer));
            }

            return("?");
        }