示例#1
0
 private void invalidate_entry(Node node, DSchedulerFunc func)
 {
     if (this.m_nodes.Contains(node))
     {
         foreach (Scheduler.Entry current in node.m_scheduler_entries)
         {
             if (current.m_func == func)
             {
                 current.invalidate();
             }
         }
     }
 }
示例#2
0
 private Scheduler.Entry add_entry(Node node, DSchedulerFunc func, float interval)
 {
     Scheduler.Entry entry = new Scheduler.Entry
     {
         m_node     = node,
         m_func     = func,
         m_interval = interval
     };
     if (!this.m_nodes.Contains(node))
     {
         this.m_nodes.Add(node);
     }
     if (node.m_scheduler_entries == null)
     {
         node.m_scheduler_entries = new List <Scheduler.Entry>();
     }
     node.m_scheduler_entries.Add(entry);
     return(entry);
 }
示例#3
0
 internal void invalidate()
 {
     this.m_node = null;
     this.m_func = null;
 }
示例#4
0
 public void Unschedule(Node target, DSchedulerFunc func)
 {
     this.invalidate_entry(target, func);
 }
示例#5
0
 public void Schedule(Node target, DSchedulerFunc func, float interval, bool paused, int priority = 0)
 {
     this.schedule_internal(target, func, interval, priority);
     target.SchedulerPaused = paused;
 }
示例#6
0
 private void schedule_internal(Node target, DSchedulerFunc func, float interval, int priority)
 {
     Scheduler.Entry entry = this.add_entry(target, func, interval);
     this.m_groups[3 + priority].Add(entry);
 }
示例#7
0
 internal void invalidate()
 {
     m_node = null;
     m_func = null;
 }
示例#8
0
 void schedule_internal( Node target, DSchedulerFunc func, float interval, int priority )
 {
     Entry entry = add_entry( target, func, interval );
     m_groups[ max_priority + priority ].Add( entry );
 }
示例#9
0
 /// <summary>Schedule node function 'func' so it gets called every 'interval' seconds.</summary>
 public void ScheduleInterval( DSchedulerFunc func, float interval, int priority = Scheduler.DefaultPriority )
 {
     Scheduler.Instance.Schedule( this, func, interval, !m_is_running, priority );
 }
示例#10
0
        Entry add_entry( Node node, DSchedulerFunc func, float interval )
        {
            Entry entry = new Entry()
            {
                m_node = node,
                m_func = func,
                m_interval = interval,
            };

            if ( !m_nodes.Contains( node ) )
                m_nodes.Add( node );

            if ( node.m_scheduler_entries == null )
                node.m_scheduler_entries = new List< Entry >();

            node.m_scheduler_entries.Add( entry );

            return entry;
        }
示例#11
0
 /// <summary>
 /// Remove a function from the scheduler.
 /// </summary>
 /// <param name="target">The target node for the removed function.</param>
 /// <param name="func">The function to remove.</param>
 public void Unschedule( Node target, DSchedulerFunc func )
 {
     invalidate_entry( target, func );
 }
示例#12
0
 /// <summary>
 /// Register a Node function in the scheduler.
 /// </summary>
 /// <param name="target">The target node for the scheduled function.</param>
 /// <param name="func">The scheduled function.</param>
 /// <param name="interval">Period at which the function should be called (in seconds). Zero means "everyframe".</param>
 /// <param name="paused">Set the scheduler paused state for that node.</param>
 public void Schedule( Node target, DSchedulerFunc func, float interval, bool paused, int priority = DefaultPriority )
 {
     schedule_internal( target, func, interval, priority );
     target.SchedulerPaused = paused;
 }
示例#13
0
 public void Unschedule(DSchedulerFunc func)
 {
     Scheduler.Instance.Unschedule(this, func);
 }
示例#14
0
 public void ScheduleInterval(DSchedulerFunc func, float interval, int priority = 0)
 {
     Scheduler.Instance.Schedule(this, func, interval, !this.m_is_running, priority);
 }
示例#15
0
 public void Schedule(DSchedulerFunc func, int priority = 0)
 {
     Scheduler.Instance.Schedule(this, func, 0f, !this.m_is_running, priority);
 }
示例#16
0
 /// <summary>Unschedule node function 'func'.</summary>
 public void Unschedule( DSchedulerFunc func )
 {
     Scheduler.Instance.Unschedule( this, func );
 }
示例#17
0
        void invalidate_entry( Node node, DSchedulerFunc func )
        {
            if ( !m_nodes.Contains( node ) )
                return;	// no such node

            foreach ( Entry entry in node.m_scheduler_entries )
            {
                if ( entry.m_func == func )
                    entry.invalidate();
            }
        }
示例#18
0
 /// <summary>Schedule node function 'func', it will get called everyframe.</summary>
 public void Schedule( DSchedulerFunc func, int priority = Scheduler.DefaultPriority )
 {
     Scheduler.Instance.Schedule( this, func, 0.0f, !m_is_running, priority );
 }