示例#1
0
        public void ParallelWithOnlyInstantObservablesIsExecutedInstantly()
        {
            _parallel.Add(Observable.ReturnUnit());
            _parallel.AddAction(() => _value = 2);
            _parallel.Add(Observable.ReturnUnit());
            _parallel.Subscribe(() => _value = 3);

            Assert.That(_value, Is.EqualTo(3));
        }
示例#2
0
    private static void _initParallelThreadsPool()
    {
        Parallel pool = Parallel.CreateNew(Program.RUNNING_THREADS_IN_TEST_SIMULTANEOUSLY);

        pool.AllDone       += Program._allDoneHandler;
        pool.TaskDone      += Program._taskDoneHandler;
        pool.TaskException += Program._threadExceptionHandler;
        for (int i = 0; i < Program.RUNNING_THREADS_IN_TEST_TOTAL; i++)
        {
            pool.Add(new Pooler.TaskDelegate(Program._testTask), false, ThreadPriority.Lowest);
        }
        Thread.CurrentThread.Priority = ThreadPriority.Highest;
        Program._stopWatch            = Stopwatch.StartNew();
        Program._reportTimer          = new System.Threading.Timer(delegate {
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            Program._report();
        }, null, 0, 200);
        Program._pool = pool;
    }
示例#3
0
        public override void Configure(object target)
        {
            //Tween.Delay = Delay;
            //Tween.Duration = Duration;

            bool goingX = false;
            bool goingY = false;

            if (null != XTo || null != XBy)
            {
                goingX = true;
            }
            //throw new Exception("XTo nor XBy value not defined");

            if (null != YTo || null != YBy)
            {
                goingY = true;
            }
            //throw new Exception("YTo nor YBy value not defined");

            if (!goingX && !goingY)
            {
                Debug.LogWarning("Not X nor Y move");
                return;
            }

            Parallel parallel = new Parallel();

            if (goingX)
            {
                float xStart = (float)(XFrom ?? StartXValueReaderFunc(target));

                _tx = new Tween
                {
                    Name       = "MoveX",
                    Property   = "X",
                    Duration   = Duration,
                    Easer      = Easer,
                    StartValue = xStart,
                    EndValue   = XTo ?? xStart + XBy
                };

                parallel.Add(_tx);
            }

            if (goingY)
            {
                float yStart = (float)(YFrom ?? StartYValueReaderFunc(target));

                _ty = new Tween
                {
                    Name       = "MoveY",
                    Property   = "Y",
                    Duration   = Duration,
                    Easer      = Easer,
                    StartValue = yStart,
                    EndValue   = YTo ?? yStart + YBy
                };

                parallel.Add(_ty);
            }

            Tween = parallel;

            //Debug.Log("_tx.StartValue " + _tx.StartValue);
            //Debug.Log("_tx.EndValue " + _tx.EndValue);
            //Debug.Log("_ty.StartValue " + _ty.StartValue);
            //Debug.Log("_ty.EndValue " + _ty.EndValue);
        }
示例#4
0
        public override void Configure(object target)
        {
            //Tween.Delay = Delay;
            //Tween.Duration = Duration;

            bool goingX = false;
            bool goingY = false;

            if (null != WidthTo || null != WidthBy)
                goingX = true;
                //throw new Exception("XTo nor XBy value not defined");

            if (null != HeightTo || null != HeightBy)
                goingY = true;
                //throw new Exception("YTo nor YBy value not defined");

            if (!goingX && !goingY)
            {
                Debug.LogWarning("Not Width nor Height resize");
                return;
            }
                
            Parallel parallel = new Parallel();

            if (goingX)
            {
                float widthStart = (float)(WidthFrom ?? StartWidthValueReaderFunc(target));

                _tx = new Tween
                {
                    Name = "ResizeX",
                    Property = "Width",
                    Duration = Duration,
                    Easer = Easer,
                    StartValue = widthStart,
                    EndValue = WidthTo ?? widthStart + WidthBy
                };

                parallel.Add(_tx);
            }

            if (goingY)
            {
                float heightStart = (float)(HeightFrom ?? StartHeightValueReaderFunc(target));

                _ty = new Tween
                {
                    Name = "ResizeY",
                    Property = "Height",
                    Duration = Duration,
                    Easer = Easer,
                    StartValue = heightStart,
                    EndValue = HeightTo ?? heightStart + HeightBy
                };

                parallel.Add(_ty);
            }

            Tween = parallel;

            //Debug.Log("_tx.StartValue " + _tx.StartValue);
            //Debug.Log("_tx.EndValue " + _tx.EndValue);
            //Debug.Log("_ty.StartValue " + _ty.StartValue);
            //Debug.Log("_ty.EndValue " + _ty.EndValue);
        }
示例#5
0
        public override void Configure(object target)
        {
            //Tween.Delay = Delay;
            //Tween.Duration = Duration;

            bool goingX = false;
            bool goingY = false;

            if (null != WidthTo || null != WidthBy)
            {
                goingX = true;
            }
            //throw new Exception("XTo nor XBy value not defined");

            if (null != HeightTo || null != HeightBy)
            {
                goingY = true;
            }
            //throw new Exception("YTo nor YBy value not defined");

            if (!goingX && !goingY)
            {
                Debug.LogWarning("Not Width nor Height resize");
                return;
            }

            Parallel parallel = new Parallel();

            if (goingX)
            {
                float widthStart = (float)(WidthFrom ?? StartWidthValueReaderFunc(target));

                _tx = new Tween
                {
                    Name       = "ResizeX",
                    Property   = "Width",
                    Duration   = Duration,
                    Easer      = Easer,
                    StartValue = widthStart,
                    EndValue   = WidthTo ?? widthStart + WidthBy
                };

                parallel.Add(_tx);
            }

            if (goingY)
            {
                float heightStart = (float)(HeightFrom ?? StartHeightValueReaderFunc(target));

                _ty = new Tween
                {
                    Name       = "ResizeY",
                    Property   = "Height",
                    Duration   = Duration,
                    Easer      = Easer,
                    StartValue = heightStart,
                    EndValue   = HeightTo ?? heightStart + HeightBy
                };

                parallel.Add(_ty);
            }

            Tween = parallel;

            //Debug.Log("_tx.StartValue " + _tx.StartValue);
            //Debug.Log("_tx.EndValue " + _tx.EndValue);
            //Debug.Log("_ty.StartValue " + _ty.StartValue);
            //Debug.Log("_ty.EndValue " + _ty.EndValue);
        }