Sign_Reward.ts 1.4 KB

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