struct IListItem: { //how we draw this item virtual cocos2d::CCNode *createNode(float width) = 0; virtual ~IListItem() {} };
class FightItem : public IListItem { public: FightItem(const DailyProperty &dp); ~FightItem(); virtual cocos2d::CCNode *createNode(float width); virtual void onExit(); void selected(); void unselected(); static FightItem *itemWithFight(const DailyProperty &dp); const DailyProperty &getDailyProperty() { return m_dp; } private: cocos2d::CCNode *m_node; };
class FightItem : public IListItem, cocos2d::CCObject { public: FightItem(const DailyProperty &dp); ~FightItem(); virtual cocos2d::CCNode *createNode(float width); virtual void onExit(); void selected(); void unselected(); static FightItem *itemWithFight(const DailyProperty &dp); const DailyProperty &getDailyProperty() { return m_dp; } private: cocos2d::CCNode *m_node; void change(); };
CCScheduler::sharedScheduler()->scheduleSelector( schedule_selector(FightItem::showTimeDescription), this, 0.5f, false);
FightItem::~FightItem() { CCScheduler::sharedScheduler()->unscheduleSelector( schedule_selector(FightItem::showTimeDescription), this); if(m_node) m_node->release(); }
struct IListItem:public cocos2d::CCObject { //how we draw this item virtual cocos2d::CCNode *createNode(float width) = 0; virtual ~IListItem() {} virtual void onExit() {} }; FightItem::~FightItem() { if(m_node) m_node->release(); } void FightItem::onExit() { CCScheduler::sharedScheduler()->unscheduleSelector( schedule_selector(FightItem::showTimeDescription), this); }
void CCImageBtn::onEnter() { CCNode::onEnter(); CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, m_touchPriority, true); } void CCImageBtn::onExit() { CCTouchDispatcher::sharedDispatcher()->removeDelegate(this); CCNode::onExit(); }