本文整理汇总了C++中Stone::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ Stone::setVisible方法的具体用法?C++ Stone::setVisible怎么用?C++ Stone::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stone
的用法示例。
在下文中一共展示了Stone::setVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: regret
void GameStartLayer::regret(CCObject *)
{
if (_steps.size() == 0)
{
return;
}
Step *step = *_steps.rbegin();
_steps.pop_back();
//! 具体恢复工作
Stone *s = _s[step->moveid];
s->_proper._row = step->rowFrom;
s->_proper._col = step->colFrom;
s->setPosition(s->fromPlate());
Stone *killed;
if (step->killid != -1)
{
killed = _s[step->killid];
killed->_dead = false;
killed->setVisible(true);
}
delete step;
//! 隐藏选中框
_selectid = -1;
//_selectedSprite->setVisible(false);
_selectedSprite->setPosition(s->getPosition());
}
示例2: doRegret
void SceneGame::doRegret()
{
// 游戏还没有开始不能悔棋
if (_steps.size() == 0)
return;
// 恢复最后一步
Step* step = *_steps.rbegin();
_steps.pop_back();
// 具体恢复工作
Stone* s = _s[step->moveid];
s->_row = step->rowFrom;
s->_col = step->colFrom;
s->setPosition(s->fromPlate());
Stone* kill;
if (step->killid != -1)
{
kill = _s[step->killid];
kill->_dead = false;
kill->setVisible(true);
}
_bRedTurn = !_bRedTurn;
delete step;
// 避免在选中棋子的情况下,悔棋
_selectid = -1;
_selectSprite->setVisible(false);
}
示例3: CheckRecv
void SceneGame::CheckRecv(float)
{
if (Net::isRecvComplete())
{
int len;
char* data = Net::RecvData(len);
unschedule(schedule_selector(SceneGame::CheckRecv));
// 悔棋
if (data[0] == 3)
{
doRegret2();
// 继续接收
Net::RecvStart();
schedule(schedule_selector(SceneGame::CheckRecv));
}
// 选棋
else if (data[0] == 1)
{
_selectid = data[1];
_selectSprite->setPosition(_s[_selectid]->fromPlate());
_selectSprite->setVisible(true);
// 继续接收
Net::RecvStart();
schedule(schedule_selector(SceneGame::CheckRecv));
}
else if (data[0] == 2)
{
// 接受移动信息
Stone* s = _s[data[1]];
int row = 9 - data[2];
int col = 8 - data[3];
int killid = Common::getStoneFromRowCol(row, col, _s);
// 记录走棋信息
recordStep(_selectid, killid, _s[_selectid]->_row, _s[_selectid]->_col, row, col);
// 移动棋子
s->_row = row;
s->_col = col;
s->setPosition(s->fromPlate());
// 杀死棋子
if (killid != -1)
{
Stone* ks = _s[killid];
ks->_dead = true;
ks->setVisible(false);
}
// 更新数据
_selectid = -1;
_selectSprite->setVisible(false);
_bRedTurn = !_bRedTurn;
}
}
}
示例4: computerMove
void GameStartLayer::computerMove(float)
{
Step*step = AI::getStepABS(this, 2);
//Step *step = AI::getStep(this, 2);
Stone *moveStone = _s[step->moveid];
moveStone->_proper._row = step->rowTo;
moveStone->_proper._col = step->colTo;
moveStone->setPosition(moveStone->fromPlate());
_bRedTurn = !_bRedTurn;
if (step->killid != -1)
{
Stone *killStone = _s[step->killid];
killStone->_dead = true;
killStone->setVisible(false);
}
_selectedSprite->setPosition(moveStone->getPosition());
_steps.push_back(step);
}