TurnableItem.ts 491 B

12345678910111213141516
  1. const { ccclass, property } = cc._decorator;
  2. @ccclass
  3. export default class TurnableItem extends cc.Component {
  4. @property(cc.Sprite)
  5. icon: cc.Sprite = null;
  6. @property(cc.Label)
  7. lbl_name: cc.Label = null;
  8. public async initData(type) {
  9. this.icon.spriteFrame = await mk.loader.load('module/turnable/texture/hb' + type, cc.SpriteFrame);
  10. this.lbl_name.string = type == 1 ? "少量红包" : type == 2 ? "中量红包" : "大量红包";
  11. }
  12. }