| 12345678910111213141516171819202122232425262728 |
- import { _decorator, Button, Node } from 'cc';
- import { UIView } from '@scripts/framework/ui/UIView';
- import { AppKernel } from '@scripts/app/AppKernel';
- import { LoginType } from '@scripts/define/Define';
- import { UIViewID } from '@scripts/define/UIDefine';
- const { ccclass, property } = _decorator;
- @ccclass('LoginView')
- export class LoginView extends UIView {
- readonly viewId = UIViewID.LoginView;
- @property(Button)
- btnGuest: Button;
- protected onCreate(): void | Promise<void> {
- this.btnGuest.node.on(Node.EventType.TOUCH_END, this.onBtnGuestClick, this);
- }
- private async onBtnGuestClick() {
- AppKernel.ui.loading(true);
- const loggedIn = await AppKernel.stores.mainStore.reqLogin({ type: LoginType.GUEST });
- if (!loggedIn) return;
- await AppKernel.services.lobbyService.onLoginSuccess();
- AppKernel.ui.loading(false);
- }
- }
|