Sign_Reward.ts 1014 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { _decorator, Button, Component, Node, Sprite } from 'cc';
  2. import ch_sign from '../../ch/sign/sign';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('Sign_Reward')
  5. export class Sign_Reward extends Component {
  6. @property(Node)
  7. private mask:Node=null;
  8. @property(Node)
  9. private gift:Node=null;
  10. @property(Node)
  11. private hadSign:Node=null;
  12. @property(Button)
  13. private sign_btn:Button=null;
  14. onLoad() {
  15. this.mask=this.node.getChildByName("Mask");
  16. this.gift=this.node.getChildByName("Gift");
  17. this.hadSign=this.node.getChildByName("HadSign");
  18. this.sign_btn=this.node.getComponent(Button);
  19. this.sign_btn.node.on(Button.EventType.CLICK,this.show,this);
  20. }
  21. update(deltaTime: number) {
  22. }
  23. async show(day:number){
  24. let state=await ch_sign.getInstance().checkSigineState(day);
  25. // 0未签到 1已签到 2失效等待补签
  26. this.mask.active=state==1;
  27. this.hadSign.active=state==1;
  28. }
  29. }