Ejemplo n.º 1
0
        async Task <bool> IShowInstructionsAndHistoryController.Load(string s)
        {
            Dictionary <string, string> history = StaticHelpers.DeserializeDictionary(s);

            if (history == null)
            {
                return(false);
            }
            string value = "";
            Deck   deck  = MainPage.Current.Deck;

            for (int i = 0; i < history.Count; i++)
            {
                string key = String.Format("Score {0}", i);
                if (history.TryGetValue(key, out value))
                {
                    var tokens = value.Split(new char[] { '*' }, StringSplitOptions.RemoveEmptyEntries);
                    if (tokens[0] == "ScoreInstance")
                    {
                        ScoreHistoryView shv = new ScoreHistoryView();
                        await shv.PopulateGrid(tokens[1]);

                        ShowInstructionsUi.HistoryList.Add(shv);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        async Task IShowInstructionsAndHistoryController.AddToHistory(List <CardView> fullHand, ScoreCollection scores, PlayerType player, Deck Deck, string gameScore)
        {
            bool   isOnRight = ShowInstructionsUi.IsRightSide;
            double y         = 800;
            double x         = 100;


            Point to = new Point(x, y);

            double angle = 45;

            if (!isOnRight)
            {
                angle = -90;
                y     = 200;
            }

            double scoreDiameter = 75.0;


            Point p = GetCenterPointForScoreAnimation(to, isOnRight);

            if (_scoreQueue.Count == 0)
            {
                _timerForFlyingScore.Interval = TimeSpan.FromTicks(1);
            }
            List <ScoreHistoryView> list = new List <ScoreHistoryView>();

            foreach (ScoreInstance score in scores.Scores)
            {
                ScoreHistoryView view = new ScoreHistoryView();
                await view.PopulateGrid(fullHand, score, player, scores.ScoreType, ShowInstructionsUi.HistoryList.Count + 1, scores.Total, scores.ActualScore, gameScore);

                view.Width  = ShowInstructionsUi.HistoryViewWidth;
                view.Height = view.Width * HEIGHT_WIDTH_RATIO;
                view.HorizontalAlignment = HorizontalAlignment.Left;
                view.VerticalAlignment   = VerticalAlignment.Top;
                list.Add(view);
            }

            FlyingScore flyingScore = new FlyingScore();

            LayoutRoot.Children.Add(flyingScore);
            Grid.SetColumnSpan(flyingScore, 0xFF);
            Grid.SetRowSpan(flyingScore, 0xFF);
            Canvas.SetZIndex(flyingScore, Int16.MaxValue);
            flyingScore.Message             = scores.Total.ToString();
            flyingScore.Center              = p;
            flyingScore.Width               = scoreDiameter;
            flyingScore.Height              = scoreDiameter;
            flyingScore.Angle               = angle;
            flyingScore.HorizontalAlignment = HorizontalAlignment.Center;
            flyingScore.VerticalAlignment   = VerticalAlignment.Center;

            FlyoutScoreAnimationHelper helper = new FlyoutScoreAnimationHelper(list, flyingScore, ShowInstructionsUi);

            _scoreQueue.Enqueue(helper);
            _timerForFlyingScore.Start();
        }
Ejemplo n.º 3
0
 void IShowInstructionsUi.AddToHistory(ScoreHistoryView shv)
 {
     _scoreHistoryList.Insert(0, shv);
 }