BBGamelib.NSUtils.hasMethod C# (CSharp) Method

hasMethod() public static method

public static hasMethod ( object objectToCheck, string methodName ) : bool
objectToCheck object
methodName string
return bool
		public static bool hasMethod(object objectToCheck, string methodName)
		{
			Type type = objectToCheck.GetType();
			MethodInfo[] ms = type.GetMethods();
			for (int i=0; i<ms.Length; i++) {
				MethodInfo m = ms[i];
				if(m.Name == methodName){
					return true;
				}
			}
			return false;
		} 
	}

Usage Example

 protected override void init(System.Object aDelegate, int aPriority)
 {
     base.init(aDelegate, aPriority);
     if (NSUtils.hasMethod(aDelegate, "ccTouchesBegan"))
     {
         _enabledSelectors |= kCCTouchSelectorFlag.BeganBit;
     }
     if (NSUtils.hasMethod(aDelegate, "ccTouchesMoved"))
     {
         _enabledSelectors |= kCCTouchSelectorFlag.MovedBit;
     }
     if (NSUtils.hasMethod(aDelegate, "ccTouchesEnded"))
     {
         _enabledSelectors |= kCCTouchSelectorFlag.EndedBit;
     }
     if (NSUtils.hasMethod(aDelegate, "ccTouchesCancelled"))
     {
         _enabledSelectors |= kCCTouchSelectorFlag.CancelledBit;
     }
 }
All Usage Examples Of BBGamelib.NSUtils::hasMethod