import { _decorator, Button, Color, EditBox, instantiate, Label, Node, RichText, Sprite, SpriteFrame, UITransform } from 'cc'; import { UIViewID } from '@scripts/define/UIDefine'; import { UICloseReason } from '@scripts/framework/ui/UILayer'; import { addBtnClick } from '@scripts/utils/UIHelper'; import { AppKernel } from '@scripts/app/AppKernel'; import { UIPopup } from '@scripts/framework/ui/UIPopup'; import { checkIsEmail } from '@scripts/utils/Helper'; const { ccclass, property } = _decorator; @ccclass('Register') export class Register extends UIPopup { readonly viewId = UIViewID.Register; @property(Node) private btnClose: Node = null; @property(Node) private btnSignUp: Node = null; @property(EditBox) account: EditBox; @property(EditBox) code: EditBox; @property(EditBox) psd: EditBox; @property(EditBox) inviteCode: EditBox; protected onCreate(): void | Promise { addBtnClick(this.btnClose, this.onBtnCloseClick, this); addBtnClick(this.btnSignUp, this.onBtnSignUpClick, this); } private onBtnCloseClick() { AppKernel.ui.close(UIViewID.Register); // const loginView = AppKernel.ui.get(UIViewID.LoginView) as any; // if (loginView && loginView?.enabled) { // loginView?._googleWebBtn?.setActive(true); // } } private async onBtnSignUpClick() { const account = this.account.string; const code = this.code.string; const password = this.psd.string; const act = this.inviteCode.string; if (account && code && password) { const res = checkIsEmail(account) ? await AppKernel.stores.mailStore.reqRegister({ account, code, password, act }) : await AppKernel.services.loginService.register({ account, code, password, act }); if (res) { await AppKernel.services.loginService.loginAccount(account, password); await AppKernel.ui.close(UIViewID.Register); await AppKernel.ui.open(UIViewID.LoginSuccess); } } } }