Commit 8c45b0f2 authored by limingzhe's avatar limingzhe

fix: debug

parent 1e09b9db
const tools = require("../script/tools"); const tools = require("../script/DG_27_tools");
var onlyOne var onlyOne
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
......
const tools = require("../script/tools"); const tools = require("../script/DG_27_tools");
var picNode = cc.Class({ var picNode = cc.Class({
extends: cc.Component, extends: cc.Component,
...@@ -65,7 +65,7 @@ var picNode = cc.Class({ ...@@ -65,7 +65,7 @@ var picNode = cc.Class({
let node, comp let node, comp
for (let data of data.hotZoneItemArr) { for (let data of data.hotZoneItemArr) {
node = cc.instantiate(this.hitPre) node = cc.instantiate(this.hitPre)
comp = node.getComponent('hitItem') comp = node.getComponent('DG_27_hitItem')
comp.initWithData(data, scale, Xvalue, Yvalue); comp.initWithData(data, scale, Xvalue, Yvalue);
this._items.addChild(node) this._items.addChild(node)
......
if (!g) {
g = {};
}
g.utils = { // g.utils = {
// 范围随机
randFromTo: function (_min, _max) { // // 范围随机
var min = parseFloat(_min); // randFromTo: function (_min, _max) {
var max = parseFloat(_max); // var min = parseFloat(_min);
return (min + Math.random() * (max - min)); // var max = parseFloat(_max);
}, // return (min + Math.random() * (max - min));
// 范围随机一个整数 // },
// 例:1~3,返回的可能值为:1、2、3 // // 范围随机一个整数
randFromTo_Int: function (min, max) { // // 例:1~3,返回的可能值为:1、2、3
var val = this.randFromTo(min, max + 1 - 0.0001); // randFromTo_Int: function (min, max) {
return Math.floor(val); // var val = this.randFromTo(min, max + 1 - 0.0001);
}, // return Math.floor(val);
// 深拷贝 // },
deepCopy: function (src) { // // 深拷贝
var cpy = src instanceof Array ? [] : {}; // deepCopy: function (src) {
for (var i in src) { // var cpy = src instanceof Array ? [] : {};
cpy[i] = typeof src[i] === 'object' ? this.deepCopy(src[i]) : src[i]; // for (var i in src) {
} // cpy[i] = typeof src[i] === 'object' ? this.deepCopy(src[i]) : src[i];
return cpy; // }
}, // return cpy;
// },
//生成唯一标识
generateUUID: function () { // //生成唯一标识
var d = new Date().getTime(); // generateUUID: function () {
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { // var d = new Date().getTime();
var r = (d + Math.random() * 16) % 16 | 0; // var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
d = Math.floor(d / 16); // var r = (d + Math.random() * 16) % 16 | 0;
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); // d = Math.floor(d / 16);
}); // return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
return uuid; // });
}, // return uuid;
// },
deletList: function (list, val) {
var index = list(val); // deletList: function (list, val) {
if (index > -1) { // var index = list(val);
this.splice(index, 1); // if (index > -1) {
} // this.splice(index, 1);
} // }
} // }
// }
export function getPosByAngle(angle, len) { export function getPosByAngle(angle, len) {
...@@ -242,30 +243,3 @@ async function rabbonFall(node) { ...@@ -242,30 +243,3 @@ async function rabbonFall(node) {
rabbonFall(node); rabbonFall(node);
} }
export function playAudio(audioClip, cb=null) {
if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
return audioId;
}
}
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
playAudio(audioClip, cb);
});
}
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Learn life-cycle callbacks: // Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import { asyncDelay, RandomInt, showFireworks } from "../common/utils"; import { asyncDelay, RandomInt, showFireworks } from "../common/DG_27_utils";
var effect = cc.Class({ var effect = cc.Class({
extends: cc.Component, extends: cc.Component,
......
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