本文整理汇总了C++中ActionObject类的典型用法代码示例。如果您正苦于以下问题:C++ ActionObject类的具体用法?C++ ActionObject怎么用?C++ ActionObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActionObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
void ActionManagerEx::initWithBinary(const char* file,
cocos2d::Ref *root,
CocoLoader* cocoLoader,
stExpCocoNode* pCocoNode)
{
std::string path = file;
ssize_t pos = path.find_last_of("/");
std::string fileName = path.substr(pos+1,path.length());
cocos2d::Vector<ActionObject*> actionList;
stExpCocoNode *stChildArray = pCocoNode->GetChildArray(cocoLoader);
stExpCocoNode *actionNode = nullptr;
for (int i=0; i < pCocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
if (key == "actionlist") {
actionNode = &stChildArray[i];
break;
}
}
if (nullptr != actionNode)
{
int actionCount = actionNode->GetChildNum();
for (int i = 0; i < actionCount; ++i) {
ActionObject* action = new (std::nothrow) ActionObject();
action->autorelease();
action->initWithBinary(cocoLoader, &actionNode->GetChildArray(cocoLoader)[i], root);
actionList.pushBack(action);
}
}
_actionDic[fileName] = actionList;
}
示例2: getActionByName
ActionObject* ActionManagerEx::playActionByName(const char* jsonName,const char* actionName, CallFunc* func)
{
ActionObject* action = getActionByName(jsonName,actionName);
if (action)
{
action->play(func);
}
return action;
}
示例3: while
BOOL CCalculator::CompareDocs(CMCPforNTDoc* pDoc1,CMCPforNTDoc* pDoc2)
{
BOOL EQUAL = TRUE;
CString TheObject1[100];
CString TheObject2[100];
USHORT Channels1[100];
USHORT Channels2[100];
USHORT i,j;
POSITION pos;
if(!pDoc1->ActionObjList.IsEmpty())
{
i=0;
ActionObject* pActionObj = (ActionObject*)pDoc1->ActionObjList.GetHead();
pos = pDoc1->ActionObjList.GetHeadPosition();
do
{
pActionObj = (ActionObject*)pDoc1->ActionObjList.GetNext(pos);
if (pActionObj!=NULL)
{
TheObject1[i] = pActionObj->GetName();
Channels1[i] = pActionObj->pTrack->Channels;
i++;
}
}
while (pos!=NULL);
}
if(!pDoc2->ActionObjList.IsEmpty())
{
i=0;
ActionObject* pActionObj = (ActionObject*)pDoc2->ActionObjList.GetHead();
pos = pDoc2->ActionObjList.GetHeadPosition();
do
{
pActionObj = (ActionObject*)pDoc2->ActionObjList.GetNext(pos);
if (pActionObj!=NULL)
{
TheObject2[i] = pActionObj->GetName();
Channels2[i] = pActionObj->pTrack->Channels;
i++;
}
}
while (pos!=NULL);
}
for(j=0;j<i;j++)
{
if((TheObject2[j]!=TheObject1[j])||
(Channels2[j]!=Channels1[j]))
EQUAL = FALSE;
}
return EQUAL;
}
示例4: getActionByName
ActionObject* ActionManager::playActionByName(const char* jsonName,const char* actionName)
{
ActionObject* action = getActionByName(jsonName,actionName);
if (action)
{
action->play();
}
return action;
}
示例5: delayAnimation
void AheadChapter::delayAnimation()
{
ActionObject *action = ActionManager::shareManager()->getActionByName("AheadChapterUI.ExportJson", "map_animation");
if (action != NULL)
{
EffectSoundPlayController *effectSound = EffectSoundPlayController::create();
effectSound->setEffect(PULL_EFFECT, 0, 0, 0.5);
this->addChild(effectSound);
action->play();
}
}
示例6: onEnterTransitionDidFinish
void AheadChapter::onEnterTransitionDidFinish()
{
//播放动作
ActionObject *action = ActionManager::shareManager()->getActionByName("AheadChapterUI.ExportJson", "title_panel_animation");
if (action != NULL)
{
EffectSoundPlayController *effectSound = EffectSoundPlayController::create();
effectSound->setEffect(DU_EFFECT, 1, 0.9, 0.1);
this->addChild(effectSound);
action->play();
}
this->scheduleOnce(schedule_selector(AheadChapter::delayAnimation), 1.2);
}
示例7: releaseActions
void ActionManagerEx::releaseActions()
{
for (auto& iter : _actionDic)
{
cocos2d::Vector<ActionObject*> objList = iter.second;
ssize_t listCount = objList.size();
for (ssize_t i = 0; i < listCount; i++) {
ActionObject* action = objList.at(i);
if (action != nullptr) {
action->stop();
}
}
objList.clear();
}
_actionDic.clear();
}
示例8: releaseActions
void ActionManagerEx::releaseActions()
{
std::unordered_map<std::string, cocos2d::Vector<ActionObject*>>::iterator iter;
for (iter = _actionDic.begin(); iter != _actionDic.end(); iter++)
{
cocos2d::Vector<ActionObject*> objList = iter->second;
ssize_t listCount = objList.size();
for (ssize_t i = 0; i < listCount; i++) {
ActionObject* action = objList.at(i);
if (action != nullptr) {
action->stop();
}
}
objList.clear();
}
_actionDic.clear();
}
示例9: getActionByName
ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* actionName)
{
auto iterator = _actionDic.find(jsonName);
if (iterator == _actionDic.end())
{
return nullptr;
}
auto actionList = iterator->second;
for (int i = 0; i < actionList.size(); i++)
{
ActionObject* action = actionList.at(i);
if (strcmp(actionName, action->getName()) == 0)
{
return action;
}
}
return nullptr;
}
示例10: CCLOG
void ActionManager::initWithDictionary(const char* jsonName,cs::CSJsonDictionary *dic,CCObject* root)
{
std::string path = jsonName;
int pos = path.find_last_of("/");
std::string fileName = path.substr(pos+1,path.length());
CCLOG("filename == %s",fileName.c_str());
CCArray* actionList = CCArray::create();
int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist");
for (int i=0; i<actionCount; i++) {
ActionObject* action = new ActionObject();
action->autorelease();
cs::CSJsonDictionary* actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i);
action->initWithDictionary(actionDic,root);
actionList->addObject(action);
CC_SAFE_DELETE(actionDic);
}
m_pActionDic->setObject(actionList, fileName);
}
示例11: _scal
double _scal( double x,... )
{
POSITION pos;
CString TheObject;
double data = 0;
BOOL FOUND = FALSE;
double Track;
CString TrackStr;
va_list arg_ptr;
va_start(arg_ptr,x);
Track = va_arg(arg_ptr,double);
if(!pDocument->ActionObjList.IsEmpty())
{
ActionObject* pActionObj = (ActionObject*)pDocument->ActionObjList.GetHead();
pos = pDocument->ActionObjList.GetHeadPosition();
do
{
pActionObj = (ActionObject*)pDocument->ActionObjList.GetNext(pos);
if (pActionObj!=NULL)
{
TheObject = pActionObj->GetName();
if (TheObject.Find(__PM_SpectrumObj)!=-1)
{
PM_SpectrumObj* pScalerObj = (PM_SpectrumObj*)pActionObj;
if ((pScalerObj->SubRegNo==(int)x)&&
(pScalerObj->pTrack->MyPosition==(int)Track))
{
if(!EVALUATENEXT)data = pScalerObj->y[index];
else data = pScalerObj->y[index]*(TheScan)/(TheScan-1);
FOUND = TRUE;
}
}
}
}
while ((pos!=NULL)&&(!FOUND));
}
return(data);
}
示例12: PreTranslateMessage
BOOL CCalculator::PreTranslateMessage(MSG* pMsg)
{
{
if (pMsg->message == WM_LBUTTONDBLCLK)
{
if(pDoc.GetCount()!=0)
{
CMCPforNTDoc* pHeadDoc = (CMCPforNTDoc*)pDoc.GetHead();
if (!pHeadDoc->ActionObjList.IsEmpty())
{
ActionObject* pActionObj =
(ActionObject*)m_templview.GetItemData(GetSelectedItem());
if ((pActionObj!= NULL)&&(pActionObj->SCALER))
{
pActionObj->DoDoubleClickAction();
}
}
}
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
示例13: menuCloseCallback
void HelloWorld::menuCloseCallback(CCObject* pSender)
{
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
// CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
//#else
// CCDirector::sharedDirector()->end();
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// exit(0);
//#endif
//#endif
int t = g_layoutcnt%2;
if( t == 0)
{
m_pLayout = dynamic_cast<UILayout *>(GUIReader::shareReader()->widgetFromJsonFile("level_select_1.json"));
if(m_pLayout)
{
m_pLayout->setPosition(ccp(-200,0));
this->addChild(m_pLayout);
ActionObject* act = NULL;
act = ActionManager::shareManager()->getActionByName("level_select_1.json","texiao");
if(NULL != act)
act->play();
act = ActionManager::shareManager()->getActionByName("level_select_1.json","shuibodonghua");
if(NULL != act)
act->play();
}
}
else
{
//ActionManager::shareManager()->stopAllActionByJson("level_select_1.json");
//ActionManager::shareManager()->stopAllActionByJson("level_select.json");
ActionObject* act = NULL;
act = ActionManager::shareManager()->getActionByName("level_select_1.json","texiao");
if(NULL != act)
act->stop();
act = ActionManager::shareManager()->getActionByName("level_select_1.json","shuibodonghua");
if(NULL != act)
act->stop();
ActionManager::shareManager()->releaseActions();
if(m_pLayout)
{
m_pLayout->removeFromParent();
m_pLayout = NULL;
}
//CCTextureCache::sharedTextureCache()->removeUnusedTextures();
}
g_layoutcnt++;
}
示例14: UpdateTree
void CCalculator::UpdateTree(CMCPforNTDoc* pDocument)
{
int Image;
int Position = 0;
CString TheObject;
int Track=0;
char TheString[50];
POSITION pos;
m_templview.DeleteAllItems();
if(!pDocument->ActionObjList.IsEmpty())
{
ActionObject* pActionObj = (ActionObject*)pDocument->ActionObjList.GetHead();
pos = pDocument->ActionObjList.GetHeadPosition();
do
{
pActionObj = (ActionObject*)pDocument->ActionObjList.GetNext(pos);
if (pActionObj!=NULL)
{
if (pActionObj->GetName().Find(_TrackObj)!=-1)
{
++Track;
m_templview.InsertItem(LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM,Position,pActionObj->GetName(),0,0,2,(LPARAM)pActionObj);
m_templview.SetItem(Position,1,LVIF_TEXT, pActionObj->GetInfo(),0,0,0,NULL);
}
else
{
if (pActionObj->TestHardware()) Image=0;
else Image = 1;
strcpy(TheString,(LPCSTR)TheObject);
m_templview.InsertItem(LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM,Position,pActionObj->GetName(),0,0,Image,(LPARAM)pActionObj);
m_templview.SetItem(Position,1,LVIF_TEXT, pActionObj->GetInfo(),0,0,0,NULL);
}
}
Position++;
}
while (pos!=NULL);
}
}
示例15: menu_selector
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
m_pLayout = NULL;
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
this,
menu_selector(HelloWorld::menuCloseCallback));
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
origin.y + pCloseItem->getContentSize().height/2));
// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1);
/////////////////////////////
// 3. add your codes below...
// add a label shows "Hello World"
// create and initialize a label
//CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE);
//
//// position the label on the center of the screen
//pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
// origin.y + visibleSize.height - pLabel->getContentSize().height));
//// add the label as a child to this layer
//this->addChild(pLabel, 1);
//// add "HelloWorld" splash screen"
//CCSprite* pSprite = CCSprite::create("HelloWorld.png");
//// position the sprite on the center of the screen
//pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
//// add the sprite as a child to this layer
//this->addChild(pSprite, 0);
Layout *pLayout = dynamic_cast<UILayout *>(GUIReader::shareReader()->widgetFromJsonFile("level_select.json"));
if(pLayout)
{
pLayout->setPosition(ccp(-200,0));
this->addChild(pLayout);
ActionObject* act = NULL;
act = ActionManager::shareManager()->getActionByName("level_select.json","texiao");
if(NULL != act)
act->play();
act = ActionManager::shareManager()->getActionByName("level_select.json","shuibodonghua");
if(NULL != act)
act->play();
}
return true;
}