LHParallaxNode::~LHParallaxNode(void){
//    CCLog("LHParallaxNode dealloc");
    
    unscheduleAllSelectors();
    
    if(NULL != followedSprite)
        followedSprite->parallaxFollowingThisSprite = NULL;
    followedSprite = NULL;
    
    if(removeSpritesOnDelete)
    {
#if COCOS2D_VERSION >= 0x00020000
        CCArray* tempSprites = CCArray::create();
#else
        CCArray* tempSprites = CCArray::array();
#endif
        
        tempSprites->addObjectsFromArray(sprites);
    
        for(int i = 0; i< tempSprites->count(); ++i)
        {        
            LHParallaxPointObject* pt = (LHParallaxPointObject*)tempSprites->objectAtIndex(i);
            if(pt->ccsprite){
                ((LHSprite*)pt->ccsprite)->setParallaxNode(NULL);
                ((LHSprite*)pt->ccsprite)->removeSelf();
            }
        }
        tempSprites->removeAllObjects();
    }
    
    sprites->removeAllObjects();
    
    delete sprites;
}
示例#2
0
//------------------------------------------------------------------------------
CCArray*    LHLayer::allSprites(void){
#if COCOS2D_VERSION >= 0x00020000
    CCArray* array = CCArray::create();
#else
    CCArray* array = CCArray::array();
#endif
    CCArray* children = getChildren();
    for(int i = 0; i < children->count(); ++i){
        CCNode* node = (CCNode*)children->objectAtIndex(i);
        
        if(LHSprite::isLHSprite(node)){
            array->addObject(node);
        }
        else if(LHBatch::isLHBatch(node)){
            array->addObjectsFromArray(((LHBatch*)node)->allSprites());
        }
        else if(LHLayer::isLHLayer(node)){
            array->addObjectsFromArray(((LHLayer*)node)->allSprites());
        }
    }
    return array;   
}
示例#3
0
void BaoZangView::openInviteFriends(CCObject *data){
    GlobalData::shared()->isBind = true;
    CCArray* arr = CCArray::create();
    arr->addObjectsFromArray(m_inviteDatas);
    arr->addObjectsFromArray(m_installDatas);
    if(arr->count()>0){
        PopupViewController::getInstance()->addPopupInView(FacebookInviteView::create(arr));
    }else{
        FBUtilies::postFBSelectedFriendList(arr,_lang("107077"));
    }
    SocialController::getInstance()->call = 1;
    if(!m_haveClick){
        string uid = "";
        string server = "";
        string fbName = CCUserDefault::sharedUserDefault()->getStringForKey(FB_USERNAME, "");
        int num = m_friendDatas->count();
        for (int i=0; i<num; i++) {
            FBFriendInfo* fbInfo1 = dynamic_cast<FBFriendInfo*>(m_friendDatas->objectAtIndex(i));
            if(fbInfo1==NULL || fbInfo1->gUid==""){
                continue;
            }
            if (uid!="") {
                uid += "|";
            }
            uid += fbInfo1->gUid;
            if (server!="") {
                server += "|";
            }
            server += CC_ITOA(fbInfo1->server);
        }
        FBMineCallHelpCommand* cmd = new FBMineCallHelpCommand(uid,server,fbName);
        //cmd->setSuccessCallback(CCCallFuncO::create(this, callfuncO_selector(BaoZangView::callHelpSuccess), NULL));
        cmd->sendAndRelease();
        m_haveClick = true;
    }
}
//--------------------------------------------------------
ccColor3B CListControllerLayer::_GetColorByName(std::string p_szName)
{
	CCArray a;
	a.addObjectsFromArray( &FKCW_Base_Utils::ComponentOfString(p_szName, '_') );
	if( a.count() >= 3 )
	{
		CCString* FKCWHead = (CCString*)a.objectAtIndex(0);
		CCString* SmallType = (CCString*)a.objectAtIndex(1);
		if(! FKCWHead->isEqual(ccs("FKCW")) )
			return ccc3(225,238,210);

		if(SmallType->isEqual(ccs("UI")))
			return ccc3(230, 155, 3);
		else if(SmallType->isEqual(ccs("Action")))
			return ccc3(209, 73, 78);
		else if(SmallType->isEqual(ccs("UIWidget")))
			return ccc3(131, 175, 155);
		else if(SmallType->isEqual(ccs("Base")))
			return ccc3(249, 205, 173);
		else if(SmallType->isEqual(ccs("EffectNode")))
			return ccc3(175, 215, 237);
		else if(SmallType->isEqual(ccs("RenderEx")))
			return ccc3(175, 18, 88);
		else if(SmallType->isEqual(ccs("GR")))
			return ccc3(130, 57, 53);
		else if(SmallType->isEqual(ccs("Database")))
			return ccc3(160, 191, 124);
		else if(SmallType->isEqual(ccs("Network")))
			return ccc3(255, 252, 153);
		else if(SmallType->isEqual(ccs("Json")))
			return ccc3(87, 105, 60);
		else if(SmallType->isEqual(ccs("Font")))
			return ccc3(230, 155, 3);
		else if(SmallType->isEqual(ccs("SimpleNet")))
			return ccc3(209, 73, 78);
		else if(SmallType->isEqual(ccs("SceneEx")))
			return ccc3(175, 215, 237);
		else if(SmallType->isEqual(ccs("3D")))
			return ccc3(64, 116, 52);
		else if(SmallType->isEqual(ccs("RichHtml")))
			return ccc3(249, 205, 173);
		else if(SmallType->isEqual(ccs("Story")))
			return ccc3(131, 175, 155);
		else if(SmallType->isEqual(ccs("Pixel")))
			return ccc3(175, 18, 88);
	}
	return ccc3(225,238,210);
}
示例#5
0
//------------------------------------------------------------------------------
CCArray* LHLayer::beziersWithTag(int tag){
#if COCOS2D_VERSION >= 0x00020000
    CCArray* array = CCArray::create();
#else
    CCArray* array = CCArray::array();
#endif
    
    CCArray* children = getChildren();
    for(int i = 0; i < children->count(); ++i){
        CCNode* node = (CCNode*)children->objectAtIndex(i);
        
        if(LHBezier::isLHBezier(node)){
            if(node->getTag() == tag)
                array->addObject(node);
        }
        else if(LHLayer::isLHLayer(node)){
            array->addObjectsFromArray(((LHLayer*)node)->beziersWithTag(tag));
        }
    }
    return array;   
}
示例#6
0
bool CMainSelect::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    this->setTouchEnabled(true);
   
    // 创建背景
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    CCSprite* backgroud = CCSprite::create("mainsel/bg.png");
    backgroud->setPosition( ccp(size.width/2, size.height/2) );
    this->addChild(backgroud);
    
    // 按钮
    CCMenuItemImage *pLack = CCMenuItemImage::create("mainsel/lackNor.png",
                                                     "mainsel/lackSel.png",
                                                      this,
                                                      menu_selector(CMainSelect::lakeCallback) );
    
    CCMenuItemImage *pForest = CCMenuItemImage::create("mainsel/forestNor.png",
                                                       "mainsel/forestSel.png",
                                                       this,
                                                       menu_selector(CMainSelect::forestCallback) );
    
    CCMenuItemImage *pDesert = CCMenuItemImage::create("mainsel/desertNor.png",
                                                       "mainsel/desertSel.png",
                                                        this,
                                                        menu_selector(CMainSelect::desertCallback) );
    
    CCMenuItemImage *pPrairie = CCMenuItemImage::create("mainsel/prairieNor.png",
                                                        "mainsel/prairieSel.png",
                                                        this,
                                                        menu_selector(CMainSelect::prairieCallback) );
    
    pLack->setPosition(    ccp(171, 437) );
    pForest->setPosition(  ccp(539, 401) );
    pDesert->setPosition(  ccp(864, 411) );
    pPrairie->setPosition( ccp(392, 208) );
    
   
    CCMenu* pMenu = CCMenu::create(pLack, pForest, pDesert, pPrairie, NULL);
    pMenu->setPosition( CCPointZero );
    this->addChild(pMenu, 1);
    
    // 创建sprite sheet
    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("mainsel/jingyu.plist");
    CCSpriteBatchNode *spriteSheet = CCSpriteBatchNode::create("mainsel/jingyu.png");
    this->addChild(spriteSheet);
    
    // 创建对象
    CCSprite *sprite = CCSprite::createWithSpriteFrameName("jingyu01.png");        
    sprite->setPosition(ccp(920,220));
    spriteSheet->addChild(sprite, 0);
          
    CCArray *arrShang = CCArray::create(); // 动画帧数组
    for(int i=1; i<=8; ++i)
    {     
        CCString *name = CCString::createWithFormat("jingyu%02d.png", i);
        arrShang->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name->getCString()));
    }
    
    CCArray *arrPeng = CCArray::create(); // 动画帧数组
    for(int i=9; i<=11; ++i)
    {
        CCString *name = CCString::createWithFormat("jingyu%02d.png", i);
        arrPeng->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name->getCString()));
    }
    CCArray *arrPengRev = CCArray::createWithArray(arrPeng);
    arrPengRev->reverseObjects();
    arrPeng->addObjectsFromArray(arrPengRev);
    
    CCFiniteTimeAction *delay = CCDelayTime::create(1);

    CCAnimate* anShang = CCAnimate::create(CCAnimation::createWithSpriteFrames(arrShang, 0.25));
    CCAnimate* anPeng  = CCAnimate::create(CCAnimation::createWithSpriteFrames(arrPeng, 0.15));
    sprite->runAction(CCRepeatForever::create((CCActionInterval*)CCSequence::create(anShang, delay, anPeng,anPeng, anPeng, anPeng, anPeng, anShang->reverse(),delay,delay,delay,NULL)));
    return true;
}