Compare commits
No commits in common. "b617219f5bdb8d4ce334dc6c55d20be758d11e5e" and "de5ff73df7ca7deb829905f00f3c127b28f33545" have entirely different histories.
b617219f5b
...
de5ff73df7
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;
|
||||
}
|
||||
else if(this.type == BlockType.炸弹块){
|
||||
this.node.getChildByName("boom").getComponent("Boom").destroyBoom(false);
|
||||
this.node.getChildByName("boom").getComponent("Boom").destroyBoom();
|
||||
}
|
||||
|
||||
|
||||
|
@ -589,7 +589,7 @@ export default class Block extends cc.Component {
|
|||
}
|
||||
}
|
||||
|
||||
MapConroler._instance.judgeWin(0);
|
||||
MapConroler._instance.judgeWin();
|
||||
|
||||
setTimeout(() => {
|
||||
let tempColor = this.color;
|
||||
|
@ -763,7 +763,7 @@ export default class Block extends cc.Component {
|
|||
var self = this;
|
||||
this.removeMapBlock();
|
||||
|
||||
MapConroler._instance.judgeWin(1);
|
||||
MapConroler._instance.judgeWin();
|
||||
setTimeout(() => {
|
||||
let pos = this.node.getPosition();
|
||||
if(self.type == BlockType.叠加块下){
|
||||
|
@ -779,7 +779,7 @@ export default class Block extends cc.Component {
|
|||
self.block_Info.node.getComponent("Block").posY,false);
|
||||
}
|
||||
else if(self.type == BlockType.炸弹块){
|
||||
this.node.getChildByName("boom").getComponent("Boom").destroyBoom(false);
|
||||
this.node.getChildByName("boom").getComponent("Boom").destroyBoom();
|
||||
}
|
||||
|
||||
MapConroler._instance.nextLevel();
|
||||
|
@ -1319,12 +1319,14 @@ export default class Block extends cc.Component {
|
|||
this.touchDelta = cc.v2(0, 0);
|
||||
|
||||
}
|
||||
if(this.type == BlockType.叠加块下){
|
||||
if(this.block_Info.node!= null){
|
||||
if(this.block_Info.node.getComponent("Block").moveStack == true){
|
||||
this.block_Info.node.x = this.node.x + this.block_Info.node.getComponent("Block").stacking.x;
|
||||
this.block_Info.node.y = this.node.y + this.block_Info.node.getComponent("Block").stacking.y;
|
||||
}
|
||||
if(this.type == BlockType.叠加块上 && this.moveStack == true){
|
||||
if((this.stacking.x != 0 || this.stacking.y!= 0) && this.block_Info.node!= null){
|
||||
this.isTouch = false;
|
||||
// this.node.x = this.block_Info.node.x + this.stacking.x;
|
||||
// this.node.y = this.block_Info.node.y + this.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){
|
||||
|
|
|
@ -259,7 +259,7 @@ export default class GameManager extends cc.Component {
|
|||
|
||||
//新用户,有本地缓存读取配置
|
||||
newReadData() {
|
||||
console.log("读取新信息2");
|
||||
console.log("读取新信息");
|
||||
let openid = cc.fx.StorageMessage.getStorage("openid");
|
||||
if (openid == null || openid == "" || openid == undefined) {
|
||||
console.log("没有openid");
|
||||
|
@ -270,7 +270,7 @@ export default class GameManager extends cc.Component {
|
|||
action: 'read'
|
||||
},
|
||||
success: res => {
|
||||
console.log('读取用户数据成功_____________________', res.result)
|
||||
console.log('读取用户数据成功', res.result)
|
||||
if (res.result.code == 404 && res.result.message == "未找到用户数据") {
|
||||
}
|
||||
else if (res.result.code == 200) {
|
||||
|
@ -687,7 +687,7 @@ export default class GameManager extends cc.Component {
|
|||
MiniGameSdk.API.shushu_Login();
|
||||
MiniGameSdk.API.yinli_Init();
|
||||
MiniGameSdk.API.yinli_Login();
|
||||
const group = cc.fx.GameTool.setWechatGameGroup(2);
|
||||
cc.fx.GameTool.setWechatGameGroup(2);
|
||||
this.startGame();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,6 @@ export default class MapConroler extends cc.Component {
|
|||
onLoad() {
|
||||
|
||||
cc.fx.GameConfig.GM_INFO.review = 0;
|
||||
cc.fx.GameConfig.GM_INFO.reviewBoom = 0;
|
||||
cc.fx.GameConfig.GM_INFO.gameState = true;
|
||||
this.mask.opacity = 0;
|
||||
this.node.getChildByName("Adhesive").zIndex = 500;
|
||||
|
@ -1334,22 +1333,13 @@ export default class MapConroler extends cc.Component {
|
|||
|
||||
}
|
||||
|
||||
judgeWin(number) {
|
||||
judgeWin(){
|
||||
this.blockNum = this.blocks.length;
|
||||
if (number == 1) {
|
||||
if((this.blockNum == 0 || this.blockNum == 1) &&!this.gameWin &&!this.gameOver){
|
||||
this.stopTimeCutDown();
|
||||
this.stopBoom();
|
||||
}
|
||||
}
|
||||
else if (number == 0) {
|
||||
if (this.blockNum == 0 && !this.gameWin && !this.gameOver) {
|
||||
this.stopTimeCutDown();
|
||||
this.stopBoom();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//判断游戏成功下一关
|
||||
nextLevel() {
|
||||
|
@ -1391,7 +1381,7 @@ export default class MapConroler extends cc.Component {
|
|||
}
|
||||
else {
|
||||
if (this.gameOver == true) {
|
||||
this.failLevel("time");
|
||||
this.failLevel(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1466,28 +1456,15 @@ export default class MapConroler extends cc.Component {
|
|||
// this.node.parent.parent.parent.destroy();
|
||||
}
|
||||
|
||||
//时间到了复活
|
||||
reviewLevel(event, type) {
|
||||
reviewLevel() {
|
||||
if(this.reviewState == true){
|
||||
return;
|
||||
}
|
||||
this.reviewState = true;
|
||||
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
||||
|
||||
let coin = 900;
|
||||
let data = {
|
||||
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);
|
||||
if (cc.fx.GameConfig.GM_INFO.coin < Math.abs(coin)) {
|
||||
MiniGameSdk.API.showToast("金币不足,无法加时间");
|
||||
|
@ -1499,33 +1476,23 @@ export default class MapConroler extends cc.Component {
|
|||
return;
|
||||
}
|
||||
else {
|
||||
this.runRewive(data);
|
||||
this.runRewive(-coin);
|
||||
}
|
||||
}
|
||||
|
||||
//执行复活函数
|
||||
runRewive(data) {
|
||||
console.log("复活回调函数内", data);
|
||||
cc.fx.GameTool.changeCoin(data.coin);
|
||||
cc.fx.GameTool.changeCoin(data);
|
||||
MiniGameSdk.API.showToast("继续游戏");
|
||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||
if (data.type == "time") {
|
||||
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.gameWin = false;
|
||||
this.pause = false;
|
||||
if (data.type == "time") {
|
||||
this.timeNumber = 21;
|
||||
this.add_Time += 20;
|
||||
}
|
||||
this.pause = false;
|
||||
|
||||
this.blockNum = this.blocks.length;
|
||||
if (this.blockNum == 0 )this.nextLevel();
|
||||
|
@ -1609,22 +1576,15 @@ export default class MapConroler extends cc.Component {
|
|||
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("Boom").active = false;
|
||||
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) {
|
||||
if (type == "boom") {
|
||||
this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = false;
|
||||
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);
|
||||
|
@ -1800,7 +1760,7 @@ export default class MapConroler extends cc.Component {
|
|||
this.setPropNum();
|
||||
// this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString();
|
||||
MiniGameSdk.API.showToast("购买冻结时间成功");
|
||||
}, 200);
|
||||
}, 2000);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1815,7 +1775,7 @@ export default class MapConroler extends cc.Component {
|
|||
MiniGameSdk.API.showToast("购买魔法棒成功");
|
||||
this.setPropNum();
|
||||
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
|
||||
}, 200);
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
else if (data == "hammerAmount") {
|
||||
|
@ -1829,7 +1789,7 @@ export default class MapConroler extends cc.Component {
|
|||
this.setPropNum();
|
||||
// this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString();
|
||||
MiniGameSdk.API.showToast("购买锤子成功");
|
||||
}, 200);
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1847,6 +1807,15 @@ export default class MapConroler extends cc.Component {
|
|||
if (hammerBtn.getComponent("btnControl")._touch) {
|
||||
hammerBtn.getComponent("btnControl").setTouch(false);
|
||||
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.parent.getComponent("SceneManager").openPropBuy("hammer");
|
||||
}
|
||||
|
|
|
@ -1170,14 +1170,6 @@ 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 });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 数数平台设置动态公共属性
|
||||
*/
|
||||
|
@ -1201,7 +1193,6 @@ export namespace MiniGameSdk {
|
|||
};
|
||||
}
|
||||
API._ta.setSuperProperties(superProperties);//设置公共事件属性
|
||||
API.updateCoinAndLevel();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,6 @@ export class GameConfig {
|
|||
mean_Time: number; //平均放箭速度
|
||||
hp: number; //体力值
|
||||
review: number; //复活次数
|
||||
reviewBoom: number; //炸弹复活次数
|
||||
reviewDoor: number; //门复活次数
|
||||
currSeed: number; //用于随机数种子
|
||||
openid: string; //微信用户唯一id
|
||||
gameId: string; //游戏ID
|
||||
|
@ -94,15 +92,17 @@ export class GameConfig {
|
|||
coinnum: number; //每局的金币数
|
||||
paid_user: boolean; //是否是付费用户
|
||||
version: number; //版本号
|
||||
shushu_DistinctId: string; //数数访客ID
|
||||
shushu_AccountId: string; //数数账号ID
|
||||
shushu_DistinctId: string //数数访客ID
|
||||
shushu_AccountId: string //数数账号ID
|
||||
};
|
||||
|
||||
|
||||
//游戏内信息
|
||||
|
||||
static get Instance() {
|
||||
if (this._instance == null) {
|
||||
static get Instance()
|
||||
{
|
||||
if (this._instance == null)
|
||||
{
|
||||
this._instance = new GameConfig();
|
||||
}
|
||||
return this._instance;
|
||||
|
@ -197,8 +197,6 @@ export class GameConfig {
|
|||
mean_Time: 0, //平均放箭速度
|
||||
hp: 5, //体力值
|
||||
review:0, //复活次数
|
||||
reviewBoom: 0, //炸弹复活次数
|
||||
reviewDoor: 0, //门复活次数
|
||||
currSeed: 200000, //用于随机数种子
|
||||
openid:"", //微信用户唯一id
|
||||
gameId: "100001", //游戏ID
|
||||
|
|
|
@ -1034,10 +1034,9 @@ var GameTool = {
|
|||
}
|
||||
console.log("type____________________:",type);
|
||||
console.log("分组编号____________________:",groupNumber);
|
||||
return groupNumber;
|
||||
|
||||
}
|
||||
}
|
||||
else return 1;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -16,16 +16,14 @@ const { ccclass, property } = cc._decorator;
|
|||
export default class Boom extends cc.Component {
|
||||
static _instance: any;
|
||||
time: number = 60;
|
||||
over: boolean = false;
|
||||
|
||||
// mapInfo: number[][] = [];
|
||||
|
||||
onLoad () {
|
||||
this.over = false;
|
||||
|
||||
}
|
||||
|
||||
start () {
|
||||
this.over = false;
|
||||
}
|
||||
|
||||
init(time){
|
||||
|
@ -40,9 +38,7 @@ export default class Boom extends cc.Component {
|
|||
this.schedule(this.updateTime, 1);
|
||||
}
|
||||
|
||||
destroyBoom(type) {
|
||||
if (this.over) return;
|
||||
this.over = true;
|
||||
destroyBoom(){
|
||||
this.unschedule(this.updateTime);
|
||||
this.node.parent.getComponent("Block").resetFreeze();
|
||||
this.node.destroy();
|
||||
|
@ -58,28 +54,16 @@ export default class Boom extends cc.Component {
|
|||
this.time --;
|
||||
NumberToImage.numberToImageNodes(this.time,20,8,"lock_",this.node.getChildByName("time"),false);
|
||||
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.node.getChildByName("time").active = false;
|
||||
MapConroler._instance.failLevel("boom");
|
||||
this.node.getChildByName("zhandan").active = true;
|
||||
this.node.getChildByName("bg").active = false;
|
||||
const skeleton = this.node.getChildByName("zhandan").getComponent(sp.Skeleton);
|
||||
skeleton.setAnimation(1,"eff",false);
|
||||
// 监听动画完成事件,销毁自身爆炸节点
|
||||
// 监听动画完成事件
|
||||
skeleton.setCompleteListener(() => {
|
||||
// 动画播放完成后销毁节点
|
||||
this.destroyBoom(true);
|
||||
this.node.destroy();
|
||||
});
|
||||
|
||||
// this.node.destroy();
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
|
||||
import JiaZai from "./JiaZai";
|
||||
import MapConroler from "./Map";
|
||||
import SceneManager from "./SceneManager";
|
||||
|
||||
|
||||
|
@ -132,13 +131,8 @@ export default class setUi extends cc.Component {
|
|||
|
||||
//退出游戏
|
||||
clickExit() {
|
||||
if(MapConroler._instance.gameStart == true) {
|
||||
this.exit.active = true;
|
||||
}
|
||||
else{
|
||||
MapConroler._instance.returnHome();
|
||||
}
|
||||
}
|
||||
//取消
|
||||
cancelExit() {
|
||||
this.exit.active = false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user