//------------------------------------------------------------------ // // Test5 // //------------------------------------------------------------------ Test5::Test5() { CCSprite* sp1 = CCSprite::spriteWithFile(s_pPathSister1); CCSprite* sp2 = CCSprite::spriteWithFile(s_pPathSister2); sp1->setPosition(CCPointMake(100,160)); sp2->setPosition(CCPointMake(380,160)); CCRotateBy* rot = CCRotateBy::actionWithDuration(2, 360); CCActionInterval* rot_back = rot->reverse(); CCAction* forever = CCRepeatForever::actionWithAction( (CCActionInterval*)(CCSequence::actions(rot, rot_back, NULL)) ); CCAction* forever2 = (CCAction*)(forever->copy()->autorelease()); forever->setTag(101); forever2->setTag(102); addChild(sp1, 0, kTagSprite1); addChild(sp2, 0, kTagSprite2); sp1->runAction(forever); sp2->runAction(forever2); schedule( schedule_selector(Test5::addAndRemove), 2.0f); }
CCAction *SudokuActionManager::createFailInputCellAction(CCPoint pt){ CCMoveBy *acMove = CCMoveBy::create(0.2,pt); CCRotateBy *rotate = CCRotateBy::create(0.2,80.f); CCJumpBy *jump = CCJumpBy::create(0.5,ccp(0,0),25,5); CCSequence *inputCellAction = CCSequence::create(acMove,rotate, rotate->reverse(), acMove->reverse(), jump, NULL); return inputCellAction; }
//////////////////////////////////////////////////////// // // For test functions // //////////////////////////////////////////////////////// void performanceActions(CCSprite* pSprite) { CCSize size = CCDirector::sharedDirector()->getWinSize(); pSprite->setPosition(ccp((rand() % (int)size.width), (rand() % (int)size.height))); float period = 0.5f + (rand() % 1000) / 500.0f; CCRotateBy* rot = CCRotateBy::create(period, 360.0f * CCRANDOM_0_1()); CCActionInterval* rot_back = rot->reverse(); CCAction *permanentRotation = CCRepeatForever::create((CCActionInterval *)CCSequence::create(rot, rot_back, NULL)); pSprite->runAction(permanentRotation); float growDuration = 0.5f + (rand() % 1000) / 500.0f; CCActionInterval *grow = CCScaleBy::create(growDuration, 0.5f, 0.5f); CCAction *permanentScaleLoop = CCRepeatForever::create((CCActionInterval *)CCSequence::create(grow, grow->reverse())); pSprite->runAction(permanentScaleLoop); }
bool FlySystemUpdateHint::init() { CCSafeNotificationCenter::sharedNotificationCenter()->postNotification("remove_hint"); CCBLoadFile("FlySystemUpdateHint", this, this); // auto layer = SceneController::getInstance()->getCurrentLayerByLevel(LEVEL_TIP); // layer->addChild(this,1000); // auto size = CCDirector::sharedDirector()->getWinSize(); // this->setPosition(ccp(size.width / 2, size.height-210)); // this->setPosition(ccp(230, 185)); // this->setPosition(ccp(size.width / 2, 185)); if(m_type == FLY_HINT_SHAKEALLIANCE){ m_shakeSp->setVisible(true); CCRotateBy * roaction = CCRotateBy::create(0.1f,60); CCRepeat * r1 = CCRepeat::create(CCSequence::create(roaction,roaction->reverse(),nullptr),4); CCDelayTime * d = CCDelayTime::create(1.0f); m_shakeSp->runAction(CCRepeatForever::create(CCSequence::create(r1,d,nullptr))); }else{ m_shakeSp->setVisible(false); } double curTime = GlobalData::shared()->getWorldTime(); m_countDown = GlobalData::shared()->changeTime(m_countDown/1000); m_time = (long)floor( m_countDown - curTime ); string delayTime = CC_ITOA(m_time/60); //delayTime.append("m"); if(m_type==FLY_HINT_KING && m_icon==""){ string temp = ""; int num = 2; for (int i=0; i<num; i++) { temp.append(m_tip); if(i!=1){ temp.append(" "); } } m_tip = temp; } m_rollText = FlyRollingText::create(m_tip.c_str(), 320, 24, ccc3(245,233,215), 60, 1,m_icon); m_rollTime = m_rollText->getRollingTime(); this->setScaleY(0); one = CCSequence::create(CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::showUIQuestNode)) ,CCScaleTo::create(0.2, 1, 1) , CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::rollText)) , CCDelayTime::create(m_rollTime) , CCScaleTo::create(0.4, 1, 0) , CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::hideUIQuestNode)) , NULL ); if (CCCommonUtils::isIosAndroidPad() && CCCommonUtils::getIsHDViewPort()) { one = CCSequence::create(CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::showUIQuestNode)) ,CCScaleTo::create(0.2, 2, 2) , CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::rollText)) , CCDelayTime::create(m_rollTime) , CCScaleTo::create(0.4, 2, 0) , CCCallFunc::create(this, callfunc_selector(FlySystemUpdateHint::hideUIQuestNode)) , NULL); } m_btnClose->setVisible(m_type==FLY_HINT_WAR); return true; }
bool IFShakeGuideLayer::initData() { this->setVisible(false); m_defaultWidth = 140; if (CCCommonUtils::isIosAndroidPad()) { m_defaultWidth = 240; } CCLoadSprite::doResourceByCommonIndex(500, true); setCleanFunction([](){ CCLoadSprite::doResourceByCommonIndex(500, false); }); CCBLoadFile("shakeGuideLayer",this,this); string infoStr(""); int guideTime = CCUserDefault::sharedUserDefault()->getIntegerForKey(MSG_SHAKEGUIDETIME, 0); string shakePicStr = GlobalData::shared()->shakePicStr; vector<string> picVec ; CCCommonUtils::splitString(shakePicStr, "|", picVec); int count = picVec.size(); int index = -1; if(count > 0 ){ index = rand() % count; } if (m_forceShake) { string picStr = "g007.png"; auto m_pic= CCLoadSprite::createSprite(picStr.c_str()); CCCommonUtils::setSpriteMaxSize(m_pic, 100); m_head->addChild(m_pic); } if (index != -1) { m_headImgNode = HFHeadImgNode::create(); m_headImgNode->initHeadImgUrl2(m_head, CCCommonUtils::getShakePicUrl(picVec[index]), 1.0f, 100, true); CCLOG("shakelog: picUrl%s",CCCommonUtils::getShakePicUrl(picVec[index]).c_str()); } schedule(schedule_selector(IFShakeGuideLayer::monitorPic), 0.5); m_startTime = WorldController::getInstance()->getTime()/1000; if (guideTime == 0) { infoStr = _lang("113100"); }else if (guideTime == 1){ infoStr = _lang("113108"); }else if (guideTime == 2){ infoStr = _lang("113103"); }else{ int randContainerArr[] = {113100,113101,113102,113103,113108,113109}; int randNUm = rand() % 6; CCLOG("shakelog: randnum %d",randNUm); infoStr = _lang(CC_ITOA(randContainerArr[randNUm])); } if (m_forceShake) { infoStr = _lang("113103"); } m_hintText->setString(infoStr.c_str()); CCUserDefault::sharedUserDefault()->setIntegerForKey(MSG_SHAKEGUIDETIME, ++guideTime); m_shakeSp->stopAllActions(); CCRotateBy * roaction = CCRotateBy::create(0.1f,60); CCRepeat * r1 = CCRepeat::create(CCSequence::create(roaction,roaction->reverse(),nullptr),4); CCDelayTime * d = CCDelayTime::create(2.0f); m_shakeSp->runAction(CCRepeatForever::create(CCSequence::create(r1,d,nullptr))); m_bgNode->setVisible(false); m_bgNode->retain(); m_bgNode->removeFromParent(); m_clipNode = CCClipNode::create(modelWidth, 150); if (CCCommonUtils::isIosAndroidPad()) { m_clipNode = CCClipNode::create(modelWidth, 320); } m_clipNode->setAnchorPoint(ccp(0, 0)); m_clipNode->addChild(m_bgNode); m_bgNode->release(); this->addChild(m_clipNode); // auto btnPic1 = CCLoadSprite::createScale9Sprite("Mail_btn03.png"); // if(btnPic1){ // btnPic1->setScale(0.8); // m_btnNode->addChild(btnPic1); // } return true; }