Sign_Reward.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { _decorator, Component, Node } from 'cc';
  2. import ch_sign from 'db://assets/ch/sign/sign';
  3. import { UINotify } from 'db://assets/module_basic/ui_notify/UINotify';
  4. import { Hall } from 'db://assets/Scripts/Hall';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('Sign_Reward')
  7. export class Sign_Reward extends Component {
  8. @property(Node)
  9. Mask: Node = null;
  10. @property([Number])
  11. type: number[] = [];
  12. @property([Number])
  13. num: number[] = [];
  14. start() {
  15. }
  16. async show(day: number) {
  17. let state = await ch_sign.getInstance().checkSigineState(day);
  18. console.log(day + ':' + state);
  19. this.Mask.active = state == 1;
  20. }
  21. add_Item(flag: boolean) {
  22. for (let i = 0; i < this.type.length; i++) {
  23. let Num=flag?(this.num[i]*2).toString():this.num[i].toString()
  24. switch(this.type[i])
  25. {
  26. case 1:
  27. UINotify.show('获得消除印章'+'X'+Num);
  28. break;
  29. case 2:
  30. UINotify.show('获得洗牌卡'+'X'+Num);
  31. break;
  32. case 3:
  33. UINotify.show('获得清空'+'X'+Num);
  34. break;
  35. }
  36. Hall.getInstance().player.add_item(this.type[i], flag?this.num[i]*2:this.num[i]);
  37. }
  38. }
  39. }