void TaoZhuangInfoUI::onEnter()
{
	CCLayer::onEnter();
	CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this,-2014,true);
	CCSize size = CCDirector::sharedDirector()->getWinSize();

	//m_lNodeList.push_back(spr);
	ccColor4B color = {0,0,0,100};
	CCLayerColor *colorLayer1 = CCLayerColor::create(color);
	colorLayer1->setPosition(CCPointZero);
	colorLayer1->setContentSize(size);
	addChild(colorLayer1);

	UILayer* uiLayer = UILayer::create();  
	///auto myLayout = dynamic_cast<Layout*>(CCUIHELPER->createWidgetFromJsonFile("testUI.ExportJson")); //alpha0中使用  
	Widget* myLayout = GUIReader::shareReader()->widgetFromJsonFile("NewFriendAddUI_2.ExportJson"); //alpha1中使用  
	uiLayer->addWidget(myLayout);  
	this->addChild(uiLayer);
	//CCSize size = CCDirector::sharedDirector()->getWinSize();
	myLayout->ignoreAnchorPointForPosition(false);
	myLayout->setAnchorPoint(ccp(0.5,0.5));
	myLayout->setPosition(ccp(size.width / 2,size.height / 2));

	//BaseSprite* getFullPhotoOfActor()
	unsigned int curGroupId = getZhuangbeiGroupID(m_sProfessionid);
	OneSuitInfo suitInfo;
	if(SuitPool::getPool()->getSuitInforByZBGroupId(curGroupId, suitInfo))
	{
		//ImageManager::getManager()->
		Label *name = dynamic_cast<Label*>(myLayout->getChildByName("Name"));
		if (name)
		{
			name->setText(suitInfo.suit_name.c_str());
		}
		int index = 0;
		for (vector<SuitPart>::iterator iter = suitInfo.parts_of_suit.begin() ; iter != suitInfo.parts_of_suit.end() ; iter++)
		{
			index ++;
			Label *name1 = dynamic_cast<Label*>(myLayout->getChildByName(CCString::createWithFormat("Name%d",index)->getCString()));

			string nameTitle = iter->zhuangbei_name.c_str();

			if (iter->zhuanbei_type == ZhuangbeiType_DanshouJian || iter->zhuanbei_type == ZhuangbeiType_ShuangshouBishou || iter->zhuanbei_type == ZhuangbeiType_ShuangshouFu || iter->zhuanbei_type == ZhuangbeiType_DanshouFazhang || iter->zhuanbei_type == ZhuangbeiType_Gong || iter->zhuanbei_type == ZhuangbeiType_ShuangshouFazhang)
			{
				nameTitle += LFStrings::getValue("ZhuangBeiWuQi");
			}
			else if (iter->zhuanbei_type == ZhuangbeiType_Faqi || iter->zhuanbei_type == ZhuangbeiType_Dunpai)
			{
				nameTitle += LFStrings::getValue("ZhuangBeiFuShou");
			}
			else if (iter->zhuanbei_type == ZhuangbeiType_Hushenfu)
			{
				nameTitle += LFStrings::getValue("ZhuangBeiHuShenFu");
			}
			else if (iter->zhuanbei_type == ZhuangbeiType_KuijiaZhong || iter->zhuanbei_type == ZhuangbeiType_KuijiaQin)
			{
				nameTitle += LFStrings::getValue("ZhuangBeiXiongJia");
			}
			else
			{
				nameTitle += LFStrings::getValue("ZhuangBeiJieZhi");
			}
			name1->setText(nameTitle.c_str());
			name1->setFontName(fontStr_kaiti);
		}
		for (int i = index + 1; i <= 6; i++)
		{
			Label *name1 = dynamic_cast<Label*>(myLayout->getChildByName(CCString::createWithFormat("Name%d",i)->getCString()));
			name1->setVisible(false);
		}
		
		for (int i = 0 ; i < 5 ; i ++)
		{
			Label *name2 = dynamic_cast<Label*>(myLayout->getChildByName(CCString::createWithFormat("Label%d",i + 1)->getCString()));
			name2->setFontName(fontStr_kaiti);
			Label *name1 = dynamic_cast<Label*>(myLayout->getChildByName(CCString::createWithFormat("ZB%dNumber",i + 1)->getCString()));
			if (suitInfo.suit_attr[i][0].attr_type == 0)
			{
				name2->setVisible(false);
				name1->setVisible(false);
				continue;
			}
			name1->setText(GetMoFaShuXing_ByZBAttr(suitInfo.suit_attr[i][0]));
			name1->setFontName(fontStr_kaiti);

			
			//string nameTitle = iter->zhuangbei_name.c_str();
		}
	}
	{
		Label *miaoShuText = dynamic_cast<Label*>(myLayout->getChildByName("Label_50"));
		if (miaoShuText)
		{
			miaoShuText->setFontName(fontStr_kaiti);
			miaoShuText->setText(getNpcMiaoShu(m_sProfessionid).c_str());
		}
	}

	CCNode *node = ImageManager::getManager()->getFullPhotoOfAllShenBing(m_sProfessionid);
	{
		UIImageView *taoZhuang = dynamic_cast<UIImageView*>(myLayout->getChildByName("Image_49"));
		if (taoZhuang)
		{
			myLayout->addNode(node,2);
			node->ignoreAnchorPointForPosition(false);
			node->setAnchorPoint(taoZhuang->getAnchorPoint());
			node->setPosition(ccp(taoZhuang->getPositionX(),taoZhuang->getPositionY() + node->getContentSize().height / 2 + 100));
			taoZhuang->setVisible(false);
			taoZhuang->setEnabled(false);
		}
	}
	{
		Button *closeItem = dynamic_cast<Button*>(myLayout->getChildByName("CloseBtn"));
		if (closeItem)
		{
			//m_iCloseItem = closeItem;
			m_lButtonList.push_back(closeItem);
			closeItem->addTouchEventListener(this, toucheventselector(TaoZhuangInfoUI::clickOk));
		}
	}
}
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());
        }
    }
}
Example #3
0
void LayerIgnoreAnchorPointScale::onToggle(CCObject* pObject)
{
    CCNode* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
    bool ignore = pLayer->isIgnoreAnchorPointForPosition();
    pLayer->ignoreAnchorPointForPosition(! ignore);
}