Commit 912f59e5 authored by 杨一航's avatar 杨一航

fix

parent 3d24d5ed
...@@ -397,6 +397,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -397,6 +397,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
return; return;
} }
this.playLocalAudio("btn"); this.playLocalAudio("btn");
this.normaltheDice();
this.networkHelper.sendFrame({ this.networkHelper.sendFrame({
type: "roll", type: "roll",
uuid: this.myData.uuid, uuid: this.myData.uuid,
...@@ -844,6 +845,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -844,6 +845,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
`Canvas/road/root/piece${this._status.current}` `Canvas/road/root/piece${this._status.current}`
); );
await this.fixStep(); await this.fixStep();
await this.toEnd()
if (this.isMySide) { if (this.isMySide) {
this.showWin(); this.showWin();
onHomeworkFinish({ isWin: true }); onHomeworkFinish({ isWin: true });
...@@ -856,6 +858,21 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -856,6 +858,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
}); });
} }
async toEnd() {
let node = cc.find(`Canvas/road/root/piece${this._status.current}`);
let pos = cc.find(`Canvas/road/root/END`).getPosition();
await asyncTweenTo(
node,
0.7,
{ x: pos.x, y: pos.y },
{ easing: "cubicOut" }
);
await asyncDelay(0.2);
}
showWin() { showWin() {
let endRoot = cc.find("Canvas/endRoot") let endRoot = cc.find("Canvas/endRoot")
endRoot.active = true; endRoot.active = true;
...@@ -901,6 +918,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -901,6 +918,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this._isRolling) { if (this._isRolling) {
return; return;
} }
const dice = cc.find("Canvas/road/board/runBoard"); const dice = cc.find("Canvas/road/board/runBoard");
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const targetAngle = Math.ceil(dice.angle / 360 + 1) * 360; const targetAngle = Math.ceil(dice.angle / 360 + 1) * 360;
......
...@@ -173,10 +173,11 @@ export class GameServer { ...@@ -173,10 +173,11 @@ export class GameServer {
let nowStep: number = this.gameStatus[this.gameStatus.current]; let nowStep: number = this.gameStatus[this.gameStatus.current];
console.log("nowStep === " + nowStep); console.log("nowStep === " + nowStep);
const jump = this.jumpList.find(jump => parseInt(jump.from) == nowStep + this.gameStatus.step); const jump = this.jumpList.find(jump => parseInt(jump.from) == nowStep + this.gameStatus.step);
this.gameStatus[this.gameStatus.current] = jump ? parseInt(jump.rto) : nowStep + this.gameStatus.step; this.gameStatus[this.gameStatus.current] = jump?.rto ? parseInt(jump.rto) : nowStep + this.gameStatus.step;
if (jump) { if (jump) {
console.log("jump=============" + jump); console.log("jump=============");
console.log(jump);
} }
if (this.gameStatus[this.gameStatus.current] < this._totalStep - 1) { if (this.gameStatus[this.gameStatus.current] < this._totalStep - 1) {
this.gameStatus.step = null; this.gameStatus.step = null;
...@@ -203,7 +204,7 @@ export class GameServer { ...@@ -203,7 +204,7 @@ export class GameServer {
let nowStep: number = this.gameStatus[this.gameStatus.current]; let nowStep: number = this.gameStatus[this.gameStatus.current];
console.log("nowStep === " + nowStep); console.log("nowStep === " + nowStep);
const jump = this.jumpList.find(jump => parseInt(jump.from) == nowStep + this.gameStatus.step); const jump = this.jumpList.find(jump => parseInt(jump.from) == nowStep + this.gameStatus.step);
this.gameStatus[this.gameStatus.current] = jump ? parseInt(jump.wto) : nowStep; this.gameStatus[this.gameStatus.current] = jump?.wto ? parseInt(jump.wto) : nowStep;
this.gameStatus.step = null; this.gameStatus.step = null;
this.gameStatus.state = 2; this.gameStatus.state = 2;
......
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