本文整理汇总了C++中Chess::fromPlate方法的典型用法代码示例。如果您正苦于以下问题:C++ Chess::fromPlate方法的具体用法?C++ Chess::fromPlate怎么用?C++ Chess::fromPlate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chess
的用法示例。
在下文中一共展示了Chess::fromPlate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doRegret
void SceneGame::doRegret()
{
if (_steps->size() == 0)
return;
Step* step = *_steps->rbegin();
_steps->pop_back();
Chess* s = _c->at(step->moveid);
s->_row = step->rowFrom;
s->_col = step->colFrom;
s->setPosition(s->fromPlate());
Chess* kill;
if (step->killid != -1)
{
kill = _c->at(step->killid);
kill->_dead = false;
kill->setVisible(true);
}
_bRedTurn = !_bRedTurn;
delete step;
_selectid = -1;
_selectSprite->setVisible(false);
}
示例2: startClient
void SceneGame::startClient(Ref* sender)
{
MenuItem* item = (MenuItem*)sender;
item->setEnabled(false);
Ref* obj = item->getUserObject();
item = (MenuItem*)obj;
item->setEnabled(false);
_bRedSide = false;
if (NetBattle::Connect("127.0.0.1"))
{
cocos2d::log("client Start Game");
for (int i = 0; i < 32; i++)
{
Chess* s = _c->at(i);
s->_row = 9 - s->_row;
s->_col = 8 - s->_col;
s->setPosition(s->fromPlate());
}
NetBattle::RecvStart();
schedule(schedule_selector(SceneGame::CheckRecv));
}
else
{
cocos2d::log("Connect failure....");
}
}
示例3: restartInit
void SceneGame::restartInit()
{
// init Chess
for (int i = 0; i < 32; ++i)
{
_c->at(i)->initChess(i, true);
}
if (!_bRedSide)
{
for (int i = 0; i < 32; i++)
{
Chess* s = _c->at(i);
s->_row = 9 - s->_row;
s->_col = 8 - s->_col;
s->setPosition(s->fromPlate());
}
NetBattle::RecvStart();
schedule(schedule_selector(SceneGame::CheckRecv));
}
_selectSprite->setOpacity(0);
_selectid = -1;
_bRedTurn = true;
_steps->clear();
}
示例4: ComputerMove
void SceneGame::ComputerMove(float dt)
{
Step* step = AI::getStepByAlphaBetaSearch(this, 2);
Chess* moveChess = _c->at(step->moveid);
moveChess->_row = step->rowTo;
moveChess->_col = step->colTo;
_bRedTurn = !_bRedTurn;
moveChess->setPosition(moveChess->fromPlate());
if (step->killid != -1)
{
Chess* killChess = _c->at(step->killid);
killChess->_dead = true;
killChess->setVisible(false);
}
_steps->push_back(step);
}
示例5: CheckRecv
void SceneGame::CheckRecv(float)
{
if (NetBattle::isRecvComplete())
{
unschedule(schedule_selector(SceneGame::CheckRecv));
int len;
char* data = NetBattle::RecvData(len);
if (data[0] == 4)
{
_bRedSide = !_bRedSide;
restartInit();
}
else if (data[0] == 3)
{
doRegret2();
NetBattle::RecvStart();
schedule(schedule_selector(SceneGame::CheckRecv));
}
else if (data[0] == 1)
{
_selectid = data[1];
_selectSprite->setPosition(_c->at(_selectid)->fromPlate());
_selectSprite->setVisible(true);
NetBattle::RecvStart();
schedule(schedule_selector(SceneGame::CheckRecv));
}
else if (data[0] == 2)
{
Chess* s = _c->at(data[1]);
int row = 9 - data[2];
int col = 8 - data[3];
int killid = getChessFromRowCol(row, col);
recordStep(_selectid, killid, _c->at(_selectid)->_row, _c->at(_selectid)->_col, row, col);
s->_row = row;
s->_col = col;
//s->setPosition(s->fromPlate());
MoveTo* moveto = MoveTo::create(1.0f, s->fromPlate());
// CCCallFuncN* callfuncN = CCCallFuncN::create(this, callfuncN_selector(SceneGame::setChessZOrder));
CallFuncN* callfuncN = CallFuncN::create(CC_CALLBACK_1(SceneGame::AfterMove,this,(void*)(intptr_t)killid));
s->runAction(Sequence::createWithTwoActions(moveto, callfuncN));
FadeOut* fadeout = FadeOut::create(1.0f);
MoveTo* SelectMoveto = MoveTo::create(1.0f, s->fromPlate());
Spawn* spawn = Spawn::createWithTwoActions(fadeout, SelectMoveto);
_selectSprite->runAction(spawn);
if (killid != -1)
{
Chess* ks = _c->at(killid);
ks->_dead = true;
ks->setVisible(false);
}
_selectid = -1;
_selectSprite->setVisible(false);
_bRedTurn = !_bRedTurn;
}
}
}