代码拉取完成,页面将自动刷新
同步操作将从 xuchongwu/cocos_creator_proj_base 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
let handler_pool:handler[] = [];
let handler_pool_size = 10;
//用于绑定回调函数this指针
export class handler
{
private cb:Function;
private host:any;
private args:any[];
constructor(){}
init(cb:Function, host = null, ...args)
{
this.cb = cb;
this.host = host;
this.args = args;
}
exec(...extras)
{
this.cb.apply(this.host, this.args.concat(extras));
}
}
export function gen_handler(cb:Function, host:any = null, ...args:any[]):handler
{
let single_handler:handler = handler_pool.length < 0 ? handler_pool.pop(): new handler()
//这里要展开args, 否则会将args当数组传给wrapper, 导致其args参数变成2维数组[[]]
single_handler.init(cb, host, ...args);
return single_handler;
}
export function strfmt(fmt:string, ...args:any[])
{
return fmt.replace(/\{(\d+)\}/g, (match:string, argIndex:number) => {
return args[argIndex] || match;
});
}
export function extend(target, ...sources) {
for (var i = 0; i < sources.length; i += 1) {
var source = sources[i];
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = source[key];
}
}
}
return target;
}
export function createBreathAction(node:cc.Node, min = 0.9, max = 1.1)
{
const action = cc.repeatForever(cc.sequence(cc.scaleTo(0.6, max), cc.scaleTo(0.6, min)));
node.runAction(action);
}
export function destroyBreathAction(node:cc.Node)
{
node.stopAllActions();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。