增加loading界面
This commit is contained in:
1 parent
a3f61a29d0
commit
e84e14783e
69 files changed
+1394
-31
No files matched your search
@@ -8,6 +8,7 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('GuestLoginView')
|
||||
export class GuestLoginView extends Component implements LoginViewPort {
|
||||
static readonly AUTHENTICATED = 'guest-authenticated';
|
||||
static readonly STATE_CHANGED = 'guest-login-state-changed';
|
||||
@property({ type: Button }) guestButton: Button | null = null;
|
||||
@property({ type: Label }) statusLabel: Label | null = null;
|
||||
private presenter: GuestLoginPresenter | null = null;
|
||||
@@ -30,6 +31,7 @@ export class GuestLoginView extends Component implements LoginViewPort {
|
||||
this.statusLabel.string = state.message;
|
||||
this.statusLabel.node.active = state.message.length > 0;
|
||||
}
|
||||
this.node.emit(GuestLoginView.STATE_CHANGED, state);
|
||||
}
|
||||
onDisable(): void { this.presenter?.cancel(); }
|
||||
onDestroy(): void {
|
||||
|
||||
@@ -1,11 +1,50 @@
|
||||
import { _decorator, Button, Canvas, Color, Component, Label, Node, Sprite, UITransform, Widget } from 'cc';
|
||||
import { EDITOR } from 'cc/env';
|
||||
import { GuestLoginView } from './GuestLoginView';
|
||||
import { StartupLoadingView } from '../../startup/scripts/StartupLoadingView';
|
||||
const { ccclass, executeInEditMode, property } = _decorator;
|
||||
|
||||
/** 仅按显式开关校准已存在节点,不在运行时重建界面。 / Explicit editor-only calibration of existing nodes; never rebuild UI at runtime. */
|
||||
@ccclass('WelcomeLayoutAuthoring')
|
||||
@executeInEditMode
|
||||
export class WelcomeLayoutAuthoring extends Component {
|
||||
@property
|
||||
get applyPreparationLayout(): boolean { return false; }
|
||||
set applyPreparationLayout(value: boolean) {
|
||||
if (!EDITOR || !value) return;
|
||||
const panel = this.child(this.node, 'PreparationPanel');
|
||||
const group = this.child(this.node, 'WelcomeComposition');
|
||||
const loading = this.node.getComponent(StartupLoadingView);
|
||||
if (!loading || !loading.frameArtwork || !loading.fillArtwork) throw new Error('Preparation artwork is not bound.');
|
||||
this.box(panel, 0, 0, 1080, 1920);
|
||||
this.text(this.child(panel, 'PreparationTitle'), 'LOADING...', -45, -454, 640, 90, 68);
|
||||
this.text(this.child(panel, 'PreparationPercent'), '70%', 368, -454, 220, 90, 68);
|
||||
this.text(this.child(panel, 'PreparationCaption'), 'Getting things ready', 0, -699, 920, 76, 51);
|
||||
for (const name of ['PreparationTitle', 'PreparationPercent', 'PreparationCaption']) {
|
||||
this.child(panel, name).getComponent(Label)!.isBold = true;
|
||||
}
|
||||
const frame = this.child(panel, 'PreparationFrame');
|
||||
this.box(frame, -2.5, -576, 973, 168);
|
||||
frame.getComponent(Sprite)!.spriteFrame = loading.frameArtwork;
|
||||
this.sprite(frame);
|
||||
const fill = this.child(panel, 'PreparationFill');
|
||||
this.box(fill, -458, -582, 906, 102);
|
||||
fill.getComponent(UITransform)!.setAnchorPoint(0, .5);
|
||||
const meter = fill.getComponent(Sprite)!;
|
||||
meter.spriteFrame = loading.fillArtwork;
|
||||
this.sprite(fill);
|
||||
meter.type = Sprite.Type.SLICED;
|
||||
// 左右圆头保持固定宽度,中段伸缩,不拉伸整条高光。 / Keep rounded caps fixed and stretch only the center highlight.
|
||||
// 九宫格边距由重命名资源的导入设置持久化。 / Slice borders are persisted in the renamed resource import settings.
|
||||
loading.login = group.getComponent(GuestLoginView);
|
||||
loading.panel = panel;
|
||||
loading.meter = meter;
|
||||
loading.percentage = this.child(panel, 'PreparationPercent').getComponent(Label);
|
||||
loading.caption = this.child(panel, 'PreparationCaption').getComponent(Label);
|
||||
loading.loginControls = ['GuestAccess', 'GuestReassurance', 'PrivacyLink', 'TermsLink', 'LegalDivider', 'AuthenticationStatus'].map(name => this.child(group, name));
|
||||
fill.getComponent(UITransform)!.setContentSize(906 * .7, 102);
|
||||
panel.active = false;
|
||||
}
|
||||
@property
|
||||
get applyReferenceLayout(): boolean { return false; }
|
||||
set applyReferenceLayout(value: boolean) {
|
||||
|
||||
Reference in new issue
Block a user