AutoLogin.ts 872 B

1234567891011121314151617181920212223242526272829303132
  1. import { _decorator, Node } from 'cc';
  2. import { UIViewID } from '@scripts/define/UIDefine';
  3. import { addBtnClick } from '@scripts/utils/UIHelper';
  4. import { AppKernel } from '@scripts/app/AppKernel';
  5. import { UIPopup } from '@scripts/framework/ui/UIPopup';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('AutoLogin')
  8. export class AutoLogin extends UIPopup {
  9. readonly viewId = UIViewID.AutoLogin;
  10. @property(Node)
  11. private btnClose: Node = null;
  12. @property(Node)
  13. private btnPlay: Node = null;
  14. protected onCreate(): void | Promise<void> {
  15. addBtnClick(this.btnClose, this.onBtnCloseClick, this);
  16. addBtnClick(this.btnPlay, this.onBtnPlayClick, this);
  17. }
  18. private async onBtnCloseClick() {
  19. await AppKernel.appLobby.onLoginSuccess();
  20. AppKernel.ui.close(UIViewID.AutoLogin);
  21. }
  22. private onBtnPlayClick() {
  23. this.onBtnCloseClick();
  24. }
  25. }