Пример #1
0
void GameRankLayer::initTabs()
{
	// Friend Tab
	CCScale9Sprite* ptrTabFriendsSelected = GameUtils::createScale9("new_blue_bg.png",
		CCRectMake(0,0,200,82),CCRectMake(35,35,125,10));
	ptrTabFriendsSelected->setContentSize(CCSizeMake(204,82));
	CCScale9Sprite* ptrTabFriendsDisabled = GameUtils::createScale9("new_blue_bg.png",
		CCRectMake(0,0,200,82),CCRectMake(35,35,125,10));
	ptrTabFriendsDisabled->setContentSize(CCSizeMake(204,82));
	CCNode* ptrTabFriendsNormal = CCNode::create();
	ptrTabFriendsNormal->setContentSize(ptrTabFriendsSelected->getContentSize());

	m_ptrTabFriends = CCMenuItemSprite::create(ptrTabFriendsNormal, ptrTabFriendsSelected, 
		ptrTabFriendsDisabled, this, menu_selector(GameRankLayer::tabFriendsCallback));
	m_ptrBg->addChild(m_ptrTabFriends);
	LayoutUtil::layoutParentLeftTop(m_ptrTabFriends, -5, -27);
	registerMenuItem(m_ptrTabFriends);

	m_ptrLbFriends = CCLabelBMFont::create(LOCALIZED_STRING("word_friends"), 
		FontConstant::BMFONT_GOTHIC725_BLK_BT_BLUE);
	m_ptrLbFriends->setScale(0.6f);
	m_ptrTabFriends->addChild(m_ptrLbFriends);
	LayoutUtil::layoutParentBottom(m_ptrLbFriends,6,22);

	// Global Tab
	CCScale9Sprite* ptrTabGlobalSelected = GameUtils::createScale9("new_blue_bg.png",
		CCRectMake(0,0,200,82),CCRectMake(35,35,125,10));
	ptrTabGlobalSelected->setContentSize(CCSizeMake(204,82));
	CCScale9Sprite* ptrTabGlobalDisabled = GameUtils::createScale9("new_blue_bg.png",
		CCRectMake(0,0,200,82),CCRectMake(35,35,125,10));
	ptrTabGlobalDisabled->setContentSize(CCSizeMake(204,82));
	CCNode* ptrTabGlobalNormal = CCNode::create();
	ptrTabGlobalNormal->setContentSize(ptrTabGlobalSelected->getContentSize());
	m_ptrTabGolbal = CCMenuItemSprite::create(ptrTabGlobalNormal, ptrTabGlobalSelected,
		ptrTabGlobalDisabled,this, menu_selector(GameRankLayer::tabGlobalCallback));
	m_ptrBg->addChild(m_ptrTabGolbal);
	LayoutUtil::layoutRight(m_ptrTabGolbal,m_ptrTabFriends,-44);
	registerMenuItem(m_ptrTabGolbal);

	m_ptrLbGlobal = CCLabelBMFont::create(LOCALIZED_STRING("word_global"), 
		FontConstant::BMFONT_GOTHIC725_BLK_BT_BLUE);
	m_ptrLbGlobal->setScale(0.6f);
	m_ptrTabGolbal->addChild(m_ptrLbGlobal);
	LayoutUtil::layoutParentBottom(m_ptrLbGlobal,5,22);

	tabFriendsCallback(NULL);
}
Пример #2
0
CCNode* CCTableWorker::createCellNode()
{
	CCNode* pRet = CCNode::create();

	pRet->setContentSize(m_tCellSize);
	registerNode(pRet);

	return pRet;
}
//-------------------------------------------------------------------------
CCNode* FKCW_UI_Table::createCellNode()
{
	CCNode* pRet = CCNode::create();

	pRet->setContentSize(m_tCellSize);
	registerNode(pRet);

	return pRet;
}
Пример #4
0
CCMenuItemSprite* BetControler::createRadioButton(const char* label,const char* normal,const char* selected,const char* disabled/*=NULL*/,const char* disabledLabel/*=NULL*/){
	if(normal==NULL){
		return NULL;
	}

	CCNode* node = CCNode::create();
	CCSprite* sprite = ResourceManager::getInstance()->createSprite(this, normal);
	CCSprite* labelSprite = ResourceManager::getInstance()->createSprite(this, label);
	node->setContentSize(CCSizeMake(90+labelSprite->getContentSize().width, 110));
	node->addChild(sprite);
	node->addChild(labelSprite);
	LayoutUtil::layoutParentLeft(sprite);
	LayoutUtil::layoutParentLeft(labelSprite,90);
	CCNode* downNode=node;
	if(selected!=NULL){
		downNode = CCNode::create();
		CCSprite* downSprite = ResourceManager::getInstance()->createSprite(this, selected);
		CCSprite* labeldownSprite = ResourceManager::getInstance()->createSprite(this, label);
		downNode->setContentSize(CCSizeMake(90+labeldownSprite->getContentSize().width, 110));
		downNode->addChild(downSprite);
		downNode->addChild(labeldownSprite);
		LayoutUtil::layoutParentLeft(downSprite);
		LayoutUtil::layoutParentLeft(labeldownSprite,90);
	}

	CCNode* disabledNode=NULL;
	if(disabled!=NULL){
		disabledNode = CCNode::create();
		disabledNode->setContentSize(CCSizeMake(104, 104));
		CCSprite* disabledSprite = ResourceManager::getInstance()->createSprite(this, disabled);
		CCSprite* labelDisabledSprite = ResourceManager::getInstance()->createSprite(this, disabledLabel);
		disabledNode->addChild(disabledSprite);
		disabledNode->addChild(labelDisabledSprite);
		LayoutUtil::layoutParentLeft(disabledSprite);
		LayoutUtil::layoutParentLeft(labelDisabledSprite,90);
	}

	CCMenuItemSprite* button=NULL;
	if(disabledNode==NULL){
		button=CCMenuItemSprite::create(node,downNode, this, menu_selector(BetControler::radioButtonsCallback));
	}else{
		button=CCMenuItemSprite::create(node,downNode,disabledNode, this, menu_selector(BetControler::radioButtonsCallback));
	}

	registerMenuItem(button);
	this->addChild(button);
	//button->unselected();
	button->setVisible(false);
	return button;
}
bool CCControlPotentiometerTest::init()
{
    if (CCControlScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        CCNode *layer = CCNode::create();
        layer->setPosition(ccp (screenSize.width / 2, screenSize.height / 2));
        this->addChild(layer, 1);
        
        double layer_width = 0;
        
        // Add the black background for the text
        CCScale9Sprite *background  = CCScale9Sprite::create("extensions/buttonBackground.png");
        background->setContentSize(CCSizeMake(80, 50));
        background->setPosition(ccp(layer_width + background->getContentSize().width / 2.0f, 0));
        layer->addChild(background);
        
        layer_width += background->getContentSize().width;
        
        this->setDisplayValueLabel(CCLabelTTF::create("", "HelveticaNeue-Bold", 30));

        m_pDisplayValueLabel->setPosition(background->getPosition());
        layer->addChild(m_pDisplayValueLabel);
		
        // Add the slider
        CCControlPotentiometer *potentiometer = CCControlPotentiometer::create("extensions/potentiometerTrack.png"
                                                                                ,"extensions/potentiometerProgress.png"
                                                                                ,"extensions/potentiometerButton.png");
        potentiometer->setPosition(ccp (layer_width + 10 + potentiometer->getContentSize().width / 2, 0));

        // When the value of the slider will change, the given selector will be call
        potentiometer->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlPotentiometerTest::valueChanged), CCControlEventValueChanged);
        
		layer->addChild(potentiometer);
        
        layer_width += potentiometer->getContentSize().width;
        
        // Set the layer size
        layer->setContentSize(CCSizeMake(layer_width, 0));
        layer->setAnchorPoint(ccp (0.5f, 0.5f));
        
        // Update the value label
        this->valueChanged(potentiometer, CCControlEventValueChanged);
        return true;
	}
	return false;
}
Пример #6
0
void MessageView::CCListView_cellForRow(CCListView *listView, CCListViewProtrolData *data)
{
    // 背景
    CCSprite* cellBg = CCSprite::create("bg_listview_item.png") ;

    const float cell_width = cellBg->getContentSize().width+15 ;
    const float cell_height = cellBg->getContentSize().height+10 ;

    CCListViewCell* cell = CCListViewCell::node() ;
    cell->setContentSize(CCSizeMake(cell_width, cell_height)) ;
    cell->setOpacity(0) ;
    // cell->setSelectionColor(ccc4(255, 0, 0, 255)) ;
    cell->setSelectionColor(ccc4(103, 102, 204, 255)) ;
    data->cell = cell ;

    CCNode* cellNode = CCNode::create() ;
    cellNode->setContentSize(CCSizeMake(cell_width, cell_height)) ;
    cellNode->setAnchorPoint(ccp(0, 0)) ;
    cellNode->setPosition(ccp(0, 0)) ;
    cell->addChild(cellNode) ;

    // 背景
    cellBg->setAnchorPoint(ccp(0.5, 0.5)) ;
    cellBg->setPosition(ccp(cell_width*0.5, cell_height*0.5)) ;
    cellNode->addChild(cellBg) ;

    // icon
    CCSprite* iconMsg = CCSprite::create("icon_msg.png") ;
    iconMsg->setAnchorPoint(ccp(0, 0.5)) ;
    iconMsg->setPosition(ccp(20, cell_height*0.5)) ;
    cellNode->addChild(iconMsg, 1) ;

    // 主题
    CCLabelTTF* themeLabel = CCLabelTTF::create("蛇年贺新春,免费拿九玩币","font01.ttf", 24.0f,CCSizeMake(cell_width, 50),
                             kCCTextAlignmentLeft, kCCVerticalTextAlignmentCenter) ;
    themeLabel->setColor(ccc3(255, 215, 0)) ;
    themeLabel->setAnchorPoint(ccp(0, 1)) ;
    themeLabel->setPosition(ccp(120, cell_height-8)) ;
    cellNode->addChild(themeLabel, 1) ;

    // 内容
    CCLabelTTF* contentLabel = CCLabelTTF::create("蛇年贺新春,免费拿九玩币,蛇年贺新春,免费拿九玩币","font01.ttf", 20.0f,CCSizeMake(cell_width, 50),
                               kCCTextAlignmentLeft, kCCVerticalTextAlignmentCenter) ;
    contentLabel->setAnchorPoint(ccp(0, 0)) ;
    contentLabel->setPosition(ccp(120, 8)) ;
    cellNode->addChild(contentLabel, 1) ;
}
Пример #7
0
CCTableViewCell* ListViewLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCTableViewCell *cell = table->dequeueCell();
	if (cell == NULL) {
		cell = new CCTableViewCell();
		cell->autorelease();

		if (mSource.creator)
		{
			CCNode* item = mSource.creator->getItemContentByIndex(idx);

			// 包裹
			CCNode* wraped = CCNode::create();
			wraped->setContentSize(item->getContentSize());
			wraped->addChild(item,0);

			// 有个0.5,0.5的偏移
			wraped->setPosition(ccp(wraped->getContentSize().width/2,wraped->getContentSize().height/2));

			cell->addChild(wraped,0,TAG_LIST_CELL_ITEM_WRAP);
		}else
		{
			CCAssert(false,"");
		}

		CCLog("ListViewLayer::tableCellAtIndex ---> create!");
	}
	else
	{
		CCLog("ListViewLayer::tableCellAtIndex ---> refesh!");

		CCNode* warped = cell->getChildByTag(TAG_LIST_CELL_ITEM_WRAP);
		CCNode* item = (CCNode*)warped->getChildren()->objectAtIndex(0);

		if (mSource.creator)
		{
			mSource.creator->refreshItem(item,idx);
		}else
		{
			CCAssert(false,"");
		}
	}

	return cell;
}
Пример #8
0
bool CCCGameScrollView::createContainer(CCCGameScrollViewDelegate *pDele, int nCount, const cocos2d::CCSize &oSize )
{
	CCAssert(m_bSetDirection, "must call setDirection first!!!");
	m_nPageCount = nCount;
	m_CellSize = oSize;
	setDelegate(pDele);
    if (nCount==1) {
        
    }
	CCLayer *pContainer = CCLayer::create();

	CCSize winSize =CCSizeZero ; //CCDirector::sharedDirector()->getVisibleSize();
	for (int i = 0; i < nCount; ++i)
	{
		CCNode *pNode = CCNode::create();
        pNode->setAnchorPoint(ccp(0, 0));
		pDele->scrollViewInitPage(this, pNode, i);

		if (m_eDirection == kCCScrollViewDirectionHorizontal)
		{
			pNode->setPosition(ccp( i * oSize.width, 0));
		}
		else
		{
			pNode->setPosition(ccp(0,i * oSize.height));
		}

		pNode->setContentSize(m_CellSize);
		pNode->setTag(i);
		pContainer->addChild(pNode);
	}
    
    setViewSize(m_CellSize);
	setContainer(pContainer);
     
	return true;
}
Пример #9
0
/**
*	初始化方法,继承CCLayer的方法
*/
bool LoginView::init() 
{
	if(!CCLayer::init())
	{
		return false ;
	}

	CCSize winSize = CCDirector::sharedDirector()->getWinSize() ;

	// 背景
	CCSprite* downBg = CCSprite::create("bg_welcome.png") ;
	downBg->setAnchorPoint(ccp(0.5, 0)) ;
	downBg->setPosition(ccp(winSize.width/2, 0)) ;
	this->addChild(downBg, 0) ;

	// 加载logo
	CCSprite* logo = CCSprite::create("logo_01.png") ;
	logo->setAnchorPoint(ccp(0.5, 0.5)) ;
	logo->setPosition(ccp(winSize.width/2, winSize.height/2+35)) ;
	this->addChild(logo, 1) ;

	///////////////////////////////// 输入框 ////////////////////////////////////////
	
	const float input_width = 213.0f ;
	const float input_height = 39.0f ;  
    const float labelNode_padding = 8.0f ;
    const float labelNode_width = winSize.width/3 ;
	const float labelNode_height = 2*input_height+labelNode_padding ;	
	
	CCNode* labelNode = CCNode::create() ;
	labelNode->setContentSize(CCSizeMake(labelNode_width, labelNode_height)) ;
	labelNode->setAnchorPoint(ccp(0.5, 0)) ;
	labelNode->setPosition(ccp(winSize.width/2-5, 85)) ;
	this->addChild(labelNode, 2) ;

	CCSpriteBatchNode* batchNode = CCSpriteBatchNode::create("bg_textfield.png") ;

    // 用户名
    CCSprite* txtUsernameBg = CCSprite::createWithTexture(batchNode->getTexture()) ;
    txtUsernameBg->setAnchorPoint(ccp(0, 0)) ;
    txtUsernameBg->setPosition(ccp(0, input_height+labelNode_padding)) ;
    labelNode->addChild(txtUsernameBg, 0) ;

    this->txtUsername = CCTextFieldTTF::textFieldWithPlaceHolder("Username", CCSizeMake(input_width, input_height),
                                                                kCCTextAlignmentLeft, "font01.ttf", 26.0f) ;
    this->txtUsername->setVerticalAlignment(kCCVerticalTextAlignmentCenter) ;
    this->txtUsername->setAnchorPoint(ccp(0, 0.5)) ;
    this->txtUsername->setPosition(ccp((winSize.width-labelNode_width)/2+5, 85+labelNode_height*3/4)) ;
    this->addChild(this->txtUsername, 3) ;

	// 密码
    CCSprite* txtPasswordBg = CCSprite::createWithTexture(batchNode->getTexture()) ;
    txtPasswordBg->setAnchorPoint(ccp(0, 0)) ;
    txtPasswordBg->setPosition(ccp(0, 0)) ;
    labelNode->addChild(txtPasswordBg, 0) ;

    this->txtPassword = CCTextFieldTTF::textFieldWithPlaceHolder("Password", CCSizeMake(input_width, input_height),
                                                                kCCTextAlignmentLeft, "font01.ttf", 26.0f) ;
    this->txtPassword->setVerticalAlignment(kCCVerticalTextAlignmentCenter) ;
    this->txtPassword->setAnchorPoint(ccp(0, 0.5)) ;
    this->txtPassword->setPosition(ccp((winSize.width-labelNode_width)/2+5, 85+labelNode_height/4-2)) ;
    this->addChild(this->txtPassword,3) ;

    // 登录按钮
    CCMenuItemImage* loginMenuItem = CCMenuItemImage::create("menu_login_n.png", "menu_login_s.png", this, menu_selector(LoginView::menuLoginCallback)) ;
    loginMenuItem->setAnchorPoint(ccp(0, 0)) ;
    loginMenuItem->setPosition(ccp(0, input_height+labelNode_padding)) ;

    // 注册按钮
    CCMenuItemImage* registeMenuItem = CCMenuItemImage::create("menu_registe_n.png", "menu_registe_s.png", this, menu_selector(LoginView::menuRegisteCallback)) ;
    registeMenuItem->setAnchorPoint(ccp(0, 0)) ;
    registeMenuItem->setPosition(ccp(0, 0)) ;

    CCMenu* loginMenu = CCMenu::create(loginMenuItem, registeMenuItem, NULL) ;
    loginMenu->setAnchorPoint(ccp(0, 0)) ;
    loginMenu->setPosition(ccp(input_width+10, -5)) ;
    labelNode->addChild(loginMenu) ;


    // //////////////////////////////////////////////////////////////////////////////////////////////
    const float loginNode_padding = 11.0f ;
	const float loginNode_margin_bottom = 32.0f ;
    const float menu_item_width = 101.0f ;
	
    CCNode* optionNode = CCNode::create() ;
    optionNode->setContentSize(CCSizeMake(winSize.width/3, 50)) ;
    optionNode->setAnchorPoint(ccp(0.5, 0)) ;
    optionNode->setPosition(ccp(winSize.width/2-5, loginNode_margin_bottom)) ;
    this->addChild(optionNode, 1) ;

    // 游客登录
    CCMenuItemImage* guestLoginItem = CCMenuItemImage::create("menu_guest_login_n.png", "menu_guest_login_s.png", this, menu_selector(LoginView::menuGuestLoginCallback)) ;
    guestLoginItem->setAnchorPoint(ccp(0, 0)) ;
    guestLoginItem->setPosition(ccp(0, 0)) ;

    // 忘记密码
    CCMenuItemImage* forgetPwdItem = CCMenuItemImage::create("menu_forget_pwd_n.png", "menu_forget_pwd_s.png", this, menu_selector(LoginView::menuForgetPwdCallback)) ;
    forgetPwdItem->setAnchorPoint(ccp(0, 0)) ;
    forgetPwdItem->setPosition(ccp(menu_item_width+loginNode_padding, 0)) ;

	
    // go
    CCMenuItemImage* goMenuItem = CCMenuItemImage::create("menu_go_n.png", "menu_go_s.png", this, menu_selector(LoginView::menuGoCallback)) ;
    goMenuItem->setAnchorPoint(ccp(0, 0)) ;
    goMenuItem->setPosition(ccp(2*(menu_item_width+loginNode_padding), 0)) ;

    CCMenu* goMenu = CCMenu::create(guestLoginItem, forgetPwdItem, goMenuItem, NULL) ;
    goMenu->setAnchorPoint(ccp(0, 0)) ;
    goMenu->setPosition(ccp(0, 0)) ;
    optionNode->addChild(goMenu) ;
/*
    /////////////////////////////////////////////////////////////////////////////////////////////
    CCLabelTTF* tipLabel = CCLabelTTF::create("小提示:在游戏中达到规定时间,可以获取神秘大奖哦!", CCSizeMake(winSize.width, 45), 
                                                    kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter, "font01.ttf", 22.0f) ;
    tipLabel->setAnchorPoint(ccp(0.5, 0)) ;
    tipLabel->setPosition(ccp(winSize.width/2, 20)) ;
    this->addChild(tipLabel, 2) ;
*/

    // 接收键盘点击事件
    this->setKeypadEnabled(true) ;

    // 触摸可使用
    this->setTouchEnabled(true);

	return true ;
}
Пример #10
0
void CCINode::loadImages(){
    int tagIndex = 0;
    while (true) {
        CCIMovieTag * tag = NULL;
        if (tagIndex<tags.size()) {
            tag = tags[tagIndex++];
        }else{
            tagIndex = 0;
            break;
        }
        if (tag->getTagType()==TagTypeDefineBitsLossless2 || tag->getTagType()==TagTypeDefineBitsJPEG3||tag->getTagType()==TagTypeDefineBitsJPEG2||tag->getTagType()==TagTypeDefineBits) {
            CCIImageTag* imageTag = (CCIImageTag*)tag;
            CCTexture2D * text = imageTag->getTexture();
            if (text) {
                this->textures->setObject(text, imageTag->getCharacterID());
            }
            
            
        }else if(tag->getTagType()==TagTypeDefineShape||tag->getTagType()==TagTypeDefineShape2||tag->getTagType()==TagTypeDefineShape3){
            //shape是可以放上去的精灵
            
            CCIDefineShape * defineShapeTag = (CCIDefineShape *)tag;
            CCIRect *bounds = defineShapeTag->getBounds();
            
            CCNode * shape = CCNode::create();
            //CCNode * shape = CCLayerColor::create(ccc4(200,0,0,100));
            shape->ignoreAnchorPointForPosition(false);
            shape->setContentSize(bounds->getSize());
            
            shape->setAnchorPoint(bounds->getAnchorPoint());
            //shape->ignoreAnchorPointForPosition(true);
            
            shape->setUserObject(CCInteger::create(NodeTypeNode));
            
            CCIShapeWithStyle * style = defineShapeTag->getShapes();
            CCIFillStyleArray * fileStyles = style->FillStyles;
            this->fillNodeWithStyle(fileStyles, shape,bounds);
            
            for (int i=0; i<style->ShapeRecords.size(); i++) {
                CCIShapeRecord * record = style->ShapeRecords[i];
                if (record->ShapeType==ShapeTypeStyle){
                    CCIStyleChangeRecord * styleRecord = (CCIStyleChangeRecord *)record;
                    if (styleRecord->StateNewStyles) {
                        fileStyles = styleRecord->FillStyles;
                        this->fillNodeWithStyle(fileStyles, shape,bounds);
                    }
                }
            }
            
            this->nodes->setObject(shape, defineShapeTag->getShapeId());
            
        }else if(tag->getTagType()==TagTypeDefineSprite){
            CCIDefineSprite * sprite = (CCIDefineSprite *)tag;
            
            CCINode * node = CCINode::createWithTags(sprite->getControlTags(), this->swfMovie,this->nodes);
            
            node->setUserObject(CCInteger::create(NodeTypeCCINode));
            this->nodes->setObject(node, sprite->getSpriteId());
        }
    }
}
Пример #11
0
bool GameMenu::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize size = CCDirector::sharedDirector()->getWinSize();    

    //初始化背景
    CCSprite* bg = CCSprite::create("bg.png");
    bg->setScale(0.5);
    bg->setPosition( ccp(size.width/2, size.height/2) );
    this->addChild(bg, 0,0);
    //初始化背景星球
    CCSprite*bgstar = CCSprite::create("moon.png");
    bgstar->setAnchorPoint(ccp(0.5,0));
    bgstar->setScale(0.5);
    bgstar->setPosition(ccp(size.width/3 * 2, 0));
    this->addChild(bgstar,1,1);
    //初始化标题
    CCNode *title = CCNode::create();
    title->setContentSize(CCSizeMake(size.width - 40,50));
    CCSprite *ptmLabel = CCSprite::create("meowstar.png");
    ptmLabel->setScale(0.5);
    ptmLabel->setPosition( ccp(0,30) );
    title->addChild(ptmLabel);
    CCSprite *ptbLabel = CCSprite::create("battle.png");
    ptbLabel->setScale(0.5);
    ptbLabel->setPosition( ccp(0,-30) );
    title->addChild(ptbLabel);
    title->setPosition(ccp(size.width / 2, size.height - 80));
    this->addChild(title,2,2);
    //初始化按钮
    CCMenuItemImage *newGameItem = CCMenuItemImage::create("newGameA.png", "newGameB.png",this,menu_selector(GameMenu::menuNewGameCallback));
    newGameItem->setScale(0.5);
    newGameItem->setPosition(ccp(size.width / 2,size.height / 2 - 20));
    newGameItem->setEnabled(false);
    CCMenuItemImage *continueItem = CCMenuItemImage::create("continueA.png", "continueB.png",this,menu_selector(GameMenu::menuContinueCallback));
    continueItem->setScale(0.5);
    continueItem->setPosition(ccp(size.width / 2,size.height / 2 - 80));
    continueItem->setEnabled(false);
    CCMenuItemImage *aboutItem = CCMenuItemImage::create("aboutA.png", "aboutB.png",this,menu_selector(GameMenu::menuAboutCallback));
    aboutItem->setScale(0.5);
    aboutItem->setPosition(ccp(size.width / 2,size.height / 2 - 140));
    aboutItem->setEnabled(false);
    soundItem = CCMenuItemImage::create("sound-on-A.png", "sound-on-B.png",this,menu_selector(GameMenu::menuSoundCallback));
    soundItem->setScale(0.5);
    soundItem->setEnabled(false);
    soundItem->setPosition(ccp(40,40));
    //使用按钮创建菜单
    CCMenu* mainmenu = CCMenu::create(newGameItem,continueItem,aboutItem,soundItem,NULL);
    mainmenu->setPosition(ccp(0,0));
    this->addChild(mainmenu,1,3);
    //初始化声音部分
    issound = true;//是否开启声音参数
    SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic( CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("background.mp3") );
    SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5);
    SimpleAudioEngine::sharedEngine()->playBackgroundMusic(std::string(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("background.mp3")).c_str(), true);
    return true;
}
Пример #12
0
// 初始化顶部bar
void ActivityView::initTopBar(CCSize winSize) 
{
	////////////////////////////////////////////////////////////////////////////////////////////////////
	// topBarNode 背景
	CCSprite* topBarBg = CCSprite::create("bg_nav_top.png") ;
	topBarBg->setAnchorPoint(ccp(0.5, 0)) ;
	topBarBg->setPosition(ccp(winSize.width/2, 0)) ;

	const float topBar_height = topBarBg->getContentSize().height ; 

	

	// 顶部条信息 //////////////////////////////////////////////////////////////////////////////////////
	this->topBarNode = CCNode::create() ;
	this->topBarNode->setContentSize(CCSizeMake(winSize.width, topBar_height)) ;
	this->topBarNode->setAnchorPoint(ccp(0, 0)) ;
	this->topBarNode->setPosition(ccp(0, winSize.height - topBar_height)) ;
	this->addChild(this->topBarNode, 0, 1) ;

	// 将topBarNode背景加入到topBarNode
	this->topBarNode->addChild(topBarBg, 0 ) ;


	///////////////////////////// 左侧布局 //////////////////////////
	CCNode* leftNode = CCNode::create() ;
	leftNode->setContentSize(CCSizeMake(300, topBar_height)) ;
	leftNode->setAnchorPoint(ccp(0, 0.5)) ;
	leftNode->setPosition(ccp(30, topBar_height/2)) ;
	this->topBarNode->addChild(leftNode, 1) ;

	// 头像
	CCSprite* headPortraitSprite = CCSprite::create("user/head_default_f2.png") ;
	headPortraitSprite->setAnchorPoint(ccp(0, 0)) ;
	headPortraitSprite->setPosition(ccp(0, 10)) ;
	headPortraitSprite->setScale(0.8) ;
	leftNode->addChild(headPortraitSprite) ;

	// 昵称
	CCLabelTTF* nikeNameLabel = CCLabelTTF::create("昵称:我是主角", "font01.ttf", 22.0f) ;
	// nikeNameLabel->setColor(ccc3(191, 173, 111)) ;
	nikeNameLabel->setAnchorPoint(ccp(0, 0)) ;
	nikeNameLabel->setPosition(ccp(70, topBar_height/2+2)) ;
	nikeNameLabel->setHorizontalAlignment(kCCTextAlignmentLeft) ; 			// 水平对齐方式
	nikeNameLabel->setVerticalAlignment(kCCVerticalTextAlignmentCenter) ; 	// 垂直对齐方式
	leftNode->addChild(nikeNameLabel) ;

	// 金币
	CCLabelTTF* goldCoinLabel = CCLabelTTF::create("金币:10000", "font01.ttf", 22.0f) ;
	goldCoinLabel->setAnchorPoint(ccp(0, 1)) ;
	goldCoinLabel->setPosition(ccp(70, topBar_height/2)) ;
	goldCoinLabel->setHorizontalAlignment(kCCTextAlignmentLeft) ; 			// 水平对齐方式
	goldCoinLabel->setVerticalAlignment(kCCVerticalTextAlignmentCenter) ; 	// 垂直对齐方式
	leftNode->addChild(goldCoinLabel) ;


	// 信息
	CCSprite* titleMsg = CCSprite::create("icon_title_activity.png") ;
	titleMsg->setAnchorPoint(ccp(0.5, 0.5)) ;
	titleMsg->setPosition(ccp(winSize.width/2, topBar_height/2)) ;
	this->topBarNode->addChild(titleMsg, 1) ;

	// 分割线
	CCSprite* spliteLineLeft = CCSprite::create("icon_top_nav_splite.png") ;
	spliteLineLeft->setAnchorPoint(ccp(0, 1)) ;
	spliteLineLeft->setPosition(ccp(winSize.width/3+10, topBar_height)) ;
	this->topBarNode->addChild(spliteLineLeft, 1) ;


	// 分割线
	CCSprite* spliteLineRight = CCSprite::create("icon_top_nav_splite.png") ;
	spliteLineRight->setAnchorPoint(ccp(0, 1)) ;
	spliteLineRight->setPosition(ccp(winSize.width*2/3-20, topBar_height)) ;
	this->topBarNode->addChild(spliteLineRight, 1) ;


	/////////////////////////////////////////////////////////////////////////////////////////////////
	/****************************** 菜单选项 ********************************************************/
	// 右侧menu
	const float right_width = 200 ;
	const float item_width = 55 ;

	
	// 礼物
	CCMenuItemImage* menuGifts = CCMenuItemImage::create("menu_gifts_n.png", "menu_gifts_s.png", this,
															menu_selector(ActivityView::menuGiftsClickCallback)) ;
	// menuBack->setContentSize(CCSizeMake(67, 68)) ;
	menuGifts->setAnchorPoint(ccp(0, 0.5)) ;
	menuGifts->setPosition(ccp(0, topBar_height/2)) ;
	//menuGifts->setPosition(ccp(right_width-2*item_width, topBar_height/2)) ;
	//rightMenu->addChild(menuGifts) ;

	// 返回大厅
	CCMenuItemImage* menuBack = CCMenuItemImage::create("menu_back_n.png", "menu_back_s.png", this,
															menu_selector(MessageView::menuBackClickCallback)) ;
	menuBack->setAnchorPoint(ccp(0, 0.5)) ;
	menuBack->setPosition(ccp(2*(item_width+10), topBar_height/2)) ;
	//menuBack->setPosition(ccp(right_width, topBar_height/2)) ;
	//rightMenu->addChild(menuBack) ;

	// 设置
	CCMenuItemImage* menuSetting = CCMenuItemImage::create("menu_setting_n.png", "menu_setting_s.png", this,
															menu_selector(MessageView::menuSettingClickCallback)) ;
	// menuBack->setContentSize(CCSizeMake(67, 68)) ;
	
	menuSetting->setAnchorPoint(ccp(0, 0.5)) ;
	menuSetting->setPosition(ccp(item_width+10, topBar_height/2)) ;
	//menuSetting->setPosition(ccp(right_width-item_width, topBar_height/2)) ;

	//rightMenu->addChild(menuSetting) ;
	CCMenu* rightMenu = CCMenu::create(menuGifts, menuBack, menuSetting, NULL) ;
	rightMenu->setContentSize(CCSizeMake(winSize.width/4, topBar_height)) ;
	rightMenu->setAnchorPoint(ccp(0, 0)) ;
	rightMenu->setPosition(ccp(winSize.width*3/4-10, 0)) ;	
	this->topBarNode->addChild(rightMenu, 1) ;
}
Пример #13
0
void CC3ActionCCNodeSizeTo::update( float t )
{
	CCNode* tNode = (CCNode*)getTarget();
	tNode->setContentSize( CCSizeMake(startSize_.width + (sizeChange_.width * t),
								   startSize_.height + (sizeChange_.height * t)) );
}
Пример #14
0
//-----------------------------------------------------------------
//
//
void CCXMLLayer::LoadPlist( const char *pList )
{
	string strPath = GetGameLevelPath();
	strPath = strPath + pList;

	std::string fullpath(CCFileUtils::fullPathFromRelativePath(strPath.c_str())); 
    
	CCDictionary<std::string, CCObject*> *dict = CCFileUtils::dictionaryWithContentsOfFile(fullpath.c_str());

	CCDictionary<std::string, CCObject*> *imagesDict = (CCDictionary<std::string, CCObject*>*)dict->objectForKey(std::string("images"));

	m_vNodeObject.clear();

	imagesDict->begin();
	std::string key = "";
	CCDictionary<std::string, CCObject*> *imageDict = NULL;
	while( (imageDict = (CCDictionary<std::string, CCObject*>*)imagesDict->next(&key)) )
	{
		float x = (float)atof(valueForKey("x", imageDict));
		float y = (float)atof(valueForKey("y", imageDict));
		float w = (float)atof(valueForKey("width", imageDict));
		float h = (float)atof(valueForKey("height", imageDict));
//        #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
//        if( CCDirector::sharedDirector()->getWinSize().width == 1024 || 2 == CC_CONTENT_SCALE_FACTOR() )
//        {
//            
//        }
//        else
//        {
//            x = x / 2;
//            y = y / 2;
//            w = w / 2;
//            h = h / 2;
//        }
//        #endif    
        
		float layer = (float)atof(valueForKey("layer", imageDict));
		bool flipX = (bool)atoi(valueForKey("FlipX", imageDict));
		bool flipY = (bool)atoi(valueForKey("FlipY", imageDict));
		TurnitorqueWorldToCoco2d( x, y, layer );

		if( strstr( key.c_str(), "t2dSceneObject_") )
		{
			CCNode *pNode = CCNode::node();
			//pNode->setPositionInPixels( ccp( x, y ) );
			pNode->setPosition( ccp( x / CC_CONTENT_SCALE_FACTOR(), y / CC_CONTENT_SCALE_FACTOR() ) );
			CCSize size( w / CC_CONTENT_SCALE_FACTOR(), h / CC_CONTENT_SCALE_FACTOR() );
			pNode->setContentSize( size );
			
			string *pNameKey = new string( key );
			pNode->setUserData( pNameKey );

			addChild( pNode, (int)layer );
			m_vNodeObject.push_back( pNode );
		}
		else if( strstr( key.c_str(), "t2dAnimatedSprite_") )
		{
			AdvanceSprite *m_pAnimation = new AdvanceSprite();
			
			string plist = (valueForKey("plist", imageDict));
			m_pAnimation->addFramesFromiT2D( plist.c_str() );
            m_pAnimation->autorelease();
			//m_pAnimation->setPositionInPixels( ccp( x, y ) );
			m_pAnimation->setPosition( ccp( x / CC_CONTENT_SCALE_FACTOR(), y / CC_CONTENT_SCALE_FACTOR() ) );
			m_pAnimation->setScaleX( ( w / CC_CONTENT_SCALE_FACTOR() ) / m_pAnimation->getContentSize().width );
			m_pAnimation->setScaleY( ( h / CC_CONTENT_SCALE_FACTOR() ) / m_pAnimation->getContentSize().height );
			m_pAnimation->setFlipX( flipX );
			m_pAnimation->setFlipY( flipY );
		    string *pNameKey = new string( key );
			m_pAnimation->setUserData( pNameKey );
			

			int startFrameIndex = (int)atoi(valueForKey("startframe", imageDict));
			int endFrameIndex   = (int)atoi(valueForKey("endframe", imageDict));
			float time = (float)atof(valueForKey("animationtime", imageDict));

			m_pAnimation->startAnimation( startFrameIndex, endFrameIndex, -1, NULL, this, (float)( ( endFrameIndex - startFrameIndex + 1 ) / time ), false, false  );
			addChild( m_pAnimation, (int)layer );

			m_vNodeObject.push_back( m_pAnimation );
		}
		else
		{
			const char *image = valueForKey("image", imageDict);

			string ImagePath = GetGameImagesPath();
			ImagePath = ImagePath + image;

			CCSprite *pSprite = CCSprite::spriteWithFile( ImagePath.c_str() );
			//pSprite->setPositionInPixels( ccp( x, y ) );
			pSprite->setPosition( ccp( x / CC_CONTENT_SCALE_FACTOR(), y / CC_CONTENT_SCALE_FACTOR() ) );
			pSprite->setScaleX( ( w / CC_CONTENT_SCALE_FACTOR() ) / pSprite->getTextureRect().size.width );
			pSprite->setScaleY( ( h / CC_CONTENT_SCALE_FACTOR() ) / pSprite->getTextureRect().size.height );
			pSprite->setFlipX( flipX );
			pSprite->setFlipY( flipY );
		    string *pNameKey = new string( key );
			pSprite->setUserData( pNameKey );
			addChild( pSprite, (int)layer );

			m_vNodeObject.push_back( pSprite );
		}
	}
}
Пример #15
0
bool ActivityView::init()
{
    if (!PopupBaseView::init()) {
        return false;
    }
    setIsHDPanel(true);
    if (m_obj->type != 6) return false;
    CCLoadSprite::doResourceByCommonIndex(500, true);
    CCLoadSprite::doResourceByCommonIndex(502, true);
    CCLoadSprite::doResourceByCommonIndex(506, true);
    auto size = CCDirector::sharedDirector()->getWinSize();
    this->setContentSize(CCSize(640, 852));
    if (CCCommonUtils::isIosAndroidPad())
    {
        this->setContentSize(CCSize(1536, 2048));
    }
    CCBLoadFile("ActivityView", this, this);
    if (CCCommonUtils::isIosAndroidPad()) {
        m_bottomNode->setPositionY(m_bottomNode->getPositionY() - (size.height - 2048));
        m_listNode->setPositionY(m_listNode->getPositionY() - (size.height - 2048));
        m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + size.height - 2048));
    } else {
        m_bottomNode->setPositionY(m_bottomNode->getPositionY() - (size.height - 852));
        m_listNode->setPositionY(m_listNode->getPositionY() - (size.height - 852));
        m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + size.height - 852));
    }

    if (m_obj->exchange == "1" || m_obj->exchange == "2") {
        m_bottomNode->setVisible(true);
    } else {
        m_bottomNode->setVisible(false);
        if (CCCommonUtils::isIosAndroidPad())
        {
            m_listNode->setPositionY(m_listNode->getPositionY() - 178);
            m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + 178));
        } else {
            m_listNode->setPositionY(m_listNode->getPositionY() - 92);
            m_listNode->setContentSize(CCSize(m_listNode->getContentSize().width, m_listNode->getContentSize().height + 92));
        }
    }
    m_titleLabel->setString(_lang("150215"));
    CCCommonUtils::setButtonTitle(m_rwdBtn, _lang("133076").c_str());
    Node* node = Node::create();
    CCLabelIF* label = nullptr;
    Sprite* spr = nullptr;
    float height = 0;
    {
        if (!m_obj->rewardIds.empty()) {
            if (m_obj->showDialogs.size() > 0) {
                height -= 20;
                if (CCCommonUtils::isIosAndroidPad())
                {
                    height -= 20;
                }
            }
            for (auto it = m_obj->showDialogs.begin(); it != m_obj->showDialogs.end(); ++it) {
                vector<string> tVec;
                CCCommonUtils::splitString(*it, ";", tVec);
                string showStr("");
                if (tVec.size() == 1)
                {
                    showStr = _lang(tVec[0]);
                } else if (tVec.size() == 2) {
                    showStr = _lang_1(tVec[0].c_str(), (CCCommonUtils::getNameById(tVec[1])).c_str());
                } else if (tVec.size() == 3) {
                    showStr = _lang_2(tVec[0].c_str(), (CCCommonUtils::getNameById(tVec[1])).c_str(), (CCCommonUtils::getNameById(tVec[2])).c_str());
                } else if (tVec.size() == 4) {
                    showStr = _lang_3(tVec[0].c_str(), (CCCommonUtils::getNameById(tVec[1])).c_str(), (CCCommonUtils::getNameById(tVec[2])).c_str(), (CCCommonUtils::getNameById(tVec[3])).c_str());
                }
                label = CCLabelIF::create(showStr.c_str());
                label->setFontSize(20);
                if (CCCommonUtils::isIosAndroidPad())
                {
                    label->setFontSize(40);
                }
                label->setColor(ccBLACK);
                label->setAnchorPoint(Vec2(0.5, 1));
                label->setDimensions(Size(580, 0));
                if (CCCommonUtils::isIosAndroidPad())
                {
                    label->setDimensions(Size(1300, 0));
                }
                label->setHorizontalAlignment(TextHAlignment::CENTER);
                label->setVerticalAlignment(TextVAlignment::TOP);
                label->setPosition(Vec2(0, height));
                node->addChild(label);
                height -= label->getContentSize().height * label->getOriginScaleY();
            }
            height -= 5;
            if (CCCommonUtils::isIosAndroidPad())
            {
                height -= 5;
            }
            //有几率获得
            label = CCLabelIF::create(_lang("150217").c_str());
            label->setFontSize(18);
            if (CCCommonUtils::isIosAndroidPad())
            {
                label->setFontSize(36);
            }
            label->setAnchorPoint(Vec2(0.5, 1));
            label->setPosition(Vec2(0, height));
            label->setColor({139, 29, 20});
            label->setHorizontalAlignment(TextHAlignment::CENTER);
            label->setVerticalAlignment(TextVAlignment::TOP);
            node->addChild(label);
            height -= label->getContentSize().height * label->getOriginScaleY();
            
            //展示奖励
            int cnt = m_obj->rewardIds.size();
            int hang = ceil(cnt / 6.0);
            for (int i = 1; i <= hang; ++i) {
                if (i < hang) {
                    for (int j = 1; j <= 6; ++j) {
                        ActivityRwdShowCell* cell = ActivityRwdShowCell::create(m_obj->rewardIds.at(j - 1 + (i - 1) * 6));
                        cell->setPositionX(- 80 * 6 / 2 + 80 / 2 + (j - 1) * 80);
                        cell->setPositionY(height - 40);
                        if (CCCommonUtils::isIosAndroidPad()) {
                            cell->setPositionX(- 160 * 6 / 2 + 160 / 2 + (j - 1) * 160);
                            cell->setPositionY(height - 80);
                        }
                        node->addChild(cell);
                    }
                    height -= 80;
                    if (CCCommonUtils::isIosAndroidPad())
                    {
                        height -= 80;
                    }
                } else {
                    int leftCnt = cnt - (i - 1) * 6;
                    for (int j = 1; j <= leftCnt; ++j) {
                        ActivityRwdShowCell* cell = ActivityRwdShowCell::create(m_obj->rewardIds.at((i - 1) * 6 + j - 1));
                        cell->setPositionX(- (80 * leftCnt) / 2 + 80 / 2 + (j - 1) * 80);
                        cell->setPositionY(height - 40);
                        if (CCCommonUtils::isIosAndroidPad()) {
                            cell->setPositionX(- 160 * leftCnt / 2 + 160 / 2 + (j - 1) * 160);
                            cell->setPositionY(height - 80);
                        }
                        node->addChild(cell);
                    }
                    height -= 80;
                    if (CCCommonUtils::isIosAndroidPad())
                    {
                        height -= 80;
                    }
                }
            }
            //空
            height -= 10;
            if (CCCommonUtils::isIosAndroidPad()) {
                height -= 10;
            }
            //横线
            spr = CCLoadSprite::createSprite("Items_tips3_lottery.png");
            spr->setAnchorPoint(Vec2(0.5, 0.5));
            spr->setPosition(0, height);
            node->addChild(spr);
            if (CCCommonUtils::isIosAndroidPad())
            {
                spr->setScale(2);
            }
            //空
            height -= 10;
            if (CCCommonUtils::isIosAndroidPad()) {
                height -= 10;
            }
            //剧情简介
            label = CCLabelIF::create(_lang("150216").c_str());
            label->setAnchorPoint(Vec2(0.5, 1));
            label->setColor(ccBLACK);
            label->setFontSize(20);
            if (CCCommonUtils::isIosAndroidPad()) {
                label->setFontSize(40);
            }
            label->setPosition(0, height);
            label->setHorizontalAlignment(TextHAlignment::CENTER);
            label->setVerticalAlignment(TextVAlignment::TOP);
            node->addChild(label);
            height -= label->getContentSize().height * label->getOriginScaleY();
            //空
            height -= 10;
            if (CCCommonUtils::isIosAndroidPad()) {
                height -= 10;
            }
        }
        //正文
        string mStory = _lang(m_obj->story);
        mStory.append("\n\n\n");
        label = CCLabelIF::create(mStory.c_str());
        label->setFontSize(20);
        if (CCCommonUtils::isIosAndroidPad()) {
            label->setFontSize(40);
        }
        label->setDimensions(Size(580, 0));
        if (CCCommonUtils::isIosAndroidPad()) {
            label->setDimensions(Size(1300, 0));
        }
        label->setAnchorPoint(Vec2(0.5, 1));
        label->setColor({85, 62, 31});
        label->setPosition(0, height);
        label->setHorizontalAlignment(TextHAlignment::CENTER);
        label->setVerticalAlignment(TextVAlignment::TOP);
        node->addChild(label);
        height -= label->getContentSize().height * label->getOriginScaleY();
    }
    ScrollView* view = ScrollView::create(m_listNode->getContentSize());
    if (abs(height) < m_listNode->getContentSize().height) {
        node->setPositionY(m_listNode->getContentSize().height / 2.0 + abs(height) / 2.0);
        height = -m_listNode->getContentSize().height;
    } else {
        node->setPositionY(abs(height));
    }
    view->setContentSize(Size(m_listNode->getContentSize().width, abs(height)));
    view->addChild(node);
    node->setPositionX(view->getContentSize().width / 2);
//    node->setPositionY(abs(height));
    view->setContentOffset(Vec2(0, m_listNode->getContentSize().height - view->getContentSize().height));
    view->setDirection(ScrollView::Direction::VERTICAL);
    m_listNode->addChild(view);
    view->setDelegate(this);
    
    bool st = false;
    if (LuaController::getInstance()->checkActLuaValid(m_obj))
    {
        CCNode* node = LuaController::getInstance()->createActivityAdCell(m_obj);
        if (node && node->getChildrenCount()) {
            m_picNode->addChild(node);
            if (CCCommonUtils::isIosAndroidPad())
            {
                float w = (1536.0 - 1156.0) / 2.0;
                float h = 645;
                node->setContentSize(CCSize(0, 0));
                node->setScaleX(1156.0 / 640.0);
                node->setScaleY(645.0 / 357.0);
                auto layer1 = CCModelLayerColor::create();
                layer1->setAnchorPoint(ccp(0, 0));
                layer1->setContentSize(CCSize(w, h));
                layer1->setPosition(-w, 0);
                layer1->setOpacity(255);
                layer1->setColor(ccBLACK);
//                layer1->setTouchPriority(-999);
                m_picNode->addChild(layer1);
                
                layer1 = CCModelLayerColor::create();
                layer1->setAnchorPoint(CCPointZero);
                layer1->setPosition(ccp(1156, 0));
                layer1->setContentSize(CCSize(w, h));
                layer1->setOpacity(255);
                layer1->setColor(ccBLACK);
//                layer1->setTouchPriority(-999);
                m_picNode->addChild(layer1);
            }
        } else {
            st = true;
        }
    }
    else
    {
        st = true;
    }
    
    if (st) {
        auto nameTTF = CCLabelIF::create(m_obj->name.c_str());
        auto infoTTF = CCLabelIF::create(m_obj->desc.c_str());
        auto bgImg = CCLoadSprite::createSprite("activity_ad_beiyong.png");
        
        nameTTF->setPosition(ccp(16,245));
        nameTTF->setAnchorPoint(ccp(0, 1));
        nameTTF->setFontSize(36);
        nameTTF->setColor({255,219,117});
        nameTTF->setHorizontalAlignment(kCCTextAlignmentLeft);
        nameTTF->setVerticalAlignment(kCCVerticalTextAlignmentTop);
        nameTTF->setDimensions(CCSize(0, 0));
        
        infoTTF->setPosition(ccp(16,201));
        infoTTF->setAnchorPoint(ccp(0, 1));
        infoTTF->setColor({0, 249, 0});
        infoTTF->setHorizontalAlignment(kCCTextAlignmentLeft);
        infoTTF->setVerticalAlignment(kCCVerticalTextAlignmentTop);
        infoTTF->setDimensions(CCSize(300, 0));
        
        
        bgImg->setAnchorPoint(ccp(0, 0));
        bgImg->setPosition(ccp(0, 0));
        auto node = CCNode::create();
        node->addChild(bgImg);
        node->addChild(nameTTF);
        node->addChild(infoTTF);
        m_picNode->addChild(node);
        if (CCCommonUtils::isIosAndroidPad()) {
            float w = (1536.0 - 1156.0) / 2.0;
            float h = 645;
            node->setContentSize(CCSize(0, 0));
            node->setScaleX(1156.0 / 640.0);
            node->setScaleY(645.0 / 357.0);
            auto layer1 = CCModelLayerColor::create();
            layer1->setAnchorPoint(ccp(0, 0));
            layer1->setContentSize(CCSize(w, h));
            layer1->setPosition(-w, 0);
            layer1->setOpacity(255);
            layer1->setColor(ccBLACK);
            //                layer1->setTouchPriority(-999);
            m_picNode->addChild(layer1);
            
            layer1 = CCModelLayerColor::create();
            layer1->setAnchorPoint(CCPointZero);
            layer1->setPosition(ccp(1156, 0));
            layer1->setContentSize(CCSize(w, h));
            layer1->setOpacity(255);
            layer1->setColor(ccBLACK);
            //                layer1->setTouchPriority(-999);
            m_picNode->addChild(layer1);
        }
    }
    
    if (m_obj->exchange == "2") {
        if (ActivityController::getInstance()->m_exc2Data.find(m_obj->id) == ActivityController::getInstance()->m_exc2Data.end()) {
            ActivityController::getInstance()->startGetAct6Data();
        } else {
            if (!ActivityController::getInstance()->checkIsToday(ActivityController::getInstance()->m_exc2RefInfo[m_obj->id].m_refreshTime)) {
                ActivityController::getInstance()->m_exc2RefInfo[m_obj->id].m_refreshTime = GlobalData::shared()->getTimeStamp();
                ActivityController::getInstance()->m_exc2RefInfo[m_obj->id].m_refresh = 0;
            }
        }
    } else if (m_obj->exchange == "1") {
        if (!ActivityController::getInstance()->isAct1DataInit(m_obj->id)) {
            ActivityController::getInstance()->startGetAct6Data();
        } else {
            ActivityController::getInstance()->checkAct1ReFreshTimes(m_obj->id);
//            if (ActivityController::getInstance()->isAct1DataShouldRefresh(m_obj->id))
//            {
//                ActivityController::getInstance()->startAct6Refresh(m_obj->id);
//            }
        }
    }

    return true;
}