本文整理汇总了C++中Tower::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ Tower::setVisible方法的具体用法?C++ Tower::setVisible怎么用?C++ Tower::setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tower
的用法示例。
在下文中一共展示了Tower::setVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setCurFloor
void Detect::setCurFloor(int floorId, int towerId, float duration)
{
// 当前楼层返回
if(_curFloor != nullptr && floorId == _curFloor->getId() && towerId == _curFloor->getTower()->getId())
return;
auto oldTower = _curTower;
auto oldFloor = _curFloor;
if(towerId == -1)
towerId = getCurTower()->getId();
// 当前显示的楼层切换
Tower* newTower = getTower(towerId);
if(_world->getChildByTag(towerId) == nullptr)
{
_world->addChild(newTower,towerId,towerId);
newTower->setVisible(false);
}
Floor* newFloor = getFloor(floorId, towerId);
newFloor->buildMap();
if(newTower->getChildByTag(floorId) == nullptr)
{
newTower->addChild(newFloor,floorId,floorId);
newFloor->setVisible(false);
}
setControlled(4,false);
_curFloor = newFloor;
_curTower = newTower;
//// 镜头跟随
//if(_player != nullptr)
//{
// auto rect = Rect(0,0,_curFloor->getHorizonTileNum()*TILE_WIDTH,_curFloor->getVerticalTileNum()*TILE_HEIGHT);
// auto follow = Follow::create(_player, rect);
// _curFloor->runAction(follow);
//}
_worldDark->removeFromParent();
_world->addChild(_worldDark,100);
_worldDark->runAction(Sequence::create(FadeTo::create(duration,180),CallFunc::create([=](){
/*for(auto node:_world->getChildren())
{
if(node != _worldDark)
{
node->setVisible(false);
}
}*/
if(oldTower != nullptr)
{
oldTower->setVisible(false);
}
if(oldFloor != nullptr)
{
oldFloor->setVisible(false);
}
newTower->setVisible(true);
newFloor->setVisible(true);
newTower->setZOrder(-1);
newFloor->setZOrder(-1);
#if DETECT_ACTOR == 1
_curFloor->updateFight();
#endif
EventHelper::getInstance()->dispatchByStr("target:hud|senderName:Detect|type:setCurFloor", StringUtils::format("floorId:%d|towerName:%s",floorId,_curTower->getNickName().c_str()));
}),FadeTo::create(duration,0),CallFuncN::create([this](Node *node){setControlled(4,true);node->removeFromParent();}),NULL));
}