コード例 #1
0
 public virtual bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     this.m_pDelegate         = pDelegate;
     this.m_nPriority         = nPriority;
     this.m_nEnabledSelectors = 0;
     return(true);
 }
コード例 #2
0
        /// <summary>
        /// allocates a TouchHandler with a delegate and a priority
        /// </summary>
        public static CCTouchHandler Create(ICCTouchDelegate pDelegate, int nPriority)
        {
            var pHandler = new CCTouchHandler();

            pHandler.InitWithDelegate(pDelegate, nPriority);
            return(pHandler);
        }
コード例 #3
0
        public CCTouchHandler findHandler(ICCTouchDelegate pDelegate)
        {
            CCTouchHandler cCTouchHandler;

            foreach (CCTouchHandler mPTargetedHandler in this.m_pTargetedHandlers)
            {
                if (mPTargetedHandler.Delegate != pDelegate)
                {
                    continue;
                }
                cCTouchHandler = mPTargetedHandler;
                return(cCTouchHandler);
            }
            List <CCTouchHandler> .Enumerator enumerator = this.m_pStandardHandlers.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    CCTouchHandler current = enumerator.Current;
                    if (current.Delegate != pDelegate)
                    {
                        continue;
                    }
                    cCTouchHandler = current;
                    return(cCTouchHandler);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(cCTouchHandler);
        }
コード例 #4
0
        /// <summary>
        /// initializes a TouchHandler with a delegate and a priority 
        /// </summary>
        public virtual bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            m_pDelegate = pDelegate;
            m_nPriority = nPriority;
            m_nEnabledSelectors = 0;

            return true;
        }
コード例 #5
0
ファイル: CCTouchHandler.cs プロジェクト: ununian/cocos2d-xna
        /// <summary>
        /// initializes a TouchHandler with a delegate and a priority
        /// </summary>
        protected virtual bool InitWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            m_pDelegate         = pDelegate;
            m_nPriority         = nPriority;
            m_nEnabledSelectors = 0;

            return(true);
        }
コード例 #6
0
        /// <summary>
        /// Changes the priority of a previously added delegate.
        /// The lower the number, the higher the priority
        /// </summary>
        public void SetPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = FindHandler(pDelegate);

            handler.Priority = nPriority;

            RearrangeHandlers(m_pTargetedHandlers);
            RearrangeHandlers(m_pStandardHandlers);
        }
コード例 #7
0
        public static CCTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            CCTouchHandler handler = new CCTouchHandler();

            if (handler.initWithDelegate(pDelegate, nPriority))
            {
                return(null);
            }
            return(null);
        }
コード例 #8
0
        /// <summary>
        /// Changes the priority of a previously added delegate.
        /// The lower the number, the higher the priority
        /// </summary>
        public void setPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = null;

            handler          = this.findHandler(pDelegate);
            handler.Priority = nPriority;

            this.rearrangeHandlers(m_pTargetedHandlers);
            this.rearrangeHandlers(m_pStandardHandlers);
        }
コード例 #9
0
        /// <summary>
        /// Use this to update the priority of the given delegate when its graph priority
        /// changes due to a parenting change.
        /// </summary>
        /// <param name="d"></param>
        public void UpdateGraphPriority(ICCTouchDelegate d)
        {
            CCTouchHandler h = FindHandler(d);

            if (h != null)
            {
                h.Priority = d.TouchPriority;
                RearrangeAllHandlersUponTouch();
            }
        }
コード例 #10
0
        /// <summary>
        ///  initializes a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not
        /// </summary>
        public bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority, bool bSwallow)
        {
            if (base.initWithDelegate(pDelegate, nPriority))
            {
                m_pClaimedTouches = new List<CCTouch>();
                m_bSwallowsTouches = bSwallow;

                return true;
            }

            return false;
        }
コード例 #11
0
 public void removeDelegate(ICCTouchDelegate pDelegate)
 {
     if (pDelegate == null)
     {
         return;
     }
     if (!this.m_bLocked)
     {
         this.forceRemoveDelegate(pDelegate);
         return;
     }
     this.m_pHandlersToRemove.Add(pDelegate);
     this.m_bToRemove = true;
 }
コード例 #12
0
        /// <summary>
        /// allocates a TouchHandler with a delegate and a priority 
        /// </summary>
        public static CCTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            CCTouchHandler pHandler = new CCTouchHandler();

            if (pHandler.initWithDelegate(pDelegate, nPriority))
            {
                pHandler = null;
            }
            else
            {
                pHandler = null;
            }

            return pHandler;
        }
コード例 #13
0
ファイル: CCTouchHandler.cs プロジェクト: liwq-net/liwq718
        /// <summary>
        /// allocates a TouchHandler with a delegate and a priority
        /// </summary>
        public static CCTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
        {
            CCTouchHandler pHandler = new CCTouchHandler();

            if (pHandler.initWithDelegate(pDelegate, nPriority))
            {
                pHandler = null;
            }
            else
            {
                pHandler = null;
            }

            return(pHandler);
        }
コード例 #14
0
        /// <summary>
        /// Removes a touch delegate.
        /// The delegate will be released
        /// </summary>
        public void RemoveDelegate(ICCTouchDelegate pDelegate)
        {
            if (pDelegate == null)
            {
                return;
            }

            if (!m_bLocked)
            {
                ForceRemoveDelegate(pDelegate);
            }
            else
            {
                m_pHandlersToRemove.Add(pDelegate);
                m_bToRemove = true;
            }
        }
コード例 #15
0
        public CCTouchHandler FindHandler(ICCTouchDelegate pDelegate)
        {
            foreach (CCTouchHandler handler in m_pTargetedHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return(handler);
                }
            }

            foreach (CCTouchHandler handler in m_pStandardHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return(handler);
                }
            }

            return(null);
        }
コード例 #16
0
 protected void forceRemoveDelegate(ICCTouchDelegate pDelegate)
 {
     foreach (CCTouchHandler mPStandardHandler in this.m_pStandardHandlers)
     {
         if (mPStandardHandler == null || mPStandardHandler.Delegate != pDelegate)
         {
             continue;
         }
         this.m_pStandardHandlers.Remove(mPStandardHandler);
         break;
     }
     foreach (CCTouchHandler mPTargetedHandler in this.m_pTargetedHandlers)
     {
         if (mPTargetedHandler == null || mPTargetedHandler.Delegate != pDelegate)
         {
             continue;
         }
         this.m_pTargetedHandlers.Remove(mPTargetedHandler);
         break;
     }
 }
コード例 #17
0
        protected void ForceRemoveDelegate(ICCTouchDelegate pDelegate)
        {
            // remove handler from m_pStandardHandlers
            foreach (CCTouchHandler pHandler in m_pStandardHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pStandardHandlers.Remove(pHandler);
                    break;
                }
            }

            // remove handler from m_pTargetedHandlers
            foreach (CCTouchHandler pHandler in m_pTargetedHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pTargetedHandlers.Remove(pHandler);
                    break;
                }
            }
        }
コード例 #18
0
ファイル: CCTouchHandler.cs プロジェクト: Ratel13/cocos2d-xna
 public CCTouchHandler(ICCTouchDelegate pDelegate)
 {
     m_pDelegate = pDelegate;
     m_nPriority = pDelegate.TouchPriority;
     m_nEnabledSelectors = 0;
 }
コード例 #19
0
ファイル: CCTouchHandler.cs プロジェクト: ununian/cocos2d-xna
 public CCTouchHandler(ICCTouchDelegate pDelegate, int nPriority) : this(pDelegate)
 {
     m_nPriority = nPriority;
 }
コード例 #20
0
        public CCTouchHandler FindHandler(ICCTouchDelegate pDelegate)
        {
            foreach (CCTouchHandler handler in m_pTargetedHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return handler;
                }
            }

            foreach (CCTouchHandler handler in m_pStandardHandlers)
            {
                if (handler.Delegate == pDelegate)
                {
                    return handler;
                }
            }

            return null;
        }
コード例 #21
0
        protected void ForceRemoveDelegate(ICCTouchDelegate pDelegate)
        {
            // remove handler from m_pStandardHandlers
            foreach (CCTouchHandler pHandler in m_pStandardHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pStandardHandlers.Remove(pHandler);
                    break;
                }
            }

            // remove handler from m_pTargetedHandlers
            foreach (CCTouchHandler pHandler in m_pTargetedHandlers)
            {
                if (pHandler != null && pHandler.Delegate == pDelegate)
                {
                    m_pTargetedHandlers.Remove(pHandler);
                    break;
                }
            }
        }
コード例 #22
0
        /// <summary>
        /// Removes a touch delegate.
        /// The delegate will be released
        /// </summary>
        public void RemoveDelegate(ICCTouchDelegate pDelegate)
        {
            if (pDelegate == null)
            {
                return;
            }

            if (!m_bLocked)
            {
                ForceRemoveDelegate(pDelegate);
            }
            else
            {
                m_pHandlersToRemove.Add(pDelegate);
                m_bToRemove = true;
            }
        }
コード例 #23
0
        /// <summary>
        /// Changes the priority of a previously added delegate. 
        /// The lower the number, the higher the priority
        /// </summary>
        public void SetPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = FindHandler(pDelegate);
            handler.Priority = nPriority;

            RearrangeHandlers(m_pTargetedHandlers);
            RearrangeHandlers(m_pStandardHandlers);
        }
コード例 #24
0
ファイル: CCTouchHandler.cs プロジェクト: Ratel13/cocos2d-xna
 public static CCTouchHandler Create(ICCTouchDelegate pDelegate, int nPriority)
 {
     var pHandler = new CCTouchHandler(pDelegate, nPriority);
     return pHandler;
 }
コード例 #25
0
 /// <summary>
 /// Adds a standard touch delegate to the dispatcher's list.
 /// See StandardTouchDelegate description.
 /// IMPORTANT: The delegate will be retained.
 /// </summary>
 public void addStandardDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     CCTouchHandler pHandler = CCStandardTouchHandler.handlerWithDelegate(pDelegate, nPriority);
     if (!m_bLocked)
     {
         forceAddHandler(pHandler, m_pStandardHandlers);
     }
     else
     {
         m_pHandlersToAdd.Add(pHandler);
         m_bToAdd = true;
     }
 }
コード例 #26
0
 /// <summary>
 /// allocates a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not 
 /// </summary>
 public static CCTargetedTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority, bool bSwallow)
 {
     CCTargetedTouchHandler pHandler = new CCTargetedTouchHandler();
     pHandler.initWithDelegate(pDelegate, nPriority, bSwallow);
     return pHandler;
 }
コード例 #27
0
 /// <summary>
 /// allocates a TouchHandler with a delegate and a priority
 /// </summary>
 public static CCStandardTouchHandler handlerWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     CCStandardTouchHandler pHandler = new CCStandardTouchHandler();
     pHandler.initWithDelegate(pDelegate, nPriority);
     return pHandler;
 }
コード例 #28
0
 /// <summary>
 ///  initializes a TouchHandler with a delegate and a priority
 /// </summary>
 public virtual bool initWithDelegate(ICCTouchDelegate pDelegate, int nPriority)
 {
     return base.initWithDelegate(pDelegate, nPriority);
 }
コード例 #29
0
        /// <summary>
        /// Changes the priority of a previously added delegate. 
        /// The lower the number, the higher the priority
        /// </summary>
        public void setPriority(int nPriority, ICCTouchDelegate pDelegate)
        {
            CCTouchHandler handler = null;

            handler = this.findHandler(pDelegate);
            handler.Priority = nPriority;

            this.rearrangeHandlers(m_pTargetedHandlers);
            this.rearrangeHandlers(m_pStandardHandlers);
        }
コード例 #30
0
 /// <summary>
 /// Adds a targeted touch delegate to the dispatcher's list.
 /// See TargetedTouchDelegate description.
 /// IMPORTANT: The delegate will be retained.
 /// </summary>
 public void addTargetedDelegate(ICCTouchDelegate pDelegate, int nPriority, bool bSwallowsTouches)
 {
     CCTouchHandler pHandler = CCTargetedTouchHandler.handlerWithDelegate(pDelegate, nPriority, bSwallowsTouches);
     if (!m_bLocked)
     {
         forceAddHandler(pHandler, m_pTargetedHandlers);
     }
     else
     {
         m_pHandlersToAdd.Add(pHandler);
         m_bToAdd = true;
     }
 }
コード例 #31
0
ファイル: CCTouchHandler.cs プロジェクト: ununian/cocos2d-xna
 public CCTouchHandler(ICCTouchDelegate pDelegate)
 {
     m_pDelegate         = pDelegate;
     m_nPriority         = pDelegate.TouchPriority;
     m_nEnabledSelectors = 0;
 }
コード例 #32
0
ファイル: CCTouchHandler.cs プロジェクト: Ratel13/cocos2d-xna
 public CCTouchHandler(ICCTouchDelegate pDelegate, int nPriority) : this(pDelegate)
 {
     m_nPriority = nPriority;
 }
コード例 #33
0
 /// <summary>
 /// Use this to update the priority of the given delegate when its graph priority 
 /// changes due to a parenting change.
 /// </summary>
 /// <param name="d"></param>
 public void UpdateGraphPriority(ICCTouchDelegate d)
 {
     CCTouchHandler h = FindHandler(d);
     if (h != null)
     {
         h.Priority = d.TouchPriority;
         RearrangeAllHandlersUponTouch();
     }
 }
コード例 #34
0
 public void setPriority(int nPriority, ICCTouchDelegate pDelegate)
 {
     this.findHandler(pDelegate).Priority = nPriority;
     this.rearrangeHandlers(this.m_pTargetedHandlers);
     this.rearrangeHandlers(this.m_pStandardHandlers);
 }