Esempio n. 1
0
        private void ActiveGame_EnteredGuess(object sender, EnteredGuessEventArgs e)
        {
            string sznumformat = "digitstats.digit{0}{1}";

            //profile.Statistics.InitializeStatistic(string.Format(sznumformat, i, ".digitguesscount.digitguessfail"));
            foreach (var ncritem in e.GuessResults.SourceTextResults)
            {
                switch (ncritem.CompareResults)
                {
                case NumberCompareResultEnum.Equals:
                    GamerProfile.Statistics[string.Format(sznumformat, ncritem.NumValue, ".digitguesscount.digitguesssuccess"), true].ValueInt++;
                    break;

                case NumberCompareResultEnum.EqualsOnDiffer:
                    GamerProfile.Statistics[string.Format(sznumformat, ncritem.NumValue, ".digitguesscount.digitguessdiffer"), true].ValueInt++;
                    break;

                default:
                    break;
                }
            }
            for (int i = 0; i < e.Guess.Length; i++)
            {
                int inum = int.Parse(e.Guess[i].ToString());
                GamerProfile.Statistics[string.Format(sznumformat, inum, ".digitguesscount"), true].ValueInt++;
                if (e.GuessResults.TargetTextResults.SingleOrDefault((c) => (c.Index == i)) == null)
                {
                    GamerProfile.Statistics[string.Format(sznumformat, inum, ".digitguesscount.digitguessfail"), true].ValueInt++;
                }
            }
            GamerProfile.Statistics["total.totalguess", true].ValueInt++;
            GamerProfile.Statistics["total.totalplus", true].ValueInt  += e.GuessResults.PlusScore;
            GamerProfile.Statistics["total.totalminus", true].ValueInt += e.GuessResults.MinusScore;
            if (!GamerProfile.FirstPlayed)
            {
                if (string.IsNullOrEmpty(GamerProfile.Statistics["first.guess", true].ValueString))
                {
                    GamerProfile.Statistics["first.guess", true].Value = e.Guess;
                }
            }
            GamerProfile.Statistics["last.guess", true].Value = e.Guess;
        }
        private void ActiveGame_EnteredGuess(object sender, EnteredGuessEventArgs e)
        {
            string sznumformat = "digitstats.digit{0}{1}";

            //profile.Statistics.InitializeStatistic(string.Format(sznumformat, i, ".digitguesscount.digitguessfail"));
            foreach (var compareResult in e.GuessResults.TargetTextResults)
            {
                GamerProfile.Statistics[string.Format(sznumformat, compareResult.NumValue, ".digitguesscount"), true].ValueInt++;
                switch (compareResult.CompareResults)
                {
                case NumberCompareResultEnum.Equals:
                    GamerProfile.Statistics[string.Format(sznumformat, compareResult.NumValue, ".digitguesscount.digitguesssuccess"), true].ValueInt++;
                    break;

                case NumberCompareResultEnum.EqualsOnDiffer:
                    GamerProfile.Statistics[string.Format(sznumformat, compareResult.NumValue, ".digitguesscount.digitguessdiffer"), true].ValueInt++;
                    break;

                case NumberCompareResultEnum.NotEquals:
                default:
                    GamerProfile.Statistics[string.Format(sznumformat, compareResult.NumValue, ".digitguesscount.digitguessfail"), true].ValueInt++;
                    break;
                }
            }
            GamerProfile.Statistics["total.totalguess", true].ValueInt++;
            GamerProfile.Statistics["total.totalplus", true].ValueInt  += e.GuessResults.PlusScore;
            GamerProfile.Statistics["total.totalminus", true].ValueInt += e.GuessResults.MinusScore;
            if (!GamerProfile.FirstPlayed)
            {
                if (string.IsNullOrEmpty(GamerProfile.Statistics["first.guess", true].ValueString))
                {
                    GamerProfile.Statistics["first.guess", true].Value = e.Guess;
                }
            }
            GamerProfile.Statistics["last.guess", true].Value = e.Guess;
        }