Commit fd9d8cc4 authored by 杨一航's avatar 杨一航

fix

parent 340d6997
...@@ -16,7 +16,7 @@ export default class BoardCardItem extends cc.Component { ...@@ -16,7 +16,7 @@ export default class BoardCardItem extends cc.Component {
_word: string; _word: string;
letter: string = ''; letter: string = '';
set cardData(data: { id: number, rJumpId: number, wJumpId?: number, url: string, word: "string" }) { set cardData(data: { id: number, rJumpId: number, wJumpId?: number, url: string, word: string }) {
this._cardId = data.id; this._cardId = data.id;
this._rjumpId = data.rJumpId; this._rjumpId = data.rJumpId;
...@@ -32,6 +32,6 @@ export default class BoardCardItem extends cc.Component { ...@@ -32,6 +32,6 @@ export default class BoardCardItem extends cc.Component {
return this._rjumpId; return this._rjumpId;
} }
get wjumpId() { get wjumpId() {
return this._rjumpId; return this._wjumpId;
} }
} }
...@@ -579,8 +579,8 @@ ...@@ -579,8 +579,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
421.974, -512.696,
-284.56, -294.691,
0, 0,
0, 0,
0, 0,
...@@ -1265,8 +1265,8 @@ ...@@ -1265,8 +1265,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-508.895, 423.242,
-296.542, -286.41,
0, 0,
0, 0,
0, 0,
...@@ -6010,7 +6010,7 @@ ...@@ -6010,7 +6010,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
1035.5, 1035.5,
258.128, 180,
0, 0,
0, 0,
0, 0,
......
...@@ -151,7 +151,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -151,7 +151,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
id: 6, rJumpId: null, wJumpId: null, word: "can", url: "", id: 6, rJumpId: null, wJumpId: null, word: "can", url: "",
}, },
{ {
id: 7, rJumpId: 12, wJumpId: null, word: "cam", url: "", id: 7, rJumpId: null, wJumpId: null, word: "cam", url: "",
}, },
{ {
id: 8, rJumpId: null, wJumpId: null, word: "mat", url: "", id: 8, rJumpId: null, wJumpId: null, word: "mat", url: "",
...@@ -163,10 +163,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -163,10 +163,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
id: 10, rJumpId: null, wJumpId: null, word: "fan", url: "", id: 10, rJumpId: null, wJumpId: null, word: "fan", url: "",
}, },
{ {
id: 11, rJumpId: 20, wJumpId: null, word: "tap", url: "", id: 11, rJumpId: null, wJumpId: null, word: "tap", url: "",
}, },
{ {
id: 12, rJumpId: null, wJumpId: null, word: "cap", url: "", id: 12, rJumpId: null, wJumpId: 7, word: "cap", url: "",
}, },
{ {
id: 13, rJumpId: null, wJumpId: null, word: "bag", url: "", id: 13, rJumpId: null, wJumpId: null, word: "bag", url: "",
...@@ -187,10 +187,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -187,10 +187,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
id: 18, rJumpId: null, wJumpId: null, word: "pan", url: "", id: 18, rJumpId: null, wJumpId: null, word: "pan", url: "",
}, },
{ {
id: 19, rJumpId: 23, wJumpId: null, word: "dad", url: "", id: 19, rJumpId: null, wJumpId: null, word: "dad", url: "",
}, },
{ {
id: 20, rJumpId: 22, wJumpId: null, word: "jam", url: "", id: 20, rJumpId: 22, wJumpId: 11, word: "jam", url: "",
}, },
{ {
id: 21, rJumpId: null, wJumpId: null, word: "ax", url: "", id: 21, rJumpId: null, wJumpId: null, word: "ax", url: "",
...@@ -199,12 +199,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -199,12 +199,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
id: 22, rJumpId: null, wJumpId: null, word: "hat", url: "", id: 22, rJumpId: null, wJumpId: null, word: "hat", url: "",
}, },
{ {
id: 23, rJumpId: null, wJumpId: null, word: "map", url: "", id: 23, rJumpId: null, wJumpId: 19, word: "map", url: "",
}, },
] ]
this._cardList = cc.find("Canvas/road/root/wordCards").children; this._cardList = cc.find("Canvas/road/root/wordCards").children;
let list = this.data.cardDatas || cardDatas; let list = cardDatas;
for (let i = 0; i < this._cardList.length; ++i) { for (let i = 0; i < this._cardList.length; ++i) {
let data = list[i]; let data = list[i];
let com = this._cardList[i].addComponent(BoardCardItem); let com = this._cardList[i].addComponent(BoardCardItem);
...@@ -222,12 +222,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -222,12 +222,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
const jumpList = []; const jumpList = [];
this._cardList.forEach(node => { this._cardList.forEach(node => {
const itemData = node.getComponent(BoardCardItem); const itemData = node.getComponent(BoardCardItem);
if (itemData.rjumpId) { if (itemData.rjumpId || itemData.wjumpId) {
const from = itemData.Id; const from = itemData.Id;
const to = itemData.rjumpId; const rto = itemData.rjumpId;
jumpList.push({ from, to }); const wto = itemData.wjumpId;
jumpList.push({ from, rto, wto });
} }
}); });
this.log(jumpList);
return jumpList; return jumpList;
} }
......
...@@ -30,14 +30,7 @@ export class GameServer { ...@@ -30,14 +30,7 @@ export class GameServer {
]; ];
jumpList = [ jumpList = [
// { from: 2, to: 11 }, // { from: 2, rto: 11 ,wto:1},
// { from: 3, to: 7 },
// { from: 8, to: 18 },
// { from: 9, to: 2 },
// { from: 12, to: 15 },
// { from: 13, to: 1 },
// { from: 21, to: 5 },
// { from: 24, to: 16 },
]; ];
private _totalStep: any; private _totalStep: any;
...@@ -162,8 +155,8 @@ export class GameServer { ...@@ -162,8 +155,8 @@ export class GameServer {
// } else { // } else {
// step = 1; // step = 1;
// } // }
step = Math.min(step, this._totalStep - 1 - nowStep);
step = Math.min(step, this._totalStep - 1 - nowStep);
console.log("random step ===" + step); console.log("random step ===" + step);
this.gameStatus.step = step; this.gameStatus.step = step;
this.gameStatus.state = 1; this.gameStatus.state = 1;
...@@ -180,7 +173,7 @@ export class GameServer { ...@@ -180,7 +173,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.to) : nowStep + this.gameStatus.step; this.gameStatus[this.gameStatus.current] = jump ? parseInt(jump.rto) : nowStep + this.gameStatus.step;
if (jump) { if (jump) {
console.log("jump=============" + jump); console.log("jump=============" + jump);
...@@ -209,8 +202,8 @@ export class GameServer { ...@@ -209,8 +202,8 @@ export class GameServer {
console.log("data = " + JSON.stringify(data)); console.log("data = " + JSON.stringify(data));
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.to) == 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.from) : nowStep; this.gameStatus[this.gameStatus.current] = jump ? 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