Esempio n. 1
0
        /// <summary>
        /// Removes a single AI delegate from the page's schedule.
        /// </summary>
        /// <param name="time">The time at which the delegate to remove is running.</param>
        /// <param name="target">The object owning the delegate to remove.</param>
        /// <returns>The removed delegate, or null if not found.</returns>
        public PageCallbackInfo RemoveAIDelegate(Int64 time, IPageCallbacker target)
        {
            List <PageCallbackInfo> foo = null;

            if (this.aiDispatchTable.TryGetValue(time, out foo) == true)
            {
                List <PageCallbackInfo> remList = new List <PageCallbackInfo>();
                foreach (PageCallbackInfo p in foo)
                {
                    if (p.Target == target)
                    {
                        remList.Add(p);
                    }
                }
                foreach (PageCallbackInfo p in remList)
                {
                    foo.Remove(p);
                    return(p);
                }
            }
            return(null);
        }
Esempio n. 2
0
 public PageCallbackInfo(Int64 callTime, IPageCallbacker target, PageActionDelegate method)
 {
     this.CallTime = callTime;
     this.Target   = target;
     this.Method   = method;
 }
Esempio n. 3
0
 public PageCallbackInfo(Int64 callTime, IPageCallbacker target, PageActionDelegate method)
 {
     this.CallTime = callTime;
     this.Target = target;
     this.Method = method;
 }
Esempio n. 4
0
 /// <summary>
 /// Removes all delegates from the specified IPageCallbacker from the
 /// page scheduler, and returns them. Used primarily to get a list of
 /// callbacks that must transition during a page move.
 /// </summary>
 /// <param name="target">The target whose callbacks to remove.</param>
 /// <returns>A list of all callbacks started by the specified IPageCallbacker.</returns>
 public List <PageCallbackInfo> RemoveAllAIDelegates(IPageCallbacker target)
 {
     return(this.RemoveAllAIDelegates(new IPageCallbacker[] { target }));
 }
Esempio n. 5
0
 /// <summary>
 /// Allows an IPageCallbacker (the page itself or an Entity) to register a
 /// callback for some future point in time. Designed for AI calls from entities,
 /// hence the name.
 /// </summary>
 /// <param name="timeToCall">The future tick to invoke the delegate at.</param>
 /// <param name="target">The object that requests this AI call; used for later culling.</param>
 /// <param name="callbackFunction">The delegate for the function to call.</param>
 public void RegisterAIDelegate(Int64 timeToCall, IPageCallbacker target, PageActionDelegate callbackFunction)
 {
     this.RegisterAIDelegate(new PageCallbackInfo(timeToCall, target, callbackFunction));
 }
Esempio n. 6
0
 /// <summary>
 /// Removes all delegates from the specified IPageCallbacker from the
 /// page scheduler, and returns them. Used primarily to get a list of
 /// callbacks that must transition during a page move.
 /// </summary>
 /// <param name="target">The target whose callbacks to remove.</param>
 /// <returns>A list of all callbacks started by the specified IPageCallbacker.</returns>
 public List<PageCallbackInfo> RemoveAllAIDelegates(IPageCallbacker target)
 {
     return this.RemoveAllAIDelegates(new IPageCallbacker[] { target } );
 }
Esempio n. 7
0
 /// <summary>
 /// Removes a single AI delegate from the page's schedule.
 /// </summary>
 /// <param name="time">The time at which the delegate to remove is running.</param>
 /// <param name="target">The object owning the delegate to remove.</param>
 /// <returns>The removed delegate, or null if not found.</returns>
 public PageCallbackInfo RemoveAIDelegate(Int64 time, IPageCallbacker target)
 {
     List<PageCallbackInfo> foo = null;
     if (this.aiDispatchTable.TryGetValue(time, out foo) == true)
     {
         List<PageCallbackInfo> remList = new List<PageCallbackInfo>();
         foreach (PageCallbackInfo p in foo)
         {
             if (p.Target == target)
                 remList.Add(p);
         }
         foreach (PageCallbackInfo p in remList)
         {
             foo.Remove(p);
             return p;
         }
     }
     return null;
 }
Esempio n. 8
0
 /// <summary>
 /// Allows an IPageCallbacker (the page itself or an Entity) to register a
 /// callback for some future point in time. Designed for AI calls from entities,
 /// hence the name.
 /// </summary>
 /// <param name="timeToCall">The future tick to invoke the delegate at.</param>
 /// <param name="target">The object that requests this AI call; used for later culling.</param>
 /// <param name="callbackFunction">The delegate for the function to call.</param>
 public void RegisterAIDelegate(Int64 timeToCall, IPageCallbacker target, PageActionDelegate callbackFunction)
 {
     this.RegisterAIDelegate(new PageCallbackInfo(timeToCall, target, callbackFunction));
 }