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

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

            if (!currentData.CheckEnd())
            {
                if (dataQueue.Count == 0)
                {
                    EndAction?.Invoke();
                    Dispose();
                    return;
                }
                currentData = dataQueue.Dequeue();
            }
        }
示例#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();
            }
        }
示例#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();
        }
    }
        public String serialized()
        {
            string header = "VERSION:" + Utilities.trackFileFormat + "\n"
                            + "[HEADER]\n"
                            + "VESSELNAME:" + VesselName + "\n"
                            + "DESCRIPTION:" + Description + "\n"
                            + "VISIBLE:" + (isVisible ? "1" : "0") + "\n"
                            + "MAINBODY:" + referenceBody.GetName() + "\n"
                            + "SAMPLING:" + SamplingFactor + "\n"
                            + "LINECOLOR:" + LineColor.r + ";" + LineColor.g + ";" + LineColor.b + ";" + LineColor.a + "\n"
                            + "LINEWIDTH:" + LineWidth + "\n"
                            + "CONERADIUSFACTOR:" + ConeRadiusToLineWidthFactor + "\n"
                            + "NUMDIRECTIONMARKERS:" + NumDirectionMarkers + "\n"
                            + "REPLAYCOLLIDERS:" + (ReplayColliders? "1":"0") + "\n"
                            + "END:" + EndAction.ToString("F") + (EndAction == EndActions.LOOP ? ":" + LoopClosureTime.ToString() : "") + "\n"; //"F" makes creates a string literal


            string points = "[WAYPOINTS]\n";

            foreach (Waypoint waypoint in waypoints)
            {
                points +=
                    waypoint.recordTime + ";"
                    + waypoint.latitude + ";"
                    + waypoint.longitude + ";"
                    + waypoint.altitude + ";"
                    + waypoint.orientation.x + ";" + waypoint.orientation.y + ";" + waypoint.orientation.z + ";" + waypoint.orientation.w + ";"
                    + waypoint.velocity.x + ";" + waypoint.velocity.y + ";" + waypoint.velocity.z + "\n";
            }

            string logs = "[LOGENTRIES]\n";

            foreach (LogEntry entry in logEntries)
            {
                logs += entry.recordTime + ";"
                        + entry.latitude + ";"
                        + entry.longitude + ";"
                        + entry.altitude + ";"
                        + entry.orientation.x + ";" + entry.orientation.y + ";" + entry.orientation.z + ";" + entry.orientation.w + ";"
                        + entry.velocity.x + ";" + entry.velocity.y + ";" + entry.velocity.z + ";"
                        + entry.label + ";"
                        + entry.description + "\n";
            }

            return(header + points + logs);
        }
示例#7
0
        public void Tick()
        {
            if (update)
            {
                time -= Time.deltaTime;
            }

            if (TimeHasCome())
            {
                if (EndAction != null)
                {
                    if (OtoReset)
                    {
                        EndAction.Invoke();
                        Reset();
                        return;
                    }
                    EndAction.Invoke();
                    Dispose();
                }
            }
        }
示例#8
0
 public Task StopAsync(CancellationToken cancellationToken)
 {
     EndAction?.Invoke();
     return(Task.CompletedTask);
 }
示例#9
0
 private void ClosingEventHandler(object sender, DialogClosingEventArgs eventArgs)
 {
     EndAction.Invoke(null);
 }
示例#10
0
 public void Init(string textString, EndAction callback)
 {
     this.textString = textString;
     this.callback   = callback;
 }
示例#11
0
 public void SetEndAction(int value)
 {
     endAction = (EndAction)value;
 }
示例#12
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);
        }
示例#13
0
 public void OnTransitionEnd(Transition transition)
 {
     EndAction?.Invoke();
 }
示例#14
0
 public void Dispose()
 {
     EndAction.Invoke();
 }