示例#1
0
        public async void TestAnimationCreateFrames()
        {
            //Set DebugMode to debug with Fiddler
            //Bootstrapper.DebugMode = true;

            var tests = new ChromaInstanceTests();
            var instance = await tests.Instance_ReturnValidInstance();

            var testAnimation = new TestAnimation(instance);
            testAnimation.AnimationState += (devices, frame, result) =>
            {
                Console.WriteLine($"Devices: {string.Join(",", devices)}, Frame: {frame} of {testAnimation.Frames.Count}, Effects: {string.Join(",", devices.Select(x=>x.EffectId))} Result: {string.Join(",", result)}");
            };

            testAnimation.CreateFrames();

            var playTask = testAnimation.Play();
            await Task.Delay(20000);
            await testAnimation.Stop();
        }
示例#2
0
    public bool PlayMec(Vector2 playindex)
    {
        TestAnimation t = GetAnimation((int)playindex.x);

        if (t != null)
        {
            t.isPositive = true;
            t.Play(this.time, this.step, this.distance);
            t.SetAction(this.actiontime * t.GetAlltime(), delegate
            {
                call1 = true;
            });
        }
        else
        {
            return(false);
        }


        //can add animation before play inverse animation
        pauseStartTime = Time.time;
        pauseAction    = delegate
        {
            pauseAction = null;
            TestAnimation tt = GetAnimation((int)playindex.y);
            if (tt != null)
            {
                tt.isPositive = false;
                Vector3 newTime     = new Vector3(this.time.z, this.time.y, this.time.x);
                Vector3 newStep     = new Vector3(this.step.z, this.step.y, this.step.x);
                Vector2 newDistance = new Vector2(this.distance.y, this.distance.x);
                tt.Play(newTime, -newStep, newDistance);
                tt.SetAction(this.actiontime * tt.GetAlltime(), delegate
                {
                    call2 = true;
                });
            }
        };
        return(true);
    }