WithdrawalItem.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. import { _decorator, Component, Node, Label, EventHandler, Button } from 'cc';
  2. import { BitmapFont } from '../core/ui/BitmapFont';
  3. import { WithDrawType } from './MyWalletUI';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('WithdrawalItem')
  6. export class WithdrawalItem extends Component {
  7. @property({ tooltip: "剩余次数", type: Label }) public times: Label;
  8. @property({ tooltip: "提现金额", type: BitmapFont }) private moneyTxt: BitmapFont;
  9. @property({ tooltip: "选中高亮", type: Node }) public chooseImg: Node;
  10. public chooseChangeBack: EventHandler;
  11. public itemData: any;
  12. public chooseID: number;
  13. start() {
  14. }
  15. public setData(data: { id: number, type: number, needWatchVideo: boolean, des: string, money: number, needBonus: number, message: string }, chooseID: number) {
  16. this.chooseID = chooseID;
  17. this.itemData = data;
  18. data.type == WithDrawType.Frist && (this.times.string = "新手档");
  19. data.type != WithDrawType.Frist && (this.times.string = "");
  20. this.moneyTxt.string = data.money + "元";
  21. this.node.getComponent(Button).interactable = true;
  22. }
  23. public choose() {
  24. this.chooseChangeBack && this.chooseChangeBack.emit([this.chooseID, this.itemData.message, this.itemData.type, this.itemData.id]);
  25. }
  26. }