예제 #1
0
 public void AnimalionRender(int animationIndex, InterpolationValue animationFrameInterpolation, InterpolationValue animationInterpolation)
 {
     control.Invoke((EventHandler) delegate
     {
         control.Location = new Point((int)(control.Location.X + animationFrameInterpolation.V1), (int)(control.Location.Y + animationFrameInterpolation.V2));
     });
 }
예제 #2
0
    private IEnumerator DoBoardDropInAnimation(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        s_centerOffset = new Vector3(Random.Range(0, 11), Random.Range(0, 11), Random.Range(0, 11));

        InterpolationValue interpolationMethod = null;

        if (Random.value > 0.5f)
        {
            interpolationMethod = Interpolation.BounceOut;
        }
        else
        {
            interpolationMethod = Interpolation.ElasticOut;
        }

        Node.DropInInfo dropInInfo = new Node.DropInInfo
        {
            animationLength       = 2.0f,
            hitThreshold          = 0.05f,
            beginOffsetDelegate   = Random.value > 0.5f ? UseOrthagonalOffsetFunction() : WaveOffset,
            interpolationDelegate = interpolationMethod
        };

        BroadcastMessage("DropIn", dropInInfo);
    }
예제 #3
0
 public void AnimalionRender(int animationIndex, InterpolationValue animationFrameInterpolation, InterpolationValue animationInterpolation)
 {
     index = animationIndex;
     this.Invoke((EventHandler) delegate
     {
         Opacity += 0.05;
     });
 }
예제 #4
0
        public void AnimalionRender(int animationIndex, InterpolationValue animationFrameInterpolation, InterpolationValue animationInterpolation)
        {
            index = animationIndex;
            if (!IsIntelligence)
            {
                switch (MyDisplayStyle)
                {
                case DisplayStyle.Default:
                    BackColor = Color.FromArgb(index, 75, 75, 75);
                    break;

                case DisplayStyle.Black2RedBackground:
                    BackColor = Color.FromArgb(index * 6 + 50, 254, 67, 101);
                    break;

                default:
                    BackColor = Color.FromArgb(index, 75, 75, 75);
                    break;
                }
            }
            Invalidate();
        }
예제 #5
0
 public void AnimalionRender(int animationIndex, InterpolationValue animationFrameInterpolation, InterpolationValue animationInterpolation)
 {
     index = animationIndex;
     Invalidate();
 }
예제 #6
0
 public void AnimalionRender(int animationIndex, InterpolationValue animationFrameInterpolation, InterpolationValue animationInterpolation)
 {
 }
예제 #7
0
        /// <summary>
        /// 开始动画
        /// </summary>
        public void StartAnimalion()
        {
            AnimationState = AnimationStates.AnimationStart;
            if (OnAnimationStartEvent != null)
            {
                OnAnimationStartEvent();
            }
            //准备动画
            if (iAnimalionInterface != null)
            {
                iAnimalionInterface.PrepareAnimalion();
            }
            Thread animalThread = new Thread(() =>
            {
                if (iInterpolation != null)
                {
                    AnimationFrameInterpolation = iInterpolation.GetInterpolationValue();
                }
                DateTime startAnimationTime;
                int sleepTime;
                AnimationState = AnimationStates.AnimationRuning;
                while (AnimationState != AnimationStates.AnimationStop)
                {
                    startAnimationTime = DateTime.Now;
                    //动画绘制
                    if (iAnimalionInterface != null)
                    {
                        iAnimalionInterface.AnimalionRender(AnimationIndex, AnimationFrameInterpolation, AnimationInterpolation);
                    }

                    AnimationIndex++;
                    if (iInterpolation != null)
                    {
                        AnimationFrameInterpolation = iInterpolation.GetInterpolationValue();
                        AnimationInterpolation.V1  += AnimationFrameInterpolation.V1;
                        AnimationInterpolation.V2  += AnimationFrameInterpolation.V2;
                        AnimationInterpolation.Tag  = AnimationFrameInterpolation.Tag;
                    }
                    AnimalionUsedTimeMilliseconds = AnimationIndex * DelayTime;

                    //如果超过设定的动画时间, 结束动画(如果动画时间为负数,不停止动画)
                    if (AnimalionTime > 0 && AnimalionUsedTimeMilliseconds >= AnimalionTime)
                    {
                        StopAnimation();
                    }
                    //每帧动画结束
                    if (iAnimalionInterface != null)
                    {
                        iAnimalionInterface.FrameAnimationFinished();
                    }
                    if (OnFrameAnimationEndEvent != null)
                    {
                        OnFrameAnimationEndEvent();
                    }
                    //暂停动画
                    if (AnimationState == AnimationStates.AnimationPause)
                    {
                        if (OnAnimationPauseWvent != null)
                        {
                            OnAnimationPauseWvent();
                        }
                        while (AnimationState == AnimationStates.AnimationPause)
                        {
                            Thread.Sleep(200);
                        }
                    }
                    sleepTime = (int)(DelayTime - (DateTime.Now - startAnimationTime).TotalMilliseconds);
                    try
                    {
                        if (sleepTime > 0)
                        {
                            Thread.Sleep(sleepTime);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                if (OnAnimationFinishedEvent != null)
                {
                    OnAnimationFinishedEvent();
                }
            });

            animalThread.IsBackground = true;
            animalThread.Priority     = ThreadPriority.Highest;
            animalThread.Start();
        }