Commit 98a207cf authored by yu's avatar yu

7.30调整

parent 9186d6e6
......@@ -2159,7 +2159,7 @@
"_id": ""
},
{
"__type__": "4d354gk3w1AIKtlOv2FygBk",
"__type__": "ed40a8PbYdCDYoyW/46QqC7",
"_name": "",
"_objFlags": 0,
"node": {
......
......@@ -8,6 +8,7 @@ import {
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import { NetworkHelper } from "../script/NetworkHelper";
import { GameServer } from "../script/Server";
import { build } from "../../../bin/buildCocos";
let win: any = window;
let courseware = win.courseware;
......@@ -48,6 +49,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
Blue: 0,
letter: "",
current: "Red",
BuleLast: 0
};
playerId;
isRoomOwner;
......@@ -110,6 +112,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initBg();
this.initLoadingLayer();
this.initPiece();
this.antAction();
}
addComponents() {
cc.find('Canvas/bg/chessBoard/boardItems').children.forEach(node => {
......@@ -173,7 +176,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const loadingLayerNode = cc.instantiate(this.loadingLayerPrefab);
loadingLayerBase.addChild(loadingLayerNode);
this.loadingLayer = loadingLayerNode.getComponent("BoardGame2_LoadingLayer");
this.loadingLayer = loadingLayerNode.getComponent("BoardGame2_hole_LoadingLayer");
this.loadingLayer.setMaxPlayerNumber(2);
this.loadingLayer.onLoadFinished(() => {
this.playAudioByUrl(this.data.gameStartAudio);
......@@ -601,6 +604,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.showStars(piece);
piece['rightTween'] = true;
this.playLocalAudio("落子");
await asyncTweenTo(piece, 1, {
x: rightBlock.x + offsetX[color],
y: rightBlock.y + offsetY[color],
......@@ -631,7 +635,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
piece.stopAllActions();
await this.playLocalAudio("落子");
piece.zIndex = 0;
}
......@@ -659,7 +662,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
updateStatus(status = null) {
if (status) {
console.log(status);
console.log("status: " + JSON.stringify(status));
this._status = JSON.parse(JSON.stringify(status));
} else {
// console.log("喵喵喵");
......@@ -852,12 +855,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
// console.log("item.data.letter = " + item.data.letter);
//根据当前startIdx和下一步的letter位置找 idx
let letterList = this.getLetterList();
let idx = letterList.findIndex(letter => letter == status.letter);
if (idx == -1) {
let index = letterList.findIndex(letter => letter == status.letter);
if (index == -1) {
console.log("error")
}
const startIdx = status[status.current];
let nextIdx = startIdx + idx + 1;
let nextIdx = startIdx + index + 1;
// const idx = ["G", "H", "I", "J", "K", "L"].findIndex(
// (letter) => letter == status.letter
// );
......@@ -868,7 +871,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pieceBlue["cantMove"] = true;
this.stopBlinkTheDice();
// console.log("status1 = " + JSON.stringify(status));
await this.rollTheDice(idx);
await this.rollTheDice(index);
pieceRed["cantMove"] = false;
pieceBlue["cantMove"] = false;
// console.log("status2 = " + JSON.stringify(status));
......@@ -916,6 +919,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
color: playerMe.color,
});
}
} else {
const node = cc.find(
`Canvas/bg/chessBoard/piece${status.current}`
);
node["touchStartPos"] = {
nodeX: node.x,
nodeY: node.y,
touchX: node.x,
touchY: node.y,
};
let rightBlock = this.getRightBlock();
let idx = this.getNextRightIdx();
let lastIdx = this._status.Blue;
this._status.BuleLast = lastIdx;
await this.pieceFindRightBlock(rightBlock, idx);
}
} else if (item.data.type == "SERVER_playerRight") {
console.log("SERVER_playerRight: " + JSON.stringify(item.data));
......@@ -942,7 +960,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// console.log("SERVER_playerRight: " + JSON.stringify(item.data));
// console.log("this._status = " + JSON.stringify(this._status));
let rightBlock = this.getRightBlock();
// this._status.Blue = this._status.BuleLast;
let rightBlock = this.getCurrentBlock();
// console.log(rightBlock);
let idx = this.getNextRightIdx();
// console.log("targetIdx->" + idx);
......@@ -950,13 +969,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
const pieceBlue = cc.find("Canvas/bg/chessBoard/pieceBlue");
pieceRed["cantMove"] = false;
pieceBlue["cantMove"] = false;
await this.pieceFindRightBlock(rightBlock, idx);
// await this.pieceFindRightBlock(rightBlock, idx);
const riData = rightBlock.getComponent("BoardGame2_ItemData_i");
if (riData.jump != "") {
rightBlock = this.jumpBlock(parseInt(riData.jump));
idx = parseInt(riData.jump);//this.getNextRightIdx();
await this.pieceFindRightBlock(rightBlock, idx);
this._status.BuleLast = this._status.Blue;
}
await this.playLocalAudio("正确");
......@@ -978,7 +998,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (playerMe.color == this._status.current) {
await this.pieceGoBack(node);
} else {
this._status.Blue = this._status.BuleLast;
this.rollPieceOnce(node);
await this.pieceGoBack(node);
}
node["cantMove"] = false;
......@@ -1163,6 +1185,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
"tokenId": "6144295408558b08dd000001",
"applicationId": "154838659000009e"
}
testData.result.overall = Math.random() * 100;
if (this.recrodEnd(testData)) {
this.playLocalAudio("正确");
await this.showVoiceGood();
......@@ -1385,6 +1408,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
}
private antAction() {
let ant = cc.find("bg/snow/antDragon", this.node);
cc.tween(ant).repeatForever(
cc.tween()
.to(3, { x: -824, y: -67 }).call(() => { ant.scaleX = 1, ant.angle = 45 })
.to(3, { x: -890, y: -190 }).call(() => { ant.scaleX = -1, ant.angle = 0 })
.to(3, { x: -730, y: -400 }).call(() => { ant.scaleX = -1, ant.angle = 0 })
.to(3, { x: -680, y: -200 }).call(() => { ant.scaleX = 1, ant.angle = 0 })
).start();
}
playLocalAudio(audioName) {
const audio = cc
.find(`audioClips/${audioName}`)
......
{
"ver": "1.0.8",
"uuid": "4d354824-df0d-4020-ab65-3afd85ca0064",
"uuid": "ed40af0f-6d87-420d-8a32-5bfe3a42a0bb",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
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