feat: consolidate unspool gameplay, 30 release levels, and 5 validation samples (026A/B, 038A, 039, 051)
This commit is contained in:
1 parent
96c19dca82
commit
f02f9b085e
18 files changed
+2922
-39
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { ImageAsset, resources, SpriteFrame, Texture2D } from 'cc';
|
||||
import { POSTER_FRAMES, PosterFrameDef } from '../core/AtelierService';
|
||||
import { HOOP_CENTER, HOOP_HEIGHT, HOOP_RADIUS, HOOP_WIDTH, MOTIFS, NEST } from '../core/LevelData';
|
||||
import { dyeRemainingUses, isPondBridged, isTargetLocked } from '../core/RouteEngine';
|
||||
import { dyeRemainingUses, isClipUnlocked, isPondBridged, isStrandClipLocked, isStrandExposed, isTargetLocked } from '../core/RouteEngine';
|
||||
import {
|
||||
AntState,
|
||||
ButtonAnchorDef,
|
||||
@@ -10,16 +10,24 @@ import {
|
||||
GateDef,
|
||||
HintState,
|
||||
LevelDef,
|
||||
OldClothClipDef,
|
||||
Point2D,
|
||||
PondDef,
|
||||
RoughZoneDef,
|
||||
RouteState,
|
||||
SectionDef,
|
||||
SpoolDef,
|
||||
TargetColor,
|
||||
UnspoolConfig,
|
||||
UnspoolRuntimeState,
|
||||
YarnColor,
|
||||
} from '../core/Types';
|
||||
|
||||
declare const wx: any;
|
||||
|
||||
export const UNSPOOL_CLOTH_WIDTH = 560;
|
||||
export const UNSPOOL_CLOTH_HEIGHT = 136;
|
||||
|
||||
const GOLD = ['#9f501b', '#d59328', '#f6bb4f', '#ffe698'];
|
||||
const HONEY = ['#9a4b1d', '#cb7724', '#ed9b39', '#ffd283'];
|
||||
const LEAF = ['#394a31', '#7d8b50', '#a8aa68', '#d0cd8a'];
|
||||
@@ -1120,7 +1128,80 @@ function drawStartDragGuide(c: CanvasRenderingContext2D, level: LevelDef, time:
|
||||
c.restore();
|
||||
}
|
||||
|
||||
function drawPatch(c: CanvasRenderingContext2D, section: SectionDef, stitched: boolean): void {
|
||||
const palette = YARN_PALETTES[section.color];
|
||||
const w = section.rx;
|
||||
const h = section.ry;
|
||||
c.save();
|
||||
c.translate(section.x, section.y);
|
||||
c.beginPath();
|
||||
if (section.patch === 'flower') {
|
||||
for (let i = 0; i <= 120; i++) {
|
||||
const a = TAU * i / 120;
|
||||
const radius = 0.75 + 0.23 * Math.cos(6 * a);
|
||||
const x = Math.cos(a) * w * radius;
|
||||
const y = Math.sin(a) * h * radius;
|
||||
if (i === 0) c.moveTo(x, y);
|
||||
else c.lineTo(x, y);
|
||||
}
|
||||
} else if (section.patch === 'leaf') {
|
||||
c.moveTo(-w, h * 0.28);
|
||||
c.quadraticCurveTo(-w * 0.57, -h, w, -h * 0.38);
|
||||
c.quadraticCurveTo(w * 0.3, h, -w, h * 0.28);
|
||||
} else if (section.patch === 'bell') {
|
||||
c.moveTo(-w, h * 0.5);
|
||||
c.quadraticCurveTo(-w * 0.5, h * 0.16, -w * 0.54, -h * 0.27);
|
||||
c.bezierCurveTo(-w * 0.37, -h, w * 0.37, -h, w * 0.54, -h * 0.27);
|
||||
c.quadraticCurveTo(w * 0.5, h * 0.16, w, h * 0.5);
|
||||
c.quadraticCurveTo(0, h, -w, h * 0.5);
|
||||
} else if (section.patch === 'boat') {
|
||||
c.moveTo(-w, h * 0.1);
|
||||
c.quadraticCurveTo(0, h * 1.5, w, h * 0.1);
|
||||
c.lineTo(w * 0.18, h * 0.1);
|
||||
c.lineTo(w * 0.18, -h);
|
||||
c.quadraticCurveTo(-w * 0.49, -h * 0.63, -w * 0.48, h * 0.1);
|
||||
c.lineTo(-w, h * 0.1);
|
||||
} else {
|
||||
c.moveTo(-w, 0);
|
||||
c.bezierCurveTo(-w * 0.5, -h * 1.22, w * 0.54, h * 0.17, w, -h * 0.55);
|
||||
c.bezierCurveTo(w * 0.55, h * 1.25, -w * 0.43, h * 0.13, -w, 0);
|
||||
}
|
||||
c.closePath();
|
||||
c.fillStyle = stitched ? palette[1] : `${ROUTE_COLORS[section.color]}20`;
|
||||
c.fill();
|
||||
c.lineWidth = stitched ? 1.6 : 1.9;
|
||||
c.strokeStyle = RINGS[section.color];
|
||||
if (!stitched) c.setLineDash([4, 5]);
|
||||
c.stroke();
|
||||
if (stitched) {
|
||||
c.save();
|
||||
c.clip();
|
||||
c.lineWidth = 1.2;
|
||||
for (let y = -h - w; y < h + w; y += 2.8) {
|
||||
c.strokeStyle = y % 4 < 1 ? palette[1] : palette[2];
|
||||
line(c, -w - 2, y, w + 2, y - w * 0.72);
|
||||
}
|
||||
c.restore();
|
||||
const detail = section.patch;
|
||||
if (detail === 'flower' || detail === 'bell') {
|
||||
ellipse(c, 0, detail === 'bell' ? h * 0.75 : 0, w * 0.19, h * 0.17);
|
||||
c.fillStyle = palette[0];
|
||||
c.fill();
|
||||
}
|
||||
if (detail === 'leaf') {
|
||||
c.strokeStyle = palette[3];
|
||||
c.lineWidth = 1.4;
|
||||
line(c, -w * 0.72, h * 0.18, w * 0.74, -h * 0.32);
|
||||
}
|
||||
}
|
||||
c.restore();
|
||||
}
|
||||
|
||||
function drawSection(c: CanvasRenderingContext2D, section: SectionDef, stitched: boolean): void {
|
||||
if (section.patch) {
|
||||
drawPatch(c, section, stitched);
|
||||
return;
|
||||
}
|
||||
if (section.garden) {
|
||||
drawGardenSection(c, section, stitched);
|
||||
return;
|
||||
@@ -1143,6 +1224,9 @@ function drawSection(c: CanvasRenderingContext2D, section: SectionDef, stitched:
|
||||
}
|
||||
|
||||
function sectionBounds(section: SectionDef): { x: number; y: number; w: number; h: number } {
|
||||
if (section.patch) {
|
||||
return { x: section.x - section.rx - 5, y: section.y - section.ry - 5, w: 2 * section.rx + 10, h: 2 * section.ry + 10 };
|
||||
}
|
||||
if (section.garden) {
|
||||
return { x: Math.max(0, section.x - 52), y: Math.max(0, section.y - 52), w: 104, h: 104 };
|
||||
}
|
||||
@@ -1442,6 +1526,9 @@ export class EmbroideryRenderer {
|
||||
private workshopLayer: OffscreenLayer | null = null;
|
||||
private workshopTexture: Texture2D | null = null;
|
||||
private workshopSpriteFrame: SpriteFrame | null = null;
|
||||
private unspoolLayer: OffscreenLayer | null = null;
|
||||
private unspoolTexture: Texture2D | null = null;
|
||||
private unspoolSpriteFrame: SpriteFrame | null = null;
|
||||
private activeLevel: LevelDef | null = null;
|
||||
|
||||
constructor(renderScale = 1.5) {
|
||||
@@ -1853,7 +1940,10 @@ export class EmbroideryRenderer {
|
||||
else this.drawOverlay(c, section);
|
||||
}
|
||||
if (level.motif === 'custom') {
|
||||
for (const target of level.targets) this.drawArtworkGuideRing(c, target);
|
||||
for (const target of level.targets) {
|
||||
if (target.patch) drawSection(c, target, false);
|
||||
else this.drawArtworkGuideRing(c, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2001,6 +2091,33 @@ export class EmbroideryRenderer {
|
||||
const locked = isTargetLocked(level, target.id, lines, drawing);
|
||||
const needsStop = !locked && Boolean(drawing && drawing.color === target.color && drawing.picks.length > drawing.deliveries.length);
|
||||
drawTargetPin(c, target, Boolean(planned || needsStop), time, planned?.step, locked);
|
||||
|
||||
// 「新针开旧夹」:在对应开夹针位旁绘制与旧布木夹完全一致的微型徽标
|
||||
const linkedClip = level.unspool?.clips?.find(clip => clip.unlockSectionId === target.id && !isClipUnlocked(clip, lines, drawing));
|
||||
if (linkedClip) {
|
||||
const pulsing = state.unspool?.pulseTargetId === target.id && time < (state.unspool.pulseUntil ?? 0);
|
||||
if (pulsing) {
|
||||
const wave = (time % 650) / 650;
|
||||
c.save();
|
||||
ellipse(c, target.x, target.y, target.rx + 8 + wave * 18, target.ry + 8 + wave * 18);
|
||||
c.strokeStyle = ROUTE_COLORS[linkedClip.badgeColor];
|
||||
c.globalAlpha = Math.max(0.15, 0.9 - wave * 0.75);
|
||||
c.lineWidth = 3.5;
|
||||
c.stroke();
|
||||
c.restore();
|
||||
}
|
||||
const bx = target.x + Math.max(22, target.rx * 0.72);
|
||||
const by = target.y - Math.max(20, target.ry * 0.68);
|
||||
c.save();
|
||||
roundRectPath(c, bx - 14, by - 11, 28, 22, 6);
|
||||
c.fillStyle = '#8b5e36';
|
||||
c.fill();
|
||||
c.strokeStyle = pulsing ? '#fff1a8' : '#573619';
|
||||
c.lineWidth = pulsing ? 2.4 : 1.5;
|
||||
c.stroke();
|
||||
this.drawClipEmblem(c, bx, by, 7.5, linkedClip.badgeColor, linkedClip.badgeShape);
|
||||
c.restore();
|
||||
}
|
||||
}
|
||||
drawUnlockLinks(c, level, lines, drawing, time);
|
||||
|
||||
@@ -2009,6 +2126,42 @@ export class EmbroideryRenderer {
|
||||
drawNest(c, nestPos, time, lines.length === 0 && !drawing, idx === activeNestIndex, multiNest);
|
||||
});
|
||||
|
||||
if (level.unspool) {
|
||||
const deadlocked = Boolean(state.unspool?.deadlocked);
|
||||
const animSlot = state.unspool?.animating?.slotIndex ?? -1;
|
||||
const capacity = level.unspool.capacity ?? level.unspool.slots.length;
|
||||
const occupiedCount = state.unspool?.slotBallIds.filter(id => id != null).length ?? 0;
|
||||
const capFull = occupiedCount >= capacity;
|
||||
level.unspool.slots.forEach((slot, idx) => {
|
||||
const occupied = state.unspool?.slotBallIds[idx] != null;
|
||||
const receiving = animSlot === idx;
|
||||
const capBlocked = !occupied && capFull;
|
||||
c.save();
|
||||
c.translate(slot.x, slot.y);
|
||||
c.globalAlpha = capBlocked ? 0.56 : 1;
|
||||
ellipse(c, 2, 12, 30, 15);
|
||||
c.fillStyle = '#63503d28';
|
||||
c.fill();
|
||||
ellipse(c, 0, 2, 28, 25);
|
||||
c.fillStyle = deadlocked ? '#e7b9aa' : '#ddd0b9';
|
||||
c.fill();
|
||||
c.strokeStyle = deadlocked ? '#975449' : receiving ? '#826146' : '#a08e73';
|
||||
c.lineWidth = receiving || deadlocked ? 2.8 : 1.6;
|
||||
c.stroke();
|
||||
ellipse(c, 0, 2, 21, 18);
|
||||
c.fillStyle = occupied ? '#c2b091' : '#f2e7d4';
|
||||
c.fill();
|
||||
if (!occupied) {
|
||||
c.fillStyle = '#6d5e4e';
|
||||
c.font = `700 12px ${SERIF_FONT}`;
|
||||
c.textAlign = 'center';
|
||||
c.textBaseline = 'middle';
|
||||
c.fillText(capBlocked ? '满格' : `线碗${idx + 1}`, 0, 2);
|
||||
}
|
||||
c.restore();
|
||||
});
|
||||
}
|
||||
|
||||
for (const ball of level.balls) {
|
||||
let pickedAt: number | undefined;
|
||||
for (const l of lines) {
|
||||
@@ -2503,6 +2656,318 @@ export class EmbroideryRenderer {
|
||||
this.workshopTexture.uploadData(this.workshopLayer.canvas);
|
||||
}
|
||||
|
||||
public getUnspoolClothSpriteFrame(): SpriteFrame {
|
||||
if (!this.unspoolSpriteFrame) {
|
||||
this.unspoolLayer = createLayer(UNSPOOL_CLOTH_WIDTH, UNSPOOL_CLOTH_HEIGHT, 1.5);
|
||||
const imageAsset = new ImageAsset(this.unspoolLayer.canvas);
|
||||
this.unspoolTexture = new Texture2D();
|
||||
this.unspoolTexture.image = imageAsset;
|
||||
this.unspoolSpriteFrame = new SpriteFrame();
|
||||
this.unspoolSpriteFrame.texture = this.unspoolTexture;
|
||||
}
|
||||
return this.unspoolSpriteFrame;
|
||||
}
|
||||
|
||||
private drawClipEmblem(
|
||||
c: CanvasRenderingContext2D,
|
||||
x: number,
|
||||
y: number,
|
||||
r: number,
|
||||
color: TargetColor,
|
||||
shape: OldClothClipDef['badgeShape'],
|
||||
): void {
|
||||
c.save();
|
||||
c.translate(x, y);
|
||||
ellipse(c, 0, 0, r + 1.5, r + 1.5);
|
||||
c.fillStyle = '#fbf4e4';
|
||||
c.fill();
|
||||
c.fillStyle = ROUTE_COLORS[color];
|
||||
c.strokeStyle = RINGS[color];
|
||||
c.lineWidth = 1.2;
|
||||
c.beginPath();
|
||||
if (shape === 'leaf') {
|
||||
c.moveTo(-r * 0.72, r * 0.45);
|
||||
c.quadraticCurveTo(-r * 0.35, -r * 0.78, r * 0.76, -r * 0.52);
|
||||
c.quadraticCurveTo(r * 0.42, r * 0.76, -r * 0.72, r * 0.45);
|
||||
c.closePath();
|
||||
c.fill();
|
||||
c.stroke();
|
||||
} else if (shape === 'flower') {
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const a = (i * Math.PI * 2) / 5 - Math.PI / 2;
|
||||
c.moveTo(Math.cos(a) * r * 0.42 + r * 0.32, Math.sin(a) * r * 0.42);
|
||||
c.arc(Math.cos(a) * r * 0.42, Math.sin(a) * r * 0.42, r * 0.32, 0, Math.PI * 2);
|
||||
}
|
||||
c.fill();
|
||||
} else if (shape === 'bell') {
|
||||
c.arc(0, -r * 0.1, r * 0.56, Math.PI, 0);
|
||||
c.lineTo(r * 0.68, r * 0.52);
|
||||
c.lineTo(-r * 0.68, r * 0.52);
|
||||
c.closePath();
|
||||
c.fill();
|
||||
c.stroke();
|
||||
} else {
|
||||
c.arc(0, 0, r * 0.58, 0, Math.PI * 2);
|
||||
c.fill();
|
||||
c.stroke();
|
||||
}
|
||||
c.restore();
|
||||
}
|
||||
|
||||
/** 「拆旧织新」上方旧绣片 2D 实时渲染:底层→顶层压叠投影、交叉阴影断口、旧布木夹与可抽亮色线头脉冲 */
|
||||
public renderUnspoolClothFrame(
|
||||
config: UnspoolConfig,
|
||||
runtime: UnspoolRuntimeState,
|
||||
timeMs: number,
|
||||
lines: RouteState[] = [],
|
||||
): void {
|
||||
if (!this.unspoolLayer || !this.unspoolTexture) return;
|
||||
const W = UNSPOOL_CLOTH_WIDTH;
|
||||
const H = UNSPOOL_CLOTH_HEIGHT;
|
||||
const c = this.unspoolLayer.ctx;
|
||||
c.clearRect(0, 0, W, H);
|
||||
|
||||
const fabric = c.createLinearGradient(0, 0, W, H);
|
||||
fabric.addColorStop(0, '#f5eddb');
|
||||
fabric.addColorStop(1, '#e9dfcc');
|
||||
roundRectPath(c, 1, 1, W - 2, H - 2, 15);
|
||||
c.fillStyle = fabric;
|
||||
c.fill();
|
||||
c.strokeStyle = '#cfc0a7';
|
||||
c.lineWidth = 1.5;
|
||||
c.stroke();
|
||||
|
||||
c.save();
|
||||
roundRectPath(c, 3, 3, W - 6, H - 6, 14);
|
||||
c.clip();
|
||||
if (config.patchDividerX) {
|
||||
const dx = config.patchDividerX;
|
||||
c.fillStyle = '#e7eef1';
|
||||
c.fillRect(dx, 0, W - dx, H);
|
||||
c.fillStyle = '#6f8ea11c';
|
||||
for (let x = dx + 6; x < W; x += 12) c.fillRect(x, 0, 1.2, H);
|
||||
for (let y = 6; y < H; y += 12) c.fillRect(dx, y, W - dx, 1.2);
|
||||
c.fillStyle = '#8069490f';
|
||||
for (let x = 3; x < dx; x += 5) c.fillRect(x, 0, 0.8, H);
|
||||
c.beginPath();
|
||||
c.moveTo(dx, 6);
|
||||
c.lineTo(dx, H - 6);
|
||||
c.strokeStyle = '#8f775d99';
|
||||
c.lineWidth = 1.5;
|
||||
c.setLineDash([4, 4]);
|
||||
c.stroke();
|
||||
c.setLineDash([]);
|
||||
} else {
|
||||
c.fillStyle = '#8069490d';
|
||||
for (let x = 3; x < W; x += 5) c.fillRect(x, 0, 0.7, H);
|
||||
c.fillStyle = '#ffffff66';
|
||||
for (let y = 3; y < H; y += 5) c.fillRect(0, y, W, 0.8);
|
||||
}
|
||||
roundRectPath(c, 9, 9, W - 18, H - 18, 9);
|
||||
c.strokeStyle = '#9c836d66';
|
||||
c.lineWidth = 1;
|
||||
c.setLineDash([3, 4]);
|
||||
c.stroke();
|
||||
c.restore();
|
||||
|
||||
const removed = new Set(runtime.removedIds);
|
||||
const remaining = config.strands.filter(s => !removed.has(s.id));
|
||||
|
||||
if (remaining.length === 0) {
|
||||
c.fillStyle = '#5f4627';
|
||||
c.font = `700 18px ${SERIF_FONT}`;
|
||||
c.textAlign = 'center';
|
||||
c.textBaseline = 'middle';
|
||||
c.fillText('旧线已拆完,拖蚂蚁开始落针', W / 2, H / 2);
|
||||
this.unspoolTexture.uploadData(this.unspoolLayer.canvas);
|
||||
return;
|
||||
}
|
||||
|
||||
const coversSomeone = new Set<string>();
|
||||
for (const s of remaining) {
|
||||
for (const cid of s.coveredBy) {
|
||||
if (!removed.has(cid)) coversSomeone.add(cid);
|
||||
}
|
||||
}
|
||||
|
||||
for (const strand of remaining) {
|
||||
const lockedClip = isStrandClipLocked(config, strand, lines);
|
||||
const exposed = isStrandExposed(config, strand, removed, lines);
|
||||
const isUpper = exposed || coversSomeone.has(strand.id);
|
||||
const isAnim = runtime.animating?.strandId === strand.id;
|
||||
const progress = isAnim ? Math.min(1, Math.max(0, runtime.animating!.progress)) : 0;
|
||||
|
||||
const rawPts = strand.points.map(([x, y]) => ({ x, y }));
|
||||
const segLens: number[] = [];
|
||||
let totalLen = 0;
|
||||
for (let i = 1; i < rawPts.length; i++) {
|
||||
const d = Math.hypot(rawPts[i].x - rawPts[i - 1].x, rawPts[i].y - rawPts[i - 1].y);
|
||||
segLens.push(d);
|
||||
totalLen += d;
|
||||
}
|
||||
const keepLen = totalLen * (1 - progress);
|
||||
const drawPts: Point2D[] = [rawPts[0]];
|
||||
let acc = 0;
|
||||
for (let i = 1; i < rawPts.length; i++) {
|
||||
const seg = segLens[i - 1];
|
||||
if (acc + seg >= keepLen) {
|
||||
const t = seg > 0 ? Math.max(0, Math.min(1, (keepLen - acc) / seg)) : 0;
|
||||
drawPts.push({
|
||||
x: rawPts[i - 1].x + (rawPts[i].x - rawPts[i - 1].x) * t,
|
||||
y: rawPts[i - 1].y + (rawPts[i].y - rawPts[i - 1].y) * t,
|
||||
});
|
||||
break;
|
||||
}
|
||||
drawPts.push(rawPts[i]);
|
||||
acc += seg;
|
||||
}
|
||||
|
||||
const palette = YARN_PALETTES[strand.color];
|
||||
const mainColor = ROUTE_COLORS[strand.color];
|
||||
const darkColor = RINGS[strand.color];
|
||||
const lightColor = palette[3];
|
||||
const width = exposed ? 13.5 : 10.5;
|
||||
|
||||
c.save();
|
||||
c.lineCap = 'round';
|
||||
c.lineJoin = 'round';
|
||||
c.globalAlpha = exposed ? 1 : lockedClip ? 0.56 : 0.72;
|
||||
|
||||
if (drawPts.length >= 2) {
|
||||
const traceSmoothPath = () => {
|
||||
c.beginPath();
|
||||
c.moveTo(drawPts[0].x, drawPts[0].y);
|
||||
for (let i = 1; i < drawPts.length - 1; i++) {
|
||||
const prev = drawPts[i - 1];
|
||||
const joint = drawPts[i];
|
||||
const next = drawPts[i + 1];
|
||||
const inScale = Math.min(0.25, 9 / Math.hypot(joint.x - prev.x, joint.y - prev.y));
|
||||
const outScale = Math.min(0.25, 9 / Math.hypot(next.x - joint.x, next.y - joint.y));
|
||||
c.lineTo(joint.x + (prev.x - joint.x) * inScale, joint.y + (prev.y - joint.y) * inScale);
|
||||
c.quadraticCurveTo(
|
||||
joint.x, joint.y,
|
||||
joint.x + (next.x - joint.x) * outScale, joint.y + (next.y - joint.y) * outScale,
|
||||
);
|
||||
}
|
||||
const last = drawPts[drawPts.length - 1];
|
||||
c.lineTo(last.x, last.y);
|
||||
};
|
||||
|
||||
if (isUpper && coversSomeone.has(strand.id)) {
|
||||
traceSmoothPath();
|
||||
c.strokeStyle = '#efe5d2ee';
|
||||
c.lineWidth = width + 6;
|
||||
c.stroke();
|
||||
}
|
||||
|
||||
traceSmoothPath();
|
||||
c.shadowColor = exposed ? '#3b281496' : '#543f2526';
|
||||
c.shadowBlur = exposed ? 6 : 1.5;
|
||||
c.shadowOffsetY = exposed ? 3.5 : 1;
|
||||
c.strokeStyle = darkColor;
|
||||
c.lineWidth = width;
|
||||
c.stroke();
|
||||
c.shadowColor = 'transparent';
|
||||
c.strokeStyle = mainColor;
|
||||
c.lineWidth = width - 1.4;
|
||||
c.stroke();
|
||||
|
||||
c.beginPath();
|
||||
for (let i = 1; i < drawPts.length; i++) {
|
||||
const start = drawPts[i - 1];
|
||||
const end = drawPts[i];
|
||||
const len = Math.hypot(end.x - start.x, end.y - start.y);
|
||||
if (len < 10) continue;
|
||||
const dx = (end.x - start.x) / len;
|
||||
const dy = (end.y - start.y) / len;
|
||||
for (let along = 5; along <= len - 5; along += 4.3) {
|
||||
const x = start.x + dx * along;
|
||||
const y = start.y + dy * along;
|
||||
const radius = width * 0.37;
|
||||
c.moveTo(x + dy * radius - dx * 1.9, y - dx * radius - dy * 1.9);
|
||||
c.quadraticCurveTo(x + dx * 0.5, y + dy * 0.5, x - dy * radius + dx * 1.9, y + dx * radius + dy * 1.9);
|
||||
}
|
||||
}
|
||||
c.strokeStyle = lightColor + '9c';
|
||||
c.lineWidth = 1.1;
|
||||
c.stroke();
|
||||
}
|
||||
|
||||
const tip = drawPts[drawPts.length - 1];
|
||||
if (isAnim) {
|
||||
this.drawBall(c, tip.x, tip.y, strand.color, 0.45 + progress * 0.58, progress * 11, true);
|
||||
} else if (exposed) {
|
||||
const halo = 12.5 + Math.sin(timeMs / 280 + tip.x * 0.03) * 1.5;
|
||||
ellipse(c, tip.x, tip.y, halo, halo);
|
||||
c.fillStyle = '#fff9e4c8';
|
||||
c.fill();
|
||||
c.strokeStyle = darkColor;
|
||||
c.lineWidth = 1.6;
|
||||
c.stroke();
|
||||
|
||||
ellipse(c, tip.x, tip.y, 5.5, 5.5);
|
||||
c.fillStyle = mainColor;
|
||||
c.fill();
|
||||
}
|
||||
c.restore();
|
||||
}
|
||||
|
||||
if (config.clips?.length) {
|
||||
for (const clip of config.clips) {
|
||||
const unlocked = isClipUnlocked(clip, lines);
|
||||
c.save();
|
||||
if (!unlocked) {
|
||||
roundRectPath(c, clip.x, clip.y, clip.w, clip.h, 10);
|
||||
c.fillStyle = '#dce4e888';
|
||||
c.fill();
|
||||
c.strokeStyle = '#7b6345aa';
|
||||
c.lineWidth = 1.6;
|
||||
c.setLineDash([5, 4]);
|
||||
c.stroke();
|
||||
c.setLineDash([]);
|
||||
|
||||
const cx = clip.x + 18;
|
||||
const cy = clip.y + clip.h / 2;
|
||||
c.shadowColor = '#2e1d0f55';
|
||||
c.shadowBlur = 6;
|
||||
c.shadowOffsetY = 2;
|
||||
roundRectPath(c, cx - 22, cy - 30, 44, 60, 10);
|
||||
const wood = c.createLinearGradient(cx - 22, cy - 30, cx + 22, cy + 30);
|
||||
wood.addColorStop(0, '#ab7846');
|
||||
wood.addColorStop(1, '#784c27');
|
||||
c.fillStyle = wood;
|
||||
c.fill();
|
||||
c.shadowColor = 'transparent';
|
||||
c.strokeStyle = '#4e2f15';
|
||||
c.lineWidth = 1.8;
|
||||
c.stroke();
|
||||
c.fillStyle = '#e7c985';
|
||||
c.fillRect(cx - 18, cy - 3, 36, 5);
|
||||
this.drawClipEmblem(c, cx, cy - 11, 11, clip.badgeColor, clip.badgeShape);
|
||||
c.fillStyle = '#fff5df';
|
||||
c.font = `700 11px ${SERIF_FONT}`;
|
||||
c.textAlign = 'center';
|
||||
c.textBaseline = 'middle';
|
||||
c.fillText(clip.label ?? '旧夹', cx, cy + 16);
|
||||
} else {
|
||||
const cx = clip.x + clip.w - 34;
|
||||
const cy = clip.y + 13;
|
||||
roundRectPath(c, cx - 24, cy - 9, 48, 18, 9);
|
||||
c.fillStyle = '#6b8555d8';
|
||||
c.fill();
|
||||
c.fillStyle = '#fffaf0';
|
||||
c.font = `700 11px ${SERIF_FONT}`;
|
||||
c.textAlign = 'center';
|
||||
c.textBaseline = 'middle';
|
||||
c.fillText('已开夹', cx, cy + 0.5);
|
||||
}
|
||||
c.restore();
|
||||
}
|
||||
}
|
||||
|
||||
this.unspoolTexture.uploadData(this.unspoolLayer.canvas);
|
||||
}
|
||||
|
||||
public exportArtwork(
|
||||
state: GameState,
|
||||
meta: {
|
||||
|
||||
Reference in new issue
Block a user