Example #1
0
        public override void OnEnd(Activity span)
        {
            EndAction?.Invoke(span);

            if (_CollectEndedSpans)
            {
                EndedActivityObjects.Add(span);
            }
        }
Example #2
0
 public override void Exit()
 {
     EndAction?.Invoke();
     if (currentTime < timeWait)
     {
         _switcher.SetState(nextAttack);
     }
     else
     {
         _switcher.SetState(endState);
     }
 }
Example #3
0
        public void Tick()
        {
            currentData.Invoke();

            if (!currentData.CheckEnd())
            {
                if (dataQueue.Count == 0)
                {
                    EndAction?.Invoke();
                    Dispose();
                    return;
                }
                currentData = dataQueue.Dequeue();
            }
        }
Example #4
0
        async Task ASyncFunc00(EndAction endFunc)
        {
            Debug.Log("---Start---");
            for (var i = 0; i < 10; ++i)
            {
                await Task.Delay(2);

                Debug.Log($"Count:{i}");
            }
            Debug.Log("---End---");

            // 終了を通知
            if (endFunc != null)
            {
                endFunc.Invoke();
            }
        }
Example #5
0
    // コルーチンで処理
    IEnumerator CoroutineFunc00(EndAction endFunc)
    {
        Debug.Log("---Start---");
        for (var i = 0; i < 10; ++i)
        {
            yield return(new WaitForSeconds(0.01f));

            Debug.Log($"Count:{i}");
        }
        Debug.Log("---End---");

        // 終了を通知
        if (endFunc != null)
        {
            endFunc.Invoke();
        }
    }
Example #6
0
        public void Tick()
        {
            if (update)
            {
                time -= Time.deltaTime;
            }

            if (TimeHasCome())
            {
                if (EndAction != null)
                {
                    if (OtoReset)
                    {
                        EndAction.Invoke();
                        Reset();
                        return;
                    }
                    EndAction.Invoke();
                    Dispose();
                }
            }
        }
Example #7
0
 public Task StopAsync(CancellationToken cancellationToken)
 {
     EndAction?.Invoke();
     return(Task.CompletedTask);
 }
Example #8
0
 private void ClosingEventHandler(object sender, DialogClosingEventArgs eventArgs)
 {
     EndAction.Invoke(null);
 }
Example #9
0
 private void OnAnimationEnd()
 {
     callback?.Invoke();
     Destroy(gameObject);
 }
Example #10
0
        private void End(Image FinalDiceImage)
        {
            Storyboard      FadeStoryboard             = new Storyboard();
            DoubleAnimation DiceImage_OpacityAnimation = new DoubleAnimation()
            {
                From           = 1,
                To             = 0,
                Duration       = TimeSpan.FromSeconds(0.5),
                EasingFunction = new ExponentialEase()
                {
                    EasingMode = EasingMode.EaseIn
                }
            };

            Storyboard.SetTargetProperty(DiceImage_OpacityAnimation, new PropertyPath("Opacity"));
            FadeStoryboard.Children.Add(DiceImage_OpacityAnimation);
            DoubleAnimationUsingKeyFrames DiceImage_ScaleXAnimation = new DoubleAnimationUsingKeyFrames()
            {
                KeyFrames =
                {
                    new EasingDoubleKeyFrame(0, TimeSpan.FromSeconds(0.5), new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseIn
                    })
                }
            };

            Storyboard.SetTarget(DiceImage_ScaleXAnimation, FinalDiceImage);
            Storyboard.SetTargetProperty(DiceImage_ScaleXAnimation, new PropertyPath("RenderTransform.(ScaleTransform.ScaleX)"));
            FadeStoryboard.Children.Add(DiceImage_ScaleXAnimation);
            DoubleAnimationUsingKeyFrames DiceImage_ScaleYAnimation = new DoubleAnimationUsingKeyFrames()
            {
                KeyFrames =
                {
                    new EasingDoubleKeyFrame(0, TimeSpan.FromSeconds(0.5), new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseIn
                    })
                }
            };

            Storyboard.SetTarget(DiceImage_ScaleYAnimation, FinalDiceImage);
            Storyboard.SetTargetProperty(DiceImage_ScaleYAnimation, new PropertyPath("RenderTransform.(ScaleTransform.ScaleY)"));
            FadeStoryboard.Children.Add(DiceImage_ScaleYAnimation);

            Success = Result + 1 > Expected;
            if (Success)
            {
                EllipseBackground.Fill = EllipseBackground.Fill.Clone();
                ((SolidColorBrush)EllipseBackground.Fill).BeginAnimation(SolidColorBrush.ColorProperty, new ColorAnimation()
                {
                    From           = ((SolidColorBrush)EllipseBackground.Fill).Color,
                    To             = Colors.DarkGreen,
                    Duration       = TimeSpan.FromSeconds(1),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseInOut
                    }
                });

                DoubleAnimation CountResetAnimation = new DoubleAnimation()
                {
                    From           = 1,
                    To             = 0,
                    Duration       = TimeSpan.FromSeconds(1),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseInOut
                    }
                };
                CountResetAnimation.Completed += delegate
                {
                    ((SolidColorBrush)CountProgressBar.Foreground).BeginAnimation(SolidColorBrush.ColorProperty, null);
                    CountProgressBar.BeginAnimation(RangeBase.ValueProperty, null);
                    CountProgressBar.BeginAnimation(OpacityProperty, null);
                    ((SolidColorBrush)EllipseBackground.Fill).BeginAnimation(SolidColorBrush.ColorProperty, null);

                    ((SolidColorBrush)EllipseBackground.Fill).Color = Colors.DarkGreen;
                    CountProgressBar.Value      = 0;
                    CountProgressBar.Opacity    = 1;
                    CountProgressBar.Foreground = Brushes.White;
                };
                CountProgressBar.Foreground = CountProgressBar.Foreground.Clone();
                ((SolidColorBrush)CountProgressBar.Foreground).BeginAnimation(SolidColorBrush.ColorProperty,
                                                                              new ColorAnimation()
                {
                    From           = ((SolidColorBrush)CountProgressBar.Foreground).Color,
                    To             = Colors.LimeGreen,
                    Duration       = TimeSpan.FromSeconds(1),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseInOut
                    }
                });
                CountProgressBar.BeginAnimation(OpacityProperty, CountResetAnimation);

                FadeStoryboard.Completed += (Sender, E) =>
                {
                    DiceCanvas.Children.Remove(FinalDiceImage);
                    DiceText.Text       = "Succeeded";
                    DiceText.Visibility = Visibility.Visible;

                    DoubleAnimation OpacityAnimation = new DoubleAnimation()
                    {
                        From           = 0,
                        To             = 1,
                        Duration       = TimeSpan.FromSeconds(0.5),
                        EasingFunction = new ExponentialEase()
                        {
                            EasingMode = EasingMode.EaseOut
                        }
                    };
                    OpacityAnimation.Completed += delegate
                    {
                        DispatcherTimer Timer = new DispatcherTimer()
                        {
                            Interval = TimeSpan.FromSeconds(1)
                        };
                        Timer.Tick += delegate
                        {
                            this.Collapse();
                            EndAction?.Invoke();
                            Timer.Stop();
                        };
                        Timer.Start();
                    };
                    DiceText.BeginAnimation(OpacityProperty, OpacityAnimation);
                };
            }
            else
            {
                EllipseBackground.Fill = EllipseBackground.Fill.Clone();
                ((SolidColorBrush)EllipseBackground.Fill).BeginAnimation(SolidColorBrush.ColorProperty, new ColorAnimation()
                {
                    From           = ((SolidColorBrush)EllipseBackground.Fill).Color,
                    To             = Colors.DarkRed,
                    Duration       = TimeSpan.FromSeconds(1),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseInOut
                    }
                });

                DoubleAnimation CountResetAnimation = new DoubleAnimation()
                {
                    From           = 100,
                    To             = 0,
                    Duration       = TimeSpan.FromSeconds(1),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseIn
                    }
                };
                CountResetAnimation.Completed += delegate
                {
                    ((SolidColorBrush)CountProgressBar.Foreground).BeginAnimation(SolidColorBrush.ColorProperty, null);
                    CountProgressBar.BeginAnimation(RangeBase.ValueProperty, null);
                    CountProgressBar.BeginAnimation(OpacityProperty, null);
                    ((SolidColorBrush)EllipseBackground.Fill).BeginAnimation(SolidColorBrush.ColorProperty, null);

                    ((SolidColorBrush)EllipseBackground.Fill).Color = Colors.DarkRed;
                    CountProgressBar.Value      = 0;
                    CountProgressBar.Opacity    = 1;
                    CountProgressBar.Foreground = Brushes.White;
                };
                CountProgressBar.Foreground = CountProgressBar.Foreground.Clone();
                ((SolidColorBrush)CountProgressBar.Foreground).BeginAnimation(SolidColorBrush.ColorProperty,
                                                                              new ColorAnimation()
                {
                    From           = ((SolidColorBrush)CountProgressBar.Foreground).Color,
                    To             = Colors.Red,
                    Duration       = TimeSpan.FromSeconds(1),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseInOut
                    }
                });
                CountProgressBar.BeginAnimation(RangeBase.ValueProperty, CountResetAnimation);

                FadeStoryboard.Completed += (Sender, E) =>
                {
                    DiceCanvas.Children.Remove(FinalDiceImage);
                    DiceText.Text       = "Failed";
                    DiceText.Visibility = Visibility.Visible;

                    DoubleAnimation OpacityAnimation = new DoubleAnimation()
                    {
                        From           = 0,
                        To             = 1,
                        Duration       = TimeSpan.FromSeconds(0.5),
                        EasingFunction = new ExponentialEase()
                        {
                            EasingMode = EasingMode.EaseOut
                        }
                    };
                    OpacityAnimation.Completed += delegate
                    {
                        DispatcherTimer Timer = new DispatcherTimer()
                        {
                            Interval = TimeSpan.FromSeconds(1)
                        };
                        Timer.Tick += delegate
                        {
                            this.Collapse();
                            EndAction?.Invoke();
                            Timer.Stop();
                        };
                        Timer.Start();
                    };
                    DiceText.BeginAnimation(OpacityProperty, OpacityAnimation);
                };
            }

            FadeStoryboard.Begin(FinalDiceImage);
        }
Example #11
0
 public void OnTransitionEnd(Transition transition)
 {
     EndAction?.Invoke();
 }
Example #12
0
 public void Dispose()
 {
     EndAction.Invoke();
 }