2011-11-20 16:38:27 +08:00
|
|
|
|
|
|
|
#include "CCLuaSupport.h"
|
|
|
|
#include "CCArray.h"
|
|
|
|
#include "CCTimer.h"
|
|
|
|
#include "LuaEngine.h"
|
|
|
|
|
|
|
|
using namespace cocos2d;
|
|
|
|
|
|
|
|
CCSchedulerFuncEntry* CCSchedulerFuncEntry::entryWithRefID(int refID, ccTime fInterval, bool bPaused)
|
|
|
|
{
|
|
|
|
CCSchedulerFuncEntry* entry = new CCSchedulerFuncEntry();
|
|
|
|
entry->initWithRefID(refID, fInterval, bPaused);
|
|
|
|
entry->autorelease();
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CCSchedulerFuncEntry::initWithRefID(int refID, ccTime fInterval, bool bPaused)
|
|
|
|
{
|
|
|
|
LuaEngine::sharedEngine()->retainRefID(refID);
|
|
|
|
m_timer = new CCTimer();
|
|
|
|
m_timer->initWithScriptFunc(refID, fInterval);
|
|
|
|
m_timer->autorelease();
|
|
|
|
m_timer->retain();
|
|
|
|
m_refID = refID;
|
|
|
|
m_paused = bPaused;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
CCSchedulerFuncEntry::CCSchedulerFuncEntry(void)
|
|
|
|
: m_timer(NULL)
|
|
|
|
, m_refID(0)
|
|
|
|
, m_paused(true)
|
|
|
|
, m_isMarkDeleted(false)
|
|
|
|
{
|
|
|
|
static int handleCount = 0;
|
|
|
|
++handleCount;
|
|
|
|
m_handle = handleCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
CCSchedulerFuncEntry::~CCSchedulerFuncEntry(void)
|
|
|
|
{
|
|
|
|
m_timer->release();
|
|
|
|
LuaEngine::sharedEngine()->releaseRefID(m_refID);
|
2011-11-20 21:12:24 +08:00
|
|
|
// CCLOG("CCSchedulerFuncEntry::~CCSchedulerFuncEntry() - remove script entry, handle: %d, refid: %d",
|
|
|
|
// m_handle, m_refID);
|
2011-11-20 16:38:27 +08:00
|
|
|
}
|