Commit 220f3d54 by Jin Liu

combo管理器首次更新

parents
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "ComboManager",
"_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__": "27c0adzlJ9D0JtNqujGeRXw",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"awardEffectPre": {
"__uuid__": "917b0d00-8157-4630-9f8f-7a9b93613293"
},
"comboEffectPre": {
"__uuid__": "f3b87995-3e46-4c2c-811b-b71cb783f2de"
},
"soundFxPre": {
"__uuid__": "f37cd79d-74d0-49c3-a63e-fb77bceceea2"
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "2030b413-43d5-42c4-bb89-665b6154b65c"
},
"fileId": "28hmwHycFMq4GYHkY0N8/K",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.6",
"uuid": "2030b413-43d5-42c4-bb89-665b6154b65c",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 找到场景里任意节点
* @param node 给定某一场景里任意节点
* @param name 要寻找的节点名
* @param isBfs true为广度优先,false为深度优先
* @returns node or false
*/
//找到根节点
function findNode(node, name, {isBfs = true}={}) {
if (node.parent)
return findNode(node.parent, name, isBfs);
else
return isBfs ? bfs(node, name) : dfs(node, name);
}
//广度优先搜索
function bfs(node, name) {
if (node != null) {
var queue = [];
queue.unshift(node);
while (queue.length != 0) {
var item = queue.shift();
// console.log("item",item.name)
if (item.name.toString() == name)
return item;
var children = item.children;
for (var i = 0; i < children.length; i++)
queue.push(children[i]);
}
}
return false;
}
//深度优先搜索
function dfs(node, name) {
if (node != null) {
var stack = [];
stack.push(node);
while (stack.length != 0) {
var item = stack.pop();
if (item.name.toString() == name)
return item;
var children = item.children;
for (var i = children.length - 1; i >= 0; i--)
stack.push(children[i]);
}
}
return false;
}
let freeCombo = {
comboManager: undefined,
//在当前场景的Canvas中找到ComboManager预置体,实现对ComboManager的控制
init(node) {
let comboManagerNode = findNode(node, "ComboManager");
if (comboManagerNode)
console.log("找到Combo管理器");
else
console.log("未成功找到Combo管理器,请检查是否在场景中挂载ComboManager预制体");
this.comboManager = comboManagerNode.getComponent("ComboManager");
this.comboManager.init();
},
//设置奖励文字与Combo计数的关系,data:[3,5]
setAward(...data) {
this.comboManager.setAward(data);
},
//combo叠加一层
comboAdd() {
this.comboManager.comboAdd();
},
//combo懒叠加,如果用户使用懒叠加,则在一帧内,最多只叠加一层
comboAddLazy() {
this.comboManager.comboAddLazy();
},
//打断combo的函数
comboBreak() {
this.comboManager.comboBreak();
},
//重置的函数
reset() {
this.comboManager.reset();
},
};
module.exports = freeCombo;
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "2dab0157-34fe-4e46-8cff-cdfdd03e006d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "2c1e6c6c-2d78-4c5b-a5d6-75ddd7ee0506",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "4a5942d0-50fd-4ff6-a4c3-00cde9511157",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 288,
"height": 64,
"platformSettings": {},
"subMetas": {
"combo 10": {
"ver": "1.0.4",
"uuid": "856b347d-e3d1-4c72-a984-79ea47f980ce",
"rawTextureUuid": "4a5942d0-50fd-4ff6-a4c3-00cde9511157",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 288,
"height": 64,
"rawWidth": 288,
"rawHeight": 64,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "19c97043-cc04-421e-b90e-8dd0fe1d898c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 259,
"height": 63,
"platformSettings": {},
"subMetas": {
"combo 3": {
"ver": "1.0.4",
"uuid": "05ef1415-e149-44a9-824e-252442cb112c",
"rawTextureUuid": "19c97043-cc04-421e-b90e-8dd0fe1d898c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 259,
"height": 63,
"rawWidth": 259,
"rawHeight": 63,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "135d85a6-9e33-43c1-8ee4-f821c871e25a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 259,
"height": 63,
"platformSettings": {},
"subMetas": {
"combo 4": {
"ver": "1.0.4",
"uuid": "f4dd369f-d2f0-4325-836e-d037ccd7c4fe",
"rawTextureUuid": "135d85a6-9e33-43c1-8ee4-f821c871e25a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 259,
"height": 63,
"rawWidth": 259,
"rawHeight": 63,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "b1fdbd02-318d-4a2b-a869-c64bfa47d121",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 259,
"height": 63,
"platformSettings": {},
"subMetas": {
"combo 5": {
"ver": "1.0.4",
"uuid": "1187ce07-f52e-46c1-8a68-c3b25c096b5d",
"rawTextureUuid": "b1fdbd02-318d-4a2b-a869-c64bfa47d121",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 259,
"height": 63,
"rawWidth": 259,
"rawHeight": 63,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "1bcbe011-3784-4b18-810f-15d516a5447a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 63,
"platformSettings": {},
"subMetas": {
"combo 6": {
"ver": "1.0.4",
"uuid": "833a3d79-7786-4f74-a319-7e63e5a4e71a",
"rawTextureUuid": "1bcbe011-3784-4b18-810f-15d516a5447a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 260,
"height": 63,
"rawWidth": 260,
"rawHeight": 63,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "da473379-a93b-40d3-8d8c-982ab639ef85",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 262,
"height": 63,
"platformSettings": {},
"subMetas": {
"combo 7": {
"ver": "1.0.4",
"uuid": "e319449d-8c19-491c-8423-e29213425a67",
"rawTextureUuid": "da473379-a93b-40d3-8d8c-982ab639ef85",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 262,
"height": 63,
"rawWidth": 262,
"rawHeight": 63,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "08f45706-5570-4561-ac8c-491cd8c209a6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 259,
"height": 65,
"platformSettings": {},
"subMetas": {
"combo 8": {
"ver": "1.0.4",
"uuid": "7a045b38-b63c-44b4-af85-89d0b2e4c109",
"rawTextureUuid": "08f45706-5570-4561-ac8c-491cd8c209a6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 259,
"height": 65,
"rawWidth": 259,
"rawHeight": 65,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "95c878b1-1cfd-4205-8062-fc6feb37590b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 261,
"height": 64,
"platformSettings": {},
"subMetas": {
"combo 9": {
"ver": "1.0.4",
"uuid": "bd626235-b4df-44cf-8e6e-0922e1e92f44",
"rawTextureUuid": "95c878b1-1cfd-4205-8062-fc6feb37590b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 261,
"height": 64,
"rawWidth": 261,
"rawHeight": 64,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
{
"ver": "2.3.4",
"uuid": "afd1a7d2-1cfe-49bb-a96a-18c9d4b3819f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 247,
"height": 68,
"platformSettings": {},
"subMetas": {
"combo !": {
"ver": "1.0.4",
"uuid": "dda2af79-7c2c-49fa-9b2c-1043da923188",
"rawTextureUuid": "afd1a7d2-1cfe-49bb-a96a-18c9d4b3819f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 247,
"height": 68,
"rawWidth": 247,
"rawHeight": 68,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "508b13e5-fdf2-483e-a61d-1e3162246457",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 238,
"height": 79,
"platformSettings": {},
"subMetas": {
"great": {
"ver": "1.0.4",
"uuid": "864ea3a9-48a5-4dac-b9cf-3e973391f613",
"rawTextureUuid": "508b13e5-fdf2-483e-a61d-1e3162246457",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 238,
"height": 79,
"rawWidth": 238,
"rawHeight": 79,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "d4403d65-3845-4457-9bc3-7b681701d833",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 211,
"height": 98,
"platformSettings": {},
"subMetas": {
"prefect": {
"ver": "1.0.4",
"uuid": "94086d4d-c323-4bb3-b914-1bc963fb7a09",
"rawTextureUuid": "d4403d65-3845-4457-9bc3-7b681701d833",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 211,
"height": 98,
"rawWidth": 211,
"rawHeight": 98,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "2b267e9a-6137-4ec5-8c9c-ae5f9a24c4ae",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}
\ No newline at end of file
function testable(isTestable) {
return function (target) {
target.isTestable = isTestable;
}
}
function log(target, name, descriptor) {
var oldValue = descriptor.value;
descriptor.value = function () {
console.log(`Calling ${name} with`, arguments);
return oldValue.apply(this, arguments);
};
return descriptor;
}
function mixins(...list) {
return function (target) {
Object.assign(target.prototype, ...list)
}
}
function nonenumerable(target, name, descriptor) {
descriptor.enumerable = false;
return descriptor;
}
function readonly(target, name, descriptor) {
descriptor.writable = false;
return descriptor;
}
export { testable, log, mixins, nonenumerable, readonly }
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "7450eb6a-5db5-4f4e-811b-1be08c70bd16",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "52f4cfd9-3c29-47bd-82c1-68fc30289d31",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "FreeAward",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 5
}
],
"_prefab": {
"__id__": 6
},
"_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__": "cc.Node",
"_name": "imgSprite",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 238,
"height": 79
},
"_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__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "864ea3a9-48a5-4dac-b9cf-3e973391f613"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "917b0d00-8157-4630-9f8f-7a9b93613293"
},
"fileId": "0eyyNS2gJPFp0dqOjIoYPO",
"sync": false
},
{
"__type__": "8e51eViY6lH7Ze/F4rzDqik",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"spriteList": [
{
"__uuid__": "864ea3a9-48a5-4dac-b9cf-3e973391f613"
},
{
"__uuid__": "94086d4d-c323-4bb3-b914-1bc963fb7a09"
}
],
"mySprite": {
"__id__": 3
},
"playFxPrefab": {
"__uuid__": "f37cd79d-74d0-49c3-a63e-fb77bceceea2"
},
"tween": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "917b0d00-8157-4630-9f8f-7a9b93613293"
},
"fileId": "4f1ZiiYKRL1bjatvWRWnFp",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.6",
"uuid": "917b0d00-8157-4630-9f8f-7a9b93613293",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "FreeCombo",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 247,
"height": 68
},
"_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__": "0eabayx4eJEZaCpjvOK2eqP",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"mySprite": {
"__id__": 3
},
"playFxPrefab": {
"__uuid__": "f37cd79d-74d0-49c3-a63e-fb77bceceea2"
},
"spriteList": [
{
"__uuid__": "dda2af79-7c2c-49fa-9b2c-1043da923188"
},
{
"__uuid__": "05ef1415-e149-44a9-824e-252442cb112c"
},
{
"__uuid__": "f4dd369f-d2f0-4325-836e-d037ccd7c4fe"
},
{
"__uuid__": "1187ce07-f52e-46c1-8a68-c3b25c096b5d"
},
{
"__uuid__": "833a3d79-7786-4f74-a319-7e63e5a4e71a"
},
{
"__uuid__": "e319449d-8c19-491c-8423-e29213425a67"
},
{
"__uuid__": "7a045b38-b63c-44b4-af85-89d0b2e4c109"
},
{
"__uuid__": "bd626235-b4df-44cf-8e6e-0922e1e92f44"
},
{
"__uuid__": "856b347d-e3d1-4c72-a984-79ea47f980ce"
}
],
"tween": null,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "dda2af79-7c2c-49fa-9b2c-1043da923188"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "f3b87995-3e46-4c2c-811b-b71cb783f2de"
},
"fileId": "bdBAUb3tZFJqsOggGBJ1Hy",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.6",
"uuid": "f3b87995-3e46-4c2c-811b-b71cb783f2de",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "soundFx",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_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__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": ""
},
{
"__type__": "4ae07hrc1xJs5cn+LHnaoUz",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"audioSource": {
"__id__": 2
},
"comboSoundFx": [
{
"__uuid__": "8d0e650a-1ffb-4714-b478-59ac89b64590"
},
{
"__uuid__": "14b6ce19-48f4-424f-b3f9-d32990910e51"
},
{
"__uuid__": "00fc4eac-2539-41a2-81bb-2489bb229510"
}
],
"awardSoundFx": [
{
"__uuid__": "17895f94-1f7e-43a6-ae43-febe7cfaff8c"
},
{
"__uuid__": "62092e75-89d1-43bf-923e-f3962ec5cfbb"
}
],
"isPlay": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "f37cd79d-74d0-49c3-a63e-fb77bceceea2"
},
"fileId": "b89laJFhdEtrUIX+BaqzRP",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.6",
"uuid": "f37cd79d-74d0-49c3-a63e-fb77bceceea2",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "c5e99609-1030-4ec7-ae7f-887f8b17b061",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}
\ No newline at end of file
let { AwardManager, ComboManager } = require('FreeCollection')
cc.Class({
extends: cc.Component,
properties: {
awardEffectPre: cc.Prefab,
comboEffectPre: cc.Prefab,
soundFxPre: cc.Prefab,
awardManager: null,
comboManager: null,
newFunc: null,
add: null
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start() {
},
init() {
let award = cc.instantiate(this.awardEffectPre);
this.node.addChild(award);
let awardControl = award.getComponent("FreeAwardEffect");
this.awardManager = new AwardManager(awardControl);
let combo = cc.instantiate(this.comboEffectPre);
this.node.addChild(combo);
let comboControl = combo.getComponent("FreeComboEffect");
this.comboManager = new ComboManager(comboControl);
},
//设置奖励文字与Combo计数的关系,args为多个参数
setAward(data) {
this.awardManager.addAward(data);
this.comboManager.setAwardManager(this.awardManager);
},
//combo叠加一层
comboAdd() {
this.comboManager.comboAdd();
},
//combo懒叠加,如果用户使用懒叠加,则在一帧内,最多只叠加一层
comboAddLazy() {
if (this.comboManager.isAllowLazyAdd) {
this.comboManager.isAllowLazyAdd = false;
this.comboManager.comboAdd();
}
//else console.log("----由于懒叠加,combo并没有继续触发" + "----");
},
//打断combo的函数
comboBreak() {
this.comboManager.comboBreak();
},
//重置的函数
reset() {
this.comboManager.reset();
this.awardManager.reset();
},
// update (dt) {},
lateUpdate(dt) {
this.comboManager.isAllowLazyAdd = true;
}
});
{
"ver": "1.0.8",
"uuid": "27c0a773-949f-43d0-9b4d-aae8c67915f0",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
// - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
// - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
spriteList: [cc.SpriteFrame],
mySprite:cc.Sprite,
playFxPrefab: cc.Prefab,
tween:null
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start() {
this.doClose();
},
doActive() {
this.node.active = true;
},
doClose() {
this.node.active = false;
this.reset();
},
reset() {
if (this.tween) {
this.tween.stop();
this.tween = null;
}
this.node.scale = 0;
this.node.pacity = 255;
},
showAward(index) {
if (index > this.spriteList.length-1) return;
if (this.node.active) this.reset();
else this.doActive();
this.playFx(index+1);
this.mySprite.spriteFrame = this.spriteList[index];
cc.tween(this.node)
.by(0.4, { scale: 1.2, position: cc.v2(0, 0) }, { easing: 'backOut' })
.by(0.8, { scale: 0, position: cc.v2(0, 0) })
.to(0.4, { scale: 0 }, { easing: 'backIn' })
.call(() => {
//console.log('award动画效果');
this.doClose();
})
.start();
},
playFx(num) {
let playFxPrefab = cc.instantiate(this.playFxPrefab);
this.node.addChild(playFxPrefab);
playFxPrefab.getComponent('FreeSoundFx').playAwardFx(num);
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "8e51e562-63a9-47ed-97bf-178af30ea8a4",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
class AwardManager {
constructor(award) {
this.awardList = [];
this.award = award;
}
addAward(data) {
if (data.length > this.award.spriteList.length) {
console.warn("当前只设置了"+this.award.spriteList.length+"张奖励图片,但提供了"+data.length+"个奖励位置,多出的奖励将不会显示");
data = data.slice(0,this.award.spriteList.length);
}
this.awardList = data;
}
checkAward(num) {
let index = 0;
this.awardList.forEach((item) => {
if (item == num) {
this.award.showAward(index);
///
//console.log("----" + "combo数为" + num + "时,第" + (index+1) + "个award出现" + "----")
}
index++;
})
}
reset() {
///
//console.log("awardManager恢复初始状态");
this.award.reset();
}
log() {
console.log("awardList", this.awardList);
}
}
class ComboManager {
constructor(combo) {
this.comboCacul = 0;
this.combo = combo;
this.isAllowLazyAdd = true;
this.awardManager = null;
}
setAwardManager(manager) {
this.awardManager = manager;
}
comboAdd() {
this.comboCacul++;
if (this.awardManager) {
this.awardManager.checkAward(this.comboCacul);
}
this.combo.showCombo(this.comboCacul);
///
//console.log("----" + "combo*" + this.comboCacul + "出现了----")
}
comboBreak() {
this.comboCacul = 0;
///
//console.log("----combo被打断了,重置为0----")
}
reset() {
this.comboCacul = 0;
this.combo.reset();
//console.log("comboManager恢复初始状态");
}
log() {
console.log("combo", this.combo);
}
}
export default{AwardManager,ComboManager}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "f738e3f5-64c8-4f2f-904a-1cd3a2df533f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
// - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
// - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
mySprite: cc.Sprite,
playFxPrefab: cc.Prefab,
spriteList: [cc.SpriteFrame],
tween: null,
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start() {
this.doClose();
},
doActive() {
this.node.active = true;
},
doClose() {
this.node.active = false;
this.reset();
},
reset() {
if (this.tween) {
this.tween.stop();
this.tween = null;
}
this.node.scale = 0;
this.node.position = cc.v2(0, 150);
},
showCombo(num) {
if (num > this.spriteList.length) return;
if (this.node.active) this.reset();
else this.doActive();
this.playFx(num);
this.mySprite.spriteFrame = this.spriteList[num - 1];
this.tween = cc.tween(this.node)
.by(0.4, { scale: 1.2, position: cc.v2(0, 150) }, { easing: 'backOut' })
.by(0.8, { scale: 0, position: cc.v2(0, 0) })
.to(0.4, { scale: 0, position: cc.v2(0, 300) }, { easing: 'backIn' })
.call(() => {
//console.log('combo动画效果');
this.doClose();
})
.start();
},
playFx(num) {
let playFxPrefab = cc.instantiate(this.playFxPrefab);
this.node.addChild(playFxPrefab);
playFxPrefab.getComponent('FreeSoundFx').playComboFx(num);
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "0eabacb1-e1e2-4465-a0a9-8ef38ad9ea8f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
audioSource: cc.AudioSource,
comboSoundFx: [cc.AudioClip],
awardSoundFx: [cc.AudioClip],
isPlay: false,
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start() {
},
playComboFx(num) {
this.playFx(0, num);
},
playAwardFx(num) {
this.playFx(1, num);
},
playFx(type, num) {
let clip = null;
if (type == 0) {
clip = this.comboSoundFx[(num - 1)%this.comboSoundFx.length];
} else {
clip = this.awardSoundFx[(num - 1)%this.awardSoundFx.length];
}
this.audioSource.clip = clip;
this.isPlay = true;
this.audioSource.play();
},
update(dt) {
if (this.isPlay == false) return;
if (!this.audioSource.isPlaying) {
this.node.destroy();
// console.log('PhreeSoundFx已销毁');
}
},
});
{
"ver": "1.0.8",
"uuid": "4ae0786b-735c-49b3-9727-f8b1e76a8533",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "a4dcf5d0-6856-4b9d-86ee-6a9b77c99f51",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.0",
"uuid": "8d0e650a-1ffb-4714-b478-59ac89b64590",
"downloadMode": 0,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.0",
"uuid": "14b6ce19-48f4-424f-b3f9-d32990910e51",
"downloadMode": 0,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.0",
"uuid": "00fc4eac-2539-41a2-81bb-2489bb229510",
"downloadMode": 0,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.0",
"uuid": "17895f94-1f7e-43a6-ae43-febe7cfaff8c",
"downloadMode": 0,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.0",
"uuid": "62092e75-89d1-43bf-923e-f3962ec5cfbb",
"downloadMode": 0,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.0",
"uuid": "03484526-23c3-478a-9c81-46c7f7a46a33",
"downloadMode": 0,
"subMetas": {}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment