更新冻结门功能
This commit is contained in:
parent
0c1fa52444
commit
e264a243ca
|
@ -169,26 +169,27 @@ export default class GameManager extends cc.Component {
|
|||
startGame() {
|
||||
console.log("进入场景之前_____________", cc.fx.GameConfig.GM_INFO.first);
|
||||
console.log(cc.fx.GameConfig.GM_INFO.level);
|
||||
// 加载 music bundle
|
||||
cc.assetManager.loadBundle('music', (err, bundle) => {
|
||||
cc.assetManager.loadBundle('shop', (err, bundle) => {
|
||||
if (err) {
|
||||
console.error('加载 music bundle 失败:', err);
|
||||
// 加载失败时仍尝试进入 HomeScene
|
||||
cc.director.loadScene("HomeScene");
|
||||
console.error('加载 shop 失败:', err);
|
||||
} else {
|
||||
console.log('music bundle 加载成功');
|
||||
cc.assetManager.loadBundle('shop', (err, bundle) => {
|
||||
console.log('shop加载成功');
|
||||
// 加载成功后进入 HomeScene
|
||||
cc.assetManager.loadBundle('music', (err, bundle) => {
|
||||
if (err) {
|
||||
console.error('加载 shop 失败:', err);
|
||||
} else {
|
||||
console.log('shop加载成功');
|
||||
// 加载成功后进入 HomeScene
|
||||
console.error('加载 music bundle 失败:', err);
|
||||
// 加载失败时仍尝试进入 HomeScene
|
||||
cc.director.loadScene("HomeScene");
|
||||
} else {
|
||||
console.log('music bundle 加载成功');
|
||||
}
|
||||
cc.director.loadScene("HomeScene");
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
// 加载 music bundle
|
||||
|
||||
}
|
||||
|
||||
returnHome() {
|
||||
|
@ -431,7 +432,7 @@ export default class GameManager extends cc.Component {
|
|||
"magicAmount": cc.fx.GameConfig.GM_INFO.magicAmoun,
|
||||
"timestamp": timestamp
|
||||
}
|
||||
console.log("_______________上传道具信息:", propInfoNew);
|
||||
console.log("_______________1111上传道具信息:", propInfoNew);
|
||||
cc.fx.StorageMessage.setStorage("prop", propInfoNew);
|
||||
}
|
||||
else {
|
||||
|
@ -491,7 +492,7 @@ export default class GameManager extends cc.Component {
|
|||
}
|
||||
//旧用户,无本地缓存读取配置
|
||||
oldReadData(retryCount: number) {
|
||||
console.log("读取旧信息");
|
||||
console.log("________读取旧信息");
|
||||
const MAX_RETRIES = 15;
|
||||
const timestamp = Date.now();
|
||||
// 读取用户数据
|
||||
|
@ -502,7 +503,7 @@ export default class GameManager extends cc.Component {
|
|||
action: 'read'
|
||||
},
|
||||
success: res => {
|
||||
console.log('读取用户数据成功', res.result)
|
||||
console.log('11111111读取用户数据成功', res.result)
|
||||
if (res.result.code == 404 && res.result.message == "未找到用户数据") {
|
||||
if (res.result.openid) {
|
||||
console.log("用户从未进入过,第一次设置openid:");
|
||||
|
@ -521,11 +522,15 @@ export default class GameManager extends cc.Component {
|
|||
console.log("33333333333");
|
||||
cc.fx.StorageMessage.setStorage("coin", coinInfo);
|
||||
let propInfo = {
|
||||
"freezeAmount": 0,
|
||||
"hammerAmount": 0,
|
||||
"magicAmount": 0,
|
||||
"freezeAmount": 3,
|
||||
"hammerAmount": 3,
|
||||
"magicAmount": 3,
|
||||
"timestamp": timestamp,
|
||||
}
|
||||
console.log("最新上传道具信息——————————:", propInfo);
|
||||
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
|
||||
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
|
||||
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
|
||||
cc.fx.StorageMessage.setStorage("prop", propInfo);
|
||||
|
||||
|
||||
|
|
|
@ -700,9 +700,7 @@ export default class MapConroler extends cc.Component {
|
|||
this.createTurn(dir, block, block.getComponent("MapBlock").posX, block.getComponent("MapBlock").posY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createWall(direction, node) {
|
||||
|
@ -1208,18 +1206,21 @@ export default class MapConroler extends cc.Component {
|
|||
}
|
||||
if (wallArray[i].getComponent("Wall").special == 2 && wallArray[i].getComponent("Wall").open == false) {
|
||||
jg = false;
|
||||
break;
|
||||
return jg;
|
||||
}
|
||||
if (wallArray[i].getComponent("Wall").special == 3) {
|
||||
jg = false;
|
||||
return jg;
|
||||
}
|
||||
//console.log(wallArray[i].getChildByName("wall").getComponent("Wall").color,node.getComponent("Block").color)
|
||||
if (wallArray[i].getComponent("Wall").color != node.getComponent("Block").color) {
|
||||
|
||||
jg = false;
|
||||
break;
|
||||
return jg;
|
||||
}
|
||||
if (node.getComponent("Block").type == 5) {
|
||||
if (wallArray[i].getComponent("Wall").special != 1) {
|
||||
jg = false;
|
||||
break;
|
||||
return jg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2545,56 +2546,56 @@ export default class MapConroler extends cc.Component {
|
|||
// return;
|
||||
// }
|
||||
}
|
||||
// else if (nomalArray.length == 1) {
|
||||
// nomalArray[0].getComponent("Block").eliminate();
|
||||
// let time = 0;
|
||||
// if (nomalArray[0].getComponent("Block").type == 1 || nomalArray[0].getComponent("Block").type == 9) {
|
||||
// time = 200;
|
||||
// }
|
||||
// setTimeout(() => {
|
||||
// if (this.freezeArray.length == 0 && this.loackArray.length == 0) {
|
||||
// // console.log("只剩下一个块道具使用完毕");
|
||||
// }
|
||||
// else {
|
||||
// if (this.loackArray.length != 0) {
|
||||
// // console.log("消除一个普通块后,消除一个带锁块");
|
||||
// this.loackArray[0].getComponent("Block").eliminate();
|
||||
// return;
|
||||
// }
|
||||
// else if (this.freezeArray.length != 0) {
|
||||
// // console.log("消除一个普通块后,消除一个冻结块");
|
||||
// this.freezeArray[0].getComponent("Block").eliminate();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }, 200 + time);
|
||||
// }
|
||||
// else {
|
||||
// let count = 2;
|
||||
// if (this.loackArray.length != 0) {
|
||||
// for (let i = 0; i < this.loackArray.length; i++) {
|
||||
// // console.log("没有普通快,魔法消除一个带锁块");
|
||||
// this.loackArray[i].getComponent("Block").eliminate();
|
||||
// count -= 1;
|
||||
// if (count == 0) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
else if (nomalArray.length == 1) {
|
||||
nomalArray[0].getComponent("Block").eliminate();
|
||||
let time = 0;
|
||||
if (nomalArray[0].getComponent("Block").type == 1 || nomalArray[0].getComponent("Block").type == 9) {
|
||||
time = 200;
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (this.freezeArray.length == 0 && this.loackArray.length == 0) {
|
||||
// console.log("只剩下一个块道具使用完毕");
|
||||
}
|
||||
else {
|
||||
if (this.loackArray.length != 0) {
|
||||
// console.log("消除一个普通块后,消除一个带锁块");
|
||||
this.loackArray[0].getComponent("Block").eliminate();
|
||||
return;
|
||||
}
|
||||
else if (this.freezeArray.length != 0) {
|
||||
// console.log("消除一个普通块后,消除一个冻结块");
|
||||
this.freezeArray[0].getComponent("Block").eliminate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, 200 + time);
|
||||
}
|
||||
else {
|
||||
let count = 2;
|
||||
if (this.loackArray.length != 0) {
|
||||
for (let i = 0; i < this.loackArray.length; i++) {
|
||||
// console.log("没有普通快,魔法消除一个带锁块");
|
||||
this.loackArray[i].getComponent("Block").eliminate();
|
||||
count -= 1;
|
||||
if (count == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// setTimeout(() => {
|
||||
// if (count != 0) {
|
||||
// for (let i = 0; i < this.freezeArray.length; i++) {
|
||||
// // console.log("没有普通快,魔法消除一个冻结块");
|
||||
// // this.freezeArray[i].getComponent("Block").eliminate();
|
||||
// count -= 1;
|
||||
// if (count == 0) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }, 100);
|
||||
// }
|
||||
setTimeout(() => {
|
||||
if (count != 0) {
|
||||
for (let i = 0; i < this.freezeArray.length; i++) {
|
||||
// console.log("没有普通快,魔法消除一个冻结块");
|
||||
// this.freezeArray[i].getComponent("Block").eliminate();
|
||||
count -= 1;
|
||||
if (count == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ export default class Reward extends cc.Component {
|
|||
}
|
||||
else {
|
||||
// 游戏整体加速
|
||||
this.speedUpGame();
|
||||
// this.speedUpGame();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
|
||||
import MapConroler from "./Map";
|
||||
import NumberToImage from "./NumberToImage";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
export enum WallSpecial{
|
||||
export enum WallSpecial {
|
||||
/*普通门*/
|
||||
"普通门" = 0,
|
||||
/*星星门*/
|
||||
|
@ -20,7 +21,7 @@ export enum WallSpecial{
|
|||
"冻结门" = 3,
|
||||
}
|
||||
|
||||
export enum WallType{
|
||||
export enum WallType {
|
||||
|
||||
/*普通地块 */
|
||||
"门横向下" = 0,
|
||||
|
@ -40,7 +41,7 @@ export enum WallType{
|
|||
"墙竖向左" = 7,
|
||||
}
|
||||
|
||||
export enum WallColor{
|
||||
export enum WallColor {
|
||||
/*普通地块 */
|
||||
"紫色" = 0,
|
||||
/*湿地 */
|
||||
|
@ -93,6 +94,9 @@ export default class Wall extends cc.Component {
|
|||
@property(cc.SpriteAtlas)
|
||||
down_SpriteFrames: cc.SpriteAtlas = null;
|
||||
|
||||
@property(cc.Prefab)
|
||||
freezeSpine: cc.Prefab = null;
|
||||
|
||||
|
||||
posX: number;
|
||||
posY: number;
|
||||
|
@ -100,14 +104,15 @@ export default class Wall extends cc.Component {
|
|||
wall_Info: any;
|
||||
openNode: cc.Node;
|
||||
freezeNode: cc.Node;
|
||||
open:boolean;
|
||||
open: boolean;
|
||||
freezeNumber: number;
|
||||
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
start() {
|
||||
// console.log(this.type);
|
||||
}
|
||||
|
||||
|
@ -115,44 +120,44 @@ export default class Wall extends cc.Component {
|
|||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
|
||||
init(wall_Info, posX: number, posY: number, direction: any){
|
||||
init(wall_Info, posX: number, posY: number, direction: any) {
|
||||
|
||||
this.wall_Info = this.jsonDeepClone(wall_Info);
|
||||
// this.open = true;
|
||||
if(wall_Info == null){
|
||||
if (wall_Info == null) {
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
|
||||
if(direction)this.direction = direction;
|
||||
if (direction) this.direction = direction;
|
||||
// console.log("门方向赋值",direction);
|
||||
if(direction == "up" ){
|
||||
this.node.parent.zIndex = 100 + this.posX - this.posY*3;
|
||||
if (direction == "up") {
|
||||
this.node.parent.zIndex = 100 + this.posX - this.posY * 3;
|
||||
}
|
||||
else if( direction == "down" || direction == "right" ||
|
||||
else if (direction == "down" || direction == "right" ||
|
||||
direction == "rightdown" || direction == "downright"
|
||||
|| direction == "rightup" || direction == "upright"){
|
||||
this.node.parent.zIndex = 30 + this.posX - this.posY*3;
|
||||
}
|
||||
else if( direction == "left"|| direction == "leftdown" || direction == "downleft"){
|
||||
this.node.parent.zIndex = 70 + this.posX - this.posY*3;
|
||||
|| direction == "rightup" || direction == "upright") {
|
||||
this.node.parent.zIndex = 30 + this.posX - this.posY * 3;
|
||||
}
|
||||
else this.node.parent.zIndex = 70 + this.posX - this.posY*3;
|
||||
else if (direction == "left" || direction == "leftdown" || direction == "downleft") {
|
||||
this.node.parent.zIndex = 70 + this.posX - this.posY * 3;
|
||||
}
|
||||
else this.node.parent.zIndex = 70 + this.posX - this.posY * 3;
|
||||
|
||||
MapConroler._instance.mapBlocksWall[this.posX][this.posY].getComponent("MapBlock").block_Id = "Wall";
|
||||
//console.log(this.posX,this.posY,MapConroler._instance.mapBlocksWall[this.posX][this.posY].getComponent("MapBlock").block_Id);
|
||||
// console.log(this.posX,this.posY,this.node.zIndex);
|
||||
//this.node.getChildByName("num").getComponent(cc.Label).string = direction;
|
||||
//this.node.getChildByName("num").getComponent(cc.Label).string = ":" + this.node.parent.zIndex;
|
||||
//this.node.getChildByName("num").getComponent(cc.Label).string = ":" + this.node.parent.zIndex;
|
||||
}
|
||||
if(wall_Info != null){
|
||||
if (wall_Info != null) {
|
||||
this.color = wall_Info.color;
|
||||
this.special = wall_Info.special;
|
||||
this.initType();
|
||||
if(wall_Info.length > 0){
|
||||
if (wall_Info.length > 0) {
|
||||
this.initColor(wall_Info.length);
|
||||
}
|
||||
else this.node.removeComponent("cc.Sprite");
|
||||
if(this.posX != null){
|
||||
if (this.posX != null) {
|
||||
MapConroler._instance.mapBlocksWall[this.posX][this.posY].getComponent("MapBlock").block_Id = "Wall";
|
||||
//console.log(this.posX,this.posY,MapConroler._instance.mapBlocksWall[this.posX][this.posY].getComponent("MapBlock").block_Id);
|
||||
}
|
||||
|
@ -164,21 +169,21 @@ export default class Wall extends cc.Component {
|
|||
}
|
||||
|
||||
//创建门的颜色
|
||||
initColor(length: number){
|
||||
initColor(length: number) {
|
||||
let direction = this.node.parent.name;
|
||||
let double = 0;
|
||||
if(direction == "left" || direction == "right"){
|
||||
if (direction == "left" || direction == "right") {
|
||||
double = 3;
|
||||
}
|
||||
|
||||
// debugger;
|
||||
if(this.wall_SpriteFrames){
|
||||
let name = this.color+"color" + (length+double);
|
||||
if (this.wall_SpriteFrames) {
|
||||
let name = this.color + "color" + (length + double);
|
||||
var spriteFrame = this.wall_SpriteFrames._spriteFrames[name];
|
||||
this.node.getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
||||
}
|
||||
if(this.down_SpriteFrames){
|
||||
let name2 = this.color + "down" + (length+double);
|
||||
if (this.down_SpriteFrames) {
|
||||
let name2 = this.color + "down" + (length + double);
|
||||
var downFrame = this.down_SpriteFrames._spriteFrames[name2];
|
||||
this.node.parent.getChildByName("down").getComponent(cc.Sprite).spriteFrame = downFrame;
|
||||
}
|
||||
|
@ -187,33 +192,33 @@ export default class Wall extends cc.Component {
|
|||
}
|
||||
|
||||
//创建特殊类型门
|
||||
initType(){
|
||||
switch(this.special){
|
||||
initType() {
|
||||
switch (this.special) {
|
||||
case WallSpecial.星星门:
|
||||
let star = cc.instantiate(MapConroler._instance.Block_Prop[this.special]);
|
||||
star.parent = this.node.parent;
|
||||
// console.log("门的方向",this.direction,"长度",this.wall_Info.length);
|
||||
// star.scaleX = star.scaleY = 0.5;
|
||||
if(this.wall_Info.length > 0){
|
||||
if(this.direction == "right" || this.direction == "left"){
|
||||
if (this.wall_Info.length > 0) {
|
||||
if (this.direction == "right" || this.direction == "left") {
|
||||
star.children[this.wall_Info.length + 2].active = true;
|
||||
}
|
||||
else if(this.direction == "up" || this.direction == "down"){
|
||||
else if (this.direction == "up" || this.direction == "down") {
|
||||
star.children[this.wall_Info.length - 1].active = true;
|
||||
}
|
||||
}
|
||||
star.setPosition(this.node.width/2+this.node.x,this.node.height/2+this.node.y);
|
||||
star.setPosition(this.node.width / 2 + this.node.x, this.node.height / 2 + this.node.y);
|
||||
break;
|
||||
case WallSpecial.开关门:
|
||||
let name = "open" + this.wall_Info.length;
|
||||
this.openNode = this.node.parent.getChildByName("open").getChildByName(name);
|
||||
this.openNode.active = true;
|
||||
if(this.wall_Info.lock == false){
|
||||
if (this.wall_Info.lock == false) {
|
||||
this.open = true;
|
||||
this.openNode.children[0].scaleX *= 0.01;
|
||||
this.openNode.children[1].scaleX *= 0.01;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.open = false;
|
||||
}
|
||||
break;
|
||||
|
@ -221,23 +226,25 @@ export default class Wall extends cc.Component {
|
|||
let freeze = "freeze" + this.wall_Info.length;
|
||||
this.freezeNode = this.node.parent.getChildByName("freeze").getChildByName(freeze);
|
||||
this.freezeNode.active = true;
|
||||
if(this.wall_Info.freeze){
|
||||
this.freezeNode.getChildByName("num").getComponent(cc.Label).string = this.wall_Info.freeze+"";
|
||||
|
||||
if (this.wall_Info.freeze) {
|
||||
this.freezeNumber = this.wall_Info.freeze;
|
||||
NumberToImage.numberToImageNodes(this.freezeNumber, 20, 8, "lock_", this.freezeNode.getChildByName("num"), false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//播放星星门通过
|
||||
playStarDoor(){
|
||||
if(this.node.parent.getChildByName("star")){
|
||||
playStarDoor() {
|
||||
if (this.node.parent.getChildByName("star")) {
|
||||
let star = this.node.parent.getChildByName("star");
|
||||
for(let i=0; i<star.children.length; i++){
|
||||
if(star.children[i].active == true){
|
||||
for (let i = 0; i < star.children.length; i++) {
|
||||
if (star.children[i].active == true) {
|
||||
let starChild = star.children[i];
|
||||
for(let j=0; j<starChild.children.length; j++){
|
||||
for (let j = 0; j < starChild.children.length; j++) {
|
||||
starChild.children[j].active = true
|
||||
starChild.children[j].getComponent(sp.Skeleton).setAnimation(1,"taopao1",false);
|
||||
starChild.children[j].getComponent(sp.Skeleton).setAnimation(1, "taopao1", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,67 +253,85 @@ export default class Wall extends cc.Component {
|
|||
|
||||
|
||||
//改变开关门状态
|
||||
changeLock(){
|
||||
changeLock() {
|
||||
this.open = !this.open;
|
||||
console.log("开关门状态改变",this.open);
|
||||
if(!this.openNode.active){
|
||||
console.log("开关门状态改变", this.open);
|
||||
if (!this.openNode.active) {
|
||||
this.openNode.active = true;
|
||||
}
|
||||
|
||||
|
||||
let fill = this.openNode.children[0].scaleX==1 ? 0.01:1;
|
||||
if(this.openNode.children[0].scaleX < 0) fill = -fill;
|
||||
let fill = this.openNode.children[0].scaleX == 1 ? 0.01 : 1;
|
||||
if (this.openNode.children[0].scaleX < 0) fill = -fill;
|
||||
// console.log("目标",fill);
|
||||
|
||||
cc.tween(this.openNode.children[0])
|
||||
.to(0.3, {scaleX: this.openNode.children[0].scaleX < 0?-fill:fill})
|
||||
.call(()=>{
|
||||
// console.log("左边完成");
|
||||
})
|
||||
.start();
|
||||
.to(0.3, { scaleX: this.openNode.children[0].scaleX < 0 ? -fill : fill })
|
||||
.call(() => {
|
||||
// console.log("左边完成");
|
||||
})
|
||||
.start();
|
||||
|
||||
cc.tween(this.openNode.children[1])
|
||||
.to(0.3, {scaleX: this.openNode.children[1].scaleX < 0?-fill:fill})
|
||||
.call(()=>{
|
||||
// console.log("右边完成");
|
||||
})
|
||||
.start();
|
||||
.to(0.3, { scaleX: this.openNode.children[1].scaleX < 0 ? -fill : fill })
|
||||
.call(() => {
|
||||
// console.log("右边完成");
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
changeFreeze(){
|
||||
let numStr = this.freezeNode.getChildByName("num").getComponent(cc.Label);
|
||||
let num = parseInt(numStr.string);
|
||||
num -= 1;
|
||||
this.freezeNode.getChildByName("num").getComponent(cc.Label).string = num+"";
|
||||
if(num == 0){
|
||||
this.freezeNode.parent.active = false;
|
||||
changeFreeze() {
|
||||
this.freezeNumber -= 1;
|
||||
|
||||
if (this.freezeNumber == 0) {
|
||||
console.log(this.node.uuid);
|
||||
// this.freezeNode.parent.active = false;
|
||||
this.resetFreeze();
|
||||
}
|
||||
else {
|
||||
NumberToImage.numberToImageNodes(this.freezeNumber, 20, 8, "lock_", this.freezeNode.getChildByName("num"), false);
|
||||
}
|
||||
}
|
||||
|
||||
downDoor(){
|
||||
if(this.openNode){
|
||||
if(this.openNode.children[0].scaleX == 1)
|
||||
downDoor() {
|
||||
if (this.openNode) {
|
||||
if (this.openNode.children[0].scaleX == 1)
|
||||
return;
|
||||
}
|
||||
if(this.freezeNode){
|
||||
if(this.freezeNode.active == true)
|
||||
if (this.freezeNode) {
|
||||
if (this.freezeNode.active == true)
|
||||
return;
|
||||
}
|
||||
|
||||
this.node.opacity = 0;
|
||||
if(this.special == WallSpecial.星星门){
|
||||
if (this.special == WallSpecial.星星门) {
|
||||
this.node.parent.getChildByName("star").y -= 10;
|
||||
}
|
||||
this.node.parent.getChildByName("down").active = true;
|
||||
}
|
||||
|
||||
upDoor(){
|
||||
if(this.special == WallSpecial.星星门){
|
||||
upDoor() {
|
||||
if (this.special == WallSpecial.星星门) {
|
||||
this.node.parent.getChildByName("star").y += 10;
|
||||
}
|
||||
this.node.parent.getChildByName("down").active = false;
|
||||
this.node.opacity = 250;
|
||||
}
|
||||
|
||||
resetFreeze() {
|
||||
this.special = 0;
|
||||
if (this.freezeNode) {
|
||||
this.freezeNode.active = false;
|
||||
}
|
||||
// if (this.wall_Info.length != 0) {
|
||||
// let spine = cc.instantiate(this.freezeSpine);
|
||||
// spine.parent = this.node.parent;
|
||||
// spine.setPosition(this.node.width / 2 + this.node.x + 60 / 2 * (this.wall_Info.length - 1), this.node.height / 2 + this.node.y);
|
||||
// spine.getComponent(sp.Skeleton).setAnimation(1, "bingkuai", false);
|
||||
// console.log("添加一个动画", spine.getPosition());
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
}
|
||||
|
|
|
@ -572,8 +572,9 @@ export default class Utils {
|
|||
let setData = {
|
||||
uid: cc.fx.GameConfig.GM_INFO.uid,
|
||||
action: 'save',
|
||||
coinAmount: parseInt(cc.fx.GameConfig.GM_INFO.coin)
|
||||
coinAmount: Math.floor(cc.fx.GameConfig.GM_INFO.coin)
|
||||
}
|
||||
console.log("服务器:上传金币", Math.floor(cc.fx.GameConfig.GM_INFO.coin));
|
||||
Utils.POST("userCoin", setData, res => {
|
||||
console.log("获得userCoin数据:", res);
|
||||
if (res.code === 1) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import MapConroler from "../Map";
|
||||
import NumberToImage from "../NumberToImage";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
|
||||
|
||||
|
@ -20,38 +20,41 @@ export default class Freeze extends cc.Component {
|
|||
@property(cc.Material)
|
||||
freeze: cc.Material = null;
|
||||
|
||||
@property(cc.Prefab)
|
||||
ice: cc.Prefab = null;
|
||||
|
||||
// mapInfo: number[][] = [];
|
||||
|
||||
onLoad () {
|
||||
onLoad() {
|
||||
|
||||
}
|
||||
|
||||
start () {
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
init(time,type){
|
||||
if(time) this.time = time;
|
||||
init(time, type) {
|
||||
if (time) this.time = time;
|
||||
this.node.getChildByName("time").active = true;
|
||||
NumberToImage.numberToImageNodes(this.time,40,25,"ice_",this.node.getChildByName("time"),false);
|
||||
NumberToImage.numberToImageNodes(this.time, 40, 25, "ice_", this.node.getChildByName("time"), false);
|
||||
// this.node.getChildByName("time").getComponent(cc.Label).string = this.time.toString();
|
||||
|
||||
}
|
||||
|
||||
reduce(number){
|
||||
reduce(number) {
|
||||
this.time -= number;
|
||||
if(this.time <= 0) this.time = 0
|
||||
NumberToImage.numberToImageNodes(this.time,40,25,"ice_",this.node.getChildByName("time"),false);
|
||||
if (this.time <= 0) this.time = 0
|
||||
NumberToImage.numberToImageNodes(this.time, 40, 25, "ice_", this.node.getChildByName("time"), false);
|
||||
// this.node.getChildByName("time").getComponent(cc.Label).string = this.time.toString();
|
||||
if(this.time <= 0){
|
||||
if (this.time <= 0) {
|
||||
this.node.getChildByName("bingkuai").active = true;
|
||||
const skeleton = this.node.getChildByName("bingkuai").getComponent(sp.Skeleton);
|
||||
skeleton.setAnimation(1,"bingkuai",false);
|
||||
skeleton.setAnimation(1, "bingkuai", false);
|
||||
this.node.getChildByName("icon").active = true;
|
||||
this.node.getChildByName("time").active = false;
|
||||
cc.tween(this.node.getChildByName("icon"))
|
||||
.to(0.5, { opacity: 0 })
|
||||
.start();
|
||||
.to(0.5, { opacity: 0 })
|
||||
.start();
|
||||
|
||||
// this.node.getChildByName("icon").getComponent(cc.Sprite).setMaterial(0,this.freeze);
|
||||
// this.node.children.forEach(element => {
|
||||
|
|
129
assets/prefab/prop/bingkuai.prefab
Normal file
129
assets/prefab/prop/bingkuai.prefab
Normal file
|
@ -0,0 +1,129 @@
|
|||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "bingkuai",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 2
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "sp.Skeleton",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
|
||||
}
|
||||
],
|
||||
"paused": false,
|
||||
"defaultSkin": "default",
|
||||
"defaultAnimation": "",
|
||||
"_preCacheMode": 0,
|
||||
"_cacheMode": 0,
|
||||
"loop": false,
|
||||
"premultipliedAlpha": false,
|
||||
"timeScale": 1,
|
||||
"_accTime": 0,
|
||||
"_playCount": 0,
|
||||
"_frameCache": null,
|
||||
"_curFrame": null,
|
||||
"_skeletonCache": null,
|
||||
"_animationName": "",
|
||||
"_animationQueue": [],
|
||||
"_headAniInfo": null,
|
||||
"_playTimes": 0,
|
||||
"_isAniComplete": true,
|
||||
"_N$skeletonData": {
|
||||
"__uuid__": "b98ab73e-af9c-47fa-862c-144da3071249"
|
||||
},
|
||||
"_N$_defaultCacheMode": 0,
|
||||
"_N$debugSlots": false,
|
||||
"_N$debugBones": false,
|
||||
"_N$debugMesh": false,
|
||||
"_N$useTint": false,
|
||||
"_N$enableBatch": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
9
assets/prefab/prop/bingkuai.prefab.meta
Normal file
9
assets/prefab/prop/bingkuai.prefab.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "f8f19cf0-280d-4872-a743-a54314eec6a8",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
|
@ -39,19 +39,12 @@
|
|||
],
|
||||
"WALL_INFO": [
|
||||
[
|
||||
{
|
||||
"id": 0,
|
||||
"num": 8,
|
||||
"color": 10,
|
||||
"special": 0,
|
||||
"length": 3
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"num": 10,
|
||||
"color": 10,
|
||||
"special": 0,
|
||||
"length": 0
|
||||
"length": 2
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user