| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // 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 PoolMgr, { NODEPOOLPREFABTYPE } from "../../mgr/PoolMgr";
- import LevelRedPacketUI from "../LevelRedPacketUI";
- import Game from "../../Game";
- import GameMgr, { UIITEM_NAME, UI_NAME } from "../../mgr/GameMgr";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class LevelRedPacketItem extends cc.Component {
- @property(cc.Animation)
- ani_waggle: cc.Animation = null;
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- start() {
- this.node.on(cc.Node.EventType.TOUCH_END, this.onClick, this);
- }
- // update (dt) {}
- onClick() {
-
- GameMgr.Inst.sendEvent(UIITEM_NAME.LevelRedPacketItem,"点击随机红包");
-
- mk.ui.openPanel("game/prefab/uiPanel/LevelRedPacketUI").then((node)=>{
- node.getComponent(LevelRedPacketUI).init(Game.Inst.cleanedVecArr.length);
- })
-
- this.recycle();
- }
- recycle() {
- PoolMgr.Inst.recyclePoolPrefab(NODEPOOLPREFABTYPE.LevelRedPacketItem, this.node);
- }
- }
|