本文整理汇总了C++中GameScene::setGameTips方法的典型用法代码示例。如果您正苦于以下问题:C++ GameScene::setGameTips方法的具体用法?C++ GameScene::setGameTips怎么用?C++ GameScene::setGameTips使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameScene
的用法示例。
在下文中一共展示了GameScene::setGameTips方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runPlayerAction
// 执行动作
void CheckerboardLayer::runPlayerAction()
{
if (!action_lock_)
{
FAction action = logic_->getActionFromQueue(action_read_pos_);
if (action.type != FActionType::NONE)
{
action_lock_ = true;
switch (action.type)
{
// 开始游戏
case FActionType::START:
{
refreshCheckerboard();
runAction(Sequence::create(CallFunc::create(std::bind(&CheckerboardLayer::actionFinished, this)), nullptr));
break;
}
// 移动棋子
case FActionType::MOVED:
{
// 自己的移动操作实时处理,不通过逻辑处理器进行
if (action.chess_type != getChesspieceType())
{
onMoveChesspiece(ToCocos2DVec2(action.source), ToCocos2DVec2(action.target));
}
else
{
runAction(Sequence::create(CallFunc::create(std::bind(&CheckerboardLayer::actionFinished, this)), nullptr));
}
break;
}
// 杀掉棋子
case FActionType::KILLED:
{
onKillChesspiece(ToCocos2DVec2(action.source), ToCocos2DVec2(action.target));
break;
}
// 玩家待机
case FActionType::STANDBY:
{
operation_lock_ = action.chess_type == getChesspieceType();
runAction(Sequence::create(CallFunc::create(std::bind(&CheckerboardLayer::actionFinished, this)), nullptr));
GameScene *parent = dynamic_cast<GameScene *>(getParent());
parent->setGameTips(getChesspieceType() == action.chess_type ? lang("wait") : lang("play_chess"));
break;
}
// 游戏结束
case FActionType::GAMEOVER:
{
operation_lock_ = true;
runAction(Sequence::create(CallFunc::create(std::bind(&CheckerboardLayer::actionFinished, this)), nullptr));
GameScene *parent = dynamic_cast<GameScene *>(getParent());
parent->setGameTips(getChesspieceType() == action.chess_type ? lang("win") : lang("lost"));
break;
}
default:
actionFinished();
}
}
}
}