create-pixifact 0.17.0 → 0.19.0
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.md +16 -1
- package/dist/createPixifactProject.d.ts +3 -2
- package/dist/index.js +34 -14
- package/dist/skills/pixifact/SKILL.md +27 -4
- package/dist/skills/pixifact/agents/openai.yaml +2 -2
- package/dist/skills/pixifact/references/scene-authoring-decisions.md +2 -0
- package/dist/skills/pixifact/references/scene-hierarchy-patterns.md +38 -0
- package/dist/skills/pixifact/references/scene-objects.md +40 -2
- package/package.json +5 -2
- package/templates/game/.env +1 -0
- package/templates/game/README.md +119 -0
- package/templates/game/assets/ui/button.png +0 -0
- package/templates/game/assets/ui/panel.png +0 -0
- package/templates/game/bunfig.toml +1 -0
- package/templates/game/index.html +12 -0
- package/templates/game/package.json +24 -0
- package/templates/game/pixifact.project.json +11 -0
- package/templates/game/src/GameApp.ts +118 -0
- package/templates/game/src/core/GameSession.ts +43 -0
- package/templates/game/src/core/ScreenManager.ts +26 -0
- package/templates/game/src/core/WebRecordStore.ts +14 -0
- package/templates/game/src/main.ts +64 -0
- package/templates/game/src/screens/MainMenu.scene +57 -0
- package/templates/game/src/screens/MainMenu.ts +101 -0
- package/templates/game/src/screens/PlayScreen.scene +13 -0
- package/templates/game/src/screens/PlayScreen.ts +31 -0
- package/templates/game/src/screens/ResultScreen.scene +13 -0
- package/templates/game/src/screens/ResultScreen.ts +25 -0
- package/templates/game/src/styles.css +21 -0
- package/templates/game/src/ui/Button.scene +10 -0
- package/templates/game/src/ui/Button.ts +84 -0
- package/templates/game/src/ui/Dialog.scene +10 -0
- package/templates/game/src/ui/Dialog.ts +31 -0
- package/templates/game/src/ui/Panel.scene +7 -0
- package/templates/game/src/ui/Panel.ts +11 -0
- package/templates/game/src/ui/ProgressBar.scene +4 -0
- package/templates/game/src/ui/ProgressBar.ts +25 -0
- package/templates/game/src/ui/nine/ButtonBackground.scene +3 -0
- package/templates/game/src/ui/nine/ButtonBackground.ts +5 -0
- package/templates/game/src/ui/nine/PanelBackground.scene +3 -0
- package/templates/game/src/ui/nine/PanelBackground.ts +5 -0
- package/templates/game/src/vite-env.d.ts +2 -0
- package/templates/game/tsconfig.json +15 -0
- package/templates/game/vite.config.ts +9 -0
- package/templates/minimal/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Group } from 'pixifact/runtime';
|
|
2
|
+
import { createEvent, event, prop, scene } from 'pixifact/scene';
|
|
3
|
+
|
|
4
|
+
@scene()
|
|
5
|
+
export class Dialog extends Group {
|
|
6
|
+
@prop({ default: '确认操作' })
|
|
7
|
+
declare title: string;
|
|
8
|
+
|
|
9
|
+
@prop({ default: '是否继续?' })
|
|
10
|
+
declare message: string;
|
|
11
|
+
|
|
12
|
+
@prop({ default: '确定' })
|
|
13
|
+
declare confirmText: string;
|
|
14
|
+
|
|
15
|
+
@prop({ default: '取消' })
|
|
16
|
+
declare cancelText: string;
|
|
17
|
+
|
|
18
|
+
@event()
|
|
19
|
+
readonly confirmed = createEvent();
|
|
20
|
+
|
|
21
|
+
@event()
|
|
22
|
+
readonly cancelled = createEvent();
|
|
23
|
+
|
|
24
|
+
confirm() {
|
|
25
|
+
this.confirmed.emit();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
cancel() {
|
|
29
|
+
this.cancelled.emit();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<Scene name="Panel" width="620" height="400">
|
|
2
|
+
<PanelBackground id="background" scene="./nine/PanelBackground.scene" left="0" right="0" top="0" bottom="0" />
|
|
3
|
+
<Label id="titleLabel" text="{title}" left="32" right="32" top="24" height="48" fontSize="36" fontFamily="sans-serif" fontWeight="700" fill="#25322d" alignY="center" eventMode="none" />
|
|
4
|
+
<Group id="contentHost" left="32" right="32" top="96" bottom="32">
|
|
5
|
+
<slot name="content" />
|
|
6
|
+
</Group>
|
|
7
|
+
</Scene>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Group, type Rect } from 'pixifact/runtime';
|
|
2
|
+
import { part, scene } from 'pixifact/scene';
|
|
3
|
+
|
|
4
|
+
@scene()
|
|
5
|
+
export class ProgressBar extends Group {
|
|
6
|
+
@part()
|
|
7
|
+
protected declare fill: Rect;
|
|
8
|
+
|
|
9
|
+
private fraction = 0;
|
|
10
|
+
|
|
11
|
+
onMounted() {
|
|
12
|
+
this.layout();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setProgress(value: number, max: number) {
|
|
16
|
+
this.fraction = Math.max(0, Math.min(1, value / max));
|
|
17
|
+
this.layout();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override layout() {
|
|
21
|
+
super.layout();
|
|
22
|
+
// Group 在 Scene 挂载完成前也会布局;@part 在挂载后注入。
|
|
23
|
+
if (this.fill) this.fill.setSize(this.width * this.fraction, this.height);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"useDefineForClassFields": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"lib": ["ESNext", "DOM"],
|
|
12
|
+
"skipLibCheck": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.ts"]
|
|
15
|
+
}
|