HeroRewardGetItem.ts 1.1 KB

12345678910111213141516171819202122
  1. import { _decorator, Component, Node, Label } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('HeroRewardGetItem')
  4. export class HeroRewardGetItem extends Component {
  5. @property({ type: Node, displayName: "类型_粮草", tooltip: "类型_粮草" }) nodeLc: Node = null;
  6. @property({ type: Node, displayName: "类型_红包币", tooltip: "类型_红包币" }) nodeBb: Node = null;
  7. @property({ type: Node, displayName: "广告icon", tooltip: "广告icon" }) nodeAd: Node = null;
  8. @property({ type: Label, displayName: "文本_数量", tooltip: "文本_数量" }) txtNum: Label = null;
  9. @property({ type: Label, displayName: "文本_名称", tooltip: "文本_名称" }) txtName: Label = null;
  10. public init(type: number, num: number, isAdReward: boolean) {
  11. this.nodeLc.active = type == 1;
  12. this.nodeBb.active = type == 3;
  13. this.nodeAd.active = type == 3;
  14. this.txtName.string = type == 1 ? "粮草" : "红包币";
  15. this.txtNum.string = num + "";
  16. this.nodeAd.active = isAdReward;
  17. }
  18. }