I have a layer:
public class MenuItemsLayer : CCLayer
{
protected override void AddedToScene()
{
base.AddedToScene();
var quitItem = new CCLabel("QUIT", "fonts/MarkerFelt", 22, CCLabelFormat.SpriteFont);
(...)
this.AddEventListener(this.addQuitItemTouchListener(), quitItem);
this.AddChild(quitItem);
}
private CCEventListenerTouchOneByOne addQuitItemTouchListener()
{
var touchListener = new CCEventListenerTouchOneByOne();
touchListener.OnTouchEnded = (touch, args) =>
{
System.Diagnostics.Debug.WriteLine("touched");
};
return touchListener;
}
}
Please pay attention to "quitItem". I'm adding CCEventListenerTouchOneByOne to it with the hope, that it will do something I want. In this case it should write "touched" in the output if element is touched. Unfortunantely, nothing happens, also breakpoint is never hit.
Basic problem - I'd like to add touch event to the CCNode. How?