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(); }
private void OnFireScoreAnimation(object sender, object e) { _timerForFlyingScore.Interval = TimeSpan.FromMilliseconds(ANIMATION_SPEED_FLYING_SCORE / 4); //subsequent ones delay FlyoutScoreAnimationHelper helper = null; if (_scoreQueue.Count == 0) { _timerForFlyingScore.Stop(); return; } try { helper = _scoreQueue.Dequeue(); helper.Animate(ANIMATION_SPEED_FLYING_SCORE); } catch (Exception) { _timerForFlyingScore.Stop(); } }