0
我想在單個菜單項中添加一個Sprite以及Label,它們都是可點擊的,但在C#中不能從多個類擴展。在Cocos2d中創建菜單Windows phoneI
我從menuItemLabel類擴展並用menuItemSprite構造類。
但是,當我點擊標籤它工作正常,但MenuItemSprite沒有響應點擊事件。
如果有人知道這個問題的解決方法,請回復此問題。
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;
}
}
無法理解,你想要做什麼。你想在同一個位置放置兩個按鈕,並通過單鍵觸摸獲得兩個點擊事件?或者你只是想添加標題到你的按鈕? – Morion
我想在一行中有兩個按鈕,並且希望可以作爲單個項目單擊。 – abubakar031