Commit 98a207cf authored by yu's avatar yu

7.30调整

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