Commit 2818bd73 authored by yu's avatar yu

1

parent ff8c32d6
......@@ -2548,7 +2548,7 @@
},
{
"__type__": "cc.Node",
"_name": "1_wig",
"_name": "1_hut",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -2571,8 +2571,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 213,
"height": 133
"width": 162,
"height": 163
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -2583,8 +2583,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
106.161,
-511.964,
-134.631,
-480.639,
0,
0,
0,
......@@ -2606,7 +2606,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "1edYDv58ZHGJAdRS5exndm"
"_id": "36n4nfGjlLkKYs3BtdeqDb"
},
{
"__type__": "cc.Sprite",
......@@ -2624,7 +2624,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "244ce4ee-c6cc-42af-b227-473ccf53e973"
"__uuid__": "f6fbb3cd-32a3-4fff-842d-ac94799532e3"
},
"_type": 0,
"_sizeMode": 1,
......@@ -2638,11 +2638,11 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "0eNv2wyGNGpJpZXRZokVOq"
"_id": "8fOy84vRdIop1OVa7Dm92a"
},
{
"__type__": "cc.Node",
"_name": "2_mop",
"_name": "2_cug",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -2736,7 +2736,7 @@
},
{
"__type__": "cc.Node",
"_name": "3_dig",
"_name": "3_cub",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -2830,7 +2830,7 @@
},
{
"__type__": "cc.Node",
"_name": "4_hot",
"_name": "4_bun",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -2924,7 +2924,7 @@
},
{
"__type__": "cc.Node",
"_name": "5_log",
"_name": "5_up",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -3018,7 +3018,7 @@
},
{
"__type__": "cc.Node",
"_name": "6_pit",
"_name": "6_hug",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -3112,7 +3112,7 @@
},
{
"__type__": "cc.Node",
"_name": "7_pop",
"_name": "7_bud",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -3206,7 +3206,7 @@
},
{
"__type__": "cc.Node",
"_name": "8_pin",
"_name": "8_cut",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -3300,7 +3300,7 @@
},
{
"__type__": "cc.Node",
"_name": "9_fox",
"_name": "9_run",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -3394,7 +3394,7 @@
},
{
"__type__": "cc.Node",
"_name": "10_hop",
"_name": "10_cup",
"_objFlags": 0,
"_parent": {
"__id__": 46
......@@ -3788,7 +3788,7 @@
},
{
"__type__": "cc.Node",
"_name": "1_wig",
"_name": "1_hum",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -3811,8 +3811,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 162,
"height": 163
"width": 213,
"height": 133
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -3823,8 +3823,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-134.631,
-476.431,
106.161,
-511.964,
0,
0,
0,
......@@ -3846,7 +3846,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "36n4nfGjlLkKYs3BtdeqDb"
"_id": "1edYDv58ZHGJAdRS5exndm"
},
{
"__type__": "cc.Sprite",
......@@ -3864,7 +3864,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f6fbb3cd-32a3-4fff-842d-ac94799532e3"
"__uuid__": "244ce4ee-c6cc-42af-b227-473ccf53e973"
},
"_type": 0,
"_sizeMode": 1,
......@@ -3878,11 +3878,11 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "8fOy84vRdIop1OVa7Dm92a"
"_id": "0eNv2wyGNGpJpZXRZokVOq"
},
{
"__type__": "cc.Node",
"_name": "2_mop",
"_name": "2_nut",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -3976,7 +3976,7 @@
},
{
"__type__": "cc.Node",
"_name": "3_dig",
"_name": "3_mug",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -4070,7 +4070,7 @@
},
{
"__type__": "cc.Node",
"_name": "4_hot",
"_name": "4_bug",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -4164,7 +4164,7 @@
},
{
"__type__": "cc.Node",
"_name": "5_log",
"_name": "5_mud",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -4258,7 +4258,7 @@
},
{
"__type__": "cc.Node",
"_name": "6_pit",
"_name": "6_fun",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -4352,7 +4352,7 @@
},
{
"__type__": "cc.Node",
"_name": "7_pop",
"_name": "7_gun",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -4446,7 +4446,7 @@
},
{
"__type__": "cc.Node",
"_name": "8_pin",
"_name": "8_pup",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -4540,7 +4540,7 @@
},
{
"__type__": "cc.Node",
"_name": "9_fox",
"_name": "9_jug",
"_objFlags": 0,
"_parent": {
"__id__": 72
......@@ -4634,7 +4634,7 @@
},
{
"__type__": "cc.Node",
"_name": "10_hop",
"_name": "10_tub",
"_objFlags": 0,
"_parent": {
"__id__": 72
......
......@@ -129,6 +129,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
});
cc.find('Canvas/bg/chessBoard/righttIems').children.forEach(node => {
let itemData = node.getComponent("BoardGame2_ItemData");
if (!itemData) {
itemData = node.addComponent('BoardGame2_ItemData');
let name = node.name;
console.log(name);
if (name == 'start' || name == 'end') {
} else {
let arr = name.split('_');
itemData.letter = arr[1];
itemData.idx = Number(arr[0]);
itemData.word = arr[1];
itemData.jump = 0;
}
}
});
}
getJumpList() {
......@@ -238,13 +255,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
const pieceNodeRed = cc.find(`Canvas/bg/chessBoard/pieceRed`);
const startIdxRed = this._status["Red"];
const boardNodeRed = board.children[startIdxRed];
pieceNodeRed.x = boardNodeRed.x + offsetX.Red;
pieceNodeRed.x = boardNodeRed.x;// + offsetX.Red;
pieceNodeRed.y = boardNodeRed.y + offsetY.Red;
const right = cc.find("Canvas/bg/chessBoard/righttIems");
const pieceNodeBlue = cc.find(`Canvas/bg/chessBoard/pieceBlue`);
const startIdxBlue = this._status["Blue"];
const boardNodeBlue = board.children[startIdxBlue];
pieceNodeBlue.x = boardNodeBlue.x + offsetX.Blue;
const boardNodeBlue = right.children[startIdxBlue];
pieceNodeBlue.x = boardNodeBlue.x;//+ offsetX.Blue;
pieceNodeBlue.y = boardNodeBlue.y + offsetY.Blue;
}
......@@ -495,12 +514,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
getCurrentBlock() {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const startIdx = this._status[this._status.current];
return board.children[startIdx]
}
getRightBlock() {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const startIdx = this._status[this._status.current];
// console.log("startIdx = " + JSON.stringify(startIdx));
for (let i = startIdx + 1; i < board.children.length; i++) {
......@@ -522,13 +541,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
jumpBlock(idx) {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const targetNode = board.children[idx];
return targetNode;
}
getNextRightIdx() {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const startIdx = this._status[this._status.current];
for (let i = startIdx + 1; i < board.children.length; i++) {
const targetNode = board.children[i];
......@@ -541,7 +560,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
checkNodeInRightBlock(node, color) {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const startIdx = this._status[color];
for (let i = startIdx + 1; i < board.children.length; i++) {
......@@ -587,7 +606,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
async pieceFindRightBlock(rightBlock, idx) {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const color = this._status.current;
const piece = cc.find(`Canvas/bg/chessBoard/piece${color}`);
const prograssbar = cc.find(
......@@ -601,7 +620,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// console.log(idx + "_进度条高:" + targetHeight);
const offsetX = { Red: -45, Blue: 45 };
const offsetY = { Red: -90, Blue: -90 };
const offsetY = { Red: -45, Blue: -45 };
this._status[color] = idx;
await this.playLocalAudio("正确");
......@@ -611,7 +630,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
piece['rightTween'] = true;
await asyncTweenTo(piece, 1, {
x: rightBlock.x + offsetX[color],
x: rightBlock.x,//+ offsetX[color],
y: rightBlock.y + offsetY[color],
});
piece['rightTween'] = false;
......@@ -761,7 +780,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
getLetterList() {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const startIdx = this._status[this._status.current];
const letterList = [];
for (let i = startIdx + 1; i < board.children.length - 1; i++) {
......@@ -982,7 +1001,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const playerMe = this.allPlayerList.find(
(player) => player.uuid == this.playerId
);
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const idx = board.children.length;
const rightBlock = board.children[idx - 1];
......@@ -1285,7 +1304,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const offsetX = { Red: -45, Blue: 45 };
const offsetY = { Red: -90, Blue: -90 };
const pieceNode = cc.find(`Canvas/bg/chessBoard/piece${color}`);
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const startIdx = this._status[color];
for (let i = startIdx + 1; i < board.children.length; i++) {
......
......@@ -50,7 +50,7 @@ export class AI {
await asyncDelay(Math.random() * 3 + 4);
const idx = this.getNextRightIdx();
if (Math.random() < 0.8) {
if (Math.random() < 1) {
this.networkHelper.sendFrame({
type: "right",
idx: idx,
......@@ -77,7 +77,7 @@ export class AI {
}
getNextRightIdx() {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this._status.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const startIdx = this._status[this._status.current];
for (let i = startIdx + 1; i < board.children.length; i++) {
const targetNode = board.children[i];
......
......@@ -114,7 +114,7 @@ export class GameServer {
this.addPlayer(playerInfo);
}
//TODO:调试加速
}, 10000)//RandomInt(10000, 15000)
}, 1000)//RandomInt(10000, 15000)
);
}
}
......@@ -214,18 +214,23 @@ export class GameServer {
}
getLetterList() {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const board = this.gameStatus.current == "Red" ? cc.find("Canvas/bg/chessBoard/boardItems") : cc.find("Canvas/bg/chessBoard/righttIems");
const color = this.gameStatus.current;
// console.log("color = " + color);
// console.log("this.gameStatus = " + JSON.stringify(this.gameStatus));
const startIdx = this.gameStatus[color];
let startIdx = this.gameStatus[color];
// console.log("startIdx = " + startIdx);
if (startIdx < 0){
startIdx = 0;
}
const letterList = [];
for (let i = startIdx + 1; i < board.children.length - 1; i++) {
const targetNode = board.children[i];
const itemData = targetNode.getComponent("BoardGame2_ItemData");
const nodeLetter = itemData.letter.toUpperCase();
if (nodeLetter == '') {
console.log(" 11")
}
if (!letterList.find((letter) => letter == nodeLetter)) {
letterList.push(nodeLetter);
}
......
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