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AAI,EAAE,EAAE,CAAC,QAAQ,CACtC,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,EACrB,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EACjB,EAAE,CAAC,KAAK,CACJ,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EACtB,EAAE,CAAC,QAAQ,CACP,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EACjB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAClB,CACJ,CACJ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,IAAI,EAAE;oBACN,IAAK,IAAY,CAAC,KAAK,EAAE;wBACrB,iCAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;qBACjC;yBAAM;wBACH,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;qBAC/B;iBACJ;gBACD,SAAS,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAvCe,qBAAQ,WAuCvB,CAAA;AACL,CAAC,EAhDgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAgD5B","file":"","sourceRoot":"/","sourcesContent":["import { NodePoolFactory } from \"../../utils/NodePoolFactory\";\r\nimport { AnimationUtils } from \"../../utils/AnimationUtils\";\r\n\r\nexport namespace ToastManager {\r\n    const path = \"prefab/ui/Toast\";\r\n    let nodeCount = 0;\r\n\r\n    export async function init() {\r\n        await NodePoolFactory.createPool(path, 3);\r\n    }\r\n\r\n    export function addToast(parent: cc.Node, content: string | cc.Node) {\r\n        let node = typeof content === \"string\" ? NodePoolFactory.getNode(path) : content;\r\n        if (node) {\r\n            nodeCount++;\r\n            if (typeof content === \"string\") {\r\n                let textComp = node.getChildByName(\"text\").getComponent(cc.RichText);\r\n                textComp.string = content;\r\n\r\n                node.height = textComp.node.height + 10;\r\n            }\r\n            node.stopAllActions();\r\n            node.x = 0;\r\n            node.y = 0;\r\n            node.scaleX = 0;\r\n            node.scaleY = 0;\r\n            node.opacity = 255;\r\n\r\n            node.parent = parent;\r\n            AnimationUtils.runAction(node, cc.sequence(\r\n                cc.scaleTo(0.2, 1, 1),\r\n                cc.delayTime(0.2),\r\n                cc.spawn(\r\n                    cc.moveBy(0.8, 0, 100),\r\n                    cc.sequence(\r\n                        cc.delayTime(0.6),\r\n                        cc.fadeOut(0.2)\r\n                    )\r\n                )\r\n            )).then(() => {\r\n                if (node) {\r\n                    if ((node as any)._path) {\r\n                        NodePoolFactory.putNode(node);\r\n                    } else {\r\n                        node.removeFromParent(true);\r\n                    }\r\n                }\r\n                nodeCount--;\r\n            });\r\n        }\r\n    }\r\n}"]}