增加loading界面

This commit is contained in:
zpx committed 2026-11-20 16:29:14 +08:00
1 parent a3f61a29d0
commit e84e14783e
69 files changed
+1394 -31

No files matched your search

@@ -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) {