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;IACP,CAAC;IA1Be,8BAAe,kBA0B9B,CAAA;IAED,oBAAoB;IACb,KAAK,UAAU,SAAS,CAAC,IAA4B,EAAE,MAAmD;QAC7G,OAAO,IAAI,OAAO,CAAM,OAAO,CAAC,EAAE;YAC9B,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE;gBAClB,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;gBACtD,OAAO,EAAE,CAAC;gBACV,OAAO;aACV;YACD,IAAI,EAAE,GAAG,IAAI,YAAY,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;YACxD,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC;gBACzC,OAAO,EAAE,CAAA;YACb,CAAC,CAAC,CAAC,CAAC,CAAA;QACR,CAAC,CAAC,CAAA;IACN,CAAC;IAZqB,wBAAS,YAY9B,CAAA;AACL,CAAC,EArEgB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAqE9B","file":"","sourceRoot":"/","sourcesContent":["import FrameAnimation from \"../components/FrameAnimation\";\nimport { ScheduleUtils } from \"./ScheduleUtils\";\n\nexport namespace AnimationUtils {\n export function playFrameAnimation(node: cc.Node, loop: boolean, name: string, callback?: (loopCount?: number) => void) {\n let anims = node.getComponents(FrameAnimation)\n if (!anims || anims.length == 0) {\n return\n }\n let findOne: FrameAnimation = anims[0]\n for (let i = 0; i < anims.length; i++) {\n const anim = anims[i];\n if (anim.tag == name) {\n findOne = anim\n } else {\n anim.enabled = false\n }\n }\n findOne.enabled = true;\n findOne.play(callback, loop);\n }\n\n export function playFrameAnimationOnce(node: cc.Node, name: string, callback?: (loopCount?: number) => void) {\n playFrameAnimation(node, false, name, callback);\n }\n\n export function playFrameAnimationLoop(node: cc.Node, name: string) {\n playFrameAnimation(node, true, name);\n }\n\n export function animateProgress(progressBar: cc.ProgressBar, progress: number, speed = 1, label?: cc.Label): Promise<void> {\n return new Promise((resolve) => {\n let oldProgress = progressBar.progress\n if (oldProgress == progress) {\n resolve();\n return;\n }\n if (progress > 1) progress = 1;\n if (progress < 0) progress = 0;\n let delta = progress - oldProgress;\n\n if ((<any>progressBar).updateFunc) ScheduleUtils.unscheduleUpdate((<any>progressBar).updateFunc);\n const update = (dt: number) => {\n oldProgress += delta * dt * speed;\n if ((delta > 0 && oldProgress > progress) || (delta < 0 && oldProgress < progress)) {\n oldProgress = progress;\n delete (<any>progressBar).updateFunc;\n ScheduleUtils.unscheduleUpdate(update);\n resolve();\n }\n progressBar.progress = oldProgress;\n if (label) label.string = `${Math.round(oldProgress * 1000) / 10}%`;\n }\n (<any>progressBar).updateFunc = update;\n ScheduleUtils.scheduleUpdate(update);\n });\n }\n\n //异步动画执行API. 方便链式调用.\n export async function runAction(node: cc.Node | cc.Component, action: cc.FiniteTimeAction | cc.FiniteTimeAction[]): Promise<any> {\n return new Promise<any>(resolve => {\n if (!action || !node) {\n console.info(\"runAction param is null:\", node, action)\n resolve();\n return;\n }\n let nd = node instanceof cc.Component ? node.node : node\n nd.runAction(cc.sequence(action, cc.callFunc(function () {\n resolve()\n })))\n })\n }\n}\n"]}