void NovelScene::dispName(string name) { CCLayer* pLayer = (CCLayer*) this->getChildByTag(kTag_TextLayer_name); if (pLayer) { //텍스트를 진행한다 CCLabelTTF* nameTextLabel = (CCLabelTTF*) pLayer->getChildByTag(kTag_TextLayer_nameTextLabel); nameTextLabel->setString(name.c_str()); } }
void NovelScene::dispText(string text) { CCLayer* pLayer = (CCLayer*) this->getChildByTag(kTag_TextLayer); if (pLayer) { //텍스트를 진행한다 CCLabelTTF* textLabel = (CCLabelTTF*) pLayer->getChildByTag(kTag_TextLayer_textLabel); textLabel->setString(text.c_str()); } }
//SetContentAccess //state //1 - active //2 - passive void CurrentGroupLayer::setContentAccess(bool state) { CCLayer* spr = (CCLayer*)this->getChildByTag(ID_CONTROLLAYER); spr->stopAllActions(); CCActionInterval* scalein = CCScaleTo::actionWithDuration(0.2f,1.2f,1.2f); CCActionInterval* scaleout = CCScaleTo::actionWithDuration(0.2f,1.0f,1.0f); CCActionInterval* fadetoin = CCFadeTo::actionWithDuration(0.2f,255); CCActionInterval* fadetoout = CCFadeTo::actionWithDuration(0.2f,180); if(state) { ((CCSprite*)(spr->getChildByTag(ID_TEXTFIELD)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoin->copy()->autorelease(),2.0f)); ((CCSprite*)(spr->getChildByTag(ID_COLORBOX)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoin->copy()->autorelease(),2.0f)); ((CCSprite*)(spr->getChildByTag(ID_STRIPE)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoin->copy()->autorelease(),2.0f)); spr->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)scalein->copy()->autorelease(),2.0f)); m_isAccessable = true; } else { ((CCSprite*)(spr->getChildByTag(ID_TEXTFIELD)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoout->copy()->autorelease(),2.0f)); ((CCSprite*)(spr->getChildByTag(ID_COLORBOX)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoout->copy()->autorelease(),2.0f)); ((CCSprite*)(spr->getChildByTag(ID_STRIPE)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoout->copy()->autorelease(),2.0f)); spr->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)scaleout->copy()->autorelease(),2.0f)); //hide keyboard this->onClickTrackNode(0); m_isAccessable = false; } }
bool TileMap::canPassedCOLROW(cocos2d::CCPoint pos){ CCLayer *layer = this->getLayer(); CCTMXTiledMap *tileMap = dynamic_cast<CCTMXTiledMap*>(layer->getChildByTag(tilemap_tag)); //获得block层 CCTMXLayer *block = tileMap->layerNamed("block"); //获得砖块(根据某个位置) int tileGID = block->tileGIDAt(pos); if (tileGID) { CCDictionary *properties = tileMap->propertiesForGID(tileGID); if (properties) { const CCString *collion = properties->valueForKey("blockTiled"); if (collion&&collion->compare("1")) { return true; } } } return true; }
CCTMXTiledMap* TileMap::getTileMap(){ CCLayer *layer = this->getLayer(); CCTMXTiledMap *tileMap = dynamic_cast<CCTMXTiledMap*>(layer->getChildByTag(tilemap_tag)); return tileMap; }