| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import PoolMgr, { NODEPOOLPREFABTYPE } from "../../mgr/PoolMgr";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class BonusTip extends cc.Component {
- public curBonusNum: number = 0;
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- start() {
- }
- // update (dt) {}
- public init(bonusNum: number) {
- this.node.getComponent(cc.Sprite).enabled = false;
- if (this.curBonusNum != bonusNum) {
- this.curBonusNum = bonusNum;
- let index = bonusNum - 4 + 1;
- //LogUtil.log("【BonusTip】bonusNum", bonusNum);
- mk.loader.load(`game/texture/tip/${index}`,cc.SpriteFrame).then((spriteFrame)=>{
- this.node.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- this.node.getComponent(cc.Sprite).enabled = true;
- })
- }
- else {
- this.node.getComponent(cc.Sprite).enabled = true;
- }
- this.node.opacity = 255;
- this.node.scaleX = this.node.scaleY = 0.8;
- this.node.setPosition(0, 0);
- //礼物
- cc.tween(this.node)
- .to(0.3, { scale: 1.2 }, { easing: "smooth" })
- .to(0.1, { scale: 1 }, { easing: "smooth" })
- .delay(0.2)
- .to(0.2, { scale: 2, opacity: 0 }, { easing: "smooth" })
- .call(() => {
- PoolMgr.Inst.recyclePoolPrefab(NODEPOOLPREFABTYPE.BonusTip, this.node);
- })
- .start();
- }
- }
|