public override void onPiecesChangedDelay(TSwitchesChangesEvent e) { base.onPiecesChangedDelay(e); if (start != null && target != null && !e.newSwitches[start.x, start.y] && e.newSwitches[target.x, target.y]) { moveDone(); } }
public override void onPiecesChangedDelay(TSwitchesChangesEvent e) { base.onPiecesChangedDelay(e); boardLeds.clear(); for (var y = 0; y < 8; y++) { for (var x = 0; x < 8; x++) { if (e.newSwitches[x, y]) { //boardLeds[x, y].state = true; //boardLeds[x, y + 1].state = true; foreach (var led in boardLeds.getAllFieldLeds(x, y)) led.on(); } Console.Write(e.newSwitches[x, y] ? "1" : "0"); } Console.WriteLine(); } }
public override void onPiecesChangedDelay(TSwitchesChangesEvent e) { base.onPiecesChangedDelay(e); for (var y = 0; y < 8; y++) for (var x = 0; x < 8; x++) if (e.oldSwitches[x, y] != e.newSwitches[x, y] && !e.newSwitches[x, y]) { piece = app.board[x, y].piece; app.board[x, y].piece = EPiece.none; } for (var y = 0; y < 8; y++) for (var x = 0; x < 8; x++) if (e.oldSwitches[x, y] != e.newSwitches[x, y] && e.newSwitches[x, y]) { app.board[x, y].piece = piece; } //if (e.state) // app.board[e.pos].piece = piece; //else { // piece = app.board[e.pos].piece; // app.board[e.pos].piece = EPiece.none; //} //if (app.board.canSendToEngine()) { // app.engine.position(app.board.toFEN()); // engine.debug(); //} app.game.setBoard(app.board.toFEN()); }