Пример #1
0
        private static IJobRepeat ActualRunRepeat(Action method, string tag, RepeatSettings repeatSettings)
        {
            CheckMethod(method);
            CheckDelay(repeatSettings.delay);

            JobRepeat jobRepeat = null;

            if (repeatSettings.repeats == INFINITY || repeatSettings.repeats > 0)                   //if repeats == 0 it does nothing

            {
                jobRepeat = new JobRepeat()
                {
                    TotalRepeatsNumber = repeatSettings.repeats
                };

                Sequence sequence = Sequence.MakeInstance();
                sequence.SetGroupTag(SuperInvokeTag.GetInstance(tag));
                sequence.AddSingleTask(SingleTask.MakeInstance(method, 0, tag));
                sequence.SetIterativeMode(repeatSettings);
                sequence.SetJob(jobRepeat);

                ScheduleBridge.Schedule(sequence);
            }

            return(jobRepeat);
        }
Пример #2
0
        private IJob ScheduleSequence(object repeatOpt = null)
        {
            IJob job = null;

            Sequence sequence = Sequence.MakeInstance();

            sequence.SetGroupTag(superInvokeTag);

            float seqDelay = 0;

            if (thereIsSequenceDelayToAdd)
            {
                seqDelay = sequenceDelayToAdd;
                thereIsSequenceDelayToAdd = false;
            }

            for (int i = 0; i < tasks.Count; i++)
            {
                DelayedTask t          = tasks[i];
                SingleTask  singleTask = SingleTask.MakeInstance(t.Method, seqDelay + t.DelayTime, null);
                seqDelay = 0;
                sequence.AddSingleTask(singleTask);
            }


            if (thereIsDelayToAdd)
            {
                SingleTask singleTask = SingleTask.MakeInstance(delegate {}, seqDelay + delayToAdd, null);
                sequence.AddSingleTask(singleTask);
            }
            else if (tasks.Count == 0)
            {
                SingleTask singleTask = SingleTask.MakeInstance(delegate {}, seqDelay, null);
                sequence.AddSingleTask(singleTask);
            }

            if (repeatOpt != null)
            {
                RepeatSettings repeatSettings = (RepeatSettings)repeatOpt;
                JobRepeat      jobRepeat      = new JobRepeat()
                {
                    TotalRepeatsNumber = repeatSettings.repeats
                };

                sequence.SetIterativeMode(repeatSettings);

                job = jobRepeat;
            }
            else
            {
                job = new Job();
            }

            sequence.SetJob(job);
            ScheduleBridge.Schedule(sequence);

            ResetStuff();

            return(job);
        }
Пример #3
0
        private static IJob ActualRun(Action method, float delay, string tag)
        {
            CheckMethod(method);
            CheckDelay(delay);

            Job job = new Job();
            ISuperInvokeRunnable runnable = SingleTask.MakeInstance(method, delay, tag);

            runnable.SetJob(job);

            ScheduleBridge.Schedule(runnable);
            return(job);
        }