mirror of
https://github.com/zhenyan121/SporeBG-Conid.git
synced 2026-04-10 06:14:08 +08:00
feat: add texture destory function
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
GameSession::GameSession()
|
||||
{
|
||||
m_board = std::make_unique<Board>(7, 7);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +62,7 @@ bool GameSession::executeAction(int toRow, int toCol) {
|
||||
if (m_currentActionType == ActionType::GROW) {
|
||||
if (Rule::canGrow(m_board.get(), fromRow, fromCol, toRow, toCol, m_currentPlayer)) {
|
||||
m_board->placePieceAt(toRow, toCol, m_currentPlayer);
|
||||
m_gamePieceEventCallback(GamePieceEvent::PLACE_PIECE, toRow, toCol);
|
||||
// 如果执行了操作就擦除
|
||||
markComponentAsUsed(getOldComponentID(fromRow, fromCol));
|
||||
return true;
|
||||
@@ -69,7 +71,9 @@ bool GameSession::executeAction(int toRow, int toCol) {
|
||||
if (m_currentActionType == ActionType::MOVE) {
|
||||
if (Rule::canMove(m_board.get(), fromRow, fromCol, toRow, toCol, m_currentPlayer)) {
|
||||
m_board->removePieceAt(fromRow, fromCol);
|
||||
m_gamePieceEventCallback(GamePieceEvent::REMOVE_PIECE, fromRow, fromCol);
|
||||
m_board->removePieceAt(toRow, toCol);
|
||||
m_gamePieceEventCallback(GamePieceEvent::REMOVE_PIECE, toRow, toCol);
|
||||
m_board->placePieceAt(toRow, toCol, m_currentPlayer);
|
||||
|
||||
markComponentAsUsed(getOldComponentID(fromRow, fromCol));
|
||||
@@ -79,8 +83,9 @@ bool GameSession::executeAction(int toRow, int toCol) {
|
||||
if (m_currentActionType == ActionType::SPORE) {
|
||||
if (Rule::canSpore(m_board.get(), fromRow, fromCol, toRow, toCol, m_currentPlayer)) {
|
||||
m_board->removePieceAt(fromRow, fromCol);
|
||||
m_gamePieceEventCallback(GamePieceEvent::REMOVE_PIECE, fromRow, fromCol);
|
||||
m_board->placePieceAt(toRow, toCol, m_currentPlayer);
|
||||
|
||||
m_gamePieceEventCallback(GamePieceEvent::PLACE_PIECE, toRow, toCol);
|
||||
markComponentAsUsed(getOldComponentID(fromRow, fromCol));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user