Commit 6eb5ec8c authored by 范雪寒's avatar 范雪寒

feat:

parent 1155d1ba
No preview for this file type
This diff is collapsed.
......@@ -80,6 +80,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
const bg = cc.find('Canvas/bg');
bg.scale = Math.min(canvas.width / bg.width, canvas.height / bg.height);
const chessBoardBg = cc.find('Canvas/bg/chessBoard/bg');
const offsetX = chessBoardBg.width * chessBoardBg.scaleX / 2 + (canvas.width - chessBoardBg.width * chessBoardBg.scaleX) / 4;
const lifeblue = cc.find('Canvas/bg/Lifeblue');
lifeblue.x = -offsetX;
const lifered = cc.find('Canvas/bg/Lifered');
lifered.x = offsetX;
}
loadingLayer;
......@@ -327,6 +335,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
for (let i = startIdx + 1; i < board.children.length; i++) {
const targetNode = board.children[i];
const itemData = targetNode.getComponent('ItemData');
if (itemData.letter.toLowerCase() == this._status.letter.toLowerCase()) {
return targetNode;
}
......@@ -539,9 +548,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log('SERVER_playerWin: ' + JSON.stringify(item.data));
const node = cc.find(`Canvas/bg/chessBoard/piece${this._status.current}`);
const playerMe = this.allPlayerList.find(player => player.uuid == this.playerId);
const rightBlock = this.getRightBlock();
const board = cc.find('Canvas/bg/chessBoard/boardItems');
const idx = board.children.length;
const rightBlock = board.children[idx - 1];
this.pieceFindRightBlock(rightBlock, idx);
if (playerMe.color == this._status.current) {
this.showWin();
......
......@@ -10,7 +10,7 @@ export default class SceneComponent extends cc.Component {
// 生命周期 onLoad
onLoad() {
this.initSize();
// this.initSize();
}
_designSize; // 设计分辨率
......
......@@ -112,6 +112,9 @@ export class GameServer {
}
} else if (data.type == 'right') {
this.gameStatus[data.color] = data.idx;
const letterList = this.getLetterList();
console.log('letterList = ' + JSON.stringify(letterList));
if (letterList.length > 0) {
this.changeSide();
this.networkHelper.sendFrame({
type: 'SERVER_playerRight',
......@@ -119,8 +122,15 @@ export class GameServer {
uuid: data.uuid,
color: data.color
});
} else {
this.networkHelper.sendFrame({
type: 'SERVER_playerWin',
color: this.gameStatus.current
});
}
} else if (data.type == 'wrong') {
this.gameStatus[data.color] = data.idx;
console.log('data = ' + JSON.stringify(data));
// this.gameStatus[data.color] = data.idx;
this.changeSide();
this.networkHelper.sendFrame({
type: 'SERVER_playerWrong',
......@@ -137,7 +147,10 @@ export class GameServer {
getLetterList() {
const board = cc.find('Canvas/bg/chessBoard/boardItems');
const color = this.gameStatus.current;
console.log("color = " + color);
console.log('this.gameStatus = ' + JSON.stringify(this.gameStatus));
const startIdx = this.gameStatus[color];
console.log('startIdx = ' + startIdx);
const letterList = [];
for (let i = startIdx + 1; i < board.children.length; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment