Shenlong/library/imports/72/722a6df3-941d-4d60-834d-9bd...

725 lines
29 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
cc._RF.push(module, '722a63zlB1NYINNm9HMiXap', 'Game');
// scripts/Game.ts
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
// @ccclass
// export class FruitItem extends cc.Component{
// @property(cc.Integer)
// id = 0;
// @property(cc.SpriteFrame)
// iconSF: cc.SpriteFrame = null;
// }
var nwId = 1;
var nxtId = 1;
var upId = 1;
var storeId = 0;
var FruitItem = cc.Class({
name: 'FruitItem',
properties: {
id: 0,
iconSF: cc.SpriteFrame,
},
});
var JuiceItem = cc.Class({
name: 'JuiceItem',
properties: {
id: 0,
particle: cc.SpriteFrame,
circle: cc.SpriteFrame,
slash: cc.SpriteFrame,
},
});
var Game = /** @class */ (function (_super) {
__extends(Game, _super);
function Game() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.fruitContainer = null;
_this.canvas = null;
_this.successPop = null;
_this.failPop = null;
_this.line = null;
_this.fruitPrefab = null;
_this.juicePrefab = null;
_this.nextSprite = null;
_this.boomAudio = null;
_this.knockAudio = null;
_this.waterAudio = null;
_this.gameOverAudio = null;
_this.gameAudio = null;
_this.scoreLabel = null;
_this.comboLabel = null;
_this.smokePrefab = null;
_this.fruits = [];
_this.juices = [];
_this.storageButton = null;
_this.takeOutButton = null;
_this.magicButton = null;
_this.banButton1 = null;
_this.banButton2 = null;
_this.nextFruit = null;
_this.score = 0;
_this.isAnimtionPlaying = false;
_this.isCreating = false;
_this.combo = 0;
_this.lineBlink = false;
_this.showOver = false;
_this.nodenumber = 1;
_this.lastNextFruitPreviewNode = null;
_this.storageContainer = null; // 储存容器节点
_this.storedFruit = null; // 已储存的水果节点
return _this;
}
Game.prototype.createOneFruit = function (num) {
var _this = this;
this.nodenumber++;
var fruit = cc.instantiate(this.fruitPrefab);
// 获取到配置信息
var config = this.fruits[num];
// 触线检测状态
fruit['isCreate'] = false;
// 获取到节点的Fruit组件并调用实例方法
fruit.getComponent('Fruit').init({
id: config.id,
iconSF: config.iconSF,
});
fruit.getComponent(cc.RigidBody).type = cc.RigidBodyType.Dynamic;
var rigidBody = fruit.getComponent(cc.RigidBody);
rigidBody.type = cc.RigidBodyType.Dynamic;
var physicsCircleCollider = fruit.getComponent(cc.PhysicsCircleCollider);
physicsCircleCollider.radius = fruit.height / 2;
physicsCircleCollider.apply();
physicsCircleCollider.restitution = 0.2;
physicsCircleCollider.friction = 0.1;
fruit.on('sameContact', function (_a) {
var self = _a.self, other = _a.other;
other.node.off('sameContact');
_this.onSameFruitContact({ self: self, other: other });
});
return fruit;
};
Game.prototype.showCombo = function () {
var _this = this;
this.combo++;
// console.log(this.combo);
if (this.combo < 2)
return;
this.comboLabel.node.opacity = 255;
this.comboLabel.node.scale = 0;
this.comboLabel.string = 'X' + this.combo.toString();
cc.tween(this.comboLabel.node)
.to(0.2, {
scale: 1.5,
})
.start();
// this.scheduleOnce(()=>{
cc.tween(this.comboLabel.node)
.to(3, {
opacity: 0,
})
.call(function () {
_this.combo = 0;
})
.start();
// },1.5)
};
Game.prototype.onSameFruitContact = function (_a) {
var self = _a.self, other = _a.other;
other.node.off('sameContact');
self.node.removeFromParent(false);
other.node.removeFromParent(false);
// 获取下面的node
var tempNode = self.node.y < other.node.y ? self.node : other.node;
var x = tempNode.x, y = tempNode.y; // 获取合并的水果位置
var id = other.getComponent('Fruit').id;
if (id == 13) {
id = self.getComponent('Fruit').id;
}
this.showCombo();
// self.node.destroy();
// other.node.destroy();
// 爆炸特效
this.createFruitJuice(id - 1, cc.v2({ x: x, y: y }), tempNode.width);
this.addScore(id);
// 生成下一级水果
var nextId = id;
var newFruit = this.createOneFruit(nextId);
newFruit.setPosition(cc.v2(x, y));
newFruit.getComponent(cc.RigidBody).enabledContactListener = false;
this.scheduleOnce(function () {
newFruit.getComponent(cc.RigidBody).enabledContactListener = true;
}, 0.5);
this.scheduleOnce(function () {
newFruit['isCreate'] = true;
}, 1);
this.fruitContainer.addChild(newFruit);
if (nextId < 11) {
newFruit.scale = 0;
cc.tween(newFruit)
.to(0.5, {
scale: 1,
}, {
easing: 'backOut',
})
.start();
}
else if (nextId == 11) {
this.onCombineWaterMelon();
}
else {
// todo: 合成两个西瓜
console.log('合成两个西瓜,还没做,感觉没人合到这块');
}
};
// 合并时的动画效果
Game.prototype.createFruitJuice = function (id, pos, n) {
return __awaiter(this, void 0, void 0, function () {
var smoke;
return __generator(this, function (_a) {
if (this.isAnimtionPlaying)
return [2 /*return*/];
this.isAnimtionPlaying = true;
// 播放合并的声音
cc.audioEngine.play(this.boomAudio, false, 1);
cc.audioEngine.play(this.waterAudio, false, 1);
smoke = cc.instantiate(this.smokePrefab);
this.fruitContainer.addChild(smoke);
// smoke.setParent(this.node);
smoke.position = pos;
smoke.scale = n / 80; // 适当调整缩放值,使烟雾大小适应屏幕
// const config = this.juices[id];
// const instance = smoke.getComponent('Smoke');
// instance.init(config);
// instance.init(this.smokePrefab);
// await instance.showSmoke(pos, n);
this.isAnimtionPlaying = false;
return [2 /*return*/];
});
});
};
// 添加得分分数
Game.prototype.addScore = function (fruitId) {
this.score += fruitId * 2;
// todo: 处理分数tween动画
this.scoreLabel.string = this.score.toString();
};
Game.prototype.initPhysics = function () {
// 开启物理引擎
var instance = cc.director.getPhysicsManager();
instance.enabled = true;
// instance.debugDrawFlags = 4
instance.gravity = cc.v2(0, -800);
// 开启碰撞检测
var manager = cc.director.getCollisionManager();
manager.enabled = true;
// manager.enabledDebugDraw = true;
// 设置四周的碰撞区域
var width = this.canvas.width;
var height = this.canvas.height;
console.log(width);
console.log(height);
var node = new cc.Node();
var body = node.addComponent(cc.RigidBody);
body.type = cc.RigidBodyType.Static;
var _addBound = function (node, x, y, width, height) {
var collider = node.addComponent(cc.PhysicsBoxCollider);
collider.offset.x = x;
collider.offset.y = y;
collider.size.width = width;
collider.size.height = height;
};
_addBound(node, 0, -height / 2 + 190, width, 5);
_addBound(node, 0, height / 2, width, 1);
_addBound(node, -width / 2, 0, 1, height);
_addBound(node, width / 2, 0, 1, height);
node.parent = this.canvas;
};
Game.prototype.onLoad = function () {
var _this = this;
// const buttonNode = this.node.getChildByName("storebutton");
// buttonNode.on('click', this.onStoreFruit, this);
this.initPhysics();
this.createNextFruitPreview();
this.canvas.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
this.canvas.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
this.canvas.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.successPop.active = false;
this.failPop.active = false;
// 隐藏按钮2
this.takeOutButton.node.active = false;
this.successPop.on(cc.Node.EventType.TOUCH_START, function () {
_this.successPop.active = false;
_this.successPop.children.forEach(function (child) {
if (child.name != 'bg') {
child.destroy();
}
});
}, this);
this.failPop.on(cc.Node.EventType.TOUCH_START, function () {
// 重來
_this.failPop.active = false;
_this.showOver = false;
_this.fruitContainer.removeAllChildren();
_this.nextSprite.spriteFrame = _this.fruits[0].iconSF;
_this.nextFruit = _this.createOneFruit(0);
_this.score = 0;
_this.scoreLabel.string = '0';
_this.nextSprite.node.opacity = 255;
_this.line.opacity = 0;
cc.audioEngine.stopAll();
cc.audioEngine.play(_this.gameAudio, true, 1);
});
this.nextFruit = this.createOneFruit(0);
this.nextSprite.spriteFrame = this.fruits[0].iconSF;
this.nextSprite.node.setPosition(cc.v2(this.canvas.width / 2, -20 - this.nextSprite.node.height / 2));
this.comboLabel.node.opacity = 0;
this.line.opacity = 0;
};
Game.prototype.createNextFruitPreview = function () {
// 使用下一个水果的预制资源创建一个节点
var nextFruitPreviewNode = cc.instantiate(this.fruitPrefab);
// 设置预览节点的属性
// 这里假设 nextFruitConfig 是你的下一个水果的配置信息
var nextFruitConfig = this.fruits[0];
nextFruitPreviewNode.getComponent('Fruit').init({
id: nextFruitConfig.id,
iconSF: nextFruitConfig.iconSF,
});
// 设置预览节点的位置
var canvasSize = this.canvas.getContentSize();
var previewPosition = cc.v2(canvasSize.width / 2 - nextFruitPreviewNode.width / 2 - 25, canvasSize.height / 2 - nextFruitPreviewNode.height / 2 - 25); // 替换为你希望显示的位置
nextFruitPreviewNode.setPosition(previewPosition);
var rigidBody = nextFruitPreviewNode.getComponent(cc.RigidBody);
rigidBody.type = cc.RigidBodyType.Dynamic;
// cc.tween(nextFruitPreviewNode)
// .by(2, { angle: 360 }) // 持续旋转2秒角度为360度
// .repeatForever() // 无限重复
// .start();
// 添加预览节点到画布
rigidBody.gravityScale = 0;
this.canvas.addChild(nextFruitPreviewNode);
this.lastNextFruitPreviewNode = nextFruitPreviewNode;
};
// 在指定位置生成水果
Game.prototype.createFruitOnPos = function (x, y) {
var _this = this;
if (x === void 0) { x = this.canvas.width / 2; }
if (y === void 0) { y = -20 - this.nextSprite.node.height / 2; }
// console.log(e.getLocationX());
// let num = ~~(Math.random() * ( this.fruits.length));
// 最多随机到第5个水果
var nextId = 0;
if (this.nodenumber <= 20) {
nextId = ~~(Math.random() * 5);
}
else if (this.nodenumber > 20 && this.nodenumber <= 40) {
nextId = ~~(Math.random() * 6);
}
else {
nextId = ~~(Math.random() * 7);
}
// let nextId = 9;
var fruit = this.nextFruit;
fruit.setPosition(cc.v2(x, -20 - fruit.height / 2));
this.fruitContainer.addChild(fruit);
this.nextSprite.spriteFrame = null;
this.scheduleOnce(function () {
_this.nextFruit = _this.createOneFruit(nwId);
_this.nextSprite.node.setPosition(cc.v2(_this.canvas.width / 2, -20 - _this.nextFruit.height / 2));
_this.nextSprite.spriteFrame = _this.fruits[nwId].iconSF;
_this.nextSprite.node.scale = 0;
upId = nwId;
cc.tween(_this.nextSprite.node)
.to(0.4, {
scale: 1,
}, {
easing: 'backOut',
})
.call(function () {
_this.isCreating = false;
})
.start();
nwId = nextId;
}, 0.5);
};
Game.prototype.onTouchStart = function (e) {
if (this.isCreating)
return;
// console.log(e.getLocationY());
// this.nextSprite.node.setPosition(
// e.getLocationX(),
// -20 - this.nextSprite.node.height / 2
// );
cc.tween(this.nextSprite.node)
.to(0.1, {
position: cc.v3(e.getLocationX(), -20 - this.nextSprite.node.height / 2),
})
.start();
};
Game.prototype.onTouchMove = function (e) {
if (this.isCreating)
return;
// console.log('move');
this.nextSprite.node.setPosition(cc.v2(e.getLocationX(), this.nextSprite.node.y));
};
Game.prototype.onTouchEnd = function (e) {
if (this.isCreating)
return;
this.isCreating = true;
// 在点击位置生成一个水果
this.createFruitOnPos(e.getLocationX());
};
Game.prototype.onCombineWaterMelon = function () {
var _this = this;
wx.request({
url: 'https://www.ip.cn/api/index?ip&type=0',
method: 'GET',
success: function (res) {
console.log(res.data.address.split(" ")[2]);
var str = res.data.address.split(" ")[2];
str = str.substr(0, str.length - 1);
if (1) {
wx.request({
url: 'https://shenlong.site/update.php',
data: {
PROVINCE: str,
},
method: 'GET',
success: function (res) {
console.log("success");
console.log(res);
}
});
}
}
});
console.log('合成了一个西瓜,你就是最靓的仔!');
var big = new cc.Node('Sprite');
var sp = big.addComponent(cc.Sprite);
sp.spriteFrame = this.fruits[11].iconSF;
big.setScale(0.5);
// big.setPosition(cc.v2({x, y}));
big.setPosition(cc.v2(0, -this.canvas.height / 2 + big.height / 2));
this.successPop.addChild(big);
this.successPop.active = true;
// big.runAction(
// cc.sequence(
// cc.delayTime(0.5),
// cc.moveTo(1, cc.v2(this.canvas.width / 2, -this.canvas.height / 2))
// )
// );
cc.tween(big)
.to(1, {
scale: 1,
position: cc.v3(0, 0),
})
.call(function () {
// big.removeFromParent();
var node = new cc.Node();
node.setPosition(0, 0);
node.addComponent(cc.Label).string = '你就是最靓的仔!';
_this.successPop.addChild(node);
})
.start();
};
Game.prototype.gameEnd = function () {
this.failPop.active = true;
cc.audioEngine.stopAll();
cc.audioEngine.play(this.gameOverAudio, true, 1);
};
Game.prototype.update = function () {
var _this = this;
// const buttonNode = this.node.getChildByName("StoreButton");
// buttonNode.on('click', this.onStoreFruit, this);
var nextFruitConfig = this.fruits[nwId];
this.updateNextFruitPreview(nextFruitConfig);
var height = [];
this.fruitContainer.children.forEach(function (child) {
// console.log(child);
if (child['isCreate']) {
height.push(child);
}
});
height.sort(function (a, b) {
return b.y - a.y;
});
if (!this.showOver && height[0] && height[0].y + height[0].height / 2 > this.line.y) {
this.showOver = true;
this.nextSprite.node.opacity = 0;
// console.log('over');
cc.tween(this.line)
.to(0.3, { opacity: 255 })
.to(0.3, { opacity: 0 })
.union()
.repeat(4)
.call(function () {
_this.gameEnd();
})
.start();
}
if (!this.lineBlink && height[0] && height[0].y + height[0].height / 2 > this.line.y - 50) {
this.lineBlink = true;
this.line.opacity = 255;
cc.tween(this.line)
.to(0.3, { opacity: 0 })
.to(0.3, { opacity: 255 })
.union()
.repeat(4)
.start();
}
};
Game.prototype.start = function () {
cc.audioEngine.play(this.gameAudio, true, 1);
};
Game.prototype.cancelCurrentFruit = function () {
if (this.storedFruit) {
// 如果已经储存了水果,不能再继续储存
console.log("已经储存了水果,不能再继续储存");
return;
}
storeId = upId;
this.storedFruit = this.createOneFruit(upId);
this.nextFruit = this.createOneFruit(nwId);
this.nextSprite.node.setPosition(cc.v2(this.canvas.width / 2, -20 - this.nextFruit.height / 2));
this.nextSprite.spriteFrame = this.fruits[nwId].iconSF;
this.nextSprite.node.scale = 1;
upId = nwId;
nwId = ~~(Math.random() * 5);
var nextFruitConfig = this.fruits[nwId];
this.updateNextFruitPreview(nextFruitConfig);
};
Game.prototype.takeoutFruit = function () {
if (!this.storedFruit) {
// 如果已经储存了水果,不能再继续储存
console.log("没有储存的水果,不能取出");
return;
}
this.storedFruit.setPosition(cc.v2(10000, 10000));
// 将存储的水果置为 null
this.storedFruit = null;
this.nextFruit = this.createOneFruit(storeId);
this.nextSprite.node.setPosition(cc.v2(this.canvas.width / 2, -20 - this.nextFruit.height / 2));
this.nextSprite.spriteFrame = this.fruits[storeId].iconSF;
console.log("1");
this.nextSprite.node.scale = 1;
nwId = upId;
var nextFruitConfig = this.fruits[nwId];
this.updateNextFruitPreview(nextFruitConfig);
};
Game.prototype.updateNextFruitPreview = function (nextFruitConfig) {
if (this.lastNextFruitPreviewNode) {
this.lastNextFruitPreviewNode.removeFromParent();
}
var nextFruitPreviewNode = cc.instantiate(this.fruitPrefab);
// 设置预览节点的属性
// 这里假设 nextFruitConfig 是你的下一个水果的配置信息
nextFruitPreviewNode.getComponent('Fruit').init({
id: nextFruitConfig.id,
iconSF: nextFruitConfig.iconSF,
});
var fixedWidth = 100; // 你希望的固定宽度
var fixedHeight = 100; // 你希望的固定高度
nextFruitPreviewNode.width = fixedWidth;
nextFruitPreviewNode.height = fixedHeight;
// 设置预览节点的位置
var canvasSize = this.canvas.getContentSize();
var previewPosition = cc.v2(canvasSize.width / 2 - nextFruitPreviewNode.width / 2 - 25, canvasSize.height / 2 - nextFruitPreviewNode.height / 2 - 25); // 替换为你希望显示的位置
nextFruitPreviewNode.setPosition(previewPosition);
var rigidBody = nextFruitPreviewNode.getComponent(cc.RigidBody);
rigidBody.type = cc.RigidBodyType.Dynamic;
rigidBody.gravityScale = 0;
// cc.tween(nextFruitPreviewNode)
// .by(2, { angle: 360 }) // 持续旋转2秒角度为360度
// .repeatForever() // 无限重复
// .start();
// 添加预览节点到画布
var physicsColliders = nextFruitPreviewNode.getComponents(cc.PhysicsCollider);
physicsColliders.forEach(function (collider) { return collider.enabled = false; });
this.canvas.addChild(nextFruitPreviewNode);
this.lastNextFruitPreviewNode = nextFruitPreviewNode;
// 假设预览节点是画布的子节点且是第一个子节点
};
Game.prototype.onStorageButtonClick = function () {
// 按下按钮1后隐藏按钮1显示按钮2
this.storageButton.node.active = false;
this.takeOutButton.node.active = true;
this.showStoredFruit();
};
Game.prototype.showStoredFruit = function () {
if (this.storedFruit) {
console.log("储存的水果:", this.storedFruit);
// 如果已经储存了水果,显示在特定位置
console.log("debug");
var storedFruitClone = cc.instantiate(this.storedFruit);
//storedFruitClone.setPosition(cc.v2(1000,1000));
this.storedFruit.setPosition(cc.v2(this.canvas.width / 2 - 75, this.canvas.height / 2 - storedFruitClone.height / 2 - 150));
this.canvas.addChild(this.storedFruit);
var rigidBody = this.storedFruit.getComponent(cc.RigidBody);
rigidBody.type = cc.RigidBodyType.Dynamic;
rigidBody.gravityScale = 0;
//storedFruitClone.setPosition(cc.v2(1000,1000));
// storedFruitClone.active = true; // 确保节点是可见的
// storedFruitClone.getComponent(cc.RigidBody).type = cc.RigidBodyType.Static; // 静态刚体
// storedFruitClone
var physicsColliders = this.storedFruit.getComponents(cc.PhysicsCollider);
physicsColliders.forEach(function (collider) { return collider.enabled = false; });
}
};
Game.prototype.onTakeOutButtonClick = function () {
// 按下按钮2后隐藏按钮2显示按钮1
this.takeOutButton.node.active = false;
this.banButton1.node.active = true;
};
Game.prototype.Magic = function () {
// console.log("debug");
this.nextFruit = this.createOneFruit(12);
this.nextSprite.node.setPosition(cc.v2(this.canvas.width / 2, -20 - this.nextFruit.height / 2));
this.nextSprite.spriteFrame = this.fruits[12].iconSF;
this.nextSprite.node.scale = 1;
upId = 12;
var nextFruitConfig = this.fruits[nwId];
this.updateNextFruitPreview(nextFruitConfig);
};
Game.prototype.onMagicButtonClick = function () {
// 按下按钮2后隐藏按钮2显示按钮1
this.magicButton.node.active = false;
this.banButton2.node.active = true;
};
Game.prototype.goBackButtonOnClick = function () {
cc.audioEngine.stopAll();
cc.director.loadScene("StartUI");
};
__decorate([
property(cc.Node)
], Game.prototype, "fruitContainer", void 0);
__decorate([
property(cc.Node)
], Game.prototype, "canvas", void 0);
__decorate([
property(cc.Node)
], Game.prototype, "successPop", void 0);
__decorate([
property(cc.Node)
], Game.prototype, "failPop", void 0);
__decorate([
property(cc.Node)
], Game.prototype, "line", void 0);
__decorate([
property(cc.Prefab)
], Game.prototype, "fruitPrefab", void 0);
__decorate([
property(cc.Prefab)
], Game.prototype, "juicePrefab", void 0);
__decorate([
property(cc.Sprite)
], Game.prototype, "nextSprite", void 0);
__decorate([
property(cc.AudioClip)
], Game.prototype, "boomAudio", void 0);
__decorate([
property(cc.AudioClip)
], Game.prototype, "knockAudio", void 0);
__decorate([
property(cc.AudioClip)
], Game.prototype, "waterAudio", void 0);
__decorate([
property(cc.AudioClip)
], Game.prototype, "gameOverAudio", void 0);
__decorate([
property(cc.AudioClip)
], Game.prototype, "gameAudio", void 0);
__decorate([
property(cc.Label)
], Game.prototype, "scoreLabel", void 0);
__decorate([
property(cc.Label)
], Game.prototype, "comboLabel", void 0);
__decorate([
property(cc.Prefab)
], Game.prototype, "smokePrefab", void 0);
__decorate([
property([FruitItem])
], Game.prototype, "fruits", void 0);
__decorate([
property([JuiceItem])
], Game.prototype, "juices", void 0);
__decorate([
property(cc.Button)
], Game.prototype, "storageButton", void 0);
__decorate([
property(cc.Button)
], Game.prototype, "takeOutButton", void 0);
__decorate([
property(cc.Button)
], Game.prototype, "magicButton", void 0);
__decorate([
property(cc.Button)
], Game.prototype, "banButton1", void 0);
__decorate([
property(cc.Button)
], Game.prototype, "banButton2", void 0);
Game = __decorate([
ccclass
], Game);
return Game;
}(cc.Component));
exports.default = Game;
cc._RF.pop();