コード例 #1
0
        private void PlayExplodeAnimation(Image bombDropImage)
        {
            var scaleAnimation = new RadScaleAnimation {
                StartScaleX = 1.0,
                EndScaleX = 0.1,
                StartScaleY = 1.0,
                EndScaleY = 0.1,
                Duration = new Duration(TimeSpan.FromSeconds(1))
            };

            _bombBurningSoundEffect.Play();
            RadAnimationManager.Play(bombDropImage, scaleAnimation,
                delegate {
                    var canvas = bombDropImage.Parent as Canvas;
                    if (canvas == null) return;
                    canvas.Children.Remove(bombDropImage);
                    CreateExplodeAnimation(Canvas.GetLeft(bombDropImage) + (bombDropImage.Width / 2), Canvas.GetTop(bombDropImage) + (bombDropImage.Height / 2));
                });
        }
コード例 #2
0
        private RadAnimation CreateSelectedAnimation()
        {
            var result = new RadScaleAnimation {
                StartScaleX = 1.0,
                EndScaleX = 1.3,
                StartScaleY = 1.0,
                EndScaleY = 1.3,
                Duration = new Duration(TimeSpan.FromSeconds(0.2)),
                AutoReverse = true,
                RepeatBehavior = new RepeatBehavior(10),
                FillBehavior = AnimationFillBehavior.Stop,
            };

            return result;
        }
コード例 #3
0
        private void AddScore()
        {
            var currentScore = int.Parse(ScoreTextBlock.Text);
            var addScore = int.Parse(TimeTextBlock.Text);
            _answerFoundTime.Add(addScore);

            var scaleAndRotateAnimation = new RadScaleAnimation {
                StartScaleX = 1.0,
                EndScaleX = 1.5,
                StartScaleY = 1.0,
                EndScaleY = 1.5,
                Duration = TimeSpan.FromSeconds(1),
                AutoReverse = true,
                Easing = new ElasticEase {Oscillations = 3}
            };

            var totalScore = currentScore + addScore;
            ScoreTextBlock.Text = totalScore + string.Empty;

            RadAnimationManager.Play(ScoreTextBlock, scaleAndRotateAnimation);
            var answerId = _answerFoundTime.Count - 1;
            Utils.SendEvent(_stage.Name, "answer" + (answerId + 1), Utils.AnswerTimeRange(_answerFoundTime[answerId]), 0);
        }
コード例 #4
0
        private void StopWatchImageTap(object sender, GestureEventArgs e)
        {
            // if already started stopwatch, ignore
            if (_stopWatchStarted) return;
            _stopWatchStarted = true;

            // if it has no more item, ignore
            int stopWatchItemCount = int.Parse(StopWatchItem.HasObtained);
            if (stopWatchItemCount <= 0) return;
            StopWatchItem.HasObtained = stopWatchItemCount - 1 + "";
            StopWatchCount.Text = StopWatchItem.HasObtained;

            // stop all timer and sound
            _timer.Stop();
            _tickerSoundEffectInstance.Pause();

            // initialize stopwatch value
            int countDownDuration = App.ViewModel.StopWatchTimerDuration;
            StopWatchCountDownTextBlock.Text = countDownDuration + "";

            // start playing heat beat music
            _heatBeatSoundEffectInstance.Play();
            var radScaleAnimation = new RadScaleAnimation {
                StartScaleX = 1,
                EndScaleX = 0.75,
                StartScaleY = 1,
                EndScaleY = 0.75,
                Duration = new Duration(TimeSpan.FromMilliseconds(250)),
                AutoReverse = true,
                FillBehavior = AnimationFillBehavior.Stop,
                Easing = new CubicEase { EasingMode = EasingMode.EaseInOut }
            };

            // Start StopWatch
            _stopWatchDispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
            _stopWatchDispatcherTimer.Tick += (o, args) =>
            {
                if (countDownDuration-- > 0) {
                    StopWatchCountDownTextBlock.Text = countDownDuration + "";
                    RadAnimationManager.Play((UIElement)sender, radScaleAnimation);
                }
                else {
                    StopWatchCountDownTextBlock.Text = "";
                    if (!GameWinWindow.IsOpen && !GameLoseWindow.IsOpen) {
                        _timer.Start();
                        if (_tickerSoundEffectInstance.IsDisposed == false)
                            _tickerSoundEffectInstance.Play();
                    }
                    _stopWatchStarted = false;
                    _stopWatchDispatcherTimer.Stop();
                    _heatBeatSoundEffectInstance.Stop();
                }
            };
            _stopWatchDispatcherTimer.Start();
            _numStoppersUsed += 1;
        }
コード例 #5
0
        private void StartCountDownTimer()
        {
            var radScaleAnimation = new RadScaleAnimation {
                StartScaleX = 1,
                EndScaleX = 1.5,
                StartScaleY = 1,
                EndScaleY = 1.5,
                Duration = new Duration(TimeSpan.FromMilliseconds(250)),
                AutoReverse = true,
                FillBehavior = AnimationFillBehavior.Stop,
                Easing = new CubicEase {EasingMode = EasingMode.EaseInOut}
            };

            _timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 1) };
            _timer.Tick += (sender, args) => {
                RadAnimationManager.Play(TimeTextBlock, radScaleAnimation);
                var time = int.Parse(TimeTextBlock.Text);

                if (time > 10) {
                    TimeTextBlock.Text = (--time).ToString(CultureInfo.InvariantCulture);
                }
                else if (time > 0) {
                    TimeTextBlock.Text = "0" + --time;
                    TimeTextBlock.Foreground = new SolidColorBrush(Colors.Red);
                }
                else {
                    GameLose();
                    _timer.Stop();
                }
            };
            _timer.Start();
            if (!_tickerSoundEffectInstance.IsDisposed)
                _tickerSoundEffectInstance.Play();
        }
コード例 #6
0
        private void AddScore()
        {
            var currentScore = int.Parse(ScoreTextBlock.Text);
            var addScore = int.Parse(TimeTextBlock.Text);
            _answerFoundTime.Add(addScore);

            var scaleAndRotateAnimation = new RadScaleAnimation();
            scaleAndRotateAnimation.StartScaleX = 1.0;
            scaleAndRotateAnimation.EndScaleX = 1.5;
            scaleAndRotateAnimation.StartScaleY = 1.0;
            scaleAndRotateAnimation.EndScaleY = 1.5;
            scaleAndRotateAnimation.Duration = TimeSpan.FromSeconds(1);
            scaleAndRotateAnimation.AutoReverse = true;
            scaleAndRotateAnimation.Easing = new ElasticEase { Oscillations = 3 };

            ScoreTextBlock.Text = currentScore + addScore + string.Empty;

            RadAnimationManager.Play(ScoreTextBlock, scaleAndRotateAnimation);
        }