Commit 3bc543da authored by 李维's avatar 李维

完成宝石进度设置

parent a86004fd
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -25,9 +25,9 @@ const MSG_FINISH = "msg_finish"; ...@@ -25,9 +25,9 @@ const MSG_FINISH = "msg_finish";
const MSG_PLAYER_TO_TREE = "msg_player_to_tree"; const MSG_PLAYER_TO_TREE = "msg_player_to_tree";
const MSG_PLAYER_TO_HOME = "msg_player_to_home"; const MSG_PLAYER_TO_HOME = "msg_player_to_home";
const MSG_PROFIX_END = "__END__"; const MSG_PROFIX_END = "__END__";
const DEBUG = true; const DEBUG = false;
const TOTAL_SCORE = 42; // 总分 - 双方分数之和等于 TOTAL_SCORE const TOTAL_SCORE = 42; // 总分 - 双方分数之和等于 TOTAL_SCORE
const AI_SUCCESS_RATE = 0.65; // ai评测成功率 const AI_SUCCESS_RATE = 0.7; // ai评测成功率
const AUTO_GAME = false; // 自动游戏-调试使用 const AUTO_GAME = false; // 自动游戏-调试使用
@ccclass @ccclass
...@@ -238,6 +238,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -238,6 +238,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
blueBagNode = null; blueBagNode = null;
redPlayerDB = null; redPlayerDB = null;
bluePlayerDB = null; bluePlayerDB = null;
redHeaderMask = null;
blueHeaderMask = null;
// 初始化玩家 // 初始化玩家
initPlayerNode() { initPlayerNode() {
this.redPlayerNode = cc.find("Canvas/playerLand/red/people"); this.redPlayerNode = cc.find("Canvas/playerLand/red/people");
...@@ -248,6 +250,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -248,6 +250,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.blueBagNode = cc.find("Canvas/playerLand/blue/bag"); this.blueBagNode = cc.find("Canvas/playerLand/blue/bag");
this.redPlayerDB = cc.find("Canvas/playerLand/red/people/db"); this.redPlayerDB = cc.find("Canvas/playerLand/red/people/db");
this.bluePlayerDB = cc.find("Canvas/playerLand/blue/people/db"); this.bluePlayerDB = cc.find("Canvas/playerLand/blue/people/db");
this.redHeaderMask = cc.find("Canvas/playerLand/red/header/mask");
this.blueHeaderMask = cc.find("Canvas/playerLand/blue/header/mask");
} }
treeNode = null; treeNode = null;
...@@ -511,6 +515,28 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -511,6 +515,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
scoreBlueFinishComponent = null; scoreBlueFinishComponent = null;
masterRedNode = null; masterRedNode = null;
masterBlueNode = null; masterBlueNode = null;
redGems_5 = null;
redGems_10 = null;
redGems_15 = null;
redGems_20 = null;
redGems_25 = null;
blueGems_5 = null;
blueGems_10 = null;
blueGems_15 = null;
blueGems_20 = null;
blueGems_25 = null;
redFinishGems_5 = null;
redFinishGems_10 = null;
redFinishGems_15 = null;
redFinishGems_20 = null;
redFinishGems_25 = null;
blueFinishGems_5 = null;
blueFinishGems_10 = null;
blueFinishGems_15 = null;
blueFinishGems_20 = null;
blueFinishGems_25 = null;
// 初始化分数 // 初始化分数
initScore() { initScore() {
this.scoreRedComponent = cc.find("Canvas/playerLand/red/bag/score").getComponent(cc.Label); this.scoreRedComponent = cc.find("Canvas/playerLand/red/bag/score").getComponent(cc.Label);
...@@ -519,6 +545,52 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -519,6 +545,52 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.scoreBlueFinishComponent = cc.find("Canvas/finishLayer/blue/bag/score").getComponent(cc.Label); this.scoreBlueFinishComponent = cc.find("Canvas/finishLayer/blue/bag/score").getComponent(cc.Label);
this.masterRedNode = cc.find("Canvas/finishLayer/red/master"); this.masterRedNode = cc.find("Canvas/finishLayer/red/master");
this.masterBlueNode = cc.find("Canvas/finishLayer/blue/master"); this.masterBlueNode = cc.find("Canvas/finishLayer/blue/master");
this.redGems_5 = cc.find("Canvas/playerLand/red/gems/gem5");
this.redGems_10 = cc.find("Canvas/playerLand/red/gems/gem10");
this.redGems_15 = cc.find("Canvas/playerLand/red/gems/gem15");
this.redGems_20 = cc.find("Canvas/playerLand/red/gems/gem20");
this.redGems_25 = cc.find("Canvas/playerLand/red/gems/gem25");
this.blueGems_5 = cc.find("Canvas/playerLand/blue/gems/gem5");
this.blueGems_10 = cc.find("Canvas/playerLand/blue/gems/gem10");
this.blueGems_15 = cc.find("Canvas/playerLand/blue/gems/gem15");
this.blueGems_20 = cc.find("Canvas/playerLand/blue/gems/gem20");
this.blueGems_25 = cc.find("Canvas/playerLand/blue/gems/gem25");
this.redFinishGems_5 = cc.find("Canvas/finishLayer/red/gems/gem5");
this.redFinishGems_10 = cc.find("Canvas/finishLayer/red/gems/gem10");
this.redFinishGems_15 = cc.find("Canvas/finishLayer/red/gems/gem15");
this.redFinishGems_20 = cc.find("Canvas/finishLayer/red/gems/gem20");
this.redFinishGems_25 = cc.find("Canvas/finishLayer/red/gems/gem25");
this.blueFinishGems_5 = cc.find("Canvas/finishLayer/blue/gems/gem5");
this.blueFinishGems_10 = cc.find("Canvas/finishLayer/blue/gems/gem10");
this.blueFinishGems_15 = cc.find("Canvas/finishLayer/blue/gems/gem15");
this.blueFinishGems_20 = cc.find("Canvas/finishLayer/blue/gems/gem20");
this.blueFinishGems_25 = cc.find("Canvas/finishLayer/blue/gems/gem25");
this.redGems_5.active = false;
this.redGems_10.active = false;
this.redGems_15.active = false;
this.redGems_20.active = false;
this.redGems_25.active = false;
this.blueGems_5.active = false;
this.blueGems_10.active = false;
this.blueGems_15.active = false;
this.blueGems_20.active = false;
this.blueGems_25.active = false;
this.redFinishGems_5.active = false;
this.redFinishGems_10.active = false;
this.redFinishGems_15.active = false;
this.redFinishGems_20.active = false;
this.redFinishGems_25.active = false;
this.blueFinishGems_5.active = false;
this.blueFinishGems_10.active = false;
this.blueFinishGems_15.active = false;
this.blueFinishGems_20.active = false;
this.blueFinishGems_25.active = false;
this.scoreRed = 0; this.scoreRed = 0;
this.scoreBlue = 0; this.scoreBlue = 0;
this.scoreRedComponent.string = this.scoreRed; this.scoreRedComponent.string = this.scoreRed;
...@@ -549,6 +621,163 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -549,6 +621,163 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.masterRedNode.active = false; this.masterRedNode.active = false;
this.masterBlueNode.active = false; this.masterBlueNode.active = false;
} }
this.setRedScoreGem(this.scoreRed);
this.setBlueScoreGem(this.scoreBlue);
}
// 根据分数显示头像框宝石数量 - 红
setRedScoreGem(score) {
if(score == 0) {
this.redGems_5.active = false;
this.redGems_10.active = false;
this.redGems_15.active = false;
this.redGems_20.active = false;
this.redGems_25.active = false;
this.redFinishGems_5.active = false;
this.redFinishGems_10.active = false;
this.redFinishGems_15.active = false;
this.redFinishGems_20.active = false;
this.redFinishGems_25.active = false;
} else if(score <= 5) {
this.redGems_5.active = true;
this.redGems_10.active = false;
this.redGems_15.active = false;
this.redGems_20.active = false;
this.redGems_25.active = false;
this.redFinishGems_5.active = true;
this.redFinishGems_10.active = false;
this.redFinishGems_15.active = false;
this.redFinishGems_20.active = false;
this.redFinishGems_25.active = false;
} else if(score <= 10) {
this.redGems_5.active = true;
this.redGems_10.active = true;
this.redGems_15.active = false;
this.redGems_20.active = false;
this.redGems_25.active = false;
this.redFinishGems_5.active = true;
this.redFinishGems_10.active = true;
this.redFinishGems_15.active = false;
this.redFinishGems_20.active = false;
this.redFinishGems_25.active = false;
} else if(score <= 15) {
this.redGems_5.active = true;
this.redGems_10.active = true;
this.redGems_15.active = true;
this.redGems_20.active = false;
this.redGems_25.active = false;
this.redFinishGems_5.active = true;
this.redFinishGems_10.active = true;
this.redFinishGems_15.active = true;
this.redFinishGems_20.active = false;
this.redFinishGems_25.active = false;
} else if(score <= 20) {
this.redGems_5.active = true;
this.redGems_10.active = true;
this.redGems_15.active = true;
this.redGems_20.active = true;
this.redGems_25.active = false;
this.redFinishGems_5.active = true;
this.redFinishGems_10.active = true;
this.redFinishGems_15.active = true;
this.redFinishGems_20.active = true;
this.redFinishGems_25.active = false;
} else {
this.redGems_5.active = true;
this.redGems_10.active = true;
this.redGems_15.active = true;
this.redGems_20.active = true;
this.redGems_25.active = true;
this.redFinishGems_5.active = true;
this.redFinishGems_10.active = true;
this.redFinishGems_15.active = true;
this.redFinishGems_20.active = true;
this.redFinishGems_25.active = true;
}
}
// 根据分数显示头像框宝石数量 - 蓝
setBlueScoreGem(score) {
if(score == 0) {
this.blueGems_5.active = false;
this.blueGems_10.active = false;
this.blueGems_15.active = false;
this.blueGems_20.active = false;
this.blueGems_25.active = false;
this.blueFinishGems_5.active = false;
this.blueFinishGems_10.active = false;
this.blueFinishGems_15.active = false;
this.blueFinishGems_20.active = false;
this.blueFinishGems_25.active = false;
} else if(score <= 5) {
this.blueGems_5.active = true;
this.blueGems_10.active = false;
this.blueGems_15.active = false;
this.blueGems_20.active = false;
this.blueGems_25.active = false;
this.blueFinishGems_5.active = true;
this.blueFinishGems_10.active = false;
this.blueFinishGems_15.active = false;
this.blueFinishGems_20.active = false;
this.blueFinishGems_25.active = false;
} else if(score <= 10) {
this.blueGems_5.active = true;
this.blueGems_10.active = true;
this.blueGems_15.active = false;
this.blueGems_20.active = false;
this.blueGems_25.active = false;
this.blueFinishGems_5.active = true;
this.blueFinishGems_10.active = true;
this.blueFinishGems_15.active = false;
this.blueFinishGems_20.active = false;
this.blueFinishGems_25.active = false;
} else if(score <= 15) {
this.blueGems_5.active = true;
this.blueGems_10.active = true;
this.blueGems_15.active = true;
this.blueGems_20.active = false;
this.blueGems_25.active = false;
this.blueFinishGems_5.active = true;
this.blueFinishGems_10.active = true;
this.blueFinishGems_15.active = true;
this.blueFinishGems_20.active = false;
this.blueFinishGems_25.active = false;
} else if(score <= 20) {
this.blueGems_5.active = true;
this.blueGems_10.active = true;
this.blueGems_15.active = true;
this.blueGems_20.active = true;
this.blueGems_25.active = false;
this.blueFinishGems_5.active = true;
this.blueFinishGems_10.active = true;
this.blueFinishGems_15.active = true;
this.blueFinishGems_20.active = true;
this.blueFinishGems_25.active = false;
} else {
this.blueGems_5.active = true;
this.blueGems_10.active = true;
this.blueGems_15.active = true;
this.blueGems_20.active = true;
this.blueGems_25.active = true;
this.blueFinishGems_5.active = true;
this.blueFinishGems_10.active = true;
this.blueFinishGems_15.active = true;
this.blueFinishGems_20.active = true;
this.blueFinishGems_25.active = true;
}
} }
// 用户自定义事件 // 用户自定义事件
...@@ -689,6 +918,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -689,6 +918,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 蓝色阵营 后手 禁止点击 // 蓝色阵营 后手 禁止点击
this.turntable.disable() this.turntable.disable()
} }
if(this.currentGameSide == RED) {
this.redHeaderMask.active = false;
this.blueHeaderMask.active = true;
} else {
this.redHeaderMask.active = true;
this.blueHeaderMask.active = false;
}
} }
// 注册自定义消息事件 // 注册自定义消息事件
...@@ -922,7 +1159,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -922,7 +1159,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
case 0: gIndex = Math.floor((Math.random() * gem1.length * 10) / 10); index = gem1[gIndex].__index; break; case 0: gIndex = Math.floor((Math.random() * gem1.length * 10) / 10); index = gem1[gIndex].__index; break;
case 1: gIndex = Math.floor((Math.random() * gem2.length * 10) / 10); index = gem2[gIndex].__index; break; case 1: gIndex = Math.floor((Math.random() * gem2.length * 10) / 10); index = gem2[gIndex].__index; break;
case 2: gIndex = Math.floor((Math.random() * gem3.length * 10) / 10); index = gem3[gIndex].__index; break; case 2: gIndex = Math.floor((Math.random() * gem3.length * 10) / 10); index = gem3[gIndex].__index; break;
default: gIndex = Math.floor((Math.random() * gem1.length * 10) / 10); index = gem1[gIndex].__index; break; default: console.log(TOTAL_SCORE); gIndex = Math.floor((Math.random() * gem1.length * 10) / 10); index = gem1[gIndex].__index; break;
} }
return { return {
score: num, score: num,
...@@ -993,6 +1230,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -993,6 +1230,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.turntable.disable(); this.turntable.disable();
this.turntable.stopBlink(); this.turntable.stopBlink();
} }
if(this.currentGameSide == RED) {
this.redHeaderMask.active = false;
this.blueHeaderMask.active = true;
} else {
this.redHeaderMask.active = true;
this.blueHeaderMask.active = false;
}
// 重置转盘 // 重置转盘
this.turntable.reset(); this.turntable.reset();
} }
......
{
"ver": "2.3.5",
"uuid": "95aae604-821e-47f1-8868-c57ef62a0d0d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 71,
"height": 57,
"platformSettings": {},
"subMetas": {
"gem10": {
"ver": "1.0.4",
"uuid": "02c444b3-3d16-4772-9590-d858f150ea6d",
"rawTextureUuid": "95aae604-821e-47f1-8868-c57ef62a0d0d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 1,
"trimX": 2,
"trimY": 0,
"width": 67,
"height": 55,
"rawWidth": 71,
"rawHeight": 57,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8f508ea1-a346-49aa-983f-aabf4ee77712",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 69,
"height": 61,
"platformSettings": {},
"subMetas": {
"gem15": {
"ver": "1.0.4",
"uuid": "7a26e89d-6594-4137-a8c9-d3eca1fe1e8e",
"rawTextureUuid": "8f508ea1-a346-49aa-983f-aabf4ee77712",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 67,
"height": 59,
"rawWidth": 69,
"rawHeight": 61,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d298578f-8b02-4259-a6aa-5230b7b2a97c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 65,
"height": 64,
"platformSettings": {},
"subMetas": {
"gem20": {
"ver": "1.0.4",
"uuid": "a7bad6f3-a0d1-49ca-bb7f-75606e50a1d6",
"rawTextureUuid": "d298578f-8b02-4259-a6aa-5230b7b2a97c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 0,
"trimY": 0,
"width": 65,
"height": 63,
"rawWidth": 65,
"rawHeight": 64,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "594bb84d-016c-43cf-bf12-8251480a10d5",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 32,
"height": 26,
"platformSettings": {},
"subMetas": {
"gem25": {
"ver": "1.0.4",
"uuid": "603280ff-fbbd-43e0-bf1b-eafa0bb6aaa1",
"rawTextureUuid": "594bb84d-016c-43cf-bf12-8251480a10d5",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 32,
"height": 26,
"rawWidth": 32,
"rawHeight": 26,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "cf876d19-27a3-4512-8a2d-3ea41dda1475",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 48,
"height": 57,
"platformSettings": {},
"subMetas": {
"gem5": {
"ver": "1.0.4",
"uuid": "c6033068-a519-4a56-9419-9881597d8547",
"rawTextureUuid": "cf876d19-27a3-4512-8a2d-3ea41dda1475",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 48,
"height": 57,
"rawWidth": 48,
"rawHeight": 57,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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