From d4b385ec22bebcfe3bdf156811dd5723d25a20e1 Mon Sep 17 00:00:00 2001 From: Burrito Date: Thu, 21 Nov 2024 07:38:35 +0800 Subject: [PATCH 1/2] Added render mode support --- src/build/play/tasks/main/engine/playData/skin.ts | 1 + src/build/preview/tasks/main/engine/playData/skin.ts | 1 + src/build/tutorial/tasks/main/engine/tutorialData/skin.ts | 1 + src/build/watch/tasks/main/engine/watchData/skin.ts | 1 + src/lib/shared/define/skin.ts | 3 +++ 5 files changed, 7 insertions(+) diff --git a/src/build/play/tasks/main/engine/playData/skin.ts b/src/build/play/tasks/main/engine/playData/skin.ts index 468abc6..b9b37a3 100644 --- a/src/build/play/tasks/main/engine/playData/skin.ts +++ b/src/build/play/tasks/main/engine/playData/skin.ts @@ -3,6 +3,7 @@ import { clean } from '../../../../../shared/utils/clean.js' export const buildSkin = (skin: EnginePlayData['skin']): EnginePlayData['skin'] => clean(skin, { + 'renderMode?': 'string', sprites: [ { name: 'string', diff --git a/src/build/preview/tasks/main/engine/playData/skin.ts b/src/build/preview/tasks/main/engine/playData/skin.ts index 468abc6..b9b37a3 100644 --- a/src/build/preview/tasks/main/engine/playData/skin.ts +++ b/src/build/preview/tasks/main/engine/playData/skin.ts @@ -3,6 +3,7 @@ import { clean } from '../../../../../shared/utils/clean.js' export const buildSkin = (skin: EnginePlayData['skin']): EnginePlayData['skin'] => clean(skin, { + 'renderMode?': 'string', sprites: [ { name: 'string', diff --git a/src/build/tutorial/tasks/main/engine/tutorialData/skin.ts b/src/build/tutorial/tasks/main/engine/tutorialData/skin.ts index e2b320c..59f10a4 100644 --- a/src/build/tutorial/tasks/main/engine/tutorialData/skin.ts +++ b/src/build/tutorial/tasks/main/engine/tutorialData/skin.ts @@ -3,6 +3,7 @@ import { clean } from '../../../../../shared/utils/clean.js' export const buildSkin = (skin: EngineTutorialData['skin']): EngineTutorialData['skin'] => clean(skin, { + 'renderMode?': 'string', sprites: [ { name: 'string', diff --git a/src/build/watch/tasks/main/engine/watchData/skin.ts b/src/build/watch/tasks/main/engine/watchData/skin.ts index 468abc6..b9b37a3 100644 --- a/src/build/watch/tasks/main/engine/watchData/skin.ts +++ b/src/build/watch/tasks/main/engine/watchData/skin.ts @@ -3,6 +3,7 @@ import { clean } from '../../../../../shared/utils/clean.js' export const buildSkin = (skin: EnginePlayData['skin']): EnginePlayData['skin'] => clean(skin, { + 'renderMode?': 'string', sprites: [ { name: 'string', diff --git a/src/lib/shared/define/skin.ts b/src/lib/shared/define/skin.ts index 993c91b..3addbae 100644 --- a/src/lib/shared/define/skin.ts +++ b/src/lib/shared/define/skin.ts @@ -33,6 +33,7 @@ export type SkinSprite = { } type SkinDefinition = { + renderMode?: 'default' | 'standard' | 'lightweight' sprites: Record } @@ -61,6 +62,7 @@ type SkinSprites = { } type Skin = { + renderMode?: 'default' | 'standard' | 'lightweight' sprites: { readonly name: string; readonly id: number }[] & { [K in keyof T['sprites']]: SkinSprite } & SkinSprites @@ -91,6 +93,7 @@ export const createDefineSkin = (pointer: (x: number, y: number, s: number) => T) => (skin: T): Skin => defineLib>({ + ...(skin.renderMode && { renderMode: skin.renderMode }), sprites: Object.assign( Object.values(skin.sprites).map((name, id) => ({ name, id })), Object.fromEntries( From 3b48db755cc4f05720c82c1a31d9ee3c3f6bc439 Mon Sep 17 00:00:00 2001 From: Burrito Date: Sat, 30 Nov 2024 16:22:58 +0800 Subject: [PATCH 2/2] Updated core --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 39979ea..257ae22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "typescript-eslint": "^8.16.0" }, "peerDependencies": { - "@sonolus/core": "~7.9.2" + "@sonolus/core": "~7.9.3" } }, "node_modules/@eslint-community/eslint-utils": { @@ -256,9 +256,9 @@ } }, "node_modules/@sonolus/core": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@sonolus/core/-/core-7.9.2.tgz", - "integrity": "sha512-AsL6zN1qnWdpAqRwXiFHFkRYjsLLwJ36epdScW/1OytxKql9+ZlODws/iZhkvAMssGoJSzwNsOiWNHHCG/ZCwA==", + "version": "7.9.3", + "resolved": "https://registry.npmjs.org/@sonolus/core/-/core-7.9.3.tgz", + "integrity": "sha512-D9ltL1W9KBlij4hDd/0d7B1wxXX0U/dzOadQMbe8DGGMBwu/rn+FQHebHKaEqCXbkUkVgFBlcbU1dCQO2PPCzQ==", "license": "MIT", "peer": true }, diff --git a/package.json b/package.json index d5b3a87..7a874ed 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "acorn": "^8.14.0" }, "peerDependencies": { - "@sonolus/core": "~7.9.2" + "@sonolus/core": "~7.9.3" }, "devDependencies": { "@eslint/js": "^9.16.0",