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

fix

parent a9681f62
...@@ -10,6 +10,9 @@ const { ccclass, property } = cc._decorator; ...@@ -10,6 +10,9 @@ const { ccclass, property } = cc._decorator;
@ccclass @ccclass
export default class EndView extends cc.Component { export default class EndView extends cc.Component {
@property(cc.Node)
frame: cc.Node = null;
@property(cc.Node) @property(cc.Node)
winRoot: cc.Node = null; winRoot: cc.Node = null;
...@@ -32,13 +35,18 @@ export default class EndView extends cc.Component { ...@@ -32,13 +35,18 @@ export default class EndView extends cc.Component {
replayNode: cc.Node = null; replayNode: cc.Node = null;
onLoad() { onLoad() {
this.node.opacity = 0;
this.replayNode.on("click", this.replay, this) this.replayNode.on("click", this.replay, this)
} }
showView(win: boolean, redScore, blueScore, redUrl, blueUrl) { showView(win: boolean, redScore, blueScore, redUrl, blueUrl) {
this.node.opacity = 255;
this.frame.scale = 0;
cc.tween(this.frame).to(1, { scale: 1 }, { easing: "sineIn" }).start();
this.winRoot.active = win; this.winRoot.active = win;
this.loseRoot.active = !win; this.loseRoot.active = !win;
this.lb_blue.string = blueScore; this.lb_blue.string = blueScore;
...@@ -53,7 +61,7 @@ export default class EndView extends cc.Component { ...@@ -53,7 +61,7 @@ export default class EndView extends cc.Component {
} }
replay() { replay() {
cc.game.restart(); cc.director.loadScene("L5R1_bingo");
} }
} }
...@@ -43,14 +43,14 @@ export default class Keyboard extends cc.Component { ...@@ -43,14 +43,14 @@ export default class Keyboard extends cc.Component {
for (let i = 0; i < btnList.length; ++i) { for (let i = 0; i < btnList.length; ++i) {
let btnNode = btnList[i]; let btnNode = btnList[i];
let key = btnNode.name; let key = btnNode.name;
btnNode.on("click", this.enterWord.bind(this, key), this); btnNode.getChildByName("btn").on("click", this.enterWord.bind(this, key), this);
} }
this.btnOkNode.on("click", this.sendWords, this) this.btnOkNode.on("click", this.sendWords, this)
this.btnbackNode.on("click", this.backWord, this) this.btnbackNode.on("click", this.backWord, this)
this.btnShowNode.on("click", this.showIn, this) this.btnShowNode.on("click", this.showIn, this)
this.btnHideNode.on("click", this.showOut, this) this.btnHideNode.on("click", this.showOut.bind(this, false), this)
this.btnShowNode.active = false; this.btnShowNode.active = false;
this.btnHideNode.active = false; this.btnHideNode.active = false;
...@@ -97,7 +97,6 @@ export default class Keyboard extends cc.Component { ...@@ -97,7 +97,6 @@ export default class Keyboard extends cc.Component {
} }
showOut(hideMini = false) { showOut(hideMini = false) {
if (this._moving) return; if (this._moving) return;
this._moving = true; this._moving = true;
this._wordList = []; this._wordList = [];
...@@ -108,7 +107,9 @@ export default class Keyboard extends cc.Component { ...@@ -108,7 +107,9 @@ export default class Keyboard extends cc.Component {
if (hideMini) { if (hideMini) {
this.btnShowNode.active = false; this.btnShowNode.active = false;
this.btnHideNode.active = false; this.btnHideNode.active = false;
} else {
this.btnShowNode.active = true;
this.btnHideNode.active = false;
} }
} }
} }
This diff is collapsed.
This diff is collapsed.
...@@ -64,9 +64,9 @@ export class AI { ...@@ -64,9 +64,9 @@ export class AI {
} else if (type == MsgType.ROUND_END_EV) { } else if (type == MsgType.ROUND_END_EV) {
let data = msgData; let data = msgData;
if (data.round == 1) { if (data.round == 1) {
this._countDelay = 500000000;
} else { } else {
this._countDelay = 500000000;
} }
} }
} }
......
...@@ -135,7 +135,12 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -135,7 +135,12 @@ export class MyCocosSceneComponent extends cc.Component {
// ------------------------------------------------ // ------------------------------------------------
getSprNode(resName) { getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame; let nodef = cc.find('Canvas/res/img/' + resName)
if (!nodef) {
console.warn("no name res = " + resName);
return;
}
const sf = nodef.getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node(); const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf; node.addComponent(cc.Sprite).spriteFrame = sf;
return node; return node;
......
...@@ -42,7 +42,7 @@ export class GameServer { ...@@ -42,7 +42,7 @@ export class GameServer {
_answerList = [] _answerList = []
private _useAI: boolean; private _useAI: boolean;
private _timer: number; private _timer: number;
private _totalTime: number = 16; private _totalTime: number = 160;
private _gameData: MsgData; private _gameData: MsgData;
private _userPrepareCount: number; private _userPrepareCount: number;
private _lastTime: number; private _lastTime: number;
...@@ -238,10 +238,13 @@ export class GameServer { ...@@ -238,10 +238,13 @@ export class GameServer {
data: this._gameData.Msg data: this._gameData.Msg
}) })
let realRedScore = (Math.floor(this._gameData.RedScore / 100) + this._gameData.RedScore % 100);
let realBlueScore = (Math.floor(this._gameData.BuleSocre / 100) + this._gameData.BuleSocre % 100);
let winSide = "Red" let winSide = "Red"
if (this._gameData.BuleSocre > this._gameData.RedScore) { if (realBlueScore > realRedScore) {
winSide = "Blue" winSide = "Blue"
} else if (this._gameData.BuleSocre == this._gameData.RedScore) { } else if (realRedScore == realBlueScore) {
let answerList = this._gameData.getAnswerList(); let answerList = this._gameData.getAnswerList();
for (let i = answerList.length - 1; i >= 0; ++i) { for (let i = answerList.length - 1; i >= 0; ++i) {
let answer = answerList[i]; let answer = answerList[i];
...@@ -385,17 +388,16 @@ export class GameServer { ...@@ -385,17 +388,16 @@ export class GameServer {
}); });
if (this._gameData.getAnswerList().length == 16) { if (this._gameData.getAnswerList().length == 16) {
this._senMsg({
type: MsgType.ROOM_ST,
data: this._gameData.Msg
});
let answerList = this._gameData.getAnswerList(); let answerList = this._gameData.getAnswerList();
for (let i = 0; i < answerList.length; ++i) {
this._round_1_cardList.push(answerList[i].word);
}
this._senMsg({ this._senMsg({
type: MsgType.ROUND_END_EV, type: MsgType.ROUND_END_EV,
data: { round: this._gameData.Round, reason: 1, answerList: this._round_1_cardList } data: { round: this._gameData.Round, reason: 1, answerList: answerList }
}); });
clearInterval(this._timer)
this._initRound2(); this._initRound2();
} else { } else {
......
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