示例#1
0
        public async Task OnCountingEnded(int playerScore, int computerScore)
        {
            UpdateCount(0);

            HintWindow.InsertScoreSummary(ScoreType.Count, playerScore, computerScore);
            await AnimateCardsBackToOwner();
        }
示例#2
0
        public async Task AddToScoreHistory(List <CardView> cards, ScoreCollection scores, PlayerType player)
        {
            List <CardView> fullHand = new List <CardView>(cards);

            switch (scores.ScoreType)
            {
            case ScoreType.Hand:
            case ScoreType.Crib:
            case ScoreType.Cut:
                fullHand.Sort(CardView.CompareCardsByRank);
                fullHand.Add(GridDeck.Items[0]);
                break;

            case ScoreType.Count:
                break;

            case ScoreType.Saved:
            case ScoreType.Unspecified:
                return;

            default:
                break;
            }

            string score = GetGameScore();
            await HintWindow.AddToHistory(fullHand, scores, player, Deck, score);
        }
示例#3
0
        public async Task OnUpdateScoreUi(PlayerType player, int scoreDelta, ScoreCollection scores)
        {
            await StateMachine.UiState.AddScore(player, scoreDelta);

            await AddToScoreHistory(GridPlayer.Items, scores, PlayerType.Player);

            HintWindow.InsertScoreSummary(scores.ScoreType, scoreDelta, 0);
            string message = String.Format("Your Score\n{0}\nHit Continue.", scores.Format(false, false, true));

            //ShowHintWindowAsync(true, false, message);
            await HintWindow_ShowAndWait(message);
        }
示例#4
0
        public async Task OnComputerScoreCrib(int scoreToAdd, ScoreCollection scores)
        {
            string message = String.Format("Computer's Crib Score\n{0}\nHit Continue.", scores.Format(false, false, true));

            await HintWindow_ShowAndWait(message);

            await StateMachine.UiState.AddScore(PlayerType.Computer, scoreToAdd);

            await AddToScoreHistory(GridComputer.Items, scores, PlayerType.Computer);

            HintWindow.InsertScoreSummary(ScoreType.Crib, 0, scoreToAdd);
        }
示例#5
0
        public async Task HintWindow_ShowAndWait(string message)
        {
            if (_hintDispatchTimer == null)
            {
                _hintDispatchTimer          = new DispatcherTimer();
                _hintDispatchTimer.Tick    += HintReminder_Tick;
                _hintDispatchTimer.Interval = TimeSpan.FromSeconds(5);
            }
            _hintDispatchTimer.Start();
            await HintWindow.ShowAndWait(message);

            ViewCallback.RemindUserToHitContinue(false);
            _hintDispatchTimer.Stop();
        }
示例#6
0
        public async Task OnEndOfHand(PlayerType dealer, int cribScore, int nComputerCountingPoint, int nPlayerCountingPoint, int ComputerPointsThisTurn, int PlayerPointsThisTurn)
        {
            CardContainer cribOwner = GridPlayer;

            if (dealer == PlayerType.Computer)
            {
                cribOwner = GridComputer;
            }
            await HintWindow.InsertEndOfHandSummary(dealer, cribScore, cribOwner.Items, nComputerCountingPoint, nPlayerCountingPoint, ComputerPointsThisTurn, PlayerPointsThisTurn, Hfs);


            List <Task <Object> > tasks = new List <Task <object> >();

            cribOwner.FlipAllCards(CardOrientation.FaceDown, tasks);
            cribOwner.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true);
            await Task.WhenAll(tasks);
        }
示例#7
0
        public void Reset()
        {
            if (PlayerScore != null)
            {
                PlayerScore.Reset();
                ComputerScore.Reset();
            }

            Board.Reset();
            PlayerSetScoreControl.HideAsync();
            HintWindow.ShowAsync(false, false, "Swipe Up to and hit New Game!");

            if (GridDeck.Items.Count > 52)
            {
                Debug.Assert(false, "Too many cards in your deck after reset!");
            }
            HintWindow.ResetScoreHistory();
            ViewCallback.Reset();
        }
示例#8
0
 public Task <bool> Load(string s)
 {
     return(HintWindow.Load(s));
 }
示例#9
0
 public string Save()
 {
     return(HintWindow.Save());
 }
示例#10
0
 private async Task ShowHintWindow(bool show, bool closeWithTimer, string message)
 {
     await HintWindow.Show(show, closeWithTimer, message);
 }
示例#11
0
 private void ShowHintWindowAsync(bool show, bool closeWithTimer, string message)
 {
     HintWindow.ShowAsync(show, closeWithTimer, message);
 }