| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
- import { TIP_SPRITEITEM_TYPE } from "../../mgr/EffectMgr";
- import PoolMgr, { NODEPOOLPREFABTYPE } from "../../mgr/PoolMgr";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class TipSpriteItemUI extends cc.Component {
- @property(cc.Sprite)
- public spr_tipSpr: cc.Sprite = null;
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- start() {
- }
- // update (dt) {}
- init(tipSpriteItemType: TIP_SPRITEITEM_TYPE) {
- this.spr_tipSpr.node.active = false;
- let url = `game/texture/tip/${tipSpriteItemType}`;
- mk.loader.load(url,cc.SpriteFrame).then((spriteFrame)=>{
- this.spr_tipSpr.spriteFrame = spriteFrame;
- this.spr_tipSpr.node.active = true;
- this.move();
- })
-
- }
- //移动
- move() {
- this.node.scaleX = this.node.scaleY = 0;
- cc.tween(this.node).to(0.5, { scale: 1 }, { easing: "backOut" })
- .delay(0.5)
- .to(0.1, { scale: 1.2 })
- .to(0.2, { scale: 0 })
- .call(() => {
- PoolMgr.Inst.recyclePoolPrefab(NODEPOOLPREFABTYPE.TipSpriteItemUI, this.node);
- })
- .start();
- }
- }
|