@playcraft/cli 0.0.53 → 0.0.55
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/dist/commands/create.js +164 -98
- package/dist/index.js +4 -1
- package/dist/scaffold/templates.js +35 -0
- package/package.json +3 -3
- package/project-templates/playable-template-phaser/.playcraftignore +10 -0
- package/project-templates/playable-template-phaser/CLAUDE.md +178 -0
- package/project-templates/playable-template-phaser/PLAYCRAFT-MIGRATION.md +328 -0
- package/project-templates/playable-template-phaser/README.md +381 -0
- package/project-templates/playable-template-phaser/assets/brain.png +0 -0
- package/project-templates/playable-template-phaser/assets/button.png +0 -0
- package/project-templates/playable-template-phaser/assets/interact.png +0 -0
- package/project-templates/playable-template-phaser/assets/logo.webp +0 -0
- package/project-templates/playable-template-phaser/assets/warn_brain.png +0 -0
- package/project-templates/playable-template-phaser/builds.config.js +12 -0
- package/project-templates/playable-template-phaser/globals.d.ts +2 -0
- package/project-templates/playable-template-phaser/index.html +12 -0
- package/project-templates/playable-template-phaser/package.json +45 -0
- package/project-templates/playable-template-phaser/scripts/base64-to-mp3.js +340 -0
- package/project-templates/playable-template-phaser/scripts/convert-to-webp.js +370 -0
- package/project-templates/playable-template-phaser/src/Game.ts +154 -0
- package/project-templates/playable-template-phaser/src/config/LoadingConfig.ts +40 -0
- package/project-templates/playable-template-phaser/src/config/ThemeConfig.ts +81 -0
- package/project-templates/playable-template-phaser/src/index.css +18 -0
- package/project-templates/playable-template-phaser/src/index.html +9 -0
- package/project-templates/playable-template-phaser/src/index.ts +30 -0
- package/project-templates/playable-template-phaser/src/json5.d.ts +4 -0
- package/project-templates/playable-template-phaser/src/managers/AudioManager.ts +559 -0
- package/project-templates/playable-template-phaser/src/scenes/MainScene.ts +301 -0
- package/project-templates/playable-template-phaser/src/scenes/PreloadScene.ts +256 -0
- package/project-templates/playable-template-phaser/src/theme/README.md +194 -0
- package/project-templates/playable-template-phaser/src/theme/blue-theme/assets/.gitkeep +24 -0
- package/project-templates/playable-template-phaser/src/theme/blue-theme/index.ts +27 -0
- package/project-templates/playable-template-phaser/src/theme/blue-theme/theme.data.json5 +19 -0
- package/project-templates/playable-template-phaser/src/theme/green-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-phaser/src/theme/green-theme/index.ts +20 -0
- package/project-templates/playable-template-phaser/src/theme/green-theme/theme.data.json5 +19 -0
- package/project-templates/playable-template-phaser/src/theme/index.ts +1 -0
- package/project-templates/playable-template-phaser/src/theme/red-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-phaser/src/theme/red-theme/index.ts +20 -0
- package/project-templates/playable-template-phaser/src/theme/red-theme/theme.data.json5 +19 -0
- package/project-templates/playable-template-phaser/src/theme/theme.metadata.md +60 -0
- package/project-templates/playable-template-phaser/src/theme/theme.schema.json5 +149 -0
- package/project-templates/playable-template-phaser/src/ui/BrainAgeUI.ts +681 -0
- package/project-templates/playable-template-phaser/src/ui/CountdownUI.ts +565 -0
- package/project-templates/playable-template-phaser/src/ui/PlayButton.ts +51 -0
- package/project-templates/playable-template-phaser/src/ui/ScoreUI.ts +207 -0
- package/project-templates/playable-template-phaser/src/ui/SuccessUI.ts +43 -0
- package/project-templates/playable-template-phaser/src/ui/index.ts +15 -0
- package/project-templates/playable-template-phaser/tsconfig.json +26 -0
- package/project-templates/playable-template-phaser/vite.config.ts +64 -0
- package/project-templates/playable-template-phaser//346/226/260/346/211/213/345/274/200/345/217/221/346/214/207/345/215/227.md +209 -0
- package/project-templates/playable-template-three/README.md +795 -0
- package/project-templates/playable-template-three/assets/Stork.glb +0 -0
- package/project-templates/playable-template-three/assets/button.png +0 -0
- package/project-templates/playable-template-three/assets/logo.webp +0 -0
- package/project-templates/playable-template-three/build.json +7 -0
- package/project-templates/playable-template-three/builds.config.example.js +151 -0
- package/project-templates/playable-template-three/builds.config.js +158 -0
- package/project-templates/playable-template-three/package.json +36 -0
- package/project-templates/playable-template-three/scripts/convert-to-webp.js +370 -0
- package/project-templates/playable-template-three/scripts/theme-builds.js +514 -0
- package/project-templates/playable-template-three/src/Game.ts +215 -0
- package/project-templates/playable-template-three/src/config/LoadingConfig.ts +27 -0
- package/project-templates/playable-template-three/src/config/ThemeConfig.ts +36 -0
- package/project-templates/playable-template-three/src/global.d.ts +108 -0
- package/project-templates/playable-template-three/src/index.css +18 -0
- package/project-templates/playable-template-three/src/index.html +9 -0
- package/project-templates/playable-template-three/src/index.ts +20 -0
- package/project-templates/playable-template-three/src/managers/AudioManager.ts +538 -0
- package/project-templates/playable-template-three/src/scenes/PreloadScene.ts +305 -0
- package/project-templates/playable-template-three/src/theme/README.md +225 -0
- package/project-templates/playable-template-three/src/theme/blue-theme/assets/.gitkeep +28 -0
- package/project-templates/playable-template-three/src/theme/blue-theme/index.ts +45 -0
- package/project-templates/playable-template-three/src/theme/current.ts +12 -0
- package/project-templates/playable-template-three/src/theme/green-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-three/src/theme/green-theme/index.ts +34 -0
- package/project-templates/playable-template-three/src/theme/red-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-three/src/theme/red-theme/index.ts +34 -0
- package/project-templates/playable-template-three/tsconfig.json +24 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# 主题系统说明
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
|
|
5
|
+
主题系统允许你为同一个游戏创建多个视觉风格变体,通过配置文件的方式抽离颜色、样式等数据,而不需要重写整个游戏逻辑。
|
|
6
|
+
|
|
7
|
+
## 目录结构
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
src/theme/
|
|
11
|
+
├── README.md # 本文档
|
|
12
|
+
├── current.ts # 当前主题入口(批量构建时自动切换)
|
|
13
|
+
├── blue-theme/ # 蓝色主题文件夹
|
|
14
|
+
│ ├── index.ts # 蓝色主题配置
|
|
15
|
+
│ └── assets/ # 蓝色主题专属资源
|
|
16
|
+
├── green-theme/ # 绿色主题文件夹
|
|
17
|
+
│ ├── index.ts # 绿色主题配置
|
|
18
|
+
│ └── assets/ # 绿色主题专属资源
|
|
19
|
+
└── red-theme/ # 红色主题文件夹
|
|
20
|
+
├── index.ts # 红色主题配置
|
|
21
|
+
└── assets/ # 红色主题专属资源
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**为什么使用文件夹结构?**
|
|
25
|
+
|
|
26
|
+
每个主题是一个独立的文件夹,不仅可以包含配置文件,还可以包含主题专属的资源(如图片、音频等),扩展性更强。
|
|
27
|
+
|
|
28
|
+
## 使用方法
|
|
29
|
+
|
|
30
|
+
### 开发时切换主题
|
|
31
|
+
|
|
32
|
+
修改 `current.ts` 的 import 语句:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// 使用蓝色主题
|
|
36
|
+
import config from './blue-theme';
|
|
37
|
+
|
|
38
|
+
// 使用绿色主题
|
|
39
|
+
import config from './green-theme';
|
|
40
|
+
|
|
41
|
+
// 使用红色主题
|
|
42
|
+
import config from './red-theme';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 批量构建多主题
|
|
46
|
+
|
|
47
|
+
参考根目录的 `builds.config.example.js` 配置主题批量构建。
|
|
48
|
+
|
|
49
|
+
## 配置说明
|
|
50
|
+
|
|
51
|
+
每个主题文件夹需要包含一个 `index.ts` 文件,导出 `ThemeConfig` 对象:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// src/theme/blue-theme/index.ts
|
|
55
|
+
import { ThemeConfig } from '../../config/ThemeConfig';
|
|
56
|
+
|
|
57
|
+
// 如果有主题专属资源,可以这样引入
|
|
58
|
+
import customBg from './assets/background.png';
|
|
59
|
+
import customButton from './assets/button.png';
|
|
60
|
+
|
|
61
|
+
const config: ThemeConfig = {
|
|
62
|
+
// 基础信息
|
|
63
|
+
name: '主题名称',
|
|
64
|
+
id: 'theme-id',
|
|
65
|
+
|
|
66
|
+
// 颜色配置
|
|
67
|
+
backgroundColor: 0x4a90e2,
|
|
68
|
+
primaryColor: 0x2c7be5,
|
|
69
|
+
textColor: '#ffffff',
|
|
70
|
+
|
|
71
|
+
// 字体配置
|
|
72
|
+
fontSize: {
|
|
73
|
+
title: '48px',
|
|
74
|
+
body: '24px',
|
|
75
|
+
button: '32px',
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// 可选:主题专属资源
|
|
79
|
+
customAssets: {
|
|
80
|
+
background: customBg,
|
|
81
|
+
button: customButton,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default config;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 主题专属资源
|
|
89
|
+
|
|
90
|
+
将主题特定的资源放在 `assets/` 目录下:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
blue-theme/
|
|
94
|
+
├── index.ts
|
|
95
|
+
└── assets/
|
|
96
|
+
├── background.png # 主题专属背景
|
|
97
|
+
├── button.png # 主题专属按钮
|
|
98
|
+
└── theme-music.mp3 # 主题专属音乐
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
在配置文件中引用:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import customBg from './assets/background.png';
|
|
105
|
+
import customMusic from './assets/theme-music.mp3';
|
|
106
|
+
|
|
107
|
+
const config: ThemeConfig = {
|
|
108
|
+
// ...
|
|
109
|
+
customAssets: {
|
|
110
|
+
background: customBg,
|
|
111
|
+
music: customMusic,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 添加新主题
|
|
117
|
+
|
|
118
|
+
1. 在 `src/theme/` 下创建新文件夹,如 `purple-theme/`
|
|
119
|
+
2. 在文件夹内创建 `index.ts` 和 `assets/` 目录
|
|
120
|
+
3. 复制现有主题的 `index.ts` 内容并修改配置
|
|
121
|
+
4. (可选)添加主题专属资源到 `assets/` 目录
|
|
122
|
+
5. 在 `current.ts` 中切换到新主题测试
|
|
123
|
+
6. 批量构建时会自动识别新主题
|
|
124
|
+
|
|
125
|
+
**示例**:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# 创建新主题文件夹
|
|
129
|
+
mkdir -p src/theme/purple-theme/assets
|
|
130
|
+
|
|
131
|
+
# 创建配置文件
|
|
132
|
+
touch src/theme/purple-theme/index.ts
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// src/theme/purple-theme/index.ts
|
|
137
|
+
import { ThemeConfig } from '../../config/ThemeConfig';
|
|
138
|
+
|
|
139
|
+
const config: ThemeConfig = {
|
|
140
|
+
name: '紫色主题',
|
|
141
|
+
id: 'purple',
|
|
142
|
+
backgroundColor: 0x9b59b6,
|
|
143
|
+
primaryColor: 0x8e44ad,
|
|
144
|
+
textColor: '#ffffff',
|
|
145
|
+
fontSize: {
|
|
146
|
+
title: '48px',
|
|
147
|
+
body: '24px',
|
|
148
|
+
button: '32px',
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export default config;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 配置项说明
|
|
156
|
+
|
|
157
|
+
| 配置项 | 类型 | 说明 |
|
|
158
|
+
| ----------------- | ------- | --------------------------------- |
|
|
159
|
+
| `name` | string | 主题名称(用于显示) |
|
|
160
|
+
| `id` | string | 主题唯一标识(用于文件命名) |
|
|
161
|
+
| `backgroundColor` | number | 背景颜色(十六进制,如 0x4a90e2) |
|
|
162
|
+
| `primaryColor` | number | 主色调 |
|
|
163
|
+
| `secondaryColor` | number? | 辅助色(可选) |
|
|
164
|
+
| `textColor` | string | 文字颜色(CSS 颜色) |
|
|
165
|
+
| `fontSize` | object | 字体大小配置 |
|
|
166
|
+
| `customAssets` | object? | 主题专属资源(可选) |
|
|
167
|
+
|
|
168
|
+
## 在游戏中使用主题
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import themeConfig from './theme/current';
|
|
172
|
+
|
|
173
|
+
// 设置背景色
|
|
174
|
+
this.cameras.main.setBackgroundColor(themeConfig.backgroundColor);
|
|
175
|
+
|
|
176
|
+
// 使用文字颜色
|
|
177
|
+
this.add.text(x, y, 'Hello', {
|
|
178
|
+
fontSize: themeConfig.fontSize.title,
|
|
179
|
+
color: themeConfig.textColor,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// 使用主题专属资源
|
|
183
|
+
if (themeConfig.customAssets?.background) {
|
|
184
|
+
this.load.image('bg', themeConfig.customAssets.background);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## 注意事项
|
|
189
|
+
|
|
190
|
+
1. **主题是纯数据配置**:不要在主题文件中编写游戏逻辑
|
|
191
|
+
2. **保持接口一致**:所有主题应该实现相同的配置接口
|
|
192
|
+
3. **使用 TypeScript**:类型检查确保配置正确
|
|
193
|
+
4. **资源管理**:主题专属资源放在 `assets/` 目录,公共资源放在项目根目录的 `assets/`
|
|
194
|
+
5. **批量构建**:使用 `npm run builds` 会自动为每个主题构建所有渠道
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 主题专属资源目录
|
|
2
|
+
|
|
3
|
+
将主题特定的资源文件放在这里,例如:
|
|
4
|
+
- 特定的背景图片
|
|
5
|
+
- 主题专属的UI元素
|
|
6
|
+
- 特殊的音频文件
|
|
7
|
+
|
|
8
|
+
示例:
|
|
9
|
+
```
|
|
10
|
+
assets/
|
|
11
|
+
├── background.png
|
|
12
|
+
├── button-special.png
|
|
13
|
+
└── theme-music.mp3
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
在主题配置中引用:
|
|
17
|
+
```typescript
|
|
18
|
+
import backgroundImg from './assets/background.png';
|
|
19
|
+
|
|
20
|
+
const config: ThemeConfig = {
|
|
21
|
+
// ...
|
|
22
|
+
customBackground: backgroundImg,
|
|
23
|
+
};
|
|
24
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎨 蓝色主题
|
|
3
|
+
* 适合海洋、天空、科技类游戏
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 公共资源 import
|
|
7
|
+
import logoWebp from 'assets/logo.webp';
|
|
8
|
+
|
|
9
|
+
// 主题特定资源(如果有)
|
|
10
|
+
// import customBg from './assets/background.png';
|
|
11
|
+
// import customButton from './assets/button.png';
|
|
12
|
+
|
|
13
|
+
// 主题配置覆盖(PlayCraft 平台)
|
|
14
|
+
import themeData from './theme.data.json5';
|
|
15
|
+
|
|
16
|
+
// 资源路径映射
|
|
17
|
+
const assetRecordByPath: Record<string, string> = {
|
|
18
|
+
'./assets/logo.webp': logoWebp,
|
|
19
|
+
// 如果有主题特定资源,在这里添加映射:
|
|
20
|
+
// './assets/background.png': customBg,
|
|
21
|
+
// './assets/button.png': customButton,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
themeData,
|
|
26
|
+
assetRecordByPath,
|
|
27
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
// 蓝色主题配置覆盖
|
|
3
|
+
// 只写与 schema 默认值不同的覆盖项
|
|
4
|
+
|
|
5
|
+
name: "蓝色主题",
|
|
6
|
+
id: "blue",
|
|
7
|
+
|
|
8
|
+
visual: {
|
|
9
|
+
backgroundColor: 0x4a90e2,
|
|
10
|
+
primaryColor: 0x2c3e50,
|
|
11
|
+
secondaryColor: 0x3498db,
|
|
12
|
+
textColor: "#ffffff",
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
gameplay: {
|
|
16
|
+
difficulty: 5,
|
|
17
|
+
enableHints: true,
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎨 绿色主题
|
|
3
|
+
* 适合自然、森林、环保类游戏
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 公共资源 import
|
|
7
|
+
import logoWebp from 'assets/logo.webp';
|
|
8
|
+
|
|
9
|
+
// 主题配置覆盖(PlayCraft 平台)
|
|
10
|
+
import themeData from './theme.data.json5';
|
|
11
|
+
|
|
12
|
+
// 资源路径映射
|
|
13
|
+
const assetRecordByPath: Record<string, string> = {
|
|
14
|
+
'./assets/logo.webp': logoWebp,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
themeData,
|
|
19
|
+
assetRecordByPath,
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
// 绿色主题配置覆盖
|
|
3
|
+
// 只写与 schema 默认值不同的覆盖项
|
|
4
|
+
|
|
5
|
+
name: "绿色主题",
|
|
6
|
+
id: "green",
|
|
7
|
+
|
|
8
|
+
visual: {
|
|
9
|
+
backgroundColor: 0x27ae60,
|
|
10
|
+
primaryColor: 0x1e8449,
|
|
11
|
+
secondaryColor: 0x52be80,
|
|
12
|
+
textColor: "#ffffff",
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
gameplay: {
|
|
16
|
+
difficulty: 3,
|
|
17
|
+
enableHints: true,
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './blue-theme';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🎨 红色主题
|
|
3
|
+
* 适合动作、冒险、激情类游戏
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 公共资源 import
|
|
7
|
+
import logoWebp from 'assets/logo.webp';
|
|
8
|
+
|
|
9
|
+
// 主题配置覆盖(PlayCraft 平台)
|
|
10
|
+
import themeData from './theme.data.json5';
|
|
11
|
+
|
|
12
|
+
// 资源路径映射
|
|
13
|
+
const assetRecordByPath: Record<string, string> = {
|
|
14
|
+
'./assets/logo.webp': logoWebp,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
themeData,
|
|
19
|
+
assetRecordByPath,
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
// 红色主题配置覆盖
|
|
3
|
+
// 只写与 schema 默认值不同的覆盖项
|
|
4
|
+
|
|
5
|
+
name: "红色主题",
|
|
6
|
+
id: "red",
|
|
7
|
+
|
|
8
|
+
visual: {
|
|
9
|
+
backgroundColor: 0xe74c3c,
|
|
10
|
+
primaryColor: 0xc0392b,
|
|
11
|
+
secondaryColor: 0xec7063,
|
|
12
|
+
textColor: "#ffffff",
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
gameplay: {
|
|
16
|
+
difficulty: 7,
|
|
17
|
+
enableHints: false,
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# 主题元数据
|
|
2
|
+
|
|
3
|
+
## 主题列表
|
|
4
|
+
|
|
5
|
+
| 主题 ID | 难度 | 提示 | 说明 |
|
|
6
|
+
| ------- | ---- | ---- | ------------------------------------- |
|
|
7
|
+
| blue | 5 | ✅ | 蓝色主题 - 适合海洋、天空、科技类游戏 |
|
|
8
|
+
| green | 3 | ✅ | 绿色主题 - 适合自然、森林、环保类游戏 |
|
|
9
|
+
| red | 7 | ❌ | 红色主题 - 适合动作、冒险、激情类游戏 |
|
|
10
|
+
|
|
11
|
+
## 配色方案
|
|
12
|
+
|
|
13
|
+
### 蓝色主题
|
|
14
|
+
|
|
15
|
+
- 背景色:`0x4a90e2` (深蓝)
|
|
16
|
+
- 主色:`0x2c3e50` (深灰蓝)
|
|
17
|
+
- 辅色:`0x3498db` (亮蓝)
|
|
18
|
+
- 文字色:`#ffffff` (白色)
|
|
19
|
+
|
|
20
|
+
### 绿色主题
|
|
21
|
+
|
|
22
|
+
- 背景色:`0x27ae60` (绿色)
|
|
23
|
+
- 主色:`0x1e8449` (深绿)
|
|
24
|
+
- 辅色:`0x52be80` (亮绿)
|
|
25
|
+
- 文字色:`#ffffff` (白色)
|
|
26
|
+
|
|
27
|
+
### 红色主题
|
|
28
|
+
|
|
29
|
+
- 背景色:`0xe74c3c` (红色)
|
|
30
|
+
- 主色:`0xc0392b` (深红)
|
|
31
|
+
- 辅色:`0xec7063` (浅红)
|
|
32
|
+
- 文字色:`#ffffff` (白色)
|
|
33
|
+
|
|
34
|
+
## 使用说明
|
|
35
|
+
|
|
36
|
+
### 切换主题
|
|
37
|
+
|
|
38
|
+
修改 `src/theme/index.ts` 文件:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// 导入当前激活的主题
|
|
42
|
+
export { default } from './blue-theme'; // 蓝色主题
|
|
43
|
+
// export { default } from './green-theme'; // 绿色主题
|
|
44
|
+
// export { default } from './red-theme'; // 红色主题
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 添加新主题
|
|
48
|
+
|
|
49
|
+
1. 复制现有主题目录(如 `blue-theme`)
|
|
50
|
+
2. 修改 `theme.data.json5` 中的配置
|
|
51
|
+
3. 更新主题特定资源(如有)
|
|
52
|
+
4. 在 `theme/index.ts` 中切换到新主题
|
|
53
|
+
|
|
54
|
+
## 配置说明
|
|
55
|
+
|
|
56
|
+
所有主题共享 `theme.schema.json5` 定义的默认值。
|
|
57
|
+
|
|
58
|
+
每个主题的 `theme.data.json5` 只需要写与默认值不同的配置项。
|
|
59
|
+
|
|
60
|
+
配置优先级:`theme.data.json5` > `theme.schema.json5`
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
// ⚠️ $schema 字段必须存在!SDK 通过它识别这是 JSON Schema(提取 default 值)
|
|
3
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
title: "Phaser Template Configuration",
|
|
5
|
+
description: "可玩广告模板配置协议",
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
// ========== 基础信息 ==========
|
|
9
|
+
name: {
|
|
10
|
+
type: "string",
|
|
11
|
+
default: "Default Theme",
|
|
12
|
+
description: "主题显示名称",
|
|
13
|
+
},
|
|
14
|
+
id: {
|
|
15
|
+
type: "string",
|
|
16
|
+
default: "default",
|
|
17
|
+
description: "主题唯一标识",
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
// ========== 资源配置 ==========
|
|
21
|
+
assets: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
logo: {
|
|
25
|
+
type: "string",
|
|
26
|
+
default: "./assets/logo.webp",
|
|
27
|
+
description: "Logo 图片",
|
|
28
|
+
xplatform: { value_type: "path", mime_type: "image/webp" },
|
|
29
|
+
},
|
|
30
|
+
buttonImage: {
|
|
31
|
+
type: "string",
|
|
32
|
+
default: "",
|
|
33
|
+
description: "按钮图片(可选)",
|
|
34
|
+
xplatform: { value_type: "path", mime_type: "image/png" },
|
|
35
|
+
},
|
|
36
|
+
backgroundImage: {
|
|
37
|
+
type: "string",
|
|
38
|
+
default: "",
|
|
39
|
+
description: "背景图片(可选)",
|
|
40
|
+
xplatform: { value_type: "path", mime_type: "image/png" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
// ========== 视觉配置 ==========
|
|
46
|
+
visual: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: {
|
|
49
|
+
backgroundColor: {
|
|
50
|
+
type: "integer",
|
|
51
|
+
default: 0xf7d37f,
|
|
52
|
+
description: "背景颜色(十六进制)",
|
|
53
|
+
},
|
|
54
|
+
primaryColor: {
|
|
55
|
+
type: "integer",
|
|
56
|
+
default: 0x4a90e2,
|
|
57
|
+
description: "主要颜色",
|
|
58
|
+
},
|
|
59
|
+
secondaryColor: {
|
|
60
|
+
type: "integer",
|
|
61
|
+
default: 0x3498db,
|
|
62
|
+
description: "次要颜色",
|
|
63
|
+
},
|
|
64
|
+
textColor: {
|
|
65
|
+
type: "string",
|
|
66
|
+
default: "#ffffff",
|
|
67
|
+
description: "文本颜色",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
// ========== 字体配置 ==========
|
|
73
|
+
fontSize: {
|
|
74
|
+
type: "object",
|
|
75
|
+
properties: {
|
|
76
|
+
title: {
|
|
77
|
+
type: "string",
|
|
78
|
+
default: "48px",
|
|
79
|
+
description: "标题字体大小",
|
|
80
|
+
},
|
|
81
|
+
body: {
|
|
82
|
+
type: "string",
|
|
83
|
+
default: "24px",
|
|
84
|
+
description: "正文字体大小",
|
|
85
|
+
},
|
|
86
|
+
button: {
|
|
87
|
+
type: "string",
|
|
88
|
+
default: "32px",
|
|
89
|
+
description: "按钮字体大小",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
// ========== 游戏参数 ==========
|
|
95
|
+
gameplay: {
|
|
96
|
+
type: "object",
|
|
97
|
+
properties: {
|
|
98
|
+
difficulty: {
|
|
99
|
+
type: "integer",
|
|
100
|
+
default: 5,
|
|
101
|
+
description: "难度系数 (1-10)",
|
|
102
|
+
},
|
|
103
|
+
enableHints: {
|
|
104
|
+
type: "boolean",
|
|
105
|
+
default: true,
|
|
106
|
+
description: "是否启用提示",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
// ========== Loading 配置 ==========
|
|
112
|
+
loading: {
|
|
113
|
+
type: "object",
|
|
114
|
+
properties: {
|
|
115
|
+
logoImage: {
|
|
116
|
+
type: "string",
|
|
117
|
+
default: "./assets/logo.webp",
|
|
118
|
+
description: "Loading 页面 Logo",
|
|
119
|
+
xplatform: { value_type: "path", mime_type: "image/webp" },
|
|
120
|
+
},
|
|
121
|
+
appTitle: {
|
|
122
|
+
type: "string",
|
|
123
|
+
default: "Sola Mahjong",
|
|
124
|
+
description: "应用标题",
|
|
125
|
+
},
|
|
126
|
+
appStars: {
|
|
127
|
+
type: "string",
|
|
128
|
+
default: "★★★★★",
|
|
129
|
+
description: "评分星星",
|
|
130
|
+
},
|
|
131
|
+
appDesc: {
|
|
132
|
+
type: "string",
|
|
133
|
+
default: "Sola Mahjong: Classic Tile\nPairing for a Relaxing Puzzle",
|
|
134
|
+
description: "应用描述",
|
|
135
|
+
},
|
|
136
|
+
loadingText: {
|
|
137
|
+
type: "string",
|
|
138
|
+
default: "Loading Playable Ads",
|
|
139
|
+
description: "加载文字",
|
|
140
|
+
},
|
|
141
|
+
sceneDuration: {
|
|
142
|
+
type: "integer",
|
|
143
|
+
default: 100,
|
|
144
|
+
description: "Loading 页面最小显示时长(毫秒)",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
}
|