コード例 #1
0
        public void MergeLastDarts(bool discard, Leg leg, int currentTurn)
        {
            if (!discard)
            {
                foreach (var dart in LastDarts)
                {
                    dart.ScoredInLeg = leg;
                    dart.TurnNumber  = currentTurn;
                    Scores.Add(dart);
                }

                var scoreToAdd = new Score
                {
                    TurnNumber  = currentTurn,
                    ScoredInLeg = leg,
                    Value       = CurrentScore,
                    DartScore   = LastDarts.Sum(m => m.Value)
                };

                TurnScores.Insert(0, scoreToAdd);
            }
            else
            {
                CurrentDartCount -= LastDarts.Count;
            }

            LastDarts.Clear();
        }
コード例 #2
0
        public void InitPlayer(int sets, int legs, int startingScore, bool resetScores)
        {
            UnHighlight();

            Sets             = sets;
            LegsPerSet       = legs;
            DartsToThrow     = 0;
            CurrentDartCount = 0;

            LastDarts.Clear();
            UndoItems.Clear();

            if (resetScores)
            {
                TurnScores.Clear();
                SetsWon            = 0;
                LegsWon            = 0;
                LegsPlayed         = 0;
                CummulativeLegsWon = 0;
            }

            IsWinner      = false;
            CurrentScore  = startingScore;
            InterimScore  = CurrentScore;
            WinMessage    = string.Empty;
            LeaderMessage = string.Empty;
            UpdateScore();

            TwentyImage    = new BitmapImage(new Uri("ms-appx:///Assets/twenty.png", UriKind.Absolute));
            NineteenImage  = new BitmapImage(new Uri("ms-appx:///Assets/nineteen.png", UriKind.Absolute));
            EighteenImage  = new BitmapImage(new Uri("ms-appx:///Assets/eighteen.png", UriKind.Absolute));
            SeventeenImage = new BitmapImage(new Uri("ms-appx:///Assets/seventeen.png", UriKind.Absolute));
            SixteenImage   = new BitmapImage(new Uri("ms-appx:///Assets/sixteen.png", UriKind.Absolute));
            FifteenImage   = new BitmapImage(new Uri("ms-appx:///Assets/fifteen.png", UriKind.Absolute));
            BullImage      = new BitmapImage(new Uri("ms-appx:///Assets/bull.png", UriKind.Absolute));
        }