当前位置: 首页>>代码示例>>C++>>正文


C++ ActionTimeline::gotoFrameAndPlay方法代码示例

本文整理汇总了C++中ActionTimeline::gotoFrameAndPlay方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionTimeline::gotoFrameAndPlay方法的具体用法?C++ ActionTimeline::gotoFrameAndPlay怎么用?C++ ActionTimeline::gotoFrameAndPlay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActionTimeline的用法示例。


在下文中一共展示了ActionTimeline::gotoFrameAndPlay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool WelcomeStudioScene::init(){
    if (!CCLayer::init()) {
        return false;
    }
    
    m_rootNode=NodeReader::getInstance()->createNode("Blackcat_1/Blackcat_1.ExportJson");
    ActionTimeline* action = ActionTimelineCache::getInstance()->createAction("Blackcat_1/Blackcat_1.ExportJson");
    
    
    m_rootNode->runAction(action);
    action->gotoFrameAndPlay(0, action->getDuration(), true);
    
    for (int i=0; i<m_rootNode->getChildrenCount(); i++) {
        Widget* child=(Widget*)m_rootNode->getChildren()->objectAtIndex(i);
        if (child->getTag()==-1) {
            Button* button=(Button*)UIHelper::seekWidgetByTag(child, 136);
            if(button){
                button->addTouchEventListener(this, toucheventselector(WelcomeStudioScene::touchEvent));
            }
        }
    }
    
    this->addChild(m_rootNode);
    
    return true;
}
开发者ID:echenonline,项目名称:Blackcat,代码行数:26,代码来源:WelcomeStudioScene.cpp

示例2: onEnter

//TestProjectNodeForSimulator
//InnerActionFrame make InnerAction Play until action's duration or next InnerActionFrame
void TestProjectNodeForSimulator::onEnter()
{
    ActionTimelineBaseTest::onEnter();
    Node* node = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd");
    ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd");

    node->runAction(action);
    action->gotoFrameAndPlay(0, true);

    node->setPosition(-300, -300);
    addChild(node);

    // test for when ProjectNode file lost
    Node* lackProjectNodefileNode = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd");
    ActionTimeline* lackProjectNodefileAction = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd");
    lackProjectNodefileNode->runAction(lackProjectNodefileAction);
    lackProjectNodefileAction->gotoFrameAndPlay(0);
    addChild(lackProjectNodefileNode);
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例3:

void TestActionTimelineIssueWith2SameActionInOneNode::onEnter()
{
    CCFileUtils::getInstance()->addSearchPath("ActionTimeline");
    ActionTimelineBaseTest::onEnter();

    Node* node = CSLoader::createNode("ani2.csb");
    ActionTimeline* action = CSLoader::createTimeline("ani2.csb");
    node->setPosition(Vec2(150, 100));
    node->runAction(action);
    action->gotoFrameAndPlay(0);
    this->addChild(node);
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: init

// on "init" you need to initialize your instance
bool ChooseCharacterLayer::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    m_RootNode = static_cast<Layout*>(CSLoader::createNode("ChooseCharacterLayer.csb"));
    
    this->addChild(m_RootNode);
    
    ActionTimeline* action = CSLoader::createTimeline("ChooseCharacterLayer.csb");
    action->gotoFrameAndPlay(0);
    m_RootNode->runAction(action);
    
    if (kIsPayTest) {
        APTools::PrintUIWidgetChildrenInfo(m_RootNode);
    }
    
    auto Button_fanhui=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_fanhui"));
    if (Button_fanhui) {
        Button_fanhui->addTouchEventListener(CC_CALLBACK_2(ChooseCharacterLayer::Button_fanhui_BtnOnTouch, this));
    }
    auto Button_kaishi=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_kaishi"));
    if (Button_kaishi) {
        Button_kaishi->addTouchEventListener(CC_CALLBACK_2(ChooseCharacterLayer::Button_kaishi_BtnOnTouch, this));
    }
    
    //加粒子
    Size winSize = Director::getInstance()->getWinSize();
    ParticleSystem *kaiping=ParticleSystemQuad::create("imgs/kaipian_lizi_2.plist");
    kaiping->setPosition(apccp(0.5, 0.3));
    this->addChild(kaiping,200);
    
    setDataView();
    
    return true;
}
开发者ID:37947538,项目名称:Young3_7,代码行数:41,代码来源:ChooseCharacterLayer.cpp

示例5: init

// on "init" you need to initialize your instance
bool MainMapScene::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    auto seq=Sequence::create(RotateBy::create(1, 10), NULL);
    auto replay=RepeatForever::create(seq);
    
    m_RootNode = static_cast<Layout*>(CSLoader::createNode("MainMapScene.csb"));
    this->addChild(m_RootNode);
    
    ActionTimeline* action = CSLoader::createTimeline("MainMapScene.csb");
    action->gotoFrameAndPlay(0);
    m_RootNode->runAction(action);
    
    if (kIsPayTest) {
        APTools::PrintUIWidgetChildrenInfo(m_RootNode);
    }
    //总战斗力
    m_SumPower=dynamic_cast<TextBMFont*>(Helper::seekWidgetByName(m_RootNode, "BitmapFontLabel_zhanli"));
    
    for (int i=1; i<=3; i++) {
        auto imgName=__String::createWithFormat("Image_yuan_%d",i);
        auto img=dynamic_cast<ImageView*>(Helper::seekWidgetByName(m_RootNode, imgName->getCString()));
        if (img) {
            img->runAction(replay->clone());
        }
    }
    for (int i=1; i<=2; i++) {
        auto btnName=__String::createWithFormat("Button_tianjia_%d", i);
        auto btn=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, btnName->getCString()));
        if (btn) {
            btn->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_Shop_BtnOnTouch, this));
        }
    }
    auto Button_guanka_3=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_guanka_3"));
    if (Button_guanka_3) {
        Button_guanka_3->setTag(3);
        Button_guanka_3->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_play_BtnOnTouch, this));
    }
    auto Button_guanka_2=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_guanka_2"));
    if (Button_guanka_2) {
        Button_guanka_2->setTag(2);
        Button_guanka_2->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_play_BtnOnTouch, this));
    }
    auto Button_guanka_1=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_guanka_1"));
    if (Button_guanka_1) {
        Button_guanka_1->setTag(1);
        Button_guanka_1->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_play_BtnOnTouch, this));
    }
    
    auto Button_DayReward=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_gongneng_6"));
    if (Button_DayReward) {
        Button_DayReward->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_DayReward_BtnOnTouch, this));
    }
    auto Button_Equip=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_gongneng_1"));
    if (Button_Equip) {
        Button_Equip->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_Equip_BtnOnTouch, this));
    }
    auto Button_EquipUpgrade=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_gongneng_2"));
    if (Button_EquipUpgrade) {
        Button_EquipUpgrade->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_EquipUpgrade_BtnOnTouch, this));
    }
    auto Button_SkillUpgrade=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_gongneng_3"));
    if (Button_SkillUpgrade) {
        Button_SkillUpgrade->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_SkillUpgrade_BtnOnTouch, this));
    }
    auto Button_Lottery=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_gongneng_4"));
    if (Button_Lottery) {
        Button_Lottery->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_Lottery_BtnOnTouch, this));
    }
    auto Button_Shop=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_gongneng_5"));
    if (Button_Shop) {
        Button_Shop->addTouchEventListener(CC_CALLBACK_2(MainMapScene::Button_Shop_BtnOnTouch, this));
    }
    
    tCoin=dynamic_cast<ui::Text*>(Helper::seekWidgetByName(m_RootNode, "Text_jinbishuliang"));
    tDiamond=dynamic_cast<ui::Text*>(Helper::seekWidgetByName(m_RootNode, "Text_zuanshishu"));
    
    updateLabel();
    
    SoundBLL::getInstance()->playbackground(kStartMusic);
    
    return true;
}
开发者ID:37947538,项目名称:Young3_7,代码行数:90,代码来源:MainMapScene.cpp


注:本文中的ActionTimeline::gotoFrameAndPlay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。