Cocos2d x 在Cocos2d Windows phoneI中创建菜单项
我想在一个菜单项中添加精灵和标签,两个菜单项都可以单击,但在C#中不能从多个类扩展 我从menuItemLabel类进行扩展,并使用menuItemSprite组成该类 但当我点击标签时,它工作正常,但MenuItemSprite没有响应点击事件 如果有人知道这个问题的解决方法,请回复Cocos2d x 在Cocos2d Windows phoneI中创建菜单项,cocos2d-x,Cocos2d X,我想在一个菜单项中添加精灵和标签,两个菜单项都可以单击,但在C#中不能从多个类扩展 我从menuItemLabel类进行扩展,并使用menuItemSprite组成该类 但当我点击标签时,它工作正常,但MenuItemSprite没有响应点击事件 如果有人知道这个问题的解决方法,请回复 public class menuitem4 : CCMenuItemLabel { public static menuitem4 itemwith(CCNode normal, CCNode sele
public class menuitem4 : CCMenuItemLabel
{
public static menuitem4 itemwith(CCNode normal, CCNode selected, CCNode label, SelectorProtocol target, SEL_MenuHandler selector)
{
menuitem4 pRet = new menuitem4();
pRet.a = CCMenuItemLabel.itemWithLabel(label,target, selector);
Specie1Store sp = (Specie1Store)target;
pRet.a.position = new CCPoint(500,100);
sp.addChild(pRet.a);
pRet.initWithLabel(label, target, selector);
return pRet;
}
}
您可以创建一个扩展CCNode的类,并将CCMenuItemImage和CCMenuItemLabel添加为子项。无法理解您想要做什么。您想在同一位置放置两个按钮,并通过单触获得两个单击事件吗?或者你只想在按钮上添加标题?我想在一行中添加两个按钮,并且两个按钮都可以作为单个项目单击。