CCMenuItem
CCMenuItem
Cocos2D@brief CCMenuItem base class Subclass CCMenuItem (or any subclass) to create your custom CCMenuItem objects.
Inheritance: System.Object → Cocos2D.CCNode
Implements: Cocos2D.ICCSelectorProtocol, Cocos2D.ICCFocusable, Cocos2D.ICCTargetedTouchDelegate, Cocos2D.ICCStandardTouchDelegate, Cocos2D.ICCTouchDelegate, Cocos2D.ICCKeypadDelegate, Cocos2D.ICCKeyboardDelegate, Cocos2D.ICCRGBAProtocol, System.Collections.Generic.IComparer{Cocos2D.CCNode}
Constructors
CCMenuItem()
CCMenuItem()()
CCMenuItem(Action)
CCMenuItem(Action)(System.ActionCocos2D.CCMenuItem selector)
Creates a CCMenuItem with a target/selector
Parameters:
selector
(System.ActionCocos2D.CCMenuItem)Example
Fields
Properties
Returns the outside box
Methods
Activate()
Activate()()
Activate the item
Example
InitWithTarget(Action)
System.Boolean InitWithTarget(Action)(System.ActionCocos2D.CCMenuItem selector)
Initializes a CCMenuItem with a target/selector
Parameters:
selector
(System.ActionCocos2D.CCMenuItem)Returns:
System.Boolean
Example
RegisterScriptHandler(string)
RegisterScriptHandler(string)(System.String pszFunctionName)
Register a script function, the function is called in activete If pszFunctionName is NULL, then unregister it.
Parameters:
pszFunctionName
(System.String)Example
Selected()
Selected()()
The item was selected (not activated), similar to "mouse-over"
Example
SetTarget(Action)
SetTarget(Action)(System.ActionCocos2D.CCMenuItem selector)
set the target/selector of the menu item. You should use the events associated with the menu item lifecycle.
Parameters:
selector
(System.ActionCocos2D.CCMenuItem)Example
Unselected()
Unselected()()
The item was unselected
Example