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

feat: v1.5

parent 60b86dc9
{
"ver": "1.1.2",
"uuid": "5eefde91-544f-4097-a088-5d1c218e0a2f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
...@@ -97,6 +97,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -97,6 +97,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
initView() { initView() {
const bgNode = cc.find('Canvas/bg'); const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax; bgNode.scale = this._mapScaleMax;
// this.node.getChildByName("cover").scale = this._mapScaleMin;
this.homeLayerCom = this.homeLayer.getComponent(HomeLayer); this.homeLayerCom = this.homeLayer.getComponent(HomeLayer);
this.matchLayerCom = this.matchLayer.getComponent(MatchLayer); this.matchLayerCom = this.matchLayer.getComponent(MatchLayer);
this.gameLayerCom = this.gameLayer.getComponent(GameLayer); this.gameLayerCom = this.gameLayer.getComponent(GameLayer);
......
...@@ -100,8 +100,11 @@ export class GameServer { ...@@ -100,8 +100,11 @@ export class GameServer {
blueRight: 0, blueRight: 0,
redRight: 0, redRight: 0,
total: 0, total: 0,
addRedScore: 0, roundAddRedScore: 0,
addBlueScore: 0, roundAddBlueScore: 0,
totalAddRedScore: 0,
totalAddBlueScore: 0,
}; };
startGame() { startGame() {
...@@ -112,6 +115,10 @@ export class GameServer { ...@@ -112,6 +115,10 @@ export class GameServer {
this.gameStatus.state = 0; this.gameStatus.state = 0;
this.gameStatus.blueRight = 0; this.gameStatus.blueRight = 0;
this.gameStatus.redRight = 0; this.gameStatus.redRight = 0;
this.gameStatus.roundAddRedScore = 0;
this.gameStatus.roundAddBlueScore = 0;
this.gameStatus.totalAddRedScore = 0;
this.gameStatus.totalAddBlueScore = 0;
this.gameStatus.total = this.lvData[this.matchLv].questionNun; this.gameStatus.total = this.lvData[this.matchLv].questionNun;
this.networkHelper.sendFrame({ this.networkHelper.sendFrame({
type: "SERVER_updateStatus", type: "SERVER_updateStatus",
...@@ -199,8 +206,8 @@ export class GameServer { ...@@ -199,8 +206,8 @@ export class GameServer {
this.prepareNum = 0 this.prepareNum = 0
this.gameStatus.index = 0; this.gameStatus.index = 0;
this.gameStatus.state = 1; this.gameStatus.state = 1;
this.gameStatus.addBlueScore = 0; this.gameStatus.roundAddBlueScore = 0;
this.gameStatus.addRedScore = 0; this.gameStatus.roundAddRedScore = 0;
this.answerIndex = 0; this.answerIndex = 0;
this.answerCount = 0; this.answerCount = 0;
this.answerData = []; this.answerData = [];
...@@ -227,12 +234,17 @@ export class GameServer { ...@@ -227,12 +234,17 @@ export class GameServer {
if (quetion.rightIndex == data.index) { if (quetion.rightIndex == data.index) {
if (sender.color == "Red") { if (sender.color == "Red") {
this.gameStatus.redRight += 1; this.gameStatus.redRight += 1;
this.gameStatus.addRedScore = 10 - Math.floor((Date.now() - this.startTime) / 1000); this.gameStatus.roundAddRedScore = 10 - Math.floor((Date.now() - this.startTime) / 1000);
this.gameStatus.addRedScore = Math.max(0, this.gameStatus.addRedScore) this.gameStatus.roundAddRedScore = Math.max(0, this.gameStatus.roundAddRedScore)
this.gameStatus.totalAddRedScore += this.gameStatus.roundAddRedScore;
} else { } else {
this.gameStatus.blueRight += 1; this.gameStatus.blueRight += 1;
this.gameStatus.addBlueScore = 10 - Math.floor((Date.now() - this.startTime) / 1000); this.gameStatus.roundAddBlueScore = 10 - Math.floor((Date.now() - this.startTime) / 1000);
this.gameStatus.addBlueScore = Math.max(0, this.gameStatus.addBlueScore) this.gameStatus.roundAddBlueScore = Math.max(0, this.gameStatus.roundAddBlueScore)
this.gameStatus.totalAddBlueScore += this.gameStatus.roundAddBlueScore;
} }
} }
...@@ -261,8 +273,8 @@ export class GameServer { ...@@ -261,8 +273,8 @@ export class GameServer {
this.prepareNum = 0 this.prepareNum = 0
this.answerIndex++; this.answerIndex++;
this.gameStatus.state = 1; this.gameStatus.state = 1;
this.gameStatus.addBlueScore = 0; this.gameStatus.roundAddBlueScore = 0;
this.gameStatus.addRedScore = 0; this.gameStatus.roundAddRedScore = 0;
this.gameStatus.index = this.answerIndex; this.gameStatus.index = this.answerIndex;
this.answerCount = 0; this.answerCount = 0;
this.answerData = []; this.answerData = [];
...@@ -326,8 +338,8 @@ export class GameServer { ...@@ -326,8 +338,8 @@ export class GameServer {
this.prepareNum = 0 this.prepareNum = 0
this.answerIndex++; this.answerIndex++;
this.gameStatus.state = 1; this.gameStatus.state = 1;
this.gameStatus.addBlueScore = 0; this.gameStatus.roundAddBlueScore = 0;
this.gameStatus.addRedScore = 0; this.gameStatus.roundAddRedScore = 0;
this.gameStatus.index = this.answerIndex; this.gameStatus.index = this.answerIndex;
this.answerCount = 0; this.answerCount = 0;
this.answerData = []; this.answerData = [];
......
...@@ -72,7 +72,7 @@ export default class EndLayer extends cc.Component { ...@@ -72,7 +72,7 @@ export default class EndLayer extends cc.Component {
let root = this.loseRoot; let root = this.loseRoot;
let golden = this.loseGold; let golden = this.loseGold;
if (data.status.blueRight >= data.status.redRight) { if (data.status.totalAddBlueScore >= data.status.totalAddRedScore) {
root = this.winRoot; root = this.winRoot;
golden = this.winGold; golden = this.winGold;
this.mainCom.playLocalAudio("win") this.mainCom.playLocalAudio("win")
...@@ -101,11 +101,11 @@ export default class EndLayer extends cc.Component { ...@@ -101,11 +101,11 @@ export default class EndLayer extends cc.Component {
this.blueHead.getComponent(Player).init(mydata.url); this.blueHead.getComponent(Player).init(mydata.url);
this.blueName.string = mydata.name; this.blueName.string = mydata.name;
this.blueScore.string = mydata.score; this.blueScore.string = data.status.totalAddBlueScore
this.redHead.getComponent(Player).init(otherData.headUrl); this.redHead.getComponent(Player).init(otherData.headUrl);
this.redName.string = otherData.name; this.redName.string = otherData.name;
this.redScore.string = otherData.score; this.redScore.string = data.status.totalAddRedScore
} }
......
...@@ -77,6 +77,7 @@ export default class GameLayer extends cc.Component { ...@@ -77,6 +77,7 @@ export default class GameLayer extends cc.Component {
countTime: number; countTime: number;
cupY: number; cupY: number;
cupX: number; cupX: number;
startScore: any;
onLoad() { onLoad() {
...@@ -96,6 +97,7 @@ export default class GameLayer extends cc.Component { ...@@ -96,6 +97,7 @@ export default class GameLayer extends cc.Component {
this.questionTime.string = "10"; this.questionTime.string = "10";
this.startScore = mydata.score;
this.picRoot.active = false; this.picRoot.active = false;
this.cupStart.active = true; this.cupStart.active = true;
...@@ -108,11 +110,12 @@ export default class GameLayer extends cc.Component { ...@@ -108,11 +110,12 @@ export default class GameLayer extends cc.Component {
this.blueHead.getComponent(Player).init(mydata.url); this.blueHead.getComponent(Player).init(mydata.url);
this.blueName.string = mydata.name; this.blueName.string = mydata.name;
this.blueScore.string = mydata.score; this.blueScore.string = "0";
this.redHead.getComponent(Player).init(otherData.headUrl); this.redHead.getComponent(Player).init(otherData.headUrl);
this.redName.string = otherData.name; this.redName.string = otherData.name;
this.redScore.string = otherData.score; this.redScore.string = "0";
cc.tween(this.cupStart).to(0.15, { y: this.cupY }, { easing: "sineIn" }).start() cc.tween(this.cupStart).to(0.15, { y: this.cupY }, { easing: "sineIn" }).start()
...@@ -234,29 +237,30 @@ export default class GameLayer extends cc.Component { ...@@ -234,29 +237,30 @@ export default class GameLayer extends cc.Component {
let addBlueScore = +data.status.addBlueScore; let roundAddBlueScore = +data.status.roundAddBlueScore;
let addRedScore = +data.status.addRedScore; let roundAddRedScore = +data.status.roundAddRedScore;
if (roundAddBlueScore > 0) {
if (addBlueScore > 0) {
let bluescore = +this.blueScore.string; this.blueScore.string = data.status.totalAddBlueScore;
this.blueScore.string = bluescore + data.status.addBlueScore; cc.sys.localStorage.setItem("mySocre", this.startScore + data.status.totalAddBlueScore)
cc.sys.localStorage.setItem("mySocre", +this.blueScore.string)
let lbnode = cc.instantiate(this.blueScore.node); let lbnode = cc.instantiate(this.blueScore.node);
lbnode.parent = this.blueScore.node.parent; lbnode.parent = this.blueScore.node.parent;
lbnode.color = cc.Color.RED; lbnode.color = cc.Color.RED;
lbnode.getComponent(cc.Label).string = "+" + addBlueScore; lbnode.getComponent(cc.Label).string = "+" + roundAddBlueScore;
cc.tween(lbnode).by(1, { y: 100, opacity: -255 }, { easing: "sineOut" }).removeSelf().start(); cc.tween(lbnode).by(1, { y: 100, opacity: -255 }, { easing: "sineOut" }).removeSelf().start();
} }
if (addRedScore > 0) { if (roundAddRedScore > 0) {
let redscore = +this.redScore.string;
this.redScore.string = redscore + data.status.addRedScore; this.redScore.string = data.status.totalAddRedScore;
let lbnode = cc.instantiate(this.redScore.node); let lbnode = cc.instantiate(this.redScore.node);
lbnode.parent = this.redScore.node.parent; lbnode.parent = this.redScore.node.parent;
lbnode.color = cc.Color.RED; lbnode.color = cc.Color.RED;
lbnode.getComponent(cc.Label).string = "+" + addRedScore; lbnode.getComponent(cc.Label).string = "+" + roundAddRedScore;
this.mainCom.otherData.score = +this.redScore.string; this.mainCom.otherData.score = +this.redScore.string;
......
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