优化弹窗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

+5505 -2771
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "1e2c5c21-d85b-4a72-a0f1-c3c96595bd64",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "1e2c5c21-d85b-4a72-a0f1-c3c96595bd64@6c48a",
"displayName": "claimed-amount",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "1e2c5c21-d85b-4a72-a0f1-c3c96595bd64",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "1e2c5c21-d85b-4a72-a0f1-c3c96595bd64@f9941",
"displayName": "claimed-amount",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 3,
"trimY": 6,
"width": 759,
"height": 159,
"rawWidth": 765,
"rawHeight": 171,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-379.5,
-79.5,
0,
379.5,
-79.5,
0,
-379.5,
79.5,
0,
379.5,
79.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
3,
165,
762,
165,
3,
6,
762,
6
],
"nuv": [
0.00392156862745098,
0.03508771929824561,
0.996078431372549,
0.03508771929824561,
0.00392156862745098,
0.9649122807017544,
0.996078431372549,
0.9649122807017544
],
"minPos": [
-379.5,
-79.5,
0
],
"maxPos": [
379.5,
79.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "1e2c5c21-d85b-4a72-a0f1-c3c96595bd64@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "1e2c5c21-d85b-4a72-a0f1-c3c96595bd64@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "6574915a-44a7-4ea8-9782-056044ded147",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "6574915a-44a7-4ea8-9782-056044ded147@6c48a",
"displayName": "claimed-dismiss",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "6574915a-44a7-4ea8-9782-056044ded147",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "6574915a-44a7-4ea8-9782-056044ded147@f9941",
"displayName": "claimed-dismiss",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 4,
"trimY": 2,
"width": 112,
"height": 116,
"rawWidth": 120,
"rawHeight": 120,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-56,
-58,
0,
56,
-58,
0,
-56,
58,
0,
56,
58,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
4,
118,
116,
118,
4,
2,
116,
2
],
"nuv": [
0.03333333333333333,
0.016666666666666666,
0.9666666666666667,
0.016666666666666666,
0.03333333333333333,
0.9833333333333333,
0.9666666666666667,
0.9833333333333333
],
"minPos": [
-56,
-58,
0
],
"maxPos": [
56,
58,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "6574915a-44a7-4ea8-9782-056044ded147@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "6574915a-44a7-4ea8-9782-056044ded147@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "e64d4a58-5242-4454-a0da-27fa43007a74",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "e64d4a58-5242-4454-a0da-27fa43007a74@6c48a",
"displayName": "gift-dismiss",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "e64d4a58-5242-4454-a0da-27fa43007a74",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "e64d4a58-5242-4454-a0da-27fa43007a74@f9941",
"displayName": "gift-dismiss",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 2,
"trimY": 2,
"width": 126,
"height": 126,
"rawWidth": 130,
"rawHeight": 130,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-63,
-63,
0,
63,
-63,
0,
-63,
63,
0,
63,
63,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
2,
128,
128,
128,
2,
2,
128,
2
],
"nuv": [
0.015384615384615385,
0.015384615384615385,
0.9846153846153847,
0.015384615384615385,
0.015384615384615385,
0.9846153846153847,
0.9846153846153847,
0.9846153846153847
],
"minPos": [
-63,
-63,
0
],
"maxPos": [
63,
63,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "e64d4a58-5242-4454-a0da-27fa43007a74@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "e64d4a58-5242-4454-a0da-27fa43007a74@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "357c3de4-a135-4f4b-824b-4d41147cd585",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "357c3de4-a135-4f4b-824b-4d41147cd585@6c48a",
"displayName": "preferences-flourish",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "357c3de4-a135-4f4b-824b-4d41147cd585",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "357c3de4-a135-4f4b-824b-4d41147cd585@f9941",
"displayName": "preferences-flourish",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 68,
"trimY": 2,
"width": 304,
"height": 36,
"rawWidth": 440,
"rawHeight": 40,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-152,
-18,
0,
152,
-18,
0,
-152,
18,
0,
152,
18,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
68,
38,
372,
38,
68,
2,
372,
2
],
"nuv": [
0.15454545454545454,
0.05,
0.8454545454545455,
0.05,
0.15454545454545454,
0.95,
0.8454545454545455,
0.95
],
"minPos": [
-152,
-18,
0
],
"maxPos": [
152,
18,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "357c3de4-a135-4f4b-824b-4d41147cd585@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "357c3de4-a135-4f4b-824b-4d41147cd585@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "0e42ba08-10e3-4a3a-b255-f1c0334c3b9b",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "0e42ba08-10e3-4a3a-b255-f1c0334c3b9b@6c48a",
"displayName": "shortfall-dismiss",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "0e42ba08-10e3-4a3a-b255-f1c0334c3b9b",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "0e42ba08-10e3-4a3a-b255-f1c0334c3b9b@f9941",
"displayName": "shortfall-dismiss",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 4,
"trimY": 2,
"width": 100,
"height": 104,
"rawWidth": 108,
"rawHeight": 108,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-50,
-52,
0,
50,
-52,
0,
-50,
52,
0,
50,
52,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
4,
106,
104,
106,
4,
2,
104,
2
],
"nuv": [
0.037037037037037035,
0.018518518518518517,
0.9629629629629629,
0.018518518518518517,
0.037037037037037035,
0.9814814814814815,
0.9629629629629629,
0.9814814814814815
],
"minPos": [
-50,
-52,
0
],
"maxPos": [
50,
52,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "0e42ba08-10e3-4a3a-b255-f1c0334c3b9b@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "0e42ba08-10e3-4a3a-b255-f1c0334c3b9b@6c48a"
}
}
+210
View File
@@ -0,0 +1,210 @@
import { Color, Graphics, Layers, Sprite, UITransform } from 'cc';
import type { Node } from 'cc';
import type { DialogComposer } from './OrchardDialogs';
type Point = readonly [number, number];
type RGB = readonly [number, number, number];
type Curve = readonly [number, number, number, number, number, number];
const LIGHT_CENTRE: Point = [535, 1090];
const GOLD: RGB = [255, 210, 125];
const PINK: RGB = [255, 135, 199];
/** 参考图坐标统一转为画布中心坐标。 / Convert reference pixels to canvas coordinates. */
function absoluteVertices(graphics: Graphics, points: readonly Point[]): void {
graphics.moveTo(points[0][0] - 540, 960 - points[0][1]);
for (let index = 1; index < points.length; index++) {
graphics.lineTo(points[index][0] - 540, 960 - points[index][1]);
}
graphics.close();
}
function decorationGraphics(ui: DialogComposer, name: string, parent: Node): Graphics {
const node = ui.group(name, parent);
node.layer = Layers.Enum.UI_2D;
node.getComponent(UITransform)!.setContentSize(1080, 1920);
const graphics = node.getComponent(Graphics) ?? node.addComponent(Graphics);
graphics.clear();
return graphics;
}
function polarPoint(radius: number, angle: number): Point {
return [
LIGHT_CENTRE[0] + Math.cos(angle) * radius,
LIGHT_CENTRE[1] + Math.sin(angle) * radius,
];
}
/** 独立扇形径向、横向渐淡,不填充整圆。 / Feather individual rays, never a solid disc. */
function authorRays(ui: DialogComposer, parent: Node): void {
const graphics = decorationGraphics(ui, 'BonusAwardRaysDecor', parent);
const rays: readonly (readonly [number, number, number, number])[] = [
[-176, 5, 610, 27], [-158, 9, 650, 30], [-140, 5, 620, 38],
[-123, 10, 650, 32], [-105, 5, 650, 43], [-88, 9, 650, 35],
[-70, 5, 650, 42], [-53, 10, 650, 31], [-34, 5, 630, 37],
[-17, 8, 650, 29], [2, 5, 610, 31], [20, 9, 625, 25],
[39, 5, 590, 34], [57, 8, 650, 26], [76, 4, 620, 32],
[95, 9, 650, 24], [114, 5, 620, 33], [132, 8, 650, 26],
[151, 5, 610, 35], [165, 4, 630, 25],
];
const feather: readonly (readonly [number, number, number])[] = [
[-1, -0.55, 0.2], [-0.55, 0.55, 1], [0.55, 1, 0.2],
];
const bands = 12;
for (let rayIndex = 0; rayIndex < rays.length; rayIndex++) {
const [degrees, halfWidth, length, opacity] = rays[rayIndex];
const angle = degrees * Math.PI / 180;
const spread = halfWidth * Math.PI / 180;
const tint = rayIndex % 3 === 0 ? PINK : GOLD;
for (let band = 0; band < bands; band++) {
const inner = length * band / bands;
const outer = length * (band + 1) / bands;
const fade = Math.pow(1 - (band + 0.5) / bands, 1.6);
for (const [left, right, strength] of feather) {
const alpha = Math.round(opacity * fade * strength);
if (alpha === 0) continue;
graphics.fillColor = new Color(tint[0], tint[1], tint[2], alpha);
const a = polarPoint(inner, angle + spread * left);
const b = polarPoint(outer, angle + spread * left);
const c = polarPoint(outer, angle + spread * right);
const d = polarPoint(inner, angle + spread * right);
absoluteVertices(graphics, [a, b, c]);
if (band > 0) absoluteVertices(graphics, [a, c, d]);
graphics.fill();
}
}
}
}
const RIBBON_START: Point = [-27, -70];
const RIBBON_CURVES: readonly Curve[] = [
[-65, -62, -53, -20, -12, -27],
[32, -37, 50, -12, 21, 4],
[-12, 24, -33, 5, -22, -9],
[-7, -28, 21, -7, 8, 22],
[-4, 48, -15, 54, 11, 75],
];
/** 多层描边表现卷曲彩带的暗边、曲面和高光。 / Layer strokes for ribbon depth and sheen. */
function authorRibbon(
ui: DialogComposer, parent: Node, name: string, centre: Point,
degrees: number, scale: number, violet: boolean,
): void {
const graphics = decorationGraphics(ui, name, parent);
graphics.lineCap = Graphics.LineCap.ROUND;
graphics.lineJoin = Graphics.LineJoin.ROUND;
const angle = degrees * Math.PI / 180;
const cosine = Math.cos(angle);
const sine = Math.sin(angle);
const transform = (x: number, y: number, offset: Point): Point => [
centre[0] + (x * cosine - y * sine + offset[0]) * scale - 540,
960 - centre[1] - (x * sine + y * cosine + offset[1]) * scale,
];
const strokes: readonly { width: number; tint: RGB; alpha: number; offset: Point }[] = [
{ width: 18, tint: [72, 12, 102], alpha: 125, offset: [2, 3] },
{ width: 14, tint: violet ? [127, 40, 199] : [211, 44, 151], alpha: 245, offset: [0, 0] },
{ width: 8, tint: violet ? [197, 105, 247] : [250, 113, 205], alpha: 245, offset: [-1, -1] },
{ width: 2.5, tint: [255, 222, 252], alpha: 220, offset: [-3, -2] },
];
for (const stroke of strokes) {
graphics.lineWidth = stroke.width * scale;
graphics.strokeColor = new Color(stroke.tint[0], stroke.tint[1], stroke.tint[2], stroke.alpha);
const start = transform(RIBBON_START[0], RIBBON_START[1], stroke.offset);
graphics.moveTo(start[0], start[1]);
for (const curve of RIBBON_CURVES) {
const first = transform(curve[0], curve[1], stroke.offset);
const second = transform(curve[2], curve[3], stroke.offset);
const end = transform(curve[4], curve[5], stroke.offset);
graphics.bezierCurveTo(first[0], first[1], second[0], second[1], end[0], end[1]);
}
graphics.stroke();
}
}
function starPoints(x: number, y: number, radius: number): readonly Point[] {
const waist = radius * 0.14;
return [
[x, y - radius], [x + waist, y - waist],
[x + radius * 0.76, y], [x + waist, y + waist],
[x, y + radius], [x - waist, y + waist],
[x - radius * 0.76, y], [x - waist, y - waist],
];
}
/** 扩散也使用四角路径,保持星芒轻透。 / Use four-point silhouettes for translucent bloom. */
function authorStar(ui: DialogComposer, parent: Node, name: string, x: number, y: number, radius: number): void {
const graphics = decorationGraphics(ui, name, parent);
const layers = [
{ scale: 2.3, tint: GOLD, alpha: 13 },
{ scale: 1.65, tint: GOLD, alpha: 31 },
{ scale: 1.15, tint: GOLD, alpha: 115 },
{ scale: 1, tint: [255, 244, 204] as const, alpha: 240 },
{ scale: 0.56, tint: [255, 255, 255] as const, alpha: 255 },
];
for (const layer of layers) {
graphics.fillColor = new Color(layer.tint[0], layer.tint[1], layer.tint[2], layer.alpha);
absoluteVertices(graphics, starPoints(x, y, radius * layer.scale));
graphics.fill();
}
}
/** 原图含叶片,按原始画幅等比适配。 / Preserve the source fruit and leaves without stretching. */
function authorFruit(
ui: DialogComposer, parent: Node, name: string, key: string,
x: number, y: number, width: number, height: number,
): void {
const node = ui.image(name, key, x, y, width, height, parent);
node.layer = Layers.Enum.UI_2D;
const frame = node.getComponent(Sprite)!.spriteFrame!;
const original = frame.originalSize;
const scale = Math.min(width / original.width, height / original.height);
node.getComponent(UITransform)!.setContentSize(original.width * scale, original.height * scale);
}
/** 只构建庆祝底饰;标题、次数、徽标与按钮由调用方创建。 / Author decorations behind caller-owned content. */
export function authorCelebration(ui: DialogComposer, parent: Node): void {
const decor = ui.group('BonusAwardCelebrationDecor', parent);
decor.layer = Layers.Enum.UI_2D;
decor.getComponent(UITransform)!.setContentSize(1080, 1920);
decor.setSiblingIndex(0);
authorRays(ui, decor);
authorRibbon(ui, decor, 'BonusAwardRibbonUpperLeftDecor', [230, 365], -23, 1.08, false);
authorRibbon(ui, decor, 'BonusAwardRibbonUpperRightDecor', [865, 410], 19, 0.95, true);
authorRibbon(ui, decor, 'BonusAwardRibbonMiddleLeftDecor', [70, 1020], 12, 0.87, true);
authorRibbon(ui, decor, 'BonusAwardRibbonMiddleRightDecor', [992, 1125], -13, 0.95, false);
authorRibbon(ui, decor, 'BonusAwardRibbonLowerLeftDecor', [90, 1350], -18, 0.86, false);
authorRibbon(ui, decor, 'BonusAwardRibbonLowerRightDecor', [980, 1420], 25, 0.82, true);
authorFruit(ui, decor, 'BonusAwardLeftStrawberryDecor', 'crimson-berry', 203, 1170, 240, 265);
authorFruit(ui, decor, 'BonusAwardLeftBlueberriesDecor', 'indigo-bunch', 285, 1240, 160, 164);
authorFruit(ui, decor, 'BonusAwardRightStrawberryDecor', 'crimson-berry', 860, 1223, 185, 204);
authorFruit(ui, decor, 'BonusAwardRightBlueberriesDecor', 'indigo-bunch', 755, 1228, 177, 182);
authorStar(ui, decor, 'BonusAwardStarUpperLeftDecor', 216, 475, 26);
authorStar(ui, decor, 'BonusAwardStarTopDecor', 780, 365, 23);
authorStar(ui, decor, 'BonusAwardStarUpperRightDecor', 980, 647, 30);
authorStar(ui, decor, 'BonusAwardStarMiddleLeftDecor', 224, 1030, 26);
authorStar(ui, decor, 'BonusAwardStarRightDecor', 970, 1280, 25);
authorStar(ui, decor, 'BonusAwardStarLowerLeftDecor', 117, 1515, 16);
authorStar(ui, decor, 'BonusAwardStarLowerRightDecor', 945, 1540, 18);
}
/** 只使用现有装饰节点重绘,禁止因加载场景而重新创建节点。 / Redraw on existing decoration nodes without rebuilding UI at runtime. */
export function drawCelebrationGraphics(parent: Node): void {
const existing = parent.getChildByName('BonusAwardCelebrationDecor');
if (!existing) return;
const ui = {
group: (name: string, owner: Node = parent): Node => {
const node = owner.getChildByName(name);
if (!node) throw new Error(`Missing celebration drawing node: ${name}`);
return node;
},
image: (name: string, _key: string, _x: number, _y: number, _w: number, _h: number, owner: Node = parent): Node => {
const node = owner.getChildByName(name);
if (!node) throw new Error(`Missing celebration image node: ${name}`);
return node;
},
} as DialogComposer;
authorCelebration(ui, parent);
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "7114b1b2-ef88-4471-9f96-9fbdf019a461",
"files": [],
"subMetas": {},
"userData": {}
}
+17
View File
@@ -0,0 +1,17 @@
import { _decorator, Color, Component, Graphics, Node } from 'cc';
import { drawCelebrationGraphics } from './DialogCelebration';
const { ccclass } = _decorator;
/** Graphics的路径不序列化;仅重绘已有节点,不创建运行时UI。 / Redraw saved graphics nodes because drawing commands are not serialized. */
@ccclass('DialogEffects')
export class DialogEffects extends Component {
onLoad(): void {
const shade = this.node.getChildByName('Shade')?.getComponent(Graphics);
if (shade) {
shade.clear(); shade.fillColor = new Color(12, 0, 22, 155);
shade.rect(-10000, -10000, 20000, 20000); shade.fill();
}
const parent = this.node.getChildByName('BonusAwardDialog');
if (parent) drawCelebrationGraphics(parent);
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "04c8a177-fa1f-44c4-b3c9-b098cd4a5d1c",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,67 @@
/** 完整切图中心坐标,原点在1080×1920参考图左上角。 / Full-canvas sprite centres in the portrait reference, without alpha trimming. */
export type DialogBox = readonly [key: string, x: number, y: number, width: number, height: number];
export const REFERENCE_IMAGES: Record<string, DialogBox> = {
PreferencesShell: ['preferences-shell', 538, 856, 884, 1050],
PreferencesTitle: ['preferences-heading', 539.5, 465.5, 505, 85],
PreferencesFlourish: ['preferences-flourish', 540.5, 529.5, 471, 43],
PreferencesMusicRow: ['melody-row', 540, 650.5, 788, 155],
PreferencesSoundRow: ['effects-row', 540, 816, 788, 155],
PreferencesVibrationRow: ['haptics-row', 540, 981.5, 788, 155],
PreferencesMusicToggle: ['toggle-lit', 791, 650.5, 210, 91],
PreferencesSoundToggle: ['toggle-lit', 791, 816, 210, 91],
PreferencesVibrationToggle: ['toggle-lit', 791, 981.5, 210, 91],
PreferencesGuide: ['instructions-pill', 540, 1159.5, 630, 133],
PreferencesClose: ['dismiss-orb', 890.5, 415.5, 123, 121],
RepeatShell: ['repeat-shell', 536.5, 1009, 905, 980],
RepeatGarnish: ['repeat-garnish', 544, 521.5, 228, 213],
RepeatTitle: ['repeat-title', 537, 663.5, 684, 157],
RepeatStart: ['repeat-confirm', 535, 1303.5, 808, 203],
RepeatClose: ['dismiss-orb', 902, 595, 114, 112],
EmptyWalletShell: ['empty-wallet-shell', 534.5, 957.5, 879, 1135],
EmptyWalletTitle: ['empty-wallet-heading', 536.5, 531.5, 747, 329],
EmptyWalletGarnish: ['empty-wallet-garnish', 531.5, 845.5, 707, 391],
EmptyWalletNote: ['empty-wallet-note', 539.5, 1095.5, 539, 111],
EmptyWalletGift: ['empty-wallet-gift', 539, 1262, 780, 175],
EmptyWalletLater: ['empty-wallet-later', 537, 1409, 354, 86],
EmptyWalletClose: ['shortfall-dismiss', 897, 425, 116, 116],
BonusAwardScatter1: ['bonus-award-emblem', 265, 638, 270, 266],
BonusAwardScatter2: ['bonus-award-emblem', 538.5, 618.5, 289, 285],
BonusAwardScatter3: ['bonus-award-emblem', 815, 638, 270, 266],
BonusAwardTitle: ['bonus-award-title', 542, 864, 952, 282],
BonusAwardCaption: ['bonus-award-caption', 535, 1323, 756, 122],
BonusAwardStart: ['bonus-begin', 541, 1503.5, 646, 219],
BonusSummaryShell: ['bonus-summary-shell', 538, 994, 996, 960],
BonusSummaryGarnish: ['bonus-summary-garnish', 540.5, 506.5, 499, 259],
BonusSummaryTitle: ['bonus-summary-title', 539, 754, 762, 248],
BonusSummaryCaption: ['bonus-summary-caption', 543.5, 934, 831, 90],
BonusSummaryAmountPlate: ['bonus-summary-amount', 539, 1075.5, 870, 229],
BonusSummaryContinue: ['bonus-dismiss', 540, 1291, 684, 206],
};
/** 两种领取状态单独还原,不能仅替换标题而保留错误底板。 / Each gift state owns its complete art and layout. */
export const GIFT_REFERENCE: Record<'available' | 'claimed', Record<string, DialogBox>> = {
available: {
GiftShell: ['gift-shell', 537, 938.5, 960, 1247],
GiftTitle: ['gift-heading', 545, 454, 584, 104],
GiftGarnish: ['gift-garnish', 530.5, 743.5, 407, 389],
GiftAmountPlate: ['gift-amount', 538, 1012.5, 766, 163],
GiftDailyLabel: ['gift-daily', 546.5, 1149.5, 731, 65],
GiftClaim: ['gift-collect', 537, 1306, 648, 198],
GiftClose: ['gift-dismiss', 917, 399, 116, 116],
},
claimed: {
GiftShell: ['claimed-shell', 536, 958, 934, 1212],
GiftTitle: ['claimed-heading', 537.5, 517, 763, 372],
GiftGarnish: ['claimed-garnish', 540, 844.5, 348, 247],
GiftAmountPlate: ['claimed-amount', 535, 1035, 750, 168],
GiftDailyLabel: ['claimed-caption', 538.5, 1180.5, 749, 61],
GiftCollected: ['gift-collected', 533.5, 1311.5, 567, 143],
GiftClose: ['claimed-dismiss', 892, 474, 106, 106],
},
};
export const REPEAT_OPTIONS = [
{ count: 10, key: 'ten', x: 356, y: 917 },
{ count: 25, key: 'quarter', x: 727, y: 917 },
{ count: 50, key: 'half', x: 355, y: 1092 },
{ count: 100, key: 'century', x: 730, y: 1092 },
] as const;
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "ce1a12b6-3eed-4a84-83e9-dc2a616ca280",
"files": [],
"subMetas": {},
"userData": {}
}
+6
View File
@@ -53,6 +53,11 @@ export const ART: Record<string, string> = {
'neon-grid': 'dbe9db6c-7b3d-4fdf-b1f5-49af9986ac4e@f9941', 'neon-grid': 'dbe9db6c-7b3d-4fdf-b1f5-49af9986ac4e@f9941',
'paired-rubies': '61cc917c-b5b5-42d5-8776-6b25f8a56771@f9941', 'paired-rubies': '61cc917c-b5b5-42d5-8776-6b25f8a56771@f9941',
'preferences-heading': '5cce6650-a0ea-41f6-bc79-7eee5d551984@f9941', 'preferences-heading': '5cce6650-a0ea-41f6-bc79-7eee5d551984@f9941',
'preferences-flourish': '357c3de4-a135-4f4b-824b-4d41147cd585@f9941',
'gift-dismiss': 'e64d4a58-5242-4454-a0da-27fa43007a74@f9941',
'claimed-dismiss': '6574915a-44a7-4ea8-9782-056044ded147@f9941',
'claimed-amount': '1e2c5c21-d85b-4a72-a0f1-c3c96595bd64@f9941',
'shortfall-dismiss': '0e42ba08-10e3-4a3a-b255-f1c0334c3b9b@f9941',
'preferences-orb': '5aa72211-d961-46f7-9885-bd758762e48d@f9941', 'preferences-orb': '5aa72211-d961-46f7-9885-bd758762e48d@f9941',
'preferences-shell': 'ccd2564c-1f01-421d-99a4-14a702645e7b@f9941', 'preferences-shell': 'ccd2564c-1f01-421d-99a4-14a702645e7b@f9941',
'prism-chime': 'ced72a7e-16ce-4ad2-b797-33f8ba727613@f9941', 'prism-chime': 'ced72a7e-16ce-4ad2-b797-33f8ba727613@f9941',
@@ -100,6 +105,7 @@ export const SYMBOL_ART: Record<SymbolId, string> = {
}; };
export const FONT_UUID = '76285818-1331-4483-8f03-aefb51af3f34'; export const FONT_UUID = '76285818-1331-4483-8f03-aefb51af3f34';
export const CELEBRATION_FONT_UUID = 'd1794df0-a1e3-4d67-9123-a7f735833c4f';
export const ART_KEYS = Object.keys(ART).sort(); export const ART_KEYS = Object.keys(ART).sort();
+18 -5
View File
@@ -1,6 +1,6 @@
import { _decorator, assetManager, BitmapFont, Component, Graphics, Mask, Sprite, SpriteFrame, UITransform, Widget } from 'cc'; import { _decorator, assetManager, BitmapFont, Component, Graphics, Mask, Sprite, SpriteFrame, UITransform, Widget } from 'cc';
import { EDITOR } from 'cc/env'; 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 { OrchardComposer } from './OrchardComposer';
import { authorDialogs } from './OrchardDialogs'; import { authorDialogs } from './OrchardDialogs';
import { OrchardView } from './OrchardView'; import { OrchardView } from './OrchardView';
@@ -12,11 +12,20 @@ const { ccclass, property, executeInEditMode } = _decorator;
export class OrchardAuthoring extends Component { export class OrchardAuthoring extends Component {
@property status = 'Not authored'; @property status = 'Not authored';
@property @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; } get composeReference(): boolean { return false; }
set composeReference(value: boolean) { set composeReference(value: boolean) {
if (!EDITOR || !value || this.status === 'Preparing artwork') return; if (!EDITOR || !value || this.status === 'Preparing artwork') return;
this.loadArtwork(false);
}
private loadArtwork(dialogsOnly: boolean): void {
this.status = 'Preparing artwork'; 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 (!this.isValid) return;
if (error) { this.status = 'Artwork preparation failed'; return; } if (error) { this.status = 'Artwork preparation failed'; return; }
try { try {
@@ -24,8 +33,12 @@ export class OrchardAuthoring extends Component {
const view = this.node.getComponent(OrchardView) ?? this.node.addComponent(OrchardView); const view = this.node.getComponent(OrchardView) ?? this.node.addComponent(OrchardView);
view.artFrames = list.slice(0, ART_KEYS.length) as SpriteFrame[]; view.artFrames = list.slice(0, ART_KEYS.length) as SpriteFrame[];
view.numerals = list[ART_KEYS.length] as BitmapFont; view.numerals = list[ART_KEYS.length] as BitmapFont;
this.compose(view); view.celebrationNumerals = list[ART_KEYS.length + 1] as BitmapFont;
this.status = 'Ready: editable reference layout'; 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'}`; } } 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('GuideAccess', 'guide-pill', 164, 1720, 284, 123);
ui.button('GiftAccess', 'daily-pill', 928, 1720, 264, 121); ui.button('GiftAccess', 'daily-pill', 928, 1720, 264, 121);
ui.text('GameNotice', '', 540, 191, 760, 84, 30).active = false; ui.text('GameNotice', '', 540, 191, 760, 84, 30).active = false;
authorDialogs(ui); authorDialogs(ui, view.celebrationNumerals ?? undefined);
} }
} }
@@ -7,6 +7,7 @@ export class OrchardComposer implements DialogComposer {
group(name: string, parent = this.root): Node { group(name: string, parent = this.root): Node {
const node = parent.getChildByName(name) ?? new Node(name); const node = parent.getChildByName(name) ?? new Node(name);
node.parent = parent; node.parent = parent;
node.setSiblingIndex(parent.children.length - 1);
node.layer = Layers.Enum.UI_2D; node.layer = Layers.Enum.UI_2D;
node.setPosition(0, 0, 0); node.setPosition(0, 0, 0);
node.getComponent(UITransform) ?? node.addComponent(UITransform); node.getComponent(UITransform) ?? node.addComponent(UITransform);
+88 -73
View File
@@ -1,9 +1,13 @@
import { BlockInputEvents, Button, Label, Node, Sprite, SpriteFrame, UITransform } from 'cc'; import { BitmapFont, BlockInputEvents, Button, Label, LabelShadow, Color, Node, Sprite, SpriteFrame, UITransform, Vec2 } from 'cc';
import type { GameSession, GameState } from './GameSession'; import type { GameSession, GameState } from './GameSession';
import { SYMBOL_ART } from './OrchardAssets'; import { SYMBOL_ART } from './OrchardAssets';
import { PAYLINES, PAYTABLE } from './SlotsMath'; import { PAYLINES, PAYTABLE } from './SlotsMath';
import type { OrdinarySymbol } from './SlotsMath'; import type { OrdinarySymbol } from './SlotsMath';
import { director } from 'cc'; import { director } from 'cc';
import { GuestLegalLinks } from '../../login/scripts/GuestLegalLinks';
import { GIFT_REFERENCE, REFERENCE_IMAGES, REPEAT_OPTIONS, type DialogBox } from './DialogReferenceLayout';
import { authorCelebration } from './DialogCelebration';
import { DialogEffects } from './DialogEffects';
/** /**
* Coordinates are screen centres in the 1080 x 1920 reference layout (origin: top left). * Coordinates are screen centres in the 1080 x 1920 reference layout (origin: top left).
@@ -33,17 +37,12 @@ const GROUP_NAMES: Record<VisibleDialog, string> = {
error: 'ErrorDialog', error: 'ErrorDialog',
}; };
const AUTO_OPTIONS = [ const AUTO_OPTIONS = REPEAT_OPTIONS;
{ count: 10, key: 'ten', x: 340, y: 880 },
{ count: 25, key: 'quarter', x: 740, y: 880 },
{ count: 50, key: 'half', x: 340, y: 1080 },
{ count: 100, key: 'century', x: 740, y: 1080 },
] as const;
const PREFERENCES: readonly { key: PreferenceKey; name: string; art: string; y: number }[] = [ const PREFERENCES: readonly { key: PreferenceKey; name: string; art: string; y: number }[] = [
{ key: 'music', name: 'Music', art: 'melody-row', y: 790 }, { key: 'music', name: 'Music', art: 'melody-row', y: 650.5 },
{ key: 'sound', name: 'Sound', art: 'effects-row', y: 955 }, { key: 'sound', name: 'Sound', art: 'effects-row', y: 816 },
{ key: 'vibration', name: 'Vibration', art: 'haptics-row', y: 1120 }, { key: 'vibration', name: 'Vibration', art: 'haptics-row', y: 981.5 },
]; ];
const PAYING_SYMBOLS = Object.keys(PAYTABLE) as OrdinarySymbol[]; const PAYING_SYMBOLS = Object.keys(PAYTABLE) as OrdinarySymbol[];
@@ -95,8 +94,9 @@ function body(ui: DialogComposer, name: string, value: string, y: number, h: num
* Authors ModalLayer/ Shade + eight independent dialog groups. No scene is saved here. * Authors ModalLayer/ Shade + eight independent dialog groups. No scene is saved here.
* Button and live-label names below are the shared authoring/runtime contract. * Button and live-label names below are the shared authoring/runtime contract.
*/ */
export function authorDialogs(ui: DialogComposer): void { export function authorDialogs(ui: DialogComposer, celebrationFont?: BitmapFont): void {
const layer = ui.group('ModalLayer'); const layer = ui.group('ModalLayer');
layer.getComponent(DialogEffects) ?? layer.addComponent(DialogEffects);
const shade = ui.shade('Shade', layer); const shade = ui.shade('Shade', layer);
if (!shade.getComponent(BlockInputEvents)) shade.addComponent(BlockInputEvents); if (!shade.getComponent(BlockInputEvents)) shade.addComponent(BlockInputEvents);
const groups = {} as Record<VisibleDialog, Node>; const groups = {} as Record<VisibleDialog, Node>;
@@ -105,68 +105,83 @@ export function authorDialogs(ui: DialogComposer): void {
groups[kind].active = false; groups[kind].active = false;
} }
const picture = (name: string, parent: Node, button = false, box: DialogBox = REFERENCE_IMAGES[name]): Node => {
const [key, x, y, w, h] = box;
const node = button ? ui.button(name, key, x, y, w, h, parent) : ui.image(name, key, x, y, w, h, parent);
node.setSiblingIndex(parent.children.length - 1);
return node;
};
const white = (name: string, text: string, x: number, y: number, w: number, h: number, size: number, parent: Node): Node => {
const node = ui.text(name, text, x, y, w, h, size, parent);
const shadow = node.getComponent(LabelShadow) ?? node.addComponent(LabelShadow);
shadow.color = new Color(18, 0, 21, 190); shadow.offset = new Vec2(0, -3); shadow.blur = 2;
return node;
};
const repeat = groups.repeat; const repeat = groups.repeat;
ui.image('RepeatShell', 'repeat-shell', 540, 960, 870, 990, repeat); picture('RepeatShell', repeat);
ui.image('RepeatTitle', 'repeat-title', 540, 600, 630, 145, repeat); picture('RepeatGarnish', repeat);
ui.image('RepeatGarnish', 'repeat-garnish', 225, 705, 150, 140, repeat); picture('RepeatTitle', repeat);
ui.text('RepeatHint', 'CHOOSE YOUR SPINS', 595, 735, 570, 60, 34, repeat); white('RepeatHint', 'Choose number of spins', 540, 777, 740, 76, 48, repeat);
for (const option of AUTO_OPTIONS) { for (const option of AUTO_OPTIONS) {
ui.button(`RepeatCount${option.count}`, `${option.key}-${option.count === 10 ? 'picked' : 'idle'}`, const selected = option.count === 25;
option.x, option.y, 360, 170, repeat); ui.button(`RepeatCount${option.count}`, `${option.key}-${selected ? 'picked' : 'idle'}`,
option.x, option.y, selected ? 377 : 364, selected ? 178 : 172, repeat);
} }
ui.button('RepeatStart', 'repeat-confirm', 540, 1300, 735, 185, repeat); picture('RepeatStart', repeat, true);
ui.button('RepeatClose', 'dismiss-orb', 900, 510, 114, 112, repeat); white('RepeatFooter', 'Stop anytime', 540, 1414, 480, 60, 38, repeat);
picture('RepeatClose', repeat, true);
const preferences = groups.preferences; const preferences = groups.preferences;
ui.image('PreferencesShell', 'preferences-shell', 540, 960, 879, 1035, preferences); preferences.getChildByName('PreferencesNote')?.destroy();
ui.image('PreferencesTitle', 'preferences-heading', 540, 568, 505, 85, preferences); picture('PreferencesShell', preferences);
picture('PreferencesTitle', preferences);
picture('PreferencesFlourish', preferences);
for (const preference of PREFERENCES) { for (const preference of PREFERENCES) {
ui.image(`Preferences${preference.name}Row`, preference.art, 540, preference.y, 788, 155, preferences); picture(`Preferences${preference.name}Row`, preferences);
ui.button(`Preferences${preference.name}Toggle`, 'toggle-lit', 795, preference.y, 216, 94, preferences); picture(`Preferences${preference.name}Toggle`, preferences, true);
} }
ui.button('PreferencesGuide', 'instructions-pill', 540, 1318, 630, 133, preferences); picture('PreferencesGuide', preferences, true);
ui.text('PreferencesNote', 'Preferences are saved on this device.', 540, 1430, 790, 50, 32, preferences); const privacy = labelButton(ui, 'PreferencesPrivacy', 'Privacy Policy', 335, 1281, 260, preferences);
ui.button('PreferencesClose', 'dismiss-orb', 900, 510, 114, 112, preferences); const terms = labelButton(ui, 'PreferencesTerms', 'Terms of Service', 726, 1281, 310, preferences);
for (const link of [privacy, terms]) {
const text = link.getComponent(Label)!;
text.fontSize = 34; text.lineHeight = 42; text.isBold = false; text.isUnderline = true;
link.getComponent(UITransform)!.setContentSize(link === privacy ? 260 : 310, 62);
}
const notice = ui.text('PreferencesLegalNotice', '', 540, 1335, 760, 40, 23, preferences);
notice.active = false;
const legal = preferences.getComponent(GuestLegalLinks) ?? preferences.addComponent(GuestLegalLinks);
legal.privacyButton = privacy.getComponent(Button); legal.termsButton = terms.getComponent(Button); legal.notice = notice.getComponent(Label);
picture('PreferencesClose', preferences, true);
const gift = groups.gift; const gift = groups.gift;
ui.image('GiftShell', 'gift-shell', 540, 960, 928, 1205, gift); for (const name of ['GiftShell', 'GiftTitle', 'GiftGarnish', 'GiftAmountPlate']) picture(name, gift, false, GIFT_REFERENCE.available[name]);
ui.image('GiftTitle', 'gift-heading', 540, 465, 590, 105, gift); white('GiftAmount', `${coins(DAILY_COINS)} COINS`, 600, 1012.5, 550, 120, 82, gift);
ui.image('GiftGarnish', 'gift-garnish', 540, 760, 415, 397, gift); picture('GiftDailyLabel', gift, false, GIFT_REFERENCE.available.GiftDailyLabel);
ui.image('GiftAmountPlate', 'gift-amount', 540, 1030, 782, 166, gift); picture('GiftClaim', gift, true, GIFT_REFERENCE.available.GiftClaim);
ui.text('GiftAmount', coins(DAILY_COINS), 600, 1030, 530, 120, 96, gift, true); picture('GiftCollected', gift, false, GIFT_REFERENCE.claimed.GiftCollected).active = false;
ui.image('GiftDailyLabel', 'gift-daily', 540, 1180, 738, 66, gift); const footer = white('GiftCountdown', 'Available once per UTC day.', 540, 1446, 820, 60, 36, gift);
ui.button('GiftClaim', 'gift-collect', 540, 1340, 642, 196, gift); footer.getComponent(Label)!.isBold = false;
ui.image('GiftCollected', 'gift-collected', 540, 1340, 585, 147, gift).active = false; picture('GiftClose', gift, true, GIFT_REFERENCE.available.GiftClose);
ui.text('GiftCountdown', 'Available once per UTC day.', 540, 1480, 820, 60, 32, gift);
ui.button('GiftClose', 'dismiss-orb', 920, 405, 114, 112, gift);
const empty = groups.empty; const empty = groups.empty;
ui.image('EmptyWalletShell', 'empty-wallet-shell', 540, 960, 862, 1113, empty); for (const name of ['EmptyWalletShell', 'EmptyWalletTitle', 'EmptyWalletGarnish', 'EmptyWalletNote']) picture(name, empty);
ui.image('EmptyWalletTitle', 'empty-wallet-heading', 540, 600, 705, 310, empty); for (const name of ['EmptyWalletGift', 'EmptyWalletLater', 'EmptyWalletClose']) picture(name, empty, true);
ui.image('EmptyWalletNote', 'empty-wallet-note', 540, 825, 523, 108, empty);
ui.image('EmptyWalletGarnish', 'empty-wallet-garnish', 540, 1050, 661, 365, empty);
ui.button('EmptyWalletGift', 'empty-wallet-gift', 540, 1300, 703, 158, empty);
ui.button('EmptyWalletLater', 'empty-wallet-later', 540, 1435, 350, 85, empty);
ui.button('EmptyWalletClose', 'dismiss-orb', 902, 465, 108, 108, empty);
const award = groups.award; const award = groups.award;
ui.image('BonusAwardShell', 'repeat-shell', 540, 960, 870, 990, award); award.getChildByName('BonusAwardShell')?.destroy();
ui.image('BonusAwardTitle', 'bonus-award-title', 540, 620, 824, 244, award); authorCelebration(ui, award);
ui.image('BonusAwardCaption', 'bonus-award-caption', 540, 822, 680, 109, award); for (const name of ['BonusAwardScatter1', 'BonusAwardScatter2', 'BonusAwardScatter3', 'BonusAwardTitle']) picture(name, award);
ui.text('BonusAwardCount', '0', 540, 985, 440, 200, 180, award, true); const count = ui.text('BonusAwardCount', '8', 534, 1116, 620, 350, 325, award, true);
for (let index = 0; index < 3; index++) { count.getComponent(Label)!.lineHeight = 325;
ui.image(`BonusAwardScatter${index + 1}`, 'bonus-award-emblem', 350 + index * 190, 1145, 155, 153, award); if (celebrationFont) { count.getComponent(Label)!.font = celebrationFont; count.getComponent(Label)!.useSystemFont = false; }
} picture('BonusAwardCaption', award);
ui.button('BonusAwardStart', 'bonus-begin', 540, 1340, 640, 217, award); picture('BonusAwardStart', award, true);
const summary = groups.summary; const summary = groups.summary;
ui.image('BonusSummaryShell', 'bonus-summary-shell', 540, 960, 1060, 945, summary); for (const name of ['BonusSummaryShell', 'BonusSummaryGarnish', 'BonusSummaryTitle', 'BonusSummaryCaption', 'BonusSummaryAmountPlate']) picture(name, summary);
ui.image('BonusSummaryTitle', 'bonus-summary-title', 540, 650, 770, 250, summary); ui.text('BonusSummaryAmount', '0', 619, 1075.5, 480, 146, 126, summary, true);
ui.image('BonusSummaryCaption', 'bonus-summary-caption', 540, 852, 690, 75, summary); picture('BonusSummaryContinue', summary, true);
ui.image('BonusSummaryGarnish', 'bonus-summary-garnish', 850, 1180, 330, 171, summary);
ui.image('BonusSummaryAmountPlate', 'bonus-summary-amount', 540, 1018, 780, 205, summary);
ui.text('BonusSummaryAmount', '0', 540, 1018, 680, 150, 108, summary, true);
ui.button('BonusSummaryContinue', 'bonus-dismiss', 540, 1280, 630, 190, summary);
const guide = groups.guide; const guide = groups.guide;
ui.image('GuideShell', 'preferences-shell', 540, 960, 980, 1550, guide); ui.image('GuideShell', 'preferences-shell', 540, 960, 980, 1550, guide);
@@ -278,7 +293,7 @@ export class OrchardDialogs {
private visible: VisibleDialog | null = null; private visible: VisibleDialog | null = null;
private errorReturn: DialogKind | null = null; private errorReturn: DialogKind | null = null;
private guideReturn: 'preferences' | null = null; private guideReturn: 'preferences' | null = null;
private selectedCount: number = AUTO_OPTIONS[0].count; private selectedCount: number = 25;
private guidePage = 0; private guidePage = 0;
private working = false; private working = false;
private persistenceFailed = false; private persistenceFailed = false;
@@ -477,7 +492,9 @@ export class OrchardDialogs {
private refreshRepeat(): void { private refreshRepeat(): void {
for (const option of AUTO_OPTIONS) { for (const option of AUTO_OPTIONS) {
this.setArt(`RepeatCount${option.count}`, `${option.key}-${option.count === this.selectedCount ? 'picked' : 'idle'}`); const selected = option.count === this.selectedCount;
this.setArt(`RepeatCount${option.count}`, `${option.key}-${selected ? 'picked' : 'idle'}`);
this.required(`RepeatCount${option.count}`).getComponent(UITransform)!.setContentSize(selected ? 377 : 364, selected ? 178 : 172);
} }
} }
@@ -490,30 +507,28 @@ export class OrchardDialogs {
private refreshGift(): void { private refreshGift(): void {
const available = this.session.canClaimDaily(); const available = this.session.canClaimDaily();
for (const [name, key, x, y, w, h] of (available ? [ for (const [name, [key, x, y, w, h]] of Object.entries(GIFT_REFERENCE[available ? 'available' : 'claimed'])) {
['GiftShell', 'gift-shell', 540, 960, 928, 1205],
['GiftTitle', 'gift-heading', 540, 465, 590, 105],
['GiftGarnish', 'gift-garnish', 540, 760, 415, 397],
['GiftDailyLabel', 'gift-daily', 540, 1180, 738, 66],
] : [
['GiftShell', 'claimed-shell', 540, 960, 925, 1150],
['GiftTitle', 'claimed-heading', 540, 520, 755, 368],
['GiftGarnish', 'claimed-garnish', 540, 840, 355, 252],
['GiftDailyLabel', 'claimed-caption', 540, 1180, 764, 62],
]) as [string, string, number, number, number, number][]) {
this.setArt(name, key); this.setArt(name, key);
this.required(name).setPosition(x - 540, 960 - y, 0); this.required(name).setPosition(x - 540, 960 - y, 0);
this.required(name).getComponent(UITransform)!.setContentSize(w, h); this.required(name).getComponent(UITransform)!.setContentSize(w, h);
} }
this.required('GiftClaim').active = available; this.required('GiftClaim').active = available;
this.required('GiftCollected').active = !available; this.required('GiftCollected').active = !available;
this.label('GiftAmount').string = coins(DAILY_COINS); const amount = this.label('GiftAmount');
amount.string = `${coins(DAILY_COINS)} COINS`;
amount.fontSize = available ? 82 : 96; amount.lineHeight = available ? 94 : 110;
amount.node.setPosition(available ? 60 : -5, available ? -52.5 : -75, 0);
amount.node.getComponent(UITransform)!.setContentSize(available ? 550 : 660, 125);
const seconds = Math.ceil(Math.max(0, this.session.nextResetMs()) / 1000); const seconds = Math.ceil(Math.max(0, this.session.nextResetMs()) / 1000);
const hours = Math.floor(seconds / 3600); const hours = Math.floor(seconds / 3600);
const minutes = Math.floor(seconds % 3600 / 60); const minutes = Math.floor(seconds % 3600 / 60);
const remaining = seconds % 60; const remaining = seconds % 60;
const time = [hours, minutes, remaining].map(value => String(value).padStart(2, '0')).join(':'); const time = [hours, minutes, remaining].map(value => String(value).padStart(2, '0')).join(':');
this.label('GiftCountdown').string = `${available ? 'Resets' : 'Next gift'} in ${time} (UTC)`; const countdown = this.label('GiftCountdown');
countdown.string = available ? 'Available once per UTC day.' : `Next claim in ${time}`;
countdown.node.setPosition(0, available ? -486 : -459, 0);
countdown.fontSize = available ? 36 : 38;
countdown.isBold = !available;
} }
private turnGuide(direction: number): void { private turnGuide(direction: number): void {
+1
View File
@@ -13,6 +13,7 @@ const { ccclass, property } = _decorator;
export class OrchardView extends Component { export class OrchardView extends Component {
@property({ type: [SpriteFrame] }) artFrames: SpriteFrame[] = []; @property({ type: [SpriteFrame] }) artFrames: SpriteFrame[] = [];
@property({ type: BitmapFont }) numerals: BitmapFont | null = null; @property({ type: BitmapFont }) numerals: BitmapFont | null = null;
@property({ type: BitmapFont }) celebrationNumerals: BitmapFont | null = null;
ready = false; ready = false;
private session: GameSession | null = null; private session: GameSession | null = null;
private reels: ReelPresentation | null = null; private reels: ReelPresentation | null = null;
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "4cd0e680-9a46-4b07-90cf-266292493c86",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "4cd0e680-9a46-4b07-90cf-266292493c86@6c48a",
"displayName": "celebration-glyphs",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "4cd0e680-9a46-4b07-90cf-266292493c86",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "4cd0e680-9a46-4b07-90cf-266292493c86@f9941",
"displayName": "celebration-glyphs",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": -214,
"offsetY": 166.5,
"trimX": 10,
"trimY": 10,
"width": 1600,
"height": 671,
"rawWidth": 2048,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-800,
-335.5,
0,
800,
-335.5,
0,
-800,
335.5,
0,
800,
335.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
10,
1014,
1610,
1014,
10,
343,
1610,
343
],
"nuv": [
0.0048828125,
0.3349609375,
0.7861328125,
0.3349609375,
0.0048828125,
0.990234375,
0.7861328125,
0.990234375
],
"minPos": [
-800,
-335.5,
0
],
"maxPos": [
800,
335.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "4cd0e680-9a46-4b07-90cf-266292493c86@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": false,
"hasAlpha": true,
"redirect": "4cd0e680-9a46-4b07-90cf-266292493c86@6c48a"
}
}
@@ -0,0 +1,15 @@
info face="Orchard Celebration Numerals" size=325 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0
common lineHeight=325 base=325 scaleW=2048 scaleH=1024 pages=1 packed=0
page id=0 file="celebration-glyphs.png"
chars count=10
char id=48 x=8 y=8 width=275 height=317 xoffset=0 yoffset=8 xadvance=278 page=0 chnl=15
char id=49 x=338 y=8 width=236 height=312 xoffset=0 yoffset=13 xadvance=239 page=0 chnl=15
char id=50 x=668 y=8 width=261 height=313 xoffset=0 yoffset=12 xadvance=264 page=0 chnl=15
char id=51 x=998 y=8 width=253 height=317 xoffset=0 yoffset=8 xadvance=256 page=0 chnl=15
char id=52 x=1328 y=8 width=284 height=314 xoffset=0 yoffset=11 xadvance=287 page=0 chnl=15
char id=53 x=8 y=358 width=270 height=320 xoffset=0 yoffset=5 xadvance=273 page=0 chnl=15
char id=54 x=338 y=358 width=270 height=321 xoffset=0 yoffset=4 xadvance=273 page=0 chnl=15
char id=55 x=668 y=358 width=269 height=320 xoffset=0 yoffset=5 xadvance=272 page=0 chnl=15
char id=56 x=998 y=358 width=269 height=325 xoffset=0 yoffset=0 xadvance=272 page=0 chnl=15
char id=57 x=1328 y=358 width=273 height=324 xoffset=0 yoffset=1 xadvance=276 page=0 chnl=15
kernings count=0
@@ -0,0 +1,132 @@
{
"ver": "1.0.6",
"importer": "bitmap-font",
"imported": true,
"uuid": "d1794df0-a1e3-4d67-9123-a7f735833c4f",
"files": [
".json"
],
"subMetas": {},
"userData": {
"_fntConfig": {
"commonHeight": 325,
"fontSize": 325,
"atlasName": "celebration-glyphs.png",
"fontDefDictionary": {
"48": {
"rect": {
"x": 8,
"y": 8,
"width": 275,
"height": 317
},
"xOffset": 0,
"yOffset": 8,
"xAdvance": 278
},
"49": {
"rect": {
"x": 338,
"y": 8,
"width": 236,
"height": 312
},
"xOffset": 0,
"yOffset": 13,
"xAdvance": 239
},
"50": {
"rect": {
"x": 668,
"y": 8,
"width": 261,
"height": 313
},
"xOffset": 0,
"yOffset": 12,
"xAdvance": 264
},
"51": {
"rect": {
"x": 998,
"y": 8,
"width": 253,
"height": 317
},
"xOffset": 0,
"yOffset": 8,
"xAdvance": 256
},
"52": {
"rect": {
"x": 1328,
"y": 8,
"width": 284,
"height": 314
},
"xOffset": 0,
"yOffset": 11,
"xAdvance": 287
},
"53": {
"rect": {
"x": 8,
"y": 358,
"width": 270,
"height": 320
},
"xOffset": 0,
"yOffset": 5,
"xAdvance": 273
},
"54": {
"rect": {
"x": 338,
"y": 358,
"width": 270,
"height": 321
},
"xOffset": 0,
"yOffset": 4,
"xAdvance": 273
},
"55": {
"rect": {
"x": 668,
"y": 358,
"width": 269,
"height": 320
},
"xOffset": 0,
"yOffset": 5,
"xAdvance": 272
},
"56": {
"rect": {
"x": 998,
"y": 358,
"width": 269,
"height": 325
},
"xOffset": 0,
"yOffset": 0,
"xAdvance": 272
},
"57": {
"rect": {
"x": 1328,
"y": 358,
"width": 273,
"height": 324
},
"xOffset": 0,
"yOffset": 1,
"xAdvance": 276
}
},
"kerningDict": {}
},
"fontSize": 325,
"textureUuid": "4cd0e680-9a46-4b07-90cf-266292493c86"
}
}
+34
View File
@@ -0,0 +1,34 @@
# 弹窗参考图修正
## 修正范围
本轮只修正已存在的七种美术状态:设置、自动旋转设置、每日金币可领取、已领取、余额不足、免费旋转触发和结果。玩法概率、金币结算和自动队列不变。新增图片与两份专用字体文件均重新命名,原始美术未修改。
- 设置:标题、下划线、三行设置、开关、说明按钮和关闭按钮按参考坐标重新排列;恢复两条白色常规字重下划线法律链接,移除额外保存说明。未配置法律地址时沿用明确的缺失提示。
- 自动设置:樱桃居中压在顶边,标题和说明独立对齐;默认选择25,普通与选中态使用各自切图并考虑透明留白;补回 Stop anytime。
- 每日金币:可领取与已领取分别拥有底板、标题、装饰、金额板、关闭按钮、说明和按钮坐标。金额使用白色 20,000 COINS,不误用仅含数字的金色字体。领取前保留 Available once per UTC day.,领取后显示 Next claim in HH:MM:SS。
- 余额不足:恢复标题/水果金币/说明/领取按钮/稍后按钮的上下层次,使用本组关闭切图。
- 免费触发:移除错误的矩形底板,恢复上方三个SCATTER、标题、325px专用数字、AWARDED与START的顺序。专用字体使用celebration-numerals与celebration-glyphs,字形覆盖0–9并同步page引用;8、12、16均动态排版。使用325行高,防止通用1.15倍行距将实际字缩至304。
- 免费结果:樱桃居中压顶,独立校准框体横纵比例、标题、TOTAL WIN、金额板和继续按钮;数字区域从金币右侧开始,避免覆盖金币。
## 可见效果与技术修正
切图使用1080×1920完整画布中心坐标,不将透明留白误认为内容中心。底板轮廓通过左右、上下发光描边复核,避免只靠等比模板匹配导致高度错误。
Graphics绘图命令不会随场景序列化,新增DialogEffects在加载弹窗时对已有遮罩和装饰节点重新绘制;运行时不创建新UI。遮罩压暗背景,输入阻断保持。庆祝光束、彩带、星芒为独立图形节点,水果为已有独立切图。
免费触发原文件夹没有独立光束、彩带、两侧组合装饰切图。本轮按构图重建这些效果,属于近似重绘,不宣称与原图逐像素一致;未将参考整图贴成运行背景。
新增applyDialogReferences显式编辑入口,只更新弹窗与新增资源绑定,不执行主界面composeReference。保留并行发生的主界面调整。
## 验证
- pnpm typecheck、pnpm test(106项)与web-mobile构建。
- 保存场景对比测量坐标、资源UUID、法律链接样式、白色金额及单位、字体page、0–9字符、8/12/16宽度、层级及独立装饰节点。
- 发布页逐态切换,核对遮罩路径、三种字号与字体、面板资源、领取前后文案;设置开关、关闭、次数选择、法律链接缺地址提示均已操作。
- 采用内存隔离存档验证领取增加20,000且重复点击不再次领取,08:42:15倒计时格式及领取前后底板和关闭图切换;不重置真实存档。
- 540×960、390×844、390×640在窗口布局稳定后一帧检查七种状态文字和按钮均无可见区域越界。
- 视觉检查与行为测试分开报告;自动化通过不等于像素级还原。
- 最终发布产物再次验证8、12、16的实际渲染字号均为325;遮罩及14个Graphics节点均有运行时绘图路径,4个水果节点使用独立切图。真实余额118,000保持,模拟领取与免费状态仅存在于内存测试会话。
最终输出:build/web-mobile-dialog-reference-release。未构建原生包、未进行真机验证;庆祝页缺少的原始装饰已如上说明。
+2 -2
View File
@@ -5,7 +5,7 @@
- Welcome 保持启动入口。两步游客认证成功后,获取同游客的独占存档权限,恢复本地游戏并加载 Orchard 场景;依赖就绪后 loading 收满并同步切入首屏。 - Welcome 保持启动入口。两步游客认证成功后,获取同游客的独占存档权限,恢复本地游戏并加载 Orchard 场景;依赖就绪后 loading 收满并同步切入首屏。
- Orchard 为独立 1080×1920 场景。主界面、5 列裁切窗口、动态数字、8 组弹窗和操作按钮均为已保存的独立节点;运行时更新已有节点,不创建整套 UI。 - Orchard 为独立 1080×1920 场景。主界面、5 列裁切窗口、动态数字、8 组弹窗和操作按钮均为已保存的独立节点;运行时更新已有节点,不创建整套 UI。
- 正常状态按主参考图排版。自动状态使用与免费旋转相同结构的 AUTO SPINS/数字/LEFT 横幅,STOP 完成本局后停止。免费状态使用独立 CURRENT WIN/TOTAL WIN 区,锁下注和主按钮。 - 正常状态按主参考图排版。自动状态使用与免费旋转相同结构的 AUTO SPINS/数字/LEFT 横幅,STOP 完成本局后停止。免费状态使用独立 CURRENT WIN/TOTAL WIN 区,锁下注和主按钮。
- 所有新增切图、字体、图集和工程目录均重新命名;assets/orchard 下绑定 81 张切图,符号目录为 emblems,弹窗为 dialogs,字体为 typefaces。amber-numerals.fnt 内 page 指向 amber-glyph-atlas.png,包含 0–9、逗号、小数点。WIN、BET、累计金额和剩余次数使用该字体,钱包白字与英文保持参考样式。 - 所有新增切图、字体、图集和工程目录均重新命名;assets/orchard 下绑定 86 张切图,符号目录为 emblems,弹窗为 dialogs,字体为 typefaces。amber-numerals.fnt 内 page 指向 amber-glyph-atlas.png,包含 0–9、逗号、小数点。WIN、BET、累计金额和横幅次数使用该字体;免费触发大数字使用 celebration-numerals,领取弹窗金额按参考改为白色金额加COINS单位。
- 每日金币包含可领取与已领取美术状态、UTC 倒计时。帮助页由实际赔率表和赔付线数据生成,不使用整张参考图覆盖。 - 每日金币包含可领取与已领取美术状态、UTC 倒计时。帮助页由实际赔率表和赔付线数据生成,不使用整张参考图覆盖。
## 代码职责 ## 代码职责
@@ -39,6 +39,6 @@
- 内存隔离测试存档完整执行免费触发、8 局转换及结果确认,累计与余额增量一致,自动未恢复;未修改真实存档的概率或免费状态。 - 内存隔离测试存档完整执行免费触发、8 局转换及结果确认,累计与余额增量一致,自动未恢复;未修改真实存档的概率或免费状态。
- 540×960、390×844、390×640、844×390 检查主控件与常用弹窗边界均在可见区域内。 - 540×960、390×844、390×640、844×390 检查主控件与常用弹窗边界均在可见区域内。
- 同源独立文档共享存储时,已有独占锁使第二文档抢锁失败,存档未变。集成浏览器新顶层页面使用隔离存储,未将它误认为共享存档测试。 - 同源独立文档共享存储时,已有独占锁使第二文档抢锁失败,存档未变。集成浏览器新顶层页面使用隔离存储,未将它误认为共享存档测试。
- web-mobile 最终交付输出 build/web-mobile-orchard-delivery;发布时包含 Welcome 与 Orchard 两场景。 - 主游戏首版输出 build/web-mobile-orchard-delivery;本轮弹窗修正版输出 build/web-mobile-dialog-reference-release,七种状态与视觉差异详见 dialog-reference-review.md。修正版类型检查、106项测试和构建均通过。
无音频素材,音乐和音效仅保存偏好,尚无实际音轨;震动按浏览器能力执行。未构建原生包或进行真机测试。规则中的理论 RTP 保持设计值,不代表本轮完成了正式数学认证。 无音频素材,音乐和音效仅保存偏好,尚无实际音轨;震动按浏览器能力执行。未构建原生包或进行真机测试。规则中的理论 RTP 保持设计值,不代表本轮完成了正式数学认证。
+427
View File
@@ -0,0 +1,427 @@
import { test } from 'node:test';
import { strict as assert } from 'node:assert';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { ART, CELEBRATION_FONT_UUID, FONT_UUID } from '../assets/orchard/scripts/OrchardAssets';
import { GIFT_REFERENCE, REFERENCE_IMAGES, type DialogBox } from '../assets/orchard/scripts/DialogReferenceLayout';
// These tests inspect saved scene data and imported assets. Live state changes are browser checks.
type Entry = Record<string, any>;
const scene: Entry[] = JSON.parse(readFileSync('assets/Orchard.scene', 'utf8'));
const nodes = scene.filter(entry => entry.__type__ === 'cc.Node');
const WHITE = { __type__: 'cc.Color', r: 255, g: 255, b: 255, a: 255 };
const TOLERANCE = 1;
function dereference(ref: Entry): Entry {
assert.ok(ref && Number.isInteger(ref.__id__), 'expected a saved scene reference');
const entry = scene[ref.__id__];
assert.ok(entry, `missing scene entry ${ref.__id__}`);
return entry;
}
function node(name: string): Entry {
const matches = nodes.filter(entry => entry._name === name);
assert.equal(matches.length, 1, `expected one saved ${name}`);
return matches[0];
}
function children(owner: Entry): Entry[] {
return owner._children.map(dereference);
}
function components(owner: Entry, type: string): Entry[] {
return owner._components.map(dereference).filter((entry: Entry) => entry.__type__ === type);
}
function component(owner: Entry, type: string): Entry {
const matches = components(owner, type);
assert.equal(matches.length, 1, `${owner._name}: expected one ${type}`);
assert.equal(dereference(matches[0].node), owner);
return matches[0];
}
function near(actual: number, expected: number, description: string): void {
assert.ok(Number.isFinite(actual) && Math.abs(actual - expected) <= TOLERANCE,
`${description}: expected ${expected} +/- ${TOLERANCE}px, got ${actual}`);
}
// Accumulate saved ancestor offsets, so moving an entire modal cannot hide a layout regression.
function referenceCenter(owner: Entry): { x: number; y: number } {
let x = 0, y = 0;
const visited = new Set<Entry>();
while (owner.__type__ === 'cc.Node') {
assert.ok(!visited.has(owner), 'saved hierarchy must not cycle');
visited.add(owner);
assert.deepEqual(owner._lscale, { __type__: 'cc.Vec3', x: 1, y: 1, z: 1 }, owner._name);
assert.deepEqual(owner._lrot, { __type__: 'cc.Quat', x: 0, y: 0, z: 0, w: 1 }, owner._name);
assert.equal(owner._lpos.z, 0, owner._name);
x += owner._lpos.x;
y += owner._lpos.y;
owner = dereference(owner._parent);
}
return { x, y: 1920 - y };
}
function assertBox(name: string, x: number, y: number, width: number, height: number): void {
const owner = node(name);
const transform = component(owner, 'cc.UITransform');
assert.deepEqual(transform._anchorPoint, { __type__: 'cc.Vec2', x: .5, y: .5 }, name);
const center = referenceCenter(owner);
near(center.x, x, `${name} reference center x`);
near(center.y, y, `${name} reference center y`);
near(transform._contentSize.width, width, `${name} width`);
near(transform._contentSize.height, height, `${name} height`);
}
function imageMeta(key: string): Entry {
const meta = JSON.parse(readFileSync(join('assets', 'orchard', 'dialogs', `${key}.png.meta`), 'utf8'));
assert.equal(meta.importer, 'image', key);
assert.equal(meta.imported, true, key);
const frames = (Object.values(meta.subMetas) as Entry[]).filter(entry => entry.importer === 'sprite-frame');
assert.equal(frames.length, 1, key);
assert.equal(frames[0].uuid, ART[key], `${key}: imported frame UUID`);
return meta;
}
function assertPicture(name: string, box: DialogBox, parent: string): void {
const [key, x, y, width, height] = box;
assertBox(name, x, y, width, height);
const owner = node(name);
assert.equal(dereference(owner._parent), node(parent), name);
const sprite = component(owner, 'cc.Sprite');
assert.equal(sprite._spriteFrame?.__uuid__, ART[key], `${name}: ${key}`);
imageMeta(key);
}
function assertWhiteSystemLabel(name: string, value: string): Entry {
const label = component(node(name), 'cc.Label');
assert.equal(label._string, value, name);
assert.equal(label._font, null, name);
assert.equal(label._isSystemFontUsed, true, name);
assert.equal(label._fontFamily, 'Arial', name);
assert.deepEqual(label._color, WHITE, name);
assert.equal(label._enableWrapText, false, name);
return label;
}
// Independent full-image measurements in 1080x1920 reference pixels (top-left origin).
// Do not derive these values from the authoring functions or their source strings.
const MEASURED_IMAGES: Record<string, DialogBox> = {
PreferencesShell: ['preferences-shell', 538, 856, 884, 1050],
PreferencesTitle: ['preferences-heading', 539.5, 465.5, 505, 85],
PreferencesFlourish: ['preferences-flourish', 540.5, 529.5, 471, 43],
PreferencesMusicRow: ['melody-row', 540, 650.5, 788, 155],
PreferencesSoundRow: ['effects-row', 540, 816, 788, 155],
PreferencesVibrationRow: ['haptics-row', 540, 981.5, 788, 155],
PreferencesMusicToggle: ['toggle-lit', 791, 650.5, 210, 91],
PreferencesSoundToggle: ['toggle-lit', 791, 816, 210, 91],
PreferencesVibrationToggle: ['toggle-lit', 791, 981.5, 210, 91],
PreferencesGuide: ['instructions-pill', 540, 1159.5, 630, 133],
PreferencesClose: ['dismiss-orb', 890.5, 415.5, 123, 121],
RepeatShell: ['repeat-shell', 536.5, 1009, 905, 980],
RepeatGarnish: ['repeat-garnish', 544, 521.5, 228, 213],
RepeatTitle: ['repeat-title', 537, 663.5, 684, 157],
RepeatStart: ['repeat-confirm', 535, 1303.5, 808, 203],
RepeatClose: ['dismiss-orb', 902, 595, 114, 112],
EmptyWalletShell: ['empty-wallet-shell', 534.5, 957.5, 879, 1135],
EmptyWalletTitle: ['empty-wallet-heading', 536.5, 531.5, 747, 329],
EmptyWalletGarnish: ['empty-wallet-garnish', 531.5, 845.5, 707, 391],
EmptyWalletNote: ['empty-wallet-note', 539.5, 1095.5, 539, 111],
EmptyWalletGift: ['empty-wallet-gift', 539, 1262, 780, 175],
EmptyWalletLater: ['empty-wallet-later', 537, 1409, 354, 86],
EmptyWalletClose: ['shortfall-dismiss', 897, 425, 116, 116],
BonusAwardScatter1: ['bonus-award-emblem', 265, 638, 270, 266],
BonusAwardScatter2: ['bonus-award-emblem', 538.5, 618.5, 289, 285],
BonusAwardScatter3: ['bonus-award-emblem', 815, 638, 270, 266],
BonusAwardTitle: ['bonus-award-title', 542, 864, 952, 282],
BonusAwardCaption: ['bonus-award-caption', 535, 1323, 756, 122],
BonusAwardStart: ['bonus-begin', 541, 1503.5, 646, 219],
BonusSummaryShell: ['bonus-summary-shell', 538, 994, 996, 960],
BonusSummaryGarnish: ['bonus-summary-garnish', 540.5, 506.5, 499, 259],
BonusSummaryTitle: ['bonus-summary-title', 539, 754, 762, 248],
BonusSummaryCaption: ['bonus-summary-caption', 543.5, 934, 831, 90],
BonusSummaryAmountPlate: ['bonus-summary-amount', 539, 1075.5, 870, 229],
BonusSummaryContinue: ['bonus-dismiss', 540, 1291, 684, 206],
};
const MEASURED_GIFTS: Record<'available' | 'claimed', Record<string, DialogBox>> = {
available: {
GiftShell: ['gift-shell', 537, 938.5, 960, 1247],
GiftTitle: ['gift-heading', 545, 454, 584, 104],
GiftGarnish: ['gift-garnish', 530.5, 743.5, 407, 389],
GiftAmountPlate: ['gift-amount', 538, 1012.5, 766, 163],
GiftDailyLabel: ['gift-daily', 546.5, 1149.5, 731, 65],
GiftClaim: ['gift-collect', 537, 1306, 648, 198],
GiftClose: ['gift-dismiss', 917, 399, 116, 116],
},
claimed: {
GiftShell: ['claimed-shell', 536, 958, 934, 1212],
GiftTitle: ['claimed-heading', 537.5, 517, 763, 372],
GiftGarnish: ['claimed-garnish', 540, 844.5, 348, 247],
GiftAmountPlate: ['claimed-amount', 535, 1035, 750, 168],
GiftDailyLabel: ['claimed-caption', 538.5, 1180.5, 749, 61],
GiftCollected: ['gift-collected', 533.5, 1311.5, 567, 143],
GiftClose: ['claimed-dismiss', 892, 474, 106, 106],
},
};
for (const prefix of ['Preferences', 'Repeat', 'EmptyWallet', 'BonusAward', 'BonusSummary']) {
test(`saved ${prefix} artwork matches independent reference measurements within one pixel`, () => {
for (const [name, box] of Object.entries(MEASURED_IMAGES).filter(([name]) => name.startsWith(prefix))) {
assert.deepEqual(REFERENCE_IMAGES[name], box, `${name}: published reference measurement`);
assertPicture(name, box, `${prefix}Dialog`);
}
});
}
test('settings legal links are regular white underlined text below the reference guide button', () => {
assert.ok(!nodes.some(entry => entry._name === 'PreferencesNote'));
for (const [name, value, x, width] of [
['PreferencesPrivacy', 'Privacy Policy', 335, 260],
['PreferencesTerms', 'Terms of Service', 726, 310],
] as const) {
assertBox(name, x, 1281, width, 62);
const label = assertWhiteSystemLabel(name, value);
assert.equal(label._isBold, false, name);
assert.equal(label._isUnderline, true, name);
assert.equal(label._fontSize, 34, name);
assert.equal(label._lineHeight, 42, name);
assert.equal(component(node(name), 'cc.Button')._interactable, true, name);
assert.equal(dereference(node(name)._parent), node('PreferencesDialog'));
}
const legal = node('PreferencesDialog')._components.map(dereference).filter((entry: Entry) =>
entry.privacyButton && entry.termsButton && entry.notice);
assert.equal(legal.length, 1, 'one saved legal-link binding');
assert.equal(dereference(legal[0].privacyButton), component(node('PreferencesPrivacy'), 'cc.Button'));
assert.equal(dereference(legal[0].termsButton), component(node('PreferencesTerms'), 'cc.Button'));
assert.equal(dereference(legal[0].notice), component(node('PreferencesLegalNotice'), 'cc.Label'));
assert.equal(node('PreferencesLegalNotice')._active, false);
});
test('automatic spin options retain measured positions, the selected 25 frame and white captions', () => {
for (const [count, key, x, y] of [
[10, 'ten-idle', 356, 917], [25, 'quarter-picked', 727, 917],
[50, 'half-idle', 355, 1092], [100, 'century-idle', 730, 1092],
] as const) {
const selected = count === 25;
const name = `RepeatCount${count}`;
assertPicture(name, [key, x, y, selected ? 377 : 364, selected ? 178 : 172], 'RepeatDialog');
assert.equal(component(node(name), 'cc.Button')._interactable, true);
}
assertBox('RepeatHint', 540, 777, 740, 76);
assert.equal(assertWhiteSystemLabel('RepeatHint', 'Choose number of spins')._fontSize, 48);
assertBox('RepeatFooter', 540, 1414, 480, 60);
assert.equal(assertWhiteSystemLabel('RepeatFooter', 'Stop anytime')._fontSize, 38);
});
test('available gift is saved with full white coin units and a claim button at least 128px on both axes', () => {
for (const [name, box] of Object.entries(MEASURED_GIFTS.available)) assertPicture(name, box, 'GiftDialog');
assertBox('GiftAmount', 600, 1012.5, 550, 120);
const amount = assertWhiteSystemLabel('GiftAmount', '20,000 COINS');
assert.equal(amount._fontSize, 82);
assert.equal(amount._isBold, true);
const claim = component(node('GiftClaim'), 'cc.Button');
assert.equal(claim._enabled, true);
assert.equal(claim._interactable, true);
assert.equal(claim._transition, 3, 'scale feedback');
assert.equal(claim._zoomScale, .96);
const { width, height } = component(node('GiftClaim'), 'cc.UITransform')._contentSize;
assert.ok(width >= 128 && height >= 128, 'claim touch target must remain usable');
assert.equal(node('GiftClaim')._active, true);
assert.equal(node('GiftCollected')._active, false);
assertPicture('GiftCollected', MEASURED_GIFTS.claimed.GiftCollected, 'GiftDialog');
assert.equal(components(node('GiftCollected'), 'cc.Button').length, 0, 'claimed artwork is not another claim action');
assertBox('GiftCountdown', 540, 1446, 820, 60);
const footer = assertWhiteSystemLabel('GiftCountdown', 'Available once per UTC day.');
assert.equal(footer._isBold, false);
});
test('gift state data owns independently measured art, plate, close and button geometry for both states', () => {
assert.deepEqual(Object.keys(GIFT_REFERENCE).sort(), ['available', 'claimed']);
for (const state of ['available', 'claimed'] as const) {
assert.deepEqual(GIFT_REFERENCE[state], MEASURED_GIFTS[state], `${state}: independent measured layout`);
for (const [name, [key]] of Object.entries(MEASURED_GIFTS[state])) {
assert.equal(dereference(node(name)._parent), node('GiftDialog'), name);
imageMeta(key);
}
}
for (const name of ['GiftShell', 'GiftTitle', 'GiftGarnish', 'GiftAmountPlate', 'GiftDailyLabel', 'GiftClose']) {
const available = MEASURED_GIFTS.available[name];
const claimed = MEASURED_GIFTS.claimed[name];
assert.notEqual(ART[available[0]], ART[claimed[0]], `${name}: independent state assets`);
assert.notDeepEqual(available.slice(1), claimed.slice(1), `${name}: independently measured geometry`);
}
// The claimed state is runtime-applied, not a second saved GiftDialog; no source-string simulation.
});
test('each close control resolves to its own reference artwork rather than a shared generic replacement', () => {
for (const [name, key] of [
['PreferencesClose', 'dismiss-orb'], ['RepeatClose', 'dismiss-orb'],
['GiftClose', 'gift-dismiss'], ['EmptyWalletClose', 'shortfall-dismiss'],
]) {
assert.equal(component(node(name), 'cc.Sprite')._spriteFrame.__uuid__, ART[key], name);
assert.equal(component(node(name), 'cc.Button')._interactable, true, name);
}
assert.equal(GIFT_REFERENCE.claimed.GiftClose[0], 'claimed-dismiss');
const distinct = ['dismiss-orb', 'gift-dismiss', 'claimed-dismiss', 'shortfall-dismiss'];
assert.equal(new Set(distinct.map(key => ART[key])).size, 4);
distinct.forEach(imageMeta);
});
test('free-spin trigger has no shell and has eighteen separately rendered decoration nodes behind its content', () => {
assert.ok(!nodes.some(entry => entry._name === 'BonusAwardShell'));
const award = node('BonusAwardDialog');
const decor = node('BonusAwardCelebrationDecor');
assert.equal(dereference(decor._parent), award);
assert.equal(children(award)[0], decor, 'decorations stay behind scatter/title/count');
assertBox('BonusAwardCelebrationDecor', 540, 960, 1080, 1920);
const pieces = children(decor);
assert.equal(pieces.length, 18, 'eighteen independently rendered decorations, excluding the container');
assert.equal(new Set(pieces).size, 18);
assert.equal(new Set(pieces.map(entry => entry._name)).size, 18);
for (const piece of pieces) {
assert.equal(dereference(piece._parent), decor, piece._name);
assert.match(piece._name, /^BonusAward.+Decor$/);
assert.equal(children(piece).length, 0, piece._name);
component(piece, 'cc.UITransform');
const renderers = [...components(piece, 'cc.Graphics'), ...components(piece, 'cc.Sprite')];
assert.equal(renderers.length, 1, `${piece._name}: independent graphics or sprite`);
assert.equal(renderers[0]._enabled, true, piece._name);
assert.equal(piece._active, true, piece._name);
assert.equal(components(piece, 'cc.Label').length, 0);
assert.equal(components(piece, 'cc.Button').length, 0);
}
});
test('free-spin scatter trio, title, 325px count, award caption and start keep reference screen and draw order', () => {
const names = ['BonusAwardCelebrationDecor', 'BonusAwardScatter1', 'BonusAwardScatter2',
'BonusAwardScatter3', 'BonusAwardTitle', 'BonusAwardCount', 'BonusAwardCaption', 'BonusAwardStart'];
assert.deepEqual(children(node('BonusAwardDialog')).map(entry => entry._name), names);
const scatters = children(node('BonusAwardDialog')).filter(entry => /^BonusAwardScatter\d+$/.test(entry._name));
assert.equal(scatters.length, 3);
assert.ok(referenceCenter(scatters[0]).x < referenceCenter(scatters[1]).x);
assert.ok(referenceCenter(scatters[1]).x < referenceCenter(scatters[2]).x);
assert.ok(referenceCenter(scatters[1]).y < referenceCenter(scatters[0]).y, 'middle scatter rises above the sides');
const sequence = ['BonusAwardTitle', 'BonusAwardCount', 'BonusAwardCaption', 'BonusAwardStart'];
const titleY = referenceCenter(node('BonusAwardTitle')).y;
assert.ok(scatters.every(scatter => referenceCenter(scatter).y < titleY));
for (let index = 1; index < sequence.length; index++) {
assert.ok(referenceCenter(node(sequence[index - 1])).y < referenceCenter(node(sequence[index])).y,
`${sequence[index - 1]} is above ${sequence[index]}`);
}
assertBox('BonusAwardCount', 534, 1116, 620, 350);
const count = component(node('BonusAwardCount'), 'cc.Label');
assert.equal(count._string, '8');
assert.equal(count._fontSize, 325);
assert.equal(count._lineHeight, 325, 'native line height prevents SHRINK from reducing the reference digit');
assert.equal(count._font.__uuid__, CELEBRATION_FONT_UUID);
assert.equal(count._isSystemFontUsed, false);
assert.equal(count._enableWrapText, false);
const buttons = children(node('BonusAwardDialog')).filter(entry => components(entry, 'cc.Button').length);
assert.deepEqual(buttons.map(entry => entry._name), ['BonusAwardStart']);
});
const fontDirectory = join('assets', 'orchard', 'typefaces');
function celebrationFontMeta(): Entry {
return JSON.parse(readFileSync(join(fontDirectory, 'celebration-numerals.fnt.meta'), 'utf8'));
}
function numericFields(line: string): Record<string, number> {
return Object.fromEntries([...line.matchAll(/\b([A-Za-z]+)=(-?\d+)\b/g)].map(match => [match[1], Number(match[2])]));
}
test('celebration font page, imported metadata and atlas retain the renamed asset and exactly digits 0-9', () => {
const font = celebrationFontMeta();
assert.equal(font.importer, 'bitmap-font');
assert.equal(font.imported, true);
assert.equal(font.uuid, CELEBRATION_FONT_UUID);
assert.notEqual(font.uuid, FONT_UUID);
const text = readFileSync(join(fontDirectory, 'celebration-numerals.fnt'), 'utf8');
const pages = [...text.matchAll(/^page\s+id=(\d+)\s+file="([^"]+)"\s*$/gm)];
assert.equal(pages.length, 1);
assert.equal(pages[0][1], '0');
assert.equal(pages[0][2], 'celebration-glyphs.png');
const atlas = JSON.parse(readFileSync(join(fontDirectory, 'celebration-glyphs.png.meta'), 'utf8'));
assert.equal(atlas.importer, 'image');
assert.equal(atlas.imported, true);
assert.equal(font.userData.textureUuid, atlas.uuid);
const textures = (Object.values(atlas.subMetas) as Entry[]).filter(entry => entry.importer === 'texture');
assert.equal(textures.length, 1);
assert.equal(textures[0].imported, true);
assert.equal(textures[0].userData.imageUuidOrDatabaseUri, atlas.uuid);
const config = font.userData._fntConfig;
assert.equal(config.atlasName, 'celebration-glyphs.png');
assert.equal(config.fontSize, 325);
assert.equal(config.commonHeight, 325);
assert.equal(font.userData.fontSize, 325);
assert.match(text, /^info\s+.*\bsize=325\b/m);
assert.match(text, /^chars\s+count=10\s*$/m);
const common = numericFields(text.split(/\r?\n/).find(line => line.startsWith('common '))!);
assert.equal(common.lineHeight, 325);
assert.equal(common.pages, 1);
const png = readFileSync(join(fontDirectory, pages[0][2]));
assert.equal(png.subarray(0, 8).toString('hex'), '89504e470d0a1a0a');
assert.equal(png.readUInt32BE(16), common.scaleW);
assert.equal(png.readUInt32BE(20), common.scaleH);
const glyphs = text.split(/\r?\n/).filter(line => line.startsWith('char ')).map(numericFields);
const digits = Array.from({ length: 10 }, (_, digit) => 48 + digit);
assert.deepEqual(glyphs.map(glyph => glyph.id).sort((a, b) => a - b), digits);
assert.deepEqual(Object.keys(config.fontDefDictionary).map(Number).sort((a, b) => a - b), digits);
for (const glyph of glyphs) {
assert.equal(glyph.page, 0);
assert.ok(glyph.x >= 0 && glyph.y >= 0 && glyph.width > 0 && glyph.height > 0 && glyph.xadvance > 0);
assert.ok(glyph.x + glyph.width <= common.scaleW && glyph.y + glyph.height <= common.scaleH);
assert.deepEqual(config.fontDefDictionary[glyph.id], {
rect: { x: glyph.x, y: glyph.y, width: glyph.width, height: glyph.height },
xOffset: glyph.xoffset, yOffset: glyph.yoffset, xAdvance: glyph.xadvance,
}, `digit ${String.fromCharCode(glyph.id)} metadata matches the imported font`);
}
assert.match(text, /^kernings\s+count=0\s*$/m);
assert.deepEqual(config.kerningDict, {});
});
for (const award of [8, 12, 16]) {
test(`dedicated font fits free-spin award ${award} in the saved 620px count at full 325px size`, () => {
const label = component(node('BonusAwardCount'), 'cc.Label');
const { width, height } = component(node('BonusAwardCount'), 'cc.UITransform')._contentSize;
assert.equal(width, 620);
assert.equal(label._fontSize, 325);
const config = celebrationFontMeta().userData._fntConfig;
const scale = label._fontSize / config.fontSize;
let advance = 0, right = 0, left = 0, bottom = 0;
for (const digit of String(award)) {
const glyph = config.fontDefDictionary[digit.charCodeAt(0)];
assert.ok(glyph, `missing digit ${digit}`);
left = Math.min(left, advance + glyph.xOffset);
right = Math.max(right, advance + glyph.xOffset + glyph.rect.width);
bottom = Math.max(bottom, glyph.yOffset + glyph.rect.height);
advance += glyph.xAdvance;
}
const requiredWidth = (Math.max(advance, right) - left) * scale;
assert.ok(requiredWidth > 0 && requiredWidth <= width, `${award}: ${requiredWidth}px must fit ${width}px without shrinking`);
assert.ok(bottom * scale <= height, `${award}: glyphs must fit the saved count height`);
});
}
test('free-spin result amount retains amber numerals inside its independently measured plate', () => {
assertBox('BonusSummaryAmount', 619, 1075.5, 480, 146);
const label = component(node('BonusSummaryAmount'), 'cc.Label');
assert.equal(label._font.__uuid__, FONT_UUID);
assert.equal(label._isSystemFontUsed, false);
assert.equal(label._fontSize, 126);
assert.equal(component(node('BonusSummaryContinue'), 'cc.Button')._interactable, true);
});
test('saved ModalLayer preserves Shade plus all eight independent dialog groups at the Canvas origin', () => {
const layer = node('ModalLayer');
assert.equal(dereference(layer._parent), node('Canvas'));
const groups = ['RepeatDialog', 'PreferencesDialog', 'GiftDialog', 'EmptyWalletDialog',
'BonusAwardDialog', 'BonusSummaryDialog', 'GuideDialog', 'ErrorDialog'];
assert.deepEqual(children(layer).map(entry => entry._name).sort(), ['Shade', ...groups].sort());
assert.equal(children(layer)[0], node('Shade'));
component(node('Shade'), 'cc.BlockInputEvents');
for (const owner of [layer, ...groups.map(node)]) {
assert.deepEqual(owner._lpos, { __type__: 'cc.Vec3', x: 0, y: 0, z: 0 }, owner._name);
if (owner !== layer) assert.equal(dereference(owner._parent), layer, owner._name);
}
});
+31 -8
View File
@@ -3,7 +3,7 @@ import { strict as assert } from 'node:assert';
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs'; import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
import { basename, dirname, extname, join, parse, resolve } from 'node:path'; import { basename, dirname, extname, join, parse, resolve } from 'node:path';
import { AutoSpinQueue } from '../assets/orchard/scripts/AutoSpinQueue'; import { AutoSpinQueue } from '../assets/orchard/scripts/AutoSpinQueue';
import { ART, ART_KEYS, FONT_UUID, SYMBOL_ART } from '../assets/orchard/scripts/OrchardAssets'; import { ART, ART_KEYS, CELEBRATION_FONT_UUID, FONT_UUID, SYMBOL_ART } from '../assets/orchard/scripts/OrchardAssets';
import { SYMBOLS } from '../assets/orchard/scripts/SlotsMath'; import { SYMBOLS } from '../assets/orchard/scripts/SlotsMath';
// Inspect saved references, not authoring/runtime source text. Node active flags remain editable. // Inspect saved references, not authoring/runtime source text. Node active flags remain editable.
@@ -115,6 +115,8 @@ const sourceByImport: Record<string, string> = {
'claimed-heading': '07-free-coins-claimed/title-no-close.png', 'claimed-heading': '07-free-coins-claimed/title-no-close.png',
'claimed-caption': '07-free-coins-claimed/daily-label.png', 'claimed-caption': '07-free-coins-claimed/daily-label.png',
'claimed-garnish': '07-free-coins-claimed/reward.png', 'claimed-garnish': '07-free-coins-claimed/reward.png',
'claimed-dismiss': '07-free-coins-claimed/close.png',
'claimed-amount': '07-free-coins-claimed/amount-bar-no-text.png',
'crest-lockup': '02-main-screen/ui/logo.png', 'crest-lockup': '02-main-screen/ui/logo.png',
'crimson-berry': '02-main-screen/symbols/strawberry.png', 'crimson-berry': '02-main-screen/symbols/strawberry.png',
'daily-pill': '02-main-screen/ui/free_coins.png', 'daily-pill': '02-main-screen/ui/free_coins.png',
@@ -130,6 +132,7 @@ const sourceByImport: Record<string, string> = {
'gift-collect': '06-free-coins-available/claim-button.png', 'gift-collect': '06-free-coins-available/claim-button.png',
'gift-collected': '07-free-coins-claimed/claimed-button.png', 'gift-collected': '07-free-coins-claimed/claimed-button.png',
'gift-daily': '06-free-coins-available/daily-label.png', 'gift-daily': '06-free-coins-available/daily-label.png',
'gift-dismiss': '06-free-coins-available/close.png',
'gift-garnish': '06-free-coins-available/reward.png', 'gift-garnish': '06-free-coins-available/reward.png',
'gift-heading': '06-free-coins-available/title.png', 'gift-heading': '06-free-coins-available/title.png',
'gift-shell': '06-free-coins-available/panel-background.png', 'gift-shell': '06-free-coins-available/panel-background.png',
@@ -145,6 +148,7 @@ const sourceByImport: Record<string, string> = {
'neon-grid': '02-main-screen/ui/reel.png', 'neon-grid': '02-main-screen/ui/reel.png',
'paired-rubies': '02-main-screen/symbols/cherry.png', 'paired-rubies': '02-main-screen/symbols/cherry.png',
'preferences-heading': '03-settings/title-settings.png', 'preferences-heading': '03-settings/title-settings.png',
'preferences-flourish': '03-settings/title-underline.png',
'preferences-orb': '02-main-screen/ui/settings.png', 'preferences-orb': '02-main-screen/ui/settings.png',
'preferences-shell': '03-settings/panel.png', 'preferences-shell': '03-settings/panel.png',
'prism-chime': '02-main-screen/symbols/bell.png', 'prism-chime': '02-main-screen/symbols/bell.png',
@@ -163,6 +167,7 @@ const sourceByImport: Record<string, string> = {
'round-prize-card': '02-main-screen/ui/current-win-no-number.png', 'round-prize-card': '02-main-screen/ui/current-win-no-number.png',
'rounds-ribbon': '02-main-screen/ui/free-spins-banner-empty.png', 'rounds-ribbon': '02-main-screen/ui/free-spins-banner-empty.png',
'ruby-seven': '02-main-screen/symbols/seven.png', 'ruby-seven': '02-main-screen/symbols/seven.png',
'shortfall-dismiss': '08-insufficient-coins/close-button.png',
'starburst-joker': '02-main-screen/symbols/wild.png', 'starburst-joker': '02-main-screen/symbols/wild.png',
'summer-wedge': '02-main-screen/symbols/watermelon.png', 'summer-wedge': '02-main-screen/symbols/watermelon.png',
'ten-idle': '05-auto-spin-setup/count_10_normal.png', 'ten-idle': '05-auto-spin-setup/count_10_normal.png',
@@ -177,6 +182,8 @@ const sourceByImport: Record<string, string> = {
'wallet-pill': '02-main-screen/ui/coin_bar.png', 'wallet-pill': '02-main-screen/ui/coin_bar.png',
'amber-numerals': '02-main-screen/font/golden-numbers.fnt', 'amber-numerals': '02-main-screen/font/golden-numbers.fnt',
'amber-glyph-atlas': '02-main-screen/font/golden-numbers.png', 'amber-glyph-atlas': '02-main-screen/font/golden-numbers.png',
'celebration-numerals': '10-free-spins-trigger/font/digits.fnt',
'celebration-glyphs': '10-free-spins-trigger/font/digits.png',
}; };
const queueState = (queue: AutoSpinQueue) => ({ active: queue.active, remaining: queue.remaining }); const queueState = (queue: AutoSpinQueue) => ({ active: queue.active, remaining: queue.remaining });
@@ -302,10 +309,10 @@ test('saved five masked reels have six cells each and exactly fifteen visible sl
test('all saved artFrames resolve to distinct orchard imports in runtime lookup order', () => { test('all saved artFrames resolve to distinct orchard imports in runtime lookup order', () => {
const saved: Entry[] = controller().artFrames; const saved: Entry[] = controller().artFrames;
assert.equal(saved.length, 81); assert.equal(saved.length, 86);
assert.equal(ART_KEYS.length, 81); assert.equal(ART_KEYS.length, 86);
const ids = saved.map(uuid); const ids = saved.map(uuid);
assert.equal(new Set(ids).size, 81); assert.equal(new Set(ids).size, 86);
assert.deepEqual(ids, ART_KEYS.map(key => ART[key])); assert.deepEqual(ids, ART_KEYS.map(key => ART[key]));
assert.deepEqual(ids.map(id => parse(frameFor(id).path).name), ART_KEYS); assert.deepEqual(ids.map(id => parse(frameFor(id).path).name), ART_KEYS);
for (const entry of scene.filter(value => value.__type__ === 'cc.Sprite')) { for (const entry of scene.filter(value => value.__type__ === 'cc.Sprite')) {
@@ -317,7 +324,7 @@ test('all saved artFrames resolve to distinct orchard imports in runtime lookup
test('every imported image/font basename is renamed against its explicitly mapped source', () => { test('every imported image/font basename is renamed against its explicitly mapped source', () => {
const imported = assets.filter(asset => ['image', 'bitmap-font'].includes(asset.meta.importer)); const imported = assets.filter(asset => ['image', 'bitmap-font'].includes(asset.meta.importer));
assert.equal(imported.length, 83, '81 artwork images, one font atlas and one bitmap font'); assert.equal(imported.length, 90, '86 artwork images, two font atlases and two bitmap fonts');
assert.deepEqual(imported.map(asset => parse(asset.path).name).sort(), Object.keys(sourceByImport).sort()); assert.deepEqual(imported.map(asset => parse(asset.path).name).sort(), Object.keys(sourceByImport).sort());
for (const asset of imported) { for (const asset of imported) {
const name = parse(asset.path).name; const name = parse(asset.path).name;
@@ -330,22 +337,38 @@ test('every imported image/font basename is renamed against its explicitly mappe
} }
}); });
test('saved main amounts, counters and companion dialogs reference the renamed amber font', () => { test('saved gold amounts retain amber, the free-spin count uses celebration and gift coins use white system text', () => {
const font = assets.find(asset => asset.meta.uuid === uuid(controller().numerals)); const font = assets.find(asset => asset.meta.uuid === uuid(controller().numerals));
assert.ok(font, 'saved numeral font resolves through orchard metadata'); assert.ok(font, 'saved numeral font resolves through orchard metadata');
assert.equal(font.meta.importer, 'bitmap-font'); assert.equal(font.meta.importer, 'bitmap-font');
assert.equal(basename(font.path), 'amber-numerals.fnt'); assert.equal(basename(font.path), 'amber-numerals.fnt');
assert.equal(font.meta.uuid, FONT_UUID); assert.equal(font.meta.uuid, FONT_UUID);
for (const name of ['NormalPrizeAmount', 'RoundsCount', 'RoundPrizeAmount', 'BonusPrizeAmount', for (const name of ['NormalPrizeAmount', 'RoundsCount', 'RoundPrizeAmount', 'BonusPrizeAmount',
'WagerAmount', 'GiftAmount', 'BonusAwardCount', 'BonusSummaryAmount', 'WagerAmount', 'BonusSummaryAmount',
'GuideLineBet0', 'GuideLineBet1', 'GuideDailyAmount']) { 'GuideLineBet0', 'GuideLineBet1', 'GuideDailyAmount']) {
const label = component(node(name), 'cc.Label'); const label = component(node(name), 'cc.Label');
assert.equal(uuid(label._font), font.meta.uuid, name); assert.equal(uuid(label._font), font.meta.uuid, name);
assert.equal(label._isSystemFontUsed, false, name); assert.equal(label._isSystemFontUsed, false, name);
} }
const celebration = assets.find(asset => asset.meta.uuid === CELEBRATION_FONT_UUID);
assert.ok(celebration, 'dedicated free-spin numeral font resolves through orchard metadata');
assert.equal(celebration.meta.importer, 'bitmap-font');
assert.equal(basename(celebration.path), 'celebration-numerals.fnt');
assert.notEqual(celebration.meta.uuid, font.meta.uuid);
const award = component(node('BonusAwardCount'), 'cc.Label');
assert.equal(uuid(award._font), CELEBRATION_FONT_UUID);
assert.equal(award._isSystemFontUsed, false);
for (const label of scene.filter(entry => entry.__type__ === 'cc.Label' && entry._font)) { for (const label of scene.filter(entry => entry.__type__ === 'cc.Label' && entry._font)) {
assert.equal(uuid(label._font), font.meta.uuid, 'no stale bitmap font reference'); const owner = dereference(label.node);
const expected = owner === node('BonusAwardCount') ? CELEBRATION_FONT_UUID : FONT_UUID;
assert.equal(uuid(label._font), expected, `${owner._name}: no stale or misplaced bitmap font reference`);
assert.equal(label._isSystemFontUsed, false, owner._name);
} }
const gift = component(node('GiftAmount'), 'cc.Label');
assert.equal(gift._string, '20,000 COINS');
assert.equal(gift._isSystemFontUsed, true);
assert.equal(gift._font, null);
assert.deepEqual(gift._color, { __type__: 'cc.Color', r: 255, g: 255, b: 255, a: 255 });
const normalWallet = component(node('WalletAmount'), 'cc.Label'); const normalWallet = component(node('WalletAmount'), 'cc.Label');
assert.equal(normalWallet._isSystemFontUsed, true); assert.equal(normalWallet._isSystemFontUsed, true);
assert.equal(normalWallet._font, null, 'normal wallet must not use the gold bitmap font'); assert.equal(normalWallet._font, null, 'normal wallet must not use the gold bitmap font');