BBGamelib.CCScheduler.unscheduleSelector C# (CSharp) Method

unscheduleSelector() public method

public unscheduleSelector ( TICK_IMP selector, System target ) : void
selector TICK_IMP
target System
return void
		public void unscheduleSelector(TICK_IMP selector, System.Object target){
			if (target==null && selector == null) {
				return;			
			}
			
			NSUtils.Assert( target != null, "Target MUST not be nil");
			NSUtils.Assert( selector != null, "Selector MUST not be NULL");
			
			tHashTimerEntry element = hashForTimers.HASH_FIND_INT (target.GetHashCode());
			if (element != null) {
				int timersCount = element.timers.Count;
				for(int i=0; i< timersCount; i++ ) {
					CCTimer timer = element.timers[i];
					if(timer is CCTimerTargetSelector && selector == ((CCTimerTargetSelector)timer).selector){
						if(timer == element.currentTimer && !element.currentTimerSalvaged){
							element.currentTimerSalvaged = true;
						}
						element.timers.RemoveAt(i);
						if(element.timerIndex >= i)
							element.timerIndex --;
						if(element.timers.Count == 0){
							if(currentTarget == element)
								currentTargetSalvaged = true;
							else 
								removeHashElement(element);
						}
						return;
					}
				}
			}
			
			// Not Found
			//	NSLog(@"CCScheduler#unscheduleSelector:forTarget: selector not found: %@", selString);
		}

Usage Example

コード例 #1
0
        public void unschedule(TICK_IMP selector)
        {
            // explicit nil handling
            if (selector == null)
            {
                return;
            }

            _scheduler.unscheduleSelector(selector, this);
        }