if (_state == State.WhiteGo)
{
// 不能在已經放置過的棋子上放置
if (CanPlace(cross.GridX, cross.GridY))
{
Chess_cx = cross.GridX;
Chess_cy = cross.GridY;
if (PlaceChess(cross, false))
{
// 已經勝利
_state = State.Over;
ShowResult(ChessType.White);
}
else
{
// 換黑方走
_state = State.BlackGo;
Tishi.text = string.Format("黑子回合");
}
Button_huiqi.onClick.AddListener(() =>
{
int _cx = Chess_cx;
int _cy = Chess_cy;
Debug.Log("白子悔棋");
GameObject objp = _board.GetCross(_cx, _cy).gameObject;
foreach (Transform child in objp.transform)
{
GameObject.Destroy(child.gameObject);
}
_board._crossMap.Remove(_cx * 10000 + _cy);
_model.Set(_cx, _cy, 0);
_state = State.WhiteGo;
Tishi.text = string.Format("白子回合");
Button_huiqi.gameObject.SetActive(false);
});
}
}
uj5u.com熱心網友回復:
悔棋按鈕重復執行嗎 為什么悔棋的操作會在每一次點擊的時候都監聽呢uj5u.com熱心網友回復:
發全一點吧 這一段看不出來的轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/12452.html
標籤:Unity3D
上一篇:Unity Vungle IOS 'not find or use auto-linked framework 'VNGMoatMobileAppKit'
