Compare commits
3 Commits
de5ff73df7
...
b617219f5b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b617219f5b | ||
![]() |
1431ea689a | ||
![]() |
97eefaaac2 |
File diff suppressed because it is too large
Load Diff
|
@ -537,7 +537,7 @@ export default class Block extends cc.Component {
|
||||||
this.block_Info.node = null;
|
this.block_Info.node = null;
|
||||||
}
|
}
|
||||||
else if(this.type == BlockType.炸弹块){
|
else if(this.type == BlockType.炸弹块){
|
||||||
this.node.getChildByName("boom").getComponent("Boom").destroyBoom();
|
this.node.getChildByName("boom").getComponent("Boom").destroyBoom(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ export default class Block extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MapConroler._instance.judgeWin();
|
MapConroler._instance.judgeWin(0);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let tempColor = this.color;
|
let tempColor = this.color;
|
||||||
|
@ -763,7 +763,7 @@ export default class Block extends cc.Component {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.removeMapBlock();
|
this.removeMapBlock();
|
||||||
|
|
||||||
MapConroler._instance.judgeWin();
|
MapConroler._instance.judgeWin(1);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let pos = this.node.getPosition();
|
let pos = this.node.getPosition();
|
||||||
if(self.type == BlockType.叠加块下){
|
if(self.type == BlockType.叠加块下){
|
||||||
|
@ -779,7 +779,7 @@ export default class Block extends cc.Component {
|
||||||
self.block_Info.node.getComponent("Block").posY,false);
|
self.block_Info.node.getComponent("Block").posY,false);
|
||||||
}
|
}
|
||||||
else if(self.type == BlockType.炸弹块){
|
else if(self.type == BlockType.炸弹块){
|
||||||
this.node.getChildByName("boom").getComponent("Boom").destroyBoom();
|
this.node.getChildByName("boom").getComponent("Boom").destroyBoom(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
MapConroler._instance.nextLevel();
|
MapConroler._instance.nextLevel();
|
||||||
|
@ -1319,14 +1319,12 @@ export default class Block extends cc.Component {
|
||||||
this.touchDelta = cc.v2(0, 0);
|
this.touchDelta = cc.v2(0, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(this.type == BlockType.叠加块上 && this.moveStack == true){
|
if(this.type == BlockType.叠加块下){
|
||||||
if((this.stacking.x != 0 || this.stacking.y!= 0) && this.block_Info.node!= null){
|
if(this.block_Info.node!= null){
|
||||||
this.isTouch = false;
|
if(this.block_Info.node.getComponent("Block").moveStack == true){
|
||||||
// this.node.x = this.block_Info.node.x + this.stacking.x;
|
this.block_Info.node.x = this.node.x + this.block_Info.node.getComponent("Block").stacking.x;
|
||||||
// this.node.y = this.block_Info.node.y + this.stacking.y;
|
this.block_Info.node.y = this.node.y + this.block_Info.node.getComponent("Block").stacking.y;
|
||||||
this.node.x = Math.round(this.block_Info.node.x + this.stacking.x);
|
}
|
||||||
this.node.y = Math.round(this.block_Info.node.y + this.stacking.y);
|
|
||||||
console.log("跟随移动",dt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.block_Info){
|
if(this.block_Info){
|
||||||
|
|
|
@ -212,8 +212,8 @@ export default class GameManager extends cc.Component {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if (typeof wx !== 'undefined' && wx !== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
MiniGameSdk.API.shushu_Init();
|
MiniGameSdk.API.shushu_Init();
|
||||||
Utils.getUserInfo((data)=>{
|
Utils.getUserInfo((data) => {
|
||||||
console.log("登陆成功",data);
|
console.log("登陆成功", data);
|
||||||
});
|
});
|
||||||
let levelInfo = cc.fx.StorageMessage.getStorage("level");
|
let levelInfo = cc.fx.StorageMessage.getStorage("level");
|
||||||
//旧的读取数据设置数据方法,以强联网为主
|
//旧的读取数据设置数据方法,以强联网为主
|
||||||
|
@ -259,7 +259,7 @@ export default class GameManager extends cc.Component {
|
||||||
|
|
||||||
//新用户,有本地缓存读取配置
|
//新用户,有本地缓存读取配置
|
||||||
newReadData() {
|
newReadData() {
|
||||||
console.log("读取新信息");
|
console.log("读取新信息2");
|
||||||
let openid = cc.fx.StorageMessage.getStorage("openid");
|
let openid = cc.fx.StorageMessage.getStorage("openid");
|
||||||
if (openid == null || openid == "" || openid == undefined) {
|
if (openid == null || openid == "" || openid == undefined) {
|
||||||
console.log("没有openid");
|
console.log("没有openid");
|
||||||
|
@ -270,7 +270,7 @@ export default class GameManager extends cc.Component {
|
||||||
action: 'read'
|
action: 'read'
|
||||||
},
|
},
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log('读取用户数据成功', res.result)
|
console.log('读取用户数据成功_____________________', res.result)
|
||||||
if (res.result.code == 404 && res.result.message == "未找到用户数据") {
|
if (res.result.code == 404 && res.result.message == "未找到用户数据") {
|
||||||
}
|
}
|
||||||
else if (res.result.code == 200) {
|
else if (res.result.code == 200) {
|
||||||
|
@ -479,7 +479,7 @@ export default class GameManager extends cc.Component {
|
||||||
console.log(res.result.openid);
|
console.log(res.result.openid);
|
||||||
cc.fx.GameConfig.GM_INFO.openid = res.result.openid
|
cc.fx.GameConfig.GM_INFO.openid = res.result.openid
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
console.log("用户此一次进入游戏为正确获取openid");
|
console.log("用户此一次进入游戏为正确获取openid");
|
||||||
}
|
}
|
||||||
cc.fx.GameConfig.GM_INFO.first = true;
|
cc.fx.GameConfig.GM_INFO.first = true;
|
||||||
|
@ -687,7 +687,7 @@ export default class GameManager extends cc.Component {
|
||||||
MiniGameSdk.API.shushu_Login();
|
MiniGameSdk.API.shushu_Login();
|
||||||
MiniGameSdk.API.yinli_Init();
|
MiniGameSdk.API.yinli_Init();
|
||||||
MiniGameSdk.API.yinli_Login();
|
MiniGameSdk.API.yinli_Login();
|
||||||
cc.fx.GameTool.setWechatGameGroup(2);
|
const group = cc.fx.GameTool.setWechatGameGroup(2);
|
||||||
this.startGame();
|
this.startGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default class MapConroler extends cc.Component {
|
||||||
destroyBtn: cc.Button = null;
|
destroyBtn: cc.Button = null;
|
||||||
@property(cc.Button)
|
@property(cc.Button)
|
||||||
magicBtn: cc.Button = null;
|
magicBtn: cc.Button = null;
|
||||||
//魔法棒特效
|
//魔法棒特效
|
||||||
@property(cc.Node)
|
@property(cc.Node)
|
||||||
magics: cc.Node = null;
|
magics: cc.Node = null;
|
||||||
@property(cc.Node)
|
@property(cc.Node)
|
||||||
|
@ -60,7 +60,7 @@ export default class MapConroler extends cc.Component {
|
||||||
@property(cc.Label)
|
@property(cc.Label)
|
||||||
magicLabel: cc.Label = null;
|
magicLabel: cc.Label = null;
|
||||||
|
|
||||||
@property(cc.Node)
|
@property(cc.Node)
|
||||||
iceNode: cc.Node = null;
|
iceNode: cc.Node = null;
|
||||||
@property(cc.Node)
|
@property(cc.Node)
|
||||||
hammerNode: cc.Node = null;
|
hammerNode: cc.Node = null;
|
||||||
|
@ -111,7 +111,7 @@ export default class MapConroler extends cc.Component {
|
||||||
mapBlockArray: any; //地图的所有格子状态存储
|
mapBlockArray: any; //地图的所有格子状态存储
|
||||||
pause: boolean = false;//暂停状态
|
pause: boolean = false;//暂停状态
|
||||||
hammer: boolean = false;//锤子状态
|
hammer: boolean = false;//锤子状态
|
||||||
ishammer: boolean = false;//魔法棒与锤子区分
|
ishammer: boolean = false;//魔法棒与锤子区分
|
||||||
freezeArray: any; //冻结
|
freezeArray: any; //冻结
|
||||||
loackArray: any; //上锁
|
loackArray: any; //上锁
|
||||||
particleEffects: cc.ParticleAsset[];
|
particleEffects: cc.ParticleAsset[];
|
||||||
|
@ -127,6 +127,7 @@ export default class MapConroler extends cc.Component {
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
cc.fx.GameConfig.GM_INFO.review = 0;
|
cc.fx.GameConfig.GM_INFO.review = 0;
|
||||||
|
cc.fx.GameConfig.GM_INFO.reviewBoom = 0;
|
||||||
cc.fx.GameConfig.GM_INFO.gameState = true;
|
cc.fx.GameConfig.GM_INFO.gameState = true;
|
||||||
this.mask.opacity = 0;
|
this.mask.opacity = 0;
|
||||||
this.node.getChildByName("Adhesive").zIndex = 500;
|
this.node.getChildByName("Adhesive").zIndex = 500;
|
||||||
|
@ -183,35 +184,35 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
//道具数量
|
//道具数量
|
||||||
setPropNum() {
|
setPropNum() {
|
||||||
//如果道具数量大于0,显示 cc.fx.GameConfig.GM_INFO.freezeAmount,如果为零显示'mul10'
|
//如果道具数量大于0,显示 cc.fx.GameConfig.GM_INFO.freezeAmount,如果为零显示'mul10'
|
||||||
|
|
||||||
if(cc.fx.GameConfig.GM_INFO.freezeAmount > 0) {
|
if (cc.fx.GameConfig.GM_INFO.freezeAmount > 0) {
|
||||||
this.iceNode.children[0].active = false;
|
this.iceNode.children[0].active = false;
|
||||||
this.iceNode.children[1].active = true;
|
this.iceNode.children[1].active = true;
|
||||||
this.iceNode.children[2].active = true;
|
this.iceNode.children[2].active = true;
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.freezeAmount, 20, 15, "mul", this.iceNode.children[2], true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.freezeAmount, 20, 15, "mul", this.iceNode.children[2], true);
|
||||||
} else {
|
} else {
|
||||||
this.iceNode.children[0].active = true
|
this.iceNode.children[0].active = true
|
||||||
this.iceNode.children[1].active = false;
|
this.iceNode.children[1].active = false;
|
||||||
this.iceNode.children[2].active = false;
|
this.iceNode.children[2].active = false;
|
||||||
}
|
}
|
||||||
if(cc.fx.GameConfig.GM_INFO.hammerAmount > 0) {
|
if (cc.fx.GameConfig.GM_INFO.hammerAmount > 0) {
|
||||||
this.hammerNode.children[1].active = true;
|
this.hammerNode.children[1].active = true;
|
||||||
this.hammerNode.children[0].active = false;
|
this.hammerNode.children[0].active = false;
|
||||||
this.hammerNode.children[2].active = true;
|
this.hammerNode.children[2].active = true;
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hammerAmount, 20, 15, "mul", this.hammerNode.children[2], true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hammerAmount, 20, 15, "mul", this.hammerNode.children[2], true);
|
||||||
} else {
|
} else {
|
||||||
this.hammerNode.children[0].active = true;
|
this.hammerNode.children[0].active = true;
|
||||||
this.hammerNode.children[1].active = false;
|
this.hammerNode.children[1].active = false;
|
||||||
this.hammerNode.children[2].active = false;
|
this.hammerNode.children[2].active = false;
|
||||||
}
|
}
|
||||||
if(cc.fx.GameConfig.GM_INFO.magicAmount > 0) {
|
if (cc.fx.GameConfig.GM_INFO.magicAmount > 0) {
|
||||||
this.magicNode.children[1].active = true;
|
this.magicNode.children[1].active = true;
|
||||||
this.magicNode.children[0].active = false;
|
this.magicNode.children[0].active = false;
|
||||||
this.magicNode.children[2].active = true;
|
this.magicNode.children[2].active = true;
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.magicAmount, 20, 15, "mul", this.magicNode.children[2], true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.magicAmount, 20, 15, "mul", this.magicNode.children[2], true);
|
||||||
} else {
|
} else {
|
||||||
this.magicNode.children[0].active = true
|
this.magicNode.children[0].active = true
|
||||||
this.magicNode.children[1].active = false;
|
this.magicNode.children[1].active = false;
|
||||||
this.magicNode.children[2].active = false;
|
this.magicNode.children[2].active = false;
|
||||||
|
@ -225,10 +226,10 @@ export default class MapConroler extends cc.Component {
|
||||||
this.count_Time = Date.now();
|
this.count_Time = Date.now();
|
||||||
//发送数数事件——进入关卡
|
//发送数数事件——进入关卡
|
||||||
console.log("准备进入下一关,发送下一关进入");
|
console.log("准备进入下一关,发送下一关进入");
|
||||||
if((cc.fx.GameConfig.GM_INFO.level + 1) == 1) {
|
if ((cc.fx.GameConfig.GM_INFO.level + 1) == 1) {
|
||||||
this.guideNode.getComponent(Animation).stop();
|
this.guideNode.getComponent(Animation).stop();
|
||||||
this.guideNode.active = false;
|
this.guideNode.active = false;
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("enter_stage");
|
cc.fx.GameTool.shushu_Track("enter_stage");
|
||||||
this.startTimeCutDown();
|
this.startTimeCutDown();
|
||||||
}
|
}
|
||||||
|
@ -260,7 +261,7 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
this.pause = false;
|
this.pause = false;
|
||||||
this.hammer = false;
|
this.hammer = false;
|
||||||
this.ishammer = false;
|
this.ishammer = false;
|
||||||
this.wallNum = 0;
|
this.wallNum = 0;
|
||||||
this.setMapInfo();
|
this.setMapInfo();
|
||||||
this.blocks = [];
|
this.blocks = [];
|
||||||
|
@ -324,7 +325,7 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
this.wallInit();
|
this.wallInit();
|
||||||
this.blockInit();
|
this.blockInit();
|
||||||
if((cc.fx.GameConfig.GM_INFO.level + 1) == 1) {
|
if ((cc.fx.GameConfig.GM_INFO.level + 1) == 1) {
|
||||||
// 如果是第一关,显示引导
|
// 如果是第一关,显示引导
|
||||||
this.guideNode.active = true;
|
this.guideNode.active = true;
|
||||||
this.guideNode.zIndex = 1000;
|
this.guideNode.zIndex = 1000;
|
||||||
|
@ -1333,12 +1334,21 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
judgeWin(){
|
judgeWin(number) {
|
||||||
this.blockNum = this.blocks.length;
|
this.blockNum = this.blocks.length;
|
||||||
if((this.blockNum == 0 || this.blockNum == 1) &&!this.gameWin &&!this.gameOver){
|
if (number == 1) {
|
||||||
this.stopTimeCutDown();
|
if ((this.blockNum == 0 || this.blockNum == 1) && !this.gameWin && !this.gameOver) {
|
||||||
this.stopBoom();
|
this.stopTimeCutDown();
|
||||||
|
this.stopBoom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (number == 0) {
|
||||||
|
if (this.blockNum == 0 && !this.gameWin && !this.gameOver) {
|
||||||
|
this.stopTimeCutDown();
|
||||||
|
this.stopBoom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断游戏成功下一关
|
//判断游戏成功下一关
|
||||||
|
@ -1352,7 +1362,7 @@ export default class MapConroler extends cc.Component {
|
||||||
// alert("游戏成功");
|
// alert("游戏成功");
|
||||||
MiniGameSdk.API.showToast(cc.fx.GameConfig.GM_INFO.level);
|
MiniGameSdk.API.showToast(cc.fx.GameConfig.GM_INFO.level);
|
||||||
this.gameWin = true;
|
this.gameWin = true;
|
||||||
console.log("恢复一点体力",cc.fx.GameConfig.GM_INFO.level);
|
console.log("恢复一点体力", cc.fx.GameConfig.GM_INFO.level);
|
||||||
cc.fx.GameTool.setUserHealth(1, (data) => {
|
cc.fx.GameTool.setUserHealth(1, (data) => {
|
||||||
})
|
})
|
||||||
this.stopTimeCutDown();
|
this.stopTimeCutDown();
|
||||||
|
@ -1381,7 +1391,7 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.gameOver == true) {
|
if (this.gameOver == true) {
|
||||||
this.failLevel(null);
|
this.failLevel("time");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1396,22 +1406,22 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
winLevel() {
|
winLevel() {
|
||||||
MiniGameSdk.API.showToast(cc.fx.GameConfig.GM_INFO.level);
|
MiniGameSdk.API.showToast(cc.fx.GameConfig.GM_INFO.level);
|
||||||
if(this.node.parent.parent.getChildByName("Win").
|
if (this.node.parent.parent.getChildByName("Win").
|
||||||
getChildByName("nextBtn").getComponent("btnControl")._touch == false){
|
getChildByName("nextBtn").getComponent("btnControl")._touch == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.node.parent.parent.getChildByName("Win").
|
this.node.parent.parent.getChildByName("Win").
|
||||||
getChildByName("nextBtn").getComponent("btnControl").setTouch(false);
|
getChildByName("nextBtn").getComponent("btnControl").setTouch(false);
|
||||||
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
||||||
console.log("下一关",cc.fx.GameConfig.GM_INFO.level);
|
console.log("下一关", cc.fx.GameConfig.GM_INFO.level);
|
||||||
if (cc.fx.GameConfig.GM_INFO.level > 249) {
|
if (cc.fx.GameConfig.GM_INFO.level > 249) {
|
||||||
cc.fx.GameConfig.GM_INFO.level = 249;
|
cc.fx.GameConfig.GM_INFO.level = 249;
|
||||||
MiniGameSdk.API.showToast("每周更新,敬请期待!");
|
MiniGameSdk.API.showToast("每周更新,敬请期待!");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.node.parent.parent.getChildByName("Win").
|
this.node.parent.parent.getChildByName("Win").
|
||||||
getChildByName("nextBtn").getComponent("btnControl").setTouch(true);
|
getChildByName("nextBtn").getComponent("btnControl").setTouch(true);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// console.log("下一关");
|
// console.log("下一关");
|
||||||
|
@ -1456,15 +1466,28 @@ export default class MapConroler extends cc.Component {
|
||||||
// this.node.parent.parent.parent.destroy();
|
// this.node.parent.parent.parent.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
reviewLevel() {
|
//时间到了复活
|
||||||
if(this.reviewState == true){
|
reviewLevel(event, type) {
|
||||||
|
if (this.reviewState == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.reviewState = true;
|
this.reviewState = true;
|
||||||
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
||||||
|
|
||||||
let coin = 900;
|
let coin = 900;
|
||||||
if (cc.fx.GameConfig.GM_INFO.review == 1) coin = 1900;
|
let data = {
|
||||||
else if (cc.fx.GameConfig.GM_INFO.review == 2) coin = 2500;
|
type: type,
|
||||||
|
coin: -coin
|
||||||
|
}
|
||||||
|
if (type == "time") {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.review == 1) coin = 1900;
|
||||||
|
else if (cc.fx.GameConfig.GM_INFO.review == 2) coin = 2500;
|
||||||
|
}
|
||||||
|
else if (type == "boom") {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.reviewBoom == 1) coin = 1900;
|
||||||
|
else if (cc.fx.GameConfig.GM_INFO.reviewBoom == 2) coin = 2500;
|
||||||
|
}
|
||||||
|
data.coin = -coin;
|
||||||
// console.log("自身金币:",cc.fx.GameConfig.GM_INFO.coin,"消耗金币:",coin);
|
// console.log("自身金币:",cc.fx.GameConfig.GM_INFO.coin,"消耗金币:",coin);
|
||||||
if (cc.fx.GameConfig.GM_INFO.coin < Math.abs(coin)) {
|
if (cc.fx.GameConfig.GM_INFO.coin < Math.abs(coin)) {
|
||||||
MiniGameSdk.API.showToast("金币不足,无法加时间");
|
MiniGameSdk.API.showToast("金币不足,无法加时间");
|
||||||
|
@ -1472,31 +1495,41 @@ export default class MapConroler extends cc.Component {
|
||||||
this.openShop();
|
this.openShop();
|
||||||
this.reviewState = false;
|
this.reviewState = false;
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.runRewive(-coin);
|
this.runRewive(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//执行复活函数
|
||||||
runRewive(data) {
|
runRewive(data) {
|
||||||
console.log("复活回调函数内", data);
|
console.log("复活回调函数内", data);
|
||||||
cc.fx.GameTool.changeCoin(data);
|
cc.fx.GameTool.changeCoin(data.coin);
|
||||||
MiniGameSdk.API.showToast("继续游戏");
|
MiniGameSdk.API.showToast("继续游戏");
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
if (cc.fx.GameConfig.GM_INFO.review < 2)
|
if (data.type == "time") {
|
||||||
cc.fx.GameConfig.GM_INFO.review += 1;
|
if (cc.fx.GameConfig.GM_INFO.review < 2)
|
||||||
|
cc.fx.GameConfig.GM_INFO.review += 1;
|
||||||
|
}
|
||||||
|
else if (data.type == "boom") {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.reviewBoom < 2)
|
||||||
|
cc.fx.GameConfig.GM_INFO.reviewBoom += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.gameOver = false;
|
this.gameOver = false;
|
||||||
this.gameWin = false;
|
this.gameWin = false;
|
||||||
this.timeNumber = 21;
|
|
||||||
this.add_Time += 20;
|
|
||||||
this.pause = false;
|
this.pause = false;
|
||||||
|
if (data.type == "time") {
|
||||||
|
this.timeNumber = 21;
|
||||||
|
this.add_Time += 20;
|
||||||
|
}
|
||||||
|
|
||||||
this.blockNum = this.blocks.length;
|
this.blockNum = this.blocks.length;
|
||||||
if (this.blockNum == 0 )this.nextLevel();
|
if (this.blockNum == 0) this.nextLevel();
|
||||||
|
|
||||||
this.node.parent.parent.getChildByName("Lose").active = false;
|
this.node.parent.parent.getChildByName("Lose").active = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.reviewState = false;
|
this.reviewState = false;
|
||||||
|
@ -1576,15 +1609,22 @@ export default class MapConroler extends cc.Component {
|
||||||
this.node.parent.parent.getChildByName("Lose").active = true;
|
this.node.parent.parent.getChildByName("Lose").active = true;
|
||||||
this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = true;
|
this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = true;
|
||||||
this.node.parent.parent.getChildByName("Lose").getChildByName("Boom").active = false;
|
this.node.parent.parent.getChildByName("Lose").getChildByName("Boom").active = false;
|
||||||
let buyBtn = this.node.parent.parent.getChildByName("Lose").getChildByName("Time").getChildByName("buyBtn");
|
|
||||||
buyBtn.getChildByName("coin1").active = buyBtn.getChildByName("coin2").active = buyBtn.getChildByName("coin3").active = false;
|
|
||||||
if (cc.fx.GameConfig.GM_INFO.review == 0) buyBtn.getChildByName("coin1").active = true;
|
|
||||||
else if (cc.fx.GameConfig.GM_INFO.review == 1) buyBtn.getChildByName("coin2").active = true;
|
|
||||||
else if (cc.fx.GameConfig.GM_INFO.review == 2) buyBtn.getChildByName("coin3").active = true;
|
|
||||||
if (type) {
|
if (type) {
|
||||||
|
if (type == "time") {
|
||||||
|
let buyBtn = this.node.parent.parent.getChildByName("Lose").getChildByName("Time").getChildByName("buyBtn");
|
||||||
|
buyBtn.getChildByName("coin1").active = buyBtn.getChildByName("coin2").active = buyBtn.getChildByName("coin3").active = false;
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.review == 0) buyBtn.getChildByName("coin1").active = true;
|
||||||
|
else if (cc.fx.GameConfig.GM_INFO.review == 1) buyBtn.getChildByName("coin2").active = true;
|
||||||
|
else if (cc.fx.GameConfig.GM_INFO.review == 2) buyBtn.getChildByName("coin3").active = true;
|
||||||
|
}
|
||||||
if (type == "boom") {
|
if (type == "boom") {
|
||||||
this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = false;
|
this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = false;
|
||||||
this.node.parent.parent.getChildByName("Lose").getChildByName("Boom").active = true;
|
this.node.parent.parent.getChildByName("Lose").getChildByName("Boom").active = true;
|
||||||
|
let buyBtn = this.node.parent.parent.getChildByName("Lose").getChildByName("Boom").getChildByName("buyBtn");
|
||||||
|
buyBtn.getChildByName("coin1").active = buyBtn.getChildByName("coin2").active = buyBtn.getChildByName("coin3").active = false;
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.reviewBoom == 0) buyBtn.getChildByName("coin1").active = true;
|
||||||
|
else if (cc.fx.GameConfig.GM_INFO.reviewBoom == 1) buyBtn.getChildByName("coin2").active = true;
|
||||||
|
else if (cc.fx.GameConfig.GM_INFO.reviewBoom == 2) buyBtn.getChildByName("coin3").active = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, time);
|
}, time);
|
||||||
|
@ -1684,7 +1724,7 @@ export default class MapConroler extends cc.Component {
|
||||||
// this.openShop();
|
// this.openShop();
|
||||||
// freezeBtn.getComponent("btnControl").setTouch(true);
|
// freezeBtn.getComponent("btnControl").setTouch(true);
|
||||||
// }, 500);
|
// }, 500);
|
||||||
|
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
this.node.parent.parent.getChildByName("propWindow").active = true;
|
this.node.parent.parent.getChildByName("propWindow").active = true;
|
||||||
|
@ -1760,7 +1800,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString();
|
// this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString();
|
||||||
MiniGameSdk.API.showToast("购买冻结时间成功");
|
MiniGameSdk.API.showToast("购买冻结时间成功");
|
||||||
}, 2000);
|
}, 200);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1775,7 +1815,7 @@ export default class MapConroler extends cc.Component {
|
||||||
MiniGameSdk.API.showToast("购买魔法棒成功");
|
MiniGameSdk.API.showToast("购买魔法棒成功");
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
|
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
|
||||||
}, 2000);
|
}, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (data == "hammerAmount") {
|
else if (data == "hammerAmount") {
|
||||||
|
@ -1789,7 +1829,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString();
|
// this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString();
|
||||||
MiniGameSdk.API.showToast("购买锤子成功");
|
MiniGameSdk.API.showToast("购买锤子成功");
|
||||||
}, 2000);
|
}, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1807,15 +1847,6 @@ export default class MapConroler extends cc.Component {
|
||||||
if (hammerBtn.getComponent("btnControl")._touch) {
|
if (hammerBtn.getComponent("btnControl")._touch) {
|
||||||
hammerBtn.getComponent("btnControl").setTouch(false);
|
hammerBtn.getComponent("btnControl").setTouch(false);
|
||||||
if (cc.fx.GameConfig.GM_INFO.hammerAmount < 1) {
|
if (cc.fx.GameConfig.GM_INFO.hammerAmount < 1) {
|
||||||
// if (cc.fx.GameConfig.GM_INFO.coin < 1500) {
|
|
||||||
// MiniGameSdk.API.showToast("金币不足,无法购买道具");
|
|
||||||
// setTimeout(() => {
|
|
||||||
// this.openShop();
|
|
||||||
// hammerBtn.getComponent("btnControl").setTouch(true);
|
|
||||||
// }, 500);
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
this.node.parent.parent.getChildByName("propWindow").active = true;
|
this.node.parent.parent.getChildByName("propWindow").active = true;
|
||||||
this.node.parent.parent.parent.getComponent("SceneManager").openPropBuy("hammer");
|
this.node.parent.parent.parent.getComponent("SceneManager").openPropBuy("hammer");
|
||||||
}
|
}
|
||||||
|
@ -1825,7 +1856,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.hammerMask.active = true;
|
this.hammerMask.active = true;
|
||||||
|
|
||||||
this.hammer = true;
|
this.hammer = true;
|
||||||
this.ishammer = true;
|
this.ishammer = true;
|
||||||
cc.fx.GameConfig.GM_INFO.hammerAmount -= 1;
|
cc.fx.GameConfig.GM_INFO.hammerAmount -= 1;
|
||||||
if (cc.fx.GameConfig.GM_INFO.hammerAmount < 0)
|
if (cc.fx.GameConfig.GM_INFO.hammerAmount < 0)
|
||||||
cc.fx.GameConfig.GM_INFO.hammerAmount = 0;
|
cc.fx.GameConfig.GM_INFO.hammerAmount = 0;
|
||||||
|
@ -1884,7 +1915,7 @@ export default class MapConroler extends cc.Component {
|
||||||
cc.fx.GameTool.buyProp(2001, this.handleBuySuccess.bind(this, "freezeAmount"));
|
cc.fx.GameTool.buyProp(2001, this.handleBuySuccess.bind(this, "freezeAmount"));
|
||||||
}
|
}
|
||||||
|
|
||||||
openShop(){
|
openShop() {
|
||||||
const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点
|
const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点
|
||||||
if (winCOIN) {
|
if (winCOIN) {
|
||||||
const wincoin = winCOIN.getComponent(SceneManager);
|
const wincoin = winCOIN.getComponent(SceneManager);
|
||||||
|
@ -1914,7 +1945,7 @@ export default class MapConroler extends cc.Component {
|
||||||
// this.openShop();
|
// this.openShop();
|
||||||
// magicBtn.getComponent("btnControl").setTouch(true);
|
// magicBtn.getComponent("btnControl").setTouch(true);
|
||||||
// }, 500);
|
// }, 500);
|
||||||
|
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
this.node.parent.parent.getChildByName("propWindow").active = true;
|
this.node.parent.parent.getChildByName("propWindow").active = true;
|
||||||
|
@ -1929,7 +1960,7 @@ export default class MapConroler extends cc.Component {
|
||||||
magicBtn.getComponent("btnControl").setTouch(true);
|
magicBtn.getComponent("btnControl").setTouch(true);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
// this.magics.active = true;
|
// this.magics.active = true;
|
||||||
// this.magics.getComponent(sp.Skeleton).setAnimation(1, "play", false);
|
// this.magics.getComponent(sp.Skeleton).setAnimation(1, "play", false);
|
||||||
// //监听播放完后节点隐藏
|
// //监听播放完后节点隐藏
|
||||||
// this.magics.getComponent(sp.Skeleton).setCompleteListener((entry) => {
|
// this.magics.getComponent(sp.Skeleton).setCompleteListener((entry) => {
|
||||||
|
@ -1938,14 +1969,14 @@ export default class MapConroler extends cc.Component {
|
||||||
// this.magics.active = false;
|
// this.magics.active = false;
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
cc.fx.GameConfig.GM_INFO.magicAmount -= 1;
|
cc.fx.GameConfig.GM_INFO.magicAmount -= 1;
|
||||||
if (cc.fx.GameConfig.GM_INFO.magicAmount < 0)
|
if (cc.fx.GameConfig.GM_INFO.magicAmount < 0)
|
||||||
cc.fx.GameConfig.GM_INFO.magicAmount = 0;
|
cc.fx.GameConfig.GM_INFO.magicAmount = 0;
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
|
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
|
||||||
let propInfo = cc.fx.StorageMessage.getStorage("prop");
|
let propInfo = cc.fx.StorageMessage.getStorage("prop");
|
||||||
if(propInfo){
|
if (propInfo) {
|
||||||
propInfo.magicAmount = cc.fx.GameConfig.GM_INFO.magicAmount;
|
propInfo.magicAmount = cc.fx.GameConfig.GM_INFO.magicAmount;
|
||||||
propInfo.timestamp = timestamp;
|
propInfo.timestamp = timestamp;
|
||||||
cc.fx.StorageMessage.setStorage("prop", propInfo);
|
cc.fx.StorageMessage.setStorage("prop", propInfo);
|
||||||
|
@ -2171,11 +2202,11 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startBoom(){
|
startBoom() {
|
||||||
for (let i = 0; i < this.blocks.length; i++) {
|
for (let i = 0; i < this.blocks.length; i++) {
|
||||||
if (this.blocks[i].getComponent("Block").type == 6) {
|
if (this.blocks[i].getComponent("Block").type == 6) {
|
||||||
this.blocks[i].getChildByName("boom").getComponent("Boom").startBoom();
|
this.blocks[i].getChildByName("boom").getComponent("Boom").startBoom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2184,7 +2215,7 @@ export default class MapConroler extends cc.Component {
|
||||||
if (this.blocks[i].getComponent("Block").type == 6) {
|
if (this.blocks[i].getComponent("Block").type == 6) {
|
||||||
this.blocks[i].getChildByName("boom").getComponent("Boom").stopBoom();
|
this.blocks[i].getChildByName("boom").getComponent("Boom").stopBoom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ export namespace MiniGameSdk {
|
||||||
},
|
},
|
||||||
// 根据环境变量设置 debug 模式
|
// 根据环境变量设置 debug 模式
|
||||||
debug: !isProduction,
|
debug: !isProduction,
|
||||||
enableLog:false
|
enableLog: false
|
||||||
};
|
};
|
||||||
// 创建 TA 实例
|
// 创建 TA 实例
|
||||||
API._ta = new ThinkingAnalyticsAPI(config);
|
API._ta = new ThinkingAnalyticsAPI(config);
|
||||||
|
@ -1154,7 +1154,7 @@ export namespace MiniGameSdk {
|
||||||
|
|
||||||
static shushu_Login() {
|
static shushu_Login() {
|
||||||
if (typeof wx !== 'undefined' && wx !== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
console.log("数数登录时,获取到的openId:",cc.fx.GameConfig.GM_INFO.openid);
|
console.log("数数登录时,获取到的openId:", cc.fx.GameConfig.GM_INFO.openid);
|
||||||
API._ta.login(cc.fx.GameConfig.GM_INFO.openid);
|
API._ta.login(cc.fx.GameConfig.GM_INFO.openid);
|
||||||
cc.fx.GameConfig.GM_INFO.shushu_AccountId = cc.fx.GameConfig.GM_INFO.openid;
|
cc.fx.GameConfig.GM_INFO.shushu_AccountId = cc.fx.GameConfig.GM_INFO.openid;
|
||||||
const result = "success";
|
const result = "success";
|
||||||
|
@ -1170,6 +1170,14 @@ export namespace MiniGameSdk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static updateCoinAndLevel() {
|
||||||
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
|
console.log("上传金币和关卡信息给数数")
|
||||||
|
API._ta.userSet({ current_level: cc.fx.GameConfig.GM_INFO.level });
|
||||||
|
API._ta.userSet({ current_coin: cc.fx.GameConfig.GM_INFO.coin });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 数数平台设置动态公共属性
|
* 数数平台设置动态公共属性
|
||||||
*/
|
*/
|
||||||
|
@ -1183,16 +1191,17 @@ export namespace MiniGameSdk {
|
||||||
tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币
|
tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币
|
||||||
version: cc.fx.GameConfig.GM_INFO.version.toString(),//当前版本号
|
version: cc.fx.GameConfig.GM_INFO.version.toString(),//当前版本号
|
||||||
};
|
};
|
||||||
if(register_time != null){
|
if (register_time != null) {
|
||||||
superProperties = {
|
superProperties = {
|
||||||
current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number
|
current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number
|
||||||
current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值
|
current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值
|
||||||
tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币
|
tmp_coin: cc.fx.GameConfig.GM_INFO.coin,//当前金币
|
||||||
version: cc.fx.GameConfig.GM_INFO.version.toString(),
|
version: cc.fx.GameConfig.GM_INFO.version.toString(),
|
||||||
register_time:register_time
|
register_time: register_time
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
API._ta.setSuperProperties(superProperties);//设置公共事件属性
|
API._ta.setSuperProperties(superProperties);//设置公共事件属性
|
||||||
|
API.updateCoinAndLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1249,7 +1258,7 @@ export namespace MiniGameSdk {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region 引力平台-
|
//#region 引力平台-
|
||||||
static yinli_Init(){
|
static yinli_Init() {
|
||||||
if (typeof wx !== 'undefined' && wx !== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
const configYinli = {
|
const configYinli = {
|
||||||
accessToken: "aGws0nluotbm6Jjiv9WMuzOAbXLydxwe", // 项目通行证,在:网站后台-->设置-->应用列表中找到Access Token列 复制(首次使用可能需要先新增应用)
|
accessToken: "aGws0nluotbm6Jjiv9WMuzOAbXLydxwe", // 项目通行证,在:网站后台-->设置-->应用列表中找到Access Token列 复制(首次使用可能需要先新增应用)
|
||||||
|
@ -1268,23 +1277,23 @@ export namespace MiniGameSdk {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
API._ge = new GravityAnalyticsAPI(configYinli);
|
API._ge = new GravityAnalyticsAPI(configYinli);
|
||||||
API._ge .setupAndStart();
|
API._ge.setupAndStart();
|
||||||
|
|
||||||
API._ge .initialize({
|
API._ge.initialize({
|
||||||
name: cc.fx.GameConfig.GM_INFO.openid,
|
name: cc.fx.GameConfig.GM_INFO.openid,
|
||||||
version: cc.fx.GameConfig.GM_INFO.version,
|
version: cc.fx.GameConfig.GM_INFO.version,
|
||||||
openid: cc.fx.GameConfig.GM_INFO.openid,
|
openid: cc.fx.GameConfig.GM_INFO.openid,
|
||||||
enable_sync_attribution: false,
|
enable_sync_attribution: false,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("引力引擎初始化成功", res)
|
console.log("引力引擎初始化成功", res)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("引力引擎初始化失败 " + err);
|
console.log("引力引擎初始化失败 " + err);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(cc.fx.GameConfig.GM_INFO.shushu_AccountId == "") cc.fx.GameConfig.GM_INFO.shushu_AccountId =
|
if (cc.fx.GameConfig.GM_INFO.shushu_AccountId == "") cc.fx.GameConfig.GM_INFO.shushu_AccountId =
|
||||||
cc.fx.GameConfig.GM_INFO.openid;
|
cc.fx.GameConfig.GM_INFO.openid;
|
||||||
|
|
||||||
const CURRENT_USER_TA_ACCOUNT_ID = cc.fx.GameConfig.GM_INFO.shushu_AccountId; // 用户唯一标识,如产品为小游戏,则必须填用户openid(注意,不是小游戏的APPID!!!)
|
const CURRENT_USER_TA_ACCOUNT_ID = cc.fx.GameConfig.GM_INFO.shushu_AccountId; // 用户唯一标识,如产品为小游戏,则必须填用户openid(注意,不是小游戏的APPID!!!)
|
||||||
const CURRENT_USER_TA_DISTINCT_ID = cc.fx.GameConfig.GM_INFO.shushu_DistinctId; // 用户唯一标识,如产品为小游戏,则必须填用户openid(注意,不是小游戏的APPID!!!)
|
const CURRENT_USER_TA_DISTINCT_ID = cc.fx.GameConfig.GM_INFO.shushu_DistinctId; // 用户唯一标识,如产品为小游戏,则必须填用户openid(注意,不是小游戏的APPID!!!)
|
||||||
|
@ -1293,10 +1302,10 @@ export namespace MiniGameSdk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static yinli_Register(){
|
static yinli_Register() {
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
API._ge.registerEvent();
|
API._ge.registerEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1307,15 +1316,15 @@ export namespace MiniGameSdk {
|
||||||
* @param payReason 付费原因 例如:购买钻石、办理月卡
|
* @param payReason 付费原因 例如:购买钻石、办理月卡
|
||||||
* @param payMethod 付费方式 例如:支付宝、微信、银联等
|
* @param payMethod 付费方式 例如:支付宝、微信、银联等
|
||||||
*/
|
*/
|
||||||
static yinli_Pay(payAmount,orderId,payReason){
|
static yinli_Pay(payAmount, orderId, payReason) {
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
API._ge.payEvent(payAmount, "CNY", orderId, payReason, "微信");
|
API._ge.payEvent(payAmount, "CNY", orderId, payReason, "微信");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static yinli_Login(){
|
static yinli_Login() {
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
API._ge.loginEvent();
|
API._ge.loginEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,14 @@ import { GameTool } from "../Tool/GameTool";
|
||||||
|
|
||||||
const { ccclass, property } = cc._decorator;
|
const { ccclass, property } = cc._decorator;
|
||||||
@ccclass('GameConfig')
|
@ccclass('GameConfig')
|
||||||
export class GameConfig {
|
export class GameConfig {
|
||||||
//所有控制信息都通过GameAppStart内控制
|
//所有控制信息都通过GameAppStart内控制
|
||||||
private static _instance : GameConfig = null;
|
private static _instance: GameConfig = null;
|
||||||
|
|
||||||
static GAME_DATA: any[];
|
static GAME_DATA: any[];
|
||||||
//关卡数据
|
//关卡数据
|
||||||
//用户需要存储在本地的数据, 金币,关卡等级,体力值以及恢复,道具数量。
|
//用户需要存储在本地的数据, 金币,关卡等级,体力值以及恢复,道具数量。
|
||||||
|
|
||||||
|
|
||||||
static CUSTOM_INFO: {
|
static CUSTOM_INFO: {
|
||||||
moveSpeed: number; //洪峰移动速度
|
moveSpeed: number; //洪峰移动速度
|
||||||
|
@ -61,6 +61,8 @@ export class GameConfig {
|
||||||
mean_Time: number; //平均放箭速度
|
mean_Time: number; //平均放箭速度
|
||||||
hp: number; //体力值
|
hp: number; //体力值
|
||||||
review: number; //复活次数
|
review: number; //复活次数
|
||||||
|
reviewBoom: number; //炸弹复活次数
|
||||||
|
reviewDoor: number; //门复活次数
|
||||||
currSeed: number; //用于随机数种子
|
currSeed: number; //用于随机数种子
|
||||||
openid: string; //微信用户唯一id
|
openid: string; //微信用户唯一id
|
||||||
gameId: string; //游戏ID
|
gameId: string; //游戏ID
|
||||||
|
@ -92,41 +94,39 @@ export class GameConfig {
|
||||||
coinnum: number; //每局的金币数
|
coinnum: number; //每局的金币数
|
||||||
paid_user: boolean; //是否是付费用户
|
paid_user: boolean; //是否是付费用户
|
||||||
version: number; //版本号
|
version: number; //版本号
|
||||||
shushu_DistinctId: string //数数访客ID
|
shushu_DistinctId: string; //数数访客ID
|
||||||
shushu_AccountId: string //数数账号ID
|
shushu_AccountId: string; //数数账号ID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//游戏内信息
|
//游戏内信息
|
||||||
|
|
||||||
static get Instance()
|
static get Instance() {
|
||||||
{
|
if (this._instance == null) {
|
||||||
if (this._instance == null)
|
|
||||||
{
|
|
||||||
this._instance = new GameConfig();
|
this._instance = new GameConfig();
|
||||||
}
|
}
|
||||||
return this._instance;
|
return this._instance;
|
||||||
}
|
}
|
||||||
//getSeedRandom
|
//getSeedRandom
|
||||||
static init(Authentication){
|
static init(Authentication) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if (typeof wx !== 'undefined' && wx !== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.cloud.init();
|
wx.cloud.init();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.TA = null;
|
this.TA = null;
|
||||||
this.CLICK_init();
|
this.CLICK_init();
|
||||||
this.GM_INFO_init();
|
this.GM_INFO_init();
|
||||||
this.LEVEL_INFO_init(false,0);
|
this.LEVEL_INFO_init(false, 0);
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
//GAME_DATA 废弃了,暂时不删除以防后面修改回 一整局传一次
|
//GAME_DATA 废弃了,暂时不删除以防后面修改回 一整局传一次
|
||||||
this.GAME_DATA = [
|
this.GAME_DATA = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
// if(!Authentication) self.Authentication();
|
// if(!Authentication) self.Authentication();
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ export class GameConfig {
|
||||||
|
|
||||||
|
|
||||||
static generateUUID(): string {
|
static generateUUID(): string {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
const r = Math.random() * 16 | 0;
|
const r = Math.random() * 16 | 0;
|
||||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
|
@ -160,7 +160,7 @@ export class GameConfig {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GM_INFO_SET(key,value) {
|
static GM_INFO_SET(key, value) {
|
||||||
this.GM_INFO[key] = value;
|
this.GM_INFO[key] = value;
|
||||||
}
|
}
|
||||||
static CLICK_init() {
|
static CLICK_init() {
|
||||||
|
@ -176,17 +176,17 @@ export class GameConfig {
|
||||||
optimizedSteps: 0, //关卡最短步数
|
optimizedSteps: 0, //关卡最短步数
|
||||||
usedSteps: 0, //玩家修建总步数
|
usedSteps: 0, //玩家修建总步数
|
||||||
stepList: [], //U、D、L、R X 息壤 F 加固
|
stepList: [], //U、D、L、R X 息壤 F 加固
|
||||||
startTime:-1, //从游戏开始到玩家操作的第一步截止时间 单位毫秒
|
startTime: -1, //从游戏开始到玩家操作的第一步截止时间 单位毫秒
|
||||||
submitTime:-1, //从第一步操作到提交时间,如果未提交为-1 单位毫秒
|
submitTime: -1, //从第一步操作到提交时间,如果未提交为-1 单位毫秒
|
||||||
duration:0, //游戏总用时(截止到提交) 单位毫秒 如果未他移交则为时间上限
|
duration: 0, //游戏总用时(截止到提交) 单位毫秒 如果未他移交则为时间上限
|
||||||
drawingBack:0, //后退次数
|
drawingBack: 0, //后退次数
|
||||||
drawingReset:0, //清空次数
|
drawingReset: 0, //清空次数
|
||||||
timer: 0 //测评倒计时剩余时间 去秒
|
timer: 0 //测评倒计时剩余时间 去秒
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CLICK_SET(key,value) {
|
static CLICK_SET(key, value) {
|
||||||
this.CLICK_DATA[key] = value;
|
this.CLICK_DATA[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,33 +196,35 @@ export class GameConfig {
|
||||||
// isEnd: false,
|
// isEnd: false,
|
||||||
mean_Time: 0, //平均放箭速度
|
mean_Time: 0, //平均放箭速度
|
||||||
hp: 5, //体力值
|
hp: 5, //体力值
|
||||||
review:0, //复活次数
|
review: 0, //复活次数
|
||||||
|
reviewBoom: 0, //炸弹复活次数
|
||||||
|
reviewDoor: 0, //门复活次数
|
||||||
currSeed: 200000, //用于随机数种子
|
currSeed: 200000, //用于随机数种子
|
||||||
openid:"", //微信用户唯一id
|
openid: "", //微信用户唯一id
|
||||||
gameId: "100001", //游戏ID
|
gameId: "100001", //游戏ID
|
||||||
userId: 0, //用户ID
|
userId: 0, //用户ID
|
||||||
scode: "", //用户code,从网页后缀获取
|
scode: "", //用户code,从网页后缀获取
|
||||||
username:"user", //用户名称
|
username: "user", //用户名称
|
||||||
useravatar:"", //用户头像地址
|
useravatar: "", //用户头像地址
|
||||||
guide: true, //是否有引导
|
guide: true, //是否有引导
|
||||||
url: "https://api.sparkus.cn",//访问域名
|
url: "https://api.sparkus.cn",//访问域名
|
||||||
coin: 0, //用户金币
|
coin: 0, //用户金币
|
||||||
success: false, //用户游戏成功与否
|
success: false, //用户游戏成功与否
|
||||||
matchId: null, //用于埋点上传的ID
|
matchId: null, //用于埋点上传的ID
|
||||||
gameState:false,
|
gameState: false,
|
||||||
custom: 0, //用于测试跳关卡
|
custom: 0, //用于测试跳关卡
|
||||||
round:0, //回合数
|
round: 0, //回合数
|
||||||
level: 0, //具体游戏内进行到第几步
|
level: 0, //具体游戏内进行到第几步
|
||||||
stepTimeList:0, //整局游戏用时,由于涉及场景切换,数据需要保留
|
stepTimeList: 0, //整局游戏用时,由于涉及场景切换,数据需要保留
|
||||||
successList:[], //整局胜负
|
successList: [], //整局胜负
|
||||||
first:false, //是否首次进入游戏
|
first: false, //是否首次进入游戏
|
||||||
score:0, //总得分
|
score: 0, //总得分
|
||||||
scale: 1, //玩家总计成功点火数
|
scale: 1, //玩家总计成功点火数
|
||||||
iosOutTradeNo:0, //ios订单号
|
iosOutTradeNo: 0, //ios订单号
|
||||||
min_Time:0, //体力恢复的剩余时间
|
min_Time: 0, //体力恢复的剩余时间
|
||||||
freezeAmount:0, //冻结道具次数
|
freezeAmount: 0, //冻结道具次数
|
||||||
hammerAmount:0, //锤子道具次数
|
hammerAmount: 0, //锤子道具次数
|
||||||
magicAmount:0, //魔法棒道具次数
|
magicAmount: 0, //魔法棒道具次数
|
||||||
musicOpen: true, //音乐
|
musicOpen: true, //音乐
|
||||||
effectOpen: true, //音效
|
effectOpen: true, //音效
|
||||||
vibrateOpen: true, //震动
|
vibrateOpen: true, //震动
|
||||||
|
@ -249,7 +251,7 @@ export class GameConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LEVEL_INFO_init(type,time) {
|
static LEVEL_INFO_init(type, time) {
|
||||||
// 示例 围墙会根据缺的地块自动生成
|
// 示例 围墙会根据缺的地块自动生成
|
||||||
// 带缺口 {"id":"1006","map":[10,11],"gap":[cc.v2(4,9),cc.v2(5,9)]},
|
// 带缺口 {"id":"1006","map":[10,11],"gap":[cc.v2(4,9),cc.v2(5,9)]},
|
||||||
// 带升降地块 {"id":"1004","map":[7,8],"risefall":[{pos:cc.v2(5,4),color:2},{pos:cc.v2(5,5),color:5}]},
|
// 带升降地块 {"id":"1004","map":[7,8],"risefall":[{pos:cc.v2(5,4),color:2},{pos:cc.v2(5,5),color:5}]},
|
||||||
|
@ -257,41 +259,41 @@ export class GameConfig {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|
||||||
if((cc.fx.GameConfig.GM_INFO.level) > 249){
|
if ((cc.fx.GameConfig.GM_INFO.level) > 249) {
|
||||||
cc.fx.GameConfig.GM_INFO.level = 249;
|
cc.fx.GameConfig.GM_INFO.level = 249;
|
||||||
}
|
}
|
||||||
let name = "Json/level" + (cc.fx.GameConfig.GM_INFO.level+1);
|
let name = "Json/level" + (cc.fx.GameConfig.GM_INFO.level + 1);
|
||||||
|
|
||||||
// //console.log("关卡名称:",name);
|
// //console.log("关卡名称:",name);
|
||||||
// name = "Json/level" + 68;
|
// name = "Json/level" + 68;
|
||||||
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString());
|
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString());
|
||||||
cc.resources.load(name, (err: any, res: cc.JsonAsset) => {
|
cc.resources.load(name, (err: any, res: cc.JsonAsset) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
cc.fx.GameTool.addLevel(null,null);
|
cc.fx.GameTool.addLevel(null, null);
|
||||||
self.LEVEL_INFO_init(type,time);
|
self.LEVEL_INFO_init(type, time);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let jsonData: object = res.json!;
|
let jsonData: object = res.json!;
|
||||||
self.BLOCK_INFO = jsonData["BLOCK_INFO"];
|
self.BLOCK_INFO = jsonData["BLOCK_INFO"];
|
||||||
self.LEVEL_INFO = jsonData["LEVEL_INFO"];
|
self.LEVEL_INFO = jsonData["LEVEL_INFO"];
|
||||||
self.WALL_INFO = jsonData["WALL_INFO"];
|
self.WALL_INFO = jsonData["WALL_INFO"];
|
||||||
// //console.log("配置加载完成");
|
// //console.log("配置加载完成");
|
||||||
if(type){
|
if (type) {
|
||||||
cc.director.preloadScene("GameScene", ()=>{
|
cc.director.preloadScene("GameScene", () => {
|
||||||
if(time == 0) cc.director.loadScene("GameScene");
|
if (time == 0) cc.director.loadScene("GameScene");
|
||||||
else{
|
else {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
cc.director.loadScene("GameScene");
|
cc.director.loadScene("GameScene");
|
||||||
}, time);
|
}, time);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
//道具位置信息
|
//道具位置信息
|
||||||
this.PROP_INFO = [
|
this.PROP_INFO = [
|
||||||
{
|
{
|
||||||
"pos1": { "x": -66, "y": 60, "z": 0 },
|
"pos1": { "x": -66, "y": 60, "z": 0 },
|
||||||
"pos2": { "x": -19, "y": 36, "z": 0 },
|
"pos2": { "x": -19, "y": 36, "z": 0 },
|
||||||
|
@ -322,7 +324,7 @@ export class GameConfig {
|
||||||
"pos3": { "x": -150, "y": 23.675, "z": 0 },
|
"pos3": { "x": -150, "y": 23.675, "z": 0 },
|
||||||
"pos4": { "x": -22, "y": 16, "z": 0 },
|
"pos4": { "x": -22, "y": 16, "z": 0 },
|
||||||
"pos5": { "x": -200, "y": 67, "z": 0 },
|
"pos5": { "x": -200, "y": 67, "z": 0 },
|
||||||
"pos6": { "x": 0, "y": 0, "z": 0 },
|
"pos6": { "x": 0, "y": 0, "z": 0 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pos1": { "x": -63, "y": 178, "z": 0 },
|
"pos1": { "x": -63, "y": 178, "z": 0 },
|
||||||
|
@ -477,16 +479,16 @@ export class GameConfig {
|
||||||
"pos6": { "x": -2, "y": 2, "z": 0 },
|
"pos6": { "x": -2, "y": 2, "z": 0 },
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
// this.PROP_INFO = [{"pos1": {"x": -60,"y": 60,"z": 0},"pos2": {"x": -16.442,"y": 30,"z": 0},"pos3": {"x": -34.362,"y": 13.246,"z": 0},"pos4": {"x": -17,"y": 12,"z": 0}},{"pos1": {"x": -126,"y": 63,"z": 0},"pos2": {"x": -25.792,"y": 34.675,"z": 0},"pos3": {"x": -94.792,"y": 21.675,"z": 0},"pos4": {"x": -20,"y": 13,"z": 0}},{"pos1": {"x": -60,"y": 125,"z": 0},"pos2": {"x": -12.792,"y": 92.675,"z": 0},"pos3": {"x": -34.792,"y": 23.675,"z": 0},"pos4": {"x": -14,"y": 24,"z": 0}},{"pos1": {"x": -185,"y": 63,"z": 0},"pos2": {"x": -34.792,"y": 37.675,"z": 0},"pos3": {"x": -154.792,"y": 23.675,"z": 0},"pos4": {"x": -22,"y": 16,"z": 0}},{"pos1": {"x": -57,"y": 178,"z": 0},"pos2": {"x": -17.792,"y": 166.675,"z": 0},"pos3": {"x": -31.792,"y": 33.675,"z": 0},"pos4": {"x": -14,"y": 37,"z": 0}},{"pos1": {"x": -123,"y": 127,"z": 0},"pos2": {"x": -25.792,"y": 99.675,"z": 0},"pos3": {"x": -97.792,"y": 27.675,"z": 0},"pos4": {"x": -27,"y": 19,"z": 0}},{"pos1": {"x": -62,"y": 181,"z": 0},"pos2": {"x": -24.792,"y": 275.675,"z": 0},"pos3": {"x": -31.792,"y": 35.675,"z": 0},"pos4": {"x": -7,"y": 39,"z": 0}},{"pos1": {"x": -181,"y": 180,"z": 0},"pos2": {"x": -31.792,"y": 163.675,"z": 0},"pos3": {"x": -33.792,"y": 34.675,"z": 0},"pos4": {"x": -18,"y": 30,"z": 0}},{"pos1": {"x": -182,"y": 182,"z": 0},"pos2": {"x": -25.792,"y": 38.675,"z": 0},"pos3": {"x": -153.792,"y": 34.675,"z": 0},"pos4": {"x": -23,"y": 14,"z": 0}},{"pos1": {"x": -186,"y": 61,"z": 0},"pos2": {"x": -37.792,"y": 37.675,"z": 0},"pos3": {"x": -36.792,"y": 26.675,"z": 0},"pos4": {"x": -24,"y": 17,"z": 0}},{"pos1": {"x": -62,"y": 177,"z": 0},"pos2": {"x": 93.208,"y": 276.675,"z": 0},"pos3": {"x": -33.792,"y": 34.675,"z": 0},"pos4": {"x": 3,"y": 31,"z": 0}},{"pos1": {"x": 58,"y": 179,"z": 0},"pos2": {"x": 205.225,"y": 154.034,"z": 0},"pos3": {"x": -29.642,"y": 25.691,"z": 0},"pos4": {"x": 7.218,"y": 29.765,"z": 0}},{"pos1": {"x": -57,"y": 182,"z": 0},"pos2": {"x": -25.792,"y": 37.675,"z": 0},"pos3": {"x": -35.792,"y": 33.675,"z": 0},"pos4": {"x": -14,"y": 12,"z": 0}},{"pos1": {"x": -180,"y": 62,"z": 0},"pos2": {"x": -35.792,"y": 36.675,"z": 0},"pos3": {"x": -271.792,"y": 24.675,"z": 0},"pos4": {"x": -17,"y": 20,"z": 0}},{"pos1": {"x": -62,"y": 178,"z": 0},"pos2": {"x": 87.208,"y": 164.675,"z": 0},"pos3": {"x": -31.792,"y": 35.675,"z": 0},"pos4": {"x": -6,"y": 24,"z": 0}},{"pos1": {"x": -176,"y": 60,"z": 0},"pos2": {"x": -33.792,"y": 38.675,"z": 0},"pos3": {"x": -154.792,"y": 29.675,"z": 0},"pos4": {"x": -29,"y": 16,"z": 0}},{"pos1": {"x": -60,"y": 181,"z": 0},"pos2": {"x": 95.208,"y": 155.675,"z": 0},"pos3": {"x": -30.792,"y": 36.675,"z": 0},"pos4": {"x": -12,"y": 32,"z": 0}},{"pos1": {"x": -63,"y": 178,"z": 0},"pos2": {"x": -21.792,"y": 156.675,"z": 0},"pos3": {"x": -31.792,"y": 37.675,"z": 0},"pos4": {"x": -12,"y": 32,"z": 0}},{"pos1": {"x": -60,"y": 183,"z": 0},"pos2": {"x": 88.208,"y": 162.675,"z": 0},"pos3": {"x": -29.792,"y": 41.675,"z": 0},"pos4": {"x": -12,"y": 18,"z": 0}},{"pos1": {"x": -64,"y": 58,"z": 0},"pos2": {"x": -26.792,"y": 32.675,"z": 0},"pos3": {"x": -34.792,"y": 23.675,"z": 0},"pos4": {"x": -12,"y": 18,"z": 0}},{"pos1": {"x": -184,"y": 62,"z": 0},"pos2": {"x": -25.792,"y": 34.675,"z": 0},"pos3": {"x": -155.792,"y": 25.675,"z": 0},"pos4": {"x": -18,"y": 26,"z": 0}},{"pos1": {"x": -57,"y": 190,"z": 0},"pos2": {"x": 95.208,"y": 158.675,"z": 0},"pos3": {"x": -33.792,"y": 29.675,"z": 0},"pos4": {"x": -18,"y": 26,"z": 0}},{"pos1": {"x": -71,"y": 184,"z": 0},"pos2": {"x": -25.792,"y": 156.675,"z": 0},"pos3": {"x": -35.792,"y": 27.675,"z": 0},"pos4": {"x": -25,"y": 40,"z": 0}}];
|
// this.PROP_INFO = [{"pos1": {"x": -60,"y": 60,"z": 0},"pos2": {"x": -16.442,"y": 30,"z": 0},"pos3": {"x": -34.362,"y": 13.246,"z": 0},"pos4": {"x": -17,"y": 12,"z": 0}},{"pos1": {"x": -126,"y": 63,"z": 0},"pos2": {"x": -25.792,"y": 34.675,"z": 0},"pos3": {"x": -94.792,"y": 21.675,"z": 0},"pos4": {"x": -20,"y": 13,"z": 0}},{"pos1": {"x": -60,"y": 125,"z": 0},"pos2": {"x": -12.792,"y": 92.675,"z": 0},"pos3": {"x": -34.792,"y": 23.675,"z": 0},"pos4": {"x": -14,"y": 24,"z": 0}},{"pos1": {"x": -185,"y": 63,"z": 0},"pos2": {"x": -34.792,"y": 37.675,"z": 0},"pos3": {"x": -154.792,"y": 23.675,"z": 0},"pos4": {"x": -22,"y": 16,"z": 0}},{"pos1": {"x": -57,"y": 178,"z": 0},"pos2": {"x": -17.792,"y": 166.675,"z": 0},"pos3": {"x": -31.792,"y": 33.675,"z": 0},"pos4": {"x": -14,"y": 37,"z": 0}},{"pos1": {"x": -123,"y": 127,"z": 0},"pos2": {"x": -25.792,"y": 99.675,"z": 0},"pos3": {"x": -97.792,"y": 27.675,"z": 0},"pos4": {"x": -27,"y": 19,"z": 0}},{"pos1": {"x": -62,"y": 181,"z": 0},"pos2": {"x": -24.792,"y": 275.675,"z": 0},"pos3": {"x": -31.792,"y": 35.675,"z": 0},"pos4": {"x": -7,"y": 39,"z": 0}},{"pos1": {"x": -181,"y": 180,"z": 0},"pos2": {"x": -31.792,"y": 163.675,"z": 0},"pos3": {"x": -33.792,"y": 34.675,"z": 0},"pos4": {"x": -18,"y": 30,"z": 0}},{"pos1": {"x": -182,"y": 182,"z": 0},"pos2": {"x": -25.792,"y": 38.675,"z": 0},"pos3": {"x": -153.792,"y": 34.675,"z": 0},"pos4": {"x": -23,"y": 14,"z": 0}},{"pos1": {"x": -186,"y": 61,"z": 0},"pos2": {"x": -37.792,"y": 37.675,"z": 0},"pos3": {"x": -36.792,"y": 26.675,"z": 0},"pos4": {"x": -24,"y": 17,"z": 0}},{"pos1": {"x": -62,"y": 177,"z": 0},"pos2": {"x": 93.208,"y": 276.675,"z": 0},"pos3": {"x": -33.792,"y": 34.675,"z": 0},"pos4": {"x": 3,"y": 31,"z": 0}},{"pos1": {"x": 58,"y": 179,"z": 0},"pos2": {"x": 205.225,"y": 154.034,"z": 0},"pos3": {"x": -29.642,"y": 25.691,"z": 0},"pos4": {"x": 7.218,"y": 29.765,"z": 0}},{"pos1": {"x": -57,"y": 182,"z": 0},"pos2": {"x": -25.792,"y": 37.675,"z": 0},"pos3": {"x": -35.792,"y": 33.675,"z": 0},"pos4": {"x": -14,"y": 12,"z": 0}},{"pos1": {"x": -180,"y": 62,"z": 0},"pos2": {"x": -35.792,"y": 36.675,"z": 0},"pos3": {"x": -271.792,"y": 24.675,"z": 0},"pos4": {"x": -17,"y": 20,"z": 0}},{"pos1": {"x": -62,"y": 178,"z": 0},"pos2": {"x": 87.208,"y": 164.675,"z": 0},"pos3": {"x": -31.792,"y": 35.675,"z": 0},"pos4": {"x": -6,"y": 24,"z": 0}},{"pos1": {"x": -176,"y": 60,"z": 0},"pos2": {"x": -33.792,"y": 38.675,"z": 0},"pos3": {"x": -154.792,"y": 29.675,"z": 0},"pos4": {"x": -29,"y": 16,"z": 0}},{"pos1": {"x": -60,"y": 181,"z": 0},"pos2": {"x": 95.208,"y": 155.675,"z": 0},"pos3": {"x": -30.792,"y": 36.675,"z": 0},"pos4": {"x": -12,"y": 32,"z": 0}},{"pos1": {"x": -63,"y": 178,"z": 0},"pos2": {"x": -21.792,"y": 156.675,"z": 0},"pos3": {"x": -31.792,"y": 37.675,"z": 0},"pos4": {"x": -12,"y": 32,"z": 0}},{"pos1": {"x": -60,"y": 183,"z": 0},"pos2": {"x": 88.208,"y": 162.675,"z": 0},"pos3": {"x": -29.792,"y": 41.675,"z": 0},"pos4": {"x": -12,"y": 18,"z": 0}},{"pos1": {"x": -64,"y": 58,"z": 0},"pos2": {"x": -26.792,"y": 32.675,"z": 0},"pos3": {"x": -34.792,"y": 23.675,"z": 0},"pos4": {"x": -12,"y": 18,"z": 0}},{"pos1": {"x": -184,"y": 62,"z": 0},"pos2": {"x": -25.792,"y": 34.675,"z": 0},"pos3": {"x": -155.792,"y": 25.675,"z": 0},"pos4": {"x": -18,"y": 26,"z": 0}},{"pos1": {"x": -57,"y": 190,"z": 0},"pos2": {"x": 95.208,"y": 158.675,"z": 0},"pos3": {"x": -33.792,"y": 29.675,"z": 0},"pos4": {"x": -18,"y": 26,"z": 0}},{"pos1": {"x": -71,"y": 184,"z": 0},"pos2": {"x": -25.792,"y": 156.675,"z": 0},"pos3": {"x": -35.792,"y": 27.675,"z": 0},"pos4": {"x": -25,"y": 40,"z": 0}}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static setCode(code){
|
static setCode(code) {
|
||||||
this.GM_INFO.scode = code;
|
this.GM_INFO.scode = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getKey(key){
|
static getKey(key) {
|
||||||
// var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)', 'i');
|
// var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)', 'i');
|
||||||
// var r = window.location.search.substring(1).match(reg);
|
// var r = window.location.search.substring(1).match(reg);
|
||||||
// if (r != null) {
|
// if (r != null) {
|
||||||
|
@ -496,7 +498,7 @@ export class GameConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Authentication(){
|
static Authentication() {
|
||||||
cc.fx.GameTool.Authentication();
|
cc.fx.GameTool.Authentication();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,7 @@
|
||||||
import MapConroler from "../Map";
|
import MapConroler from "../Map";
|
||||||
import NumberToImage from "../NumberToImage";
|
import NumberToImage from "../NumberToImage";
|
||||||
|
|
||||||
const {ccclass, property} = cc._decorator;
|
const { ccclass, property } = cc._decorator;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,56 +16,72 @@ const {ccclass, property} = cc._decorator;
|
||||||
export default class Boom extends cc.Component {
|
export default class Boom extends cc.Component {
|
||||||
static _instance: any;
|
static _instance: any;
|
||||||
time: number = 60;
|
time: number = 60;
|
||||||
|
over: boolean = false;
|
||||||
|
|
||||||
// mapInfo: number[][] = [];
|
// mapInfo: number[][] = [];
|
||||||
|
|
||||||
onLoad () {
|
onLoad() {
|
||||||
|
this.over = false;
|
||||||
}
|
|
||||||
|
|
||||||
start () {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init(time){
|
start() {
|
||||||
if(time) this.time = time;
|
this.over = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
init(time) {
|
||||||
|
if (time) this.time = time;
|
||||||
this.node.getChildByName("time").active = true;
|
this.node.getChildByName("time").active = true;
|
||||||
NumberToImage.numberToImageNodes(this.time,20,8,"lock_",this.node.getChildByName("time"),false);
|
NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("time"), false);
|
||||||
// this.node.getChildByName("time").getComponent(cc.Label).string = this.time.toString();
|
// this.node.getChildByName("time").getComponent(cc.Label).string = this.time.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startBoom(){
|
startBoom() {
|
||||||
this.schedule(this.updateTime, 1);
|
this.schedule(this.updateTime, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
destroyBoom(){
|
destroyBoom(type) {
|
||||||
|
if (this.over) return;
|
||||||
|
this.over = true;
|
||||||
this.unschedule(this.updateTime);
|
this.unschedule(this.updateTime);
|
||||||
this.node.parent.getComponent("Block").resetFreeze();
|
this.node.parent.getComponent("Block").resetFreeze();
|
||||||
this.node.destroy();
|
this.node.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
stopBoom(){
|
stopBoom() {
|
||||||
this.unschedule(this.updateTime);
|
this.unschedule(this.updateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
updateTime(){
|
updateTime() {
|
||||||
this.time --;
|
this.time--;
|
||||||
NumberToImage.numberToImageNodes(this.time,20,8,"lock_",this.node.getChildByName("time"),false);
|
NumberToImage.numberToImageNodes(this.time, 20, 8, "lock_", this.node.getChildByName("time"), false);
|
||||||
if(this.time <= 0){
|
if (this.time <= 0) {
|
||||||
|
// 创建模拟触摸事件对象
|
||||||
|
const mockTouchEvent = {
|
||||||
|
getLocation: () => {
|
||||||
|
// 获取父节点的位置作为触摸落点
|
||||||
|
const parentPos = this.node.parent.getPosition();
|
||||||
|
return parentPos;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 触发父节点 Block 的 touchEnd 事件
|
||||||
|
this.node.parent.getComponent("Block").touchEnd(mockTouchEvent);
|
||||||
this.unschedule(this.updateTime);
|
this.unschedule(this.updateTime);
|
||||||
|
this.node.getChildByName("time").active = false;
|
||||||
MapConroler._instance.failLevel("boom");
|
MapConroler._instance.failLevel("boom");
|
||||||
this.node.getChildByName("zhandan").active = true;
|
this.node.getChildByName("zhandan").active = true;
|
||||||
this.node.getChildByName("bg").active = false;
|
this.node.getChildByName("bg").active = false;
|
||||||
const skeleton = this.node.getChildByName("zhandan").getComponent(sp.Skeleton);
|
const skeleton = this.node.getChildByName("zhandan").getComponent(sp.Skeleton);
|
||||||
skeleton.setAnimation(1,"eff",false);
|
skeleton.setAnimation(1, "eff", false);
|
||||||
// 监听动画完成事件
|
// 监听动画完成事件,销毁自身爆炸节点
|
||||||
skeleton.setCompleteListener(() => {
|
skeleton.setCompleteListener(() => {
|
||||||
// 动画播放完成后销毁节点
|
// 动画播放完成后销毁节点
|
||||||
this.node.destroy();
|
this.destroyBoom(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.node.destroy();
|
// this.node.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||||
|
|
||||||
import JiaZai from "./JiaZai";
|
import JiaZai from "./JiaZai";
|
||||||
|
import MapConroler from "./Map";
|
||||||
import SceneManager from "./SceneManager";
|
import SceneManager from "./SceneManager";
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +132,12 @@ export default class setUi extends cc.Component {
|
||||||
|
|
||||||
//退出游戏
|
//退出游戏
|
||||||
clickExit() {
|
clickExit() {
|
||||||
this.exit.active = true;
|
if(MapConroler._instance.gameStart == true) {
|
||||||
|
this.exit.active = true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
MapConroler._instance.returnHome();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//取消
|
//取消
|
||||||
cancelExit() {
|
cancelExit() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user