@linxin666/dsh-pet 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/assets/whale/pet.json +54 -54
- package/assets/whale-refined/pet.json +96 -1
- package/lib/client.js +84 -14
- package/lib/client.js.map +1 -1
- package/lib/index.js +62 -58
- package/lib/types/client/PetSprite.d.ts.map +1 -1
- package/lib/types/client/PetSprite.js +23 -17
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +50 -3
- package/lib/types/client/ui-teardown.d.ts +29 -0
- package/lib/types/client/ui-teardown.d.ts.map +1 -0
- package/lib/types/client/ui-teardown.js +41 -0
- package/lib/types/registry.d.ts +5 -1
- package/lib/types/registry.d.ts.map +1 -1
- package/lib/types/registry.js +14 -10
- package/package.json +12 -9
- package/src/client/PetSprite.test.tsx +168 -26
- package/src/client/PetSprite.tsx +21 -15
- package/src/client/index.test.tsx +118 -11
- package/src/client/index.ts +51 -3
- package/src/client/ui-teardown.ts +47 -0
- package/src/registry.test.ts +14 -0
- package/src/registry.ts +14 -10
package/src/registry.test.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { join } from 'node:path'
|
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_FRAME_COUNTS,
|
|
7
7
|
DEFAULT_PET_CELL,
|
|
8
|
+
DEFAULT_TRACK_PATTERNS,
|
|
9
|
+
PET_ROW_ORDER,
|
|
8
10
|
PET_SCAN_JSON_CAP,
|
|
9
11
|
codexPetsDir,
|
|
10
12
|
loadPetRegistry,
|
|
@@ -168,6 +170,18 @@ describe('loadPetRegistry', () => {
|
|
|
168
170
|
readFileSync(petAtlasFile(registry.byId('whale-girl-refined')!)),
|
|
169
171
|
)).toBe(false)
|
|
170
172
|
expect(registry.defaultEntry().id).toBe('whale-girl')
|
|
173
|
+
// Both built-in whales and every override-free pet share the one slow
|
|
174
|
+
// global rhythm (user request: all pets were too fast at the legacy
|
|
175
|
+
// hatch-pet contract pace).
|
|
176
|
+
for (const track of PET_ROW_ORDER) {
|
|
177
|
+
expect(registry.byId('whale-girl')!.tracks[track].durations)
|
|
178
|
+
.toEqual(DEFAULT_TRACK_PATTERNS[track].durations)
|
|
179
|
+
expect(registry.byId('whale-girl-refined')!.tracks[track].durations)
|
|
180
|
+
.toEqual(DEFAULT_TRACK_PATTERNS[track].durations)
|
|
181
|
+
}
|
|
182
|
+
expect(DEFAULT_TRACK_PATTERNS.idle.durations[0]!).toBeGreaterThanOrEqual(500)
|
|
183
|
+
expect(DEFAULT_TRACK_PATTERNS['running-right'].durations[0]!).toBeGreaterThanOrEqual(300)
|
|
184
|
+
expect(DEFAULT_TRACK_PATTERNS.waving.durations[0]!).toBeGreaterThanOrEqual(450)
|
|
171
185
|
})
|
|
172
186
|
|
|
173
187
|
it('scans built-in assets, the custom pets dir, and composed extras with precedence', () => {
|
package/src/registry.ts
CHANGED
|
@@ -114,21 +114,25 @@ export interface PetTrackDef {
|
|
|
114
114
|
fallback?: PetAnimation
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Default per-track rhythm — the shared slow baseline every sprite2d pet
|
|
119
|
+
* plays unless its manifest overrides a track (user request: all pets were
|
|
120
|
+
* too fast at the legacy hatch-pet contract pace).
|
|
121
|
+
*/
|
|
118
122
|
export const DEFAULT_TRACK_PATTERNS: Record<PetAnimation, {
|
|
119
123
|
durations: number[]
|
|
120
124
|
loop: boolean
|
|
121
125
|
fallback?: PetAnimation
|
|
122
126
|
}> = {
|
|
123
|
-
idle: { durations: [
|
|
124
|
-
'running-right': { durations: [
|
|
125
|
-
'running-left': { durations: [
|
|
126
|
-
waving: { durations: [
|
|
127
|
-
jumping: { durations: [
|
|
128
|
-
failed: { durations: [
|
|
129
|
-
waiting: { durations: [
|
|
130
|
-
running: { durations: [
|
|
131
|
-
review: { durations: [
|
|
127
|
+
idle: { durations: [500, 500, 600, 500, 500, 600], loop: true },
|
|
128
|
+
'running-right': { durations: [300, 300, 300, 300, 300, 300, 300, 400], loop: true },
|
|
129
|
+
'running-left': { durations: [300, 300, 300, 300, 300, 300, 300, 400], loop: true },
|
|
130
|
+
waving: { durations: [450, 450, 450, 450], loop: true },
|
|
131
|
+
jumping: { durations: [400, 400, 400, 450, 450], loop: false, fallback: 'idle' },
|
|
132
|
+
failed: { durations: [550, 550, 550, 600, 650, 700, 550, 550], loop: false, fallback: 'idle' },
|
|
133
|
+
waiting: { durations: [550, 550, 600, 550, 550, 600], loop: true },
|
|
134
|
+
running: { durations: [330, 330, 330, 330, 330, 400], loop: true },
|
|
135
|
+
review: { durations: [650, 650, 650, 650, 650, 650], loop: true },
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
/** Manifest shape a pet directory (or 'PetConfig.pets' entry) declares. */
|