优化弹窗UI细节

This commit is contained in:
zpx committed 2026-11-20 20:32:40 +08:00
1 parent eb48d8e845
commit b2036cd9bc
30 files changed
+7385 -2859

No files matched your search

+18 -5
View File
@@ -1,6 +1,6 @@
import { _decorator, assetManager, BitmapFont, Component, Graphics, Mask, Sprite, SpriteFrame, UITransform, Widget } from 'cc';
import { EDITOR } from 'cc/env';
import { ART, ART_KEYS, FONT_UUID, SYMBOL_ART } from './OrchardAssets';
import { ART, ART_KEYS, CELEBRATION_FONT_UUID, FONT_UUID, SYMBOL_ART } from './OrchardAssets';
import { OrchardComposer } from './OrchardComposer';
import { authorDialogs } from './OrchardDialogs';
import { OrchardView } from './OrchardView';
@@ -12,11 +12,20 @@ const { ccclass, property, executeInEditMode } = _decorator;
export class OrchardAuthoring extends Component {
@property status = 'Not authored';
@property
get applyDialogReferences(): boolean { return false; }
set applyDialogReferences(value: boolean) {
if (!EDITOR || !value || this.status === 'Preparing artwork') return;
this.loadArtwork(true);
}
@property
get composeReference(): boolean { return false; }
set composeReference(value: boolean) {
if (!EDITOR || !value || this.status === 'Preparing artwork') return;
this.loadArtwork(false);
}
private loadArtwork(dialogsOnly: boolean): void {
this.status = 'Preparing artwork';
assetManager.loadAny([...ART_KEYS.map(key => ART[key]), FONT_UUID], (error, assets) => {
assetManager.loadAny([...ART_KEYS.map(key => ART[key]), FONT_UUID, CELEBRATION_FONT_UUID], (error, assets) => {
if (!this.isValid) return;
if (error) { this.status = 'Artwork preparation failed'; return; }
try {
@@ -24,8 +33,12 @@ export class OrchardAuthoring extends Component {
const view = this.node.getComponent(OrchardView) ?? this.node.addComponent(OrchardView);
view.artFrames = list.slice(0, ART_KEYS.length) as SpriteFrame[];
view.numerals = list[ART_KEYS.length] as BitmapFont;
this.compose(view);
this.status = 'Ready: editable reference layout';
view.celebrationNumerals = list[ART_KEYS.length + 1] as BitmapFont;
if (dialogsOnly) {
const ui = new OrchardComposer(this.node, key => view.artFrames[ART_KEYS.indexOf(key)], view.numerals!);
authorDialogs(ui, view.celebrationNumerals);
} else this.compose(view);
this.status = dialogsOnly ? 'Ready: seven dialog references applied' : 'Ready: editable reference layout';
} catch (cause) { this.status = `Layout error: ${cause instanceof Error ? cause.message : 'unknown'}`; }
});
}
@@ -85,6 +98,6 @@ export class OrchardAuthoring extends Component {
ui.button('GuideAccess', 'guide-pill', 164, 1720, 284, 123);
ui.button('GiftAccess', 'daily-pill', 928, 1720, 264, 121);
ui.text('GameNotice', '', 540, 191, 760, 84, 30).active = false;
authorDialogs(ui);
authorDialogs(ui, view.celebrationNumerals ?? undefined);
}
}