@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,215 @@
|
|
|
1
|
+
import { sdk } from '@playcraft/adsdk';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { AudioManager } from './managers/AudioManager';
|
|
4
|
+
import { PreloadScene, PreloadResources } from './scenes/PreloadScene';
|
|
5
|
+
import themeConfig from './theme/current';
|
|
6
|
+
|
|
7
|
+
export class Game {
|
|
8
|
+
private scene: THREE.Scene;
|
|
9
|
+
private camera: THREE.PerspectiveCamera;
|
|
10
|
+
private renderer: THREE.WebGLRenderer;
|
|
11
|
+
private uiContainer: HTMLDivElement;
|
|
12
|
+
private installButton: HTMLDivElement;
|
|
13
|
+
private storkModel: THREE.Group;
|
|
14
|
+
private mixer: THREE.AnimationMixer;
|
|
15
|
+
private clock: THREE.Clock;
|
|
16
|
+
public isPaused: boolean = false;
|
|
17
|
+
|
|
18
|
+
// Audio Manager
|
|
19
|
+
private audioManager: AudioManager;
|
|
20
|
+
|
|
21
|
+
constructor(width: number, height: number) {
|
|
22
|
+
// 创建 PreloadScene
|
|
23
|
+
const preloadScene = new PreloadScene();
|
|
24
|
+
preloadScene.start((resources: PreloadResources) => {
|
|
25
|
+
// 资源加载完成,初始化游戏
|
|
26
|
+
this.initGame(width, height, resources);
|
|
27
|
+
// 通知 SDK 游戏开始
|
|
28
|
+
sdk.start();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private initGame(width: number, height: number, resources: PreloadResources): void {
|
|
33
|
+
// 初始化 AudioManager(示例配置,可根据需要调整)
|
|
34
|
+
this.audioManager = new AudioManager({
|
|
35
|
+
bgmVolume: 0.5,
|
|
36
|
+
effectVolume: 0.6,
|
|
37
|
+
enableBackgroundPause: true,
|
|
38
|
+
watchdogInterval: 500
|
|
39
|
+
});
|
|
40
|
+
this.audioManager.init();
|
|
41
|
+
|
|
42
|
+
// Create renderer
|
|
43
|
+
this.renderer = new THREE.WebGLRenderer({ antialias: true });
|
|
44
|
+
this.renderer.setSize(width, height);
|
|
45
|
+
this.renderer.setPixelRatio(1.5);
|
|
46
|
+
document.body.appendChild(this.renderer.domElement);
|
|
47
|
+
|
|
48
|
+
// Create THREE.js scene(使用主题配置)
|
|
49
|
+
this.scene = new THREE.Scene();
|
|
50
|
+
this.scene.background = new THREE.Color(themeConfig.sceneBackground);
|
|
51
|
+
|
|
52
|
+
// Create camera
|
|
53
|
+
this.camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
|
|
54
|
+
|
|
55
|
+
// Initialize clock for animations
|
|
56
|
+
this.clock = new THREE.Clock();
|
|
57
|
+
|
|
58
|
+
// Create UI container
|
|
59
|
+
this.uiContainer = document.createElement('div');
|
|
60
|
+
this.uiContainer.style.cssText = 'position: absolute; top: 0px; left: 0px; transform-origin: top left;';
|
|
61
|
+
document.body.appendChild(this.uiContainer);
|
|
62
|
+
|
|
63
|
+
// 使用预加载的资源创建场景
|
|
64
|
+
this.create(resources);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private create(resources: PreloadResources): void {
|
|
68
|
+
this.createUI(resources.buttonImage);
|
|
69
|
+
|
|
70
|
+
// Add lights(使用主题配置)
|
|
71
|
+
const ambientLight = new THREE.AmbientLight(
|
|
72
|
+
themeConfig.ambientLightColor,
|
|
73
|
+
themeConfig.ambientLightIntensity
|
|
74
|
+
);
|
|
75
|
+
this.scene.add(ambientLight);
|
|
76
|
+
|
|
77
|
+
const directionalLight = new THREE.DirectionalLight(
|
|
78
|
+
themeConfig.directionalLightColor,
|
|
79
|
+
themeConfig.directionalLightIntensity
|
|
80
|
+
);
|
|
81
|
+
directionalLight.position.set(5, 5, 5);
|
|
82
|
+
this.scene.add(directionalLight);
|
|
83
|
+
|
|
84
|
+
// 添加 3D 模型(使用主题配置的缩放)
|
|
85
|
+
if (resources.storkModel) {
|
|
86
|
+
this.storkModel = resources.storkModel.scene;
|
|
87
|
+
const scale = themeConfig.modelScale || 0.5;
|
|
88
|
+
this.storkModel.scale.set(scale, scale, scale);
|
|
89
|
+
this.scene.add(this.storkModel);
|
|
90
|
+
|
|
91
|
+
// Set up animation mixer
|
|
92
|
+
this.mixer = new THREE.AnimationMixer(this.storkModel);
|
|
93
|
+
|
|
94
|
+
// Play first animation
|
|
95
|
+
if (resources.storkModel.animations.length > 0) {
|
|
96
|
+
const action = this.mixer.clipAction(resources.storkModel.animations[0]);
|
|
97
|
+
action.play();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Set up interaction listener
|
|
102
|
+
sdk.on('interaction', (count: number) => {
|
|
103
|
+
console.log(`Interaction count: ${count}`);
|
|
104
|
+
|
|
105
|
+
if (sdk.interactions >= 10) {
|
|
106
|
+
sdk.finish();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Start animation loop
|
|
111
|
+
this.animate();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private createUI(buttonImage: HTMLImageElement | null): void {
|
|
115
|
+
this.installButton = document.createElement('div');
|
|
116
|
+
this.installButton.style.cssText =
|
|
117
|
+
'cursor: pointer; width: 200px; display: flex; align-items: center; justify-content: center; margin: 20px;';
|
|
118
|
+
this.installButton.onclick = () => {
|
|
119
|
+
// 用户交互时可以播放音效或BGM
|
|
120
|
+
// 示例:this.audioManager.playEffect('click');
|
|
121
|
+
// 示例:this.audioManager.playBgm();
|
|
122
|
+
sdk.install();
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Add image
|
|
126
|
+
if (buttonImage) {
|
|
127
|
+
buttonImage.style.width = '100%';
|
|
128
|
+
this.installButton.appendChild(buttonImage);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Add text overlay(使用主题配置)
|
|
132
|
+
const text = document.createElement('div');
|
|
133
|
+
text.textContent = 'Install';
|
|
134
|
+
text.style.cssText = `
|
|
135
|
+
position: absolute;
|
|
136
|
+
color: ${themeConfig.uiTextColor};
|
|
137
|
+
font-size: ${themeConfig.buttonStyle.fontSize};
|
|
138
|
+
font-weight: ${themeConfig.buttonStyle.fontWeight};
|
|
139
|
+
text-shadow: ${themeConfig.buttonStyle.textShadow};
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
font-family: cursive;
|
|
142
|
+
`;
|
|
143
|
+
this.installButton.appendChild(text);
|
|
144
|
+
|
|
145
|
+
this.uiContainer.appendChild(this.installButton);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private update(): void {
|
|
149
|
+
if (this.mixer) {
|
|
150
|
+
const delta = this.clock.getDelta();
|
|
151
|
+
this.mixer.update(delta);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (this.storkModel) {
|
|
155
|
+
const speed = themeConfig.rotationSpeed || 0.01;
|
|
156
|
+
this.storkModel.rotation.y += speed;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private animate(): void {
|
|
161
|
+
requestAnimationFrame(() => this.animate());
|
|
162
|
+
|
|
163
|
+
if (!this.isPaused) this.update();
|
|
164
|
+
|
|
165
|
+
this.renderer.render(this.scene, this.camera);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public resize(width: number, height: number): void {
|
|
169
|
+
// Update container size
|
|
170
|
+
this.uiContainer.style.width = `${width}px`;
|
|
171
|
+
this.uiContainer.style.height = `${height}px`;
|
|
172
|
+
|
|
173
|
+
// Calculate scale based on screen dimensions
|
|
174
|
+
const scaleX = width / 320;
|
|
175
|
+
const scaleY = height / 480;
|
|
176
|
+
const scale = Math.min(scaleX, scaleY); // Use smaller scale to fit both dimensions
|
|
177
|
+
|
|
178
|
+
this.uiContainer.style.transform = `scale(${scale})`;
|
|
179
|
+
|
|
180
|
+
// Update camera aspect ratio
|
|
181
|
+
this.camera.aspect = width / height;
|
|
182
|
+
|
|
183
|
+
// 使用主题配置的相机距离(如果有),否则使用默认值
|
|
184
|
+
const landscapeDistance = themeConfig.cameraDistance || 80;
|
|
185
|
+
const portraitDistance = landscapeDistance * 2;
|
|
186
|
+
this.camera.position.z = width > height ? landscapeDistance : portraitDistance;
|
|
187
|
+
|
|
188
|
+
this.camera.updateProjectionMatrix();
|
|
189
|
+
|
|
190
|
+
// Resize renderer
|
|
191
|
+
this.renderer.setSize(width, height);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
public pause(): void {
|
|
195
|
+
this.isPaused = true;
|
|
196
|
+
this.audioManager.setGamePaused(true);
|
|
197
|
+
console.log('Game paused');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public resume(): void {
|
|
201
|
+
this.isPaused = false;
|
|
202
|
+
this.audioManager.setGamePaused(false);
|
|
203
|
+
console.log('Game resumed');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public volume(value: number): void {
|
|
207
|
+
this.audioManager.setVolume(value);
|
|
208
|
+
console.log(`Volume changed to: ${value}`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
public finish(): void {
|
|
212
|
+
this.audioManager.setGameEnded(true);
|
|
213
|
+
console.log('Game finished');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading 页面配置
|
|
3
|
+
* 可根据实际项目需要修改
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// TODO: 替换为实际的 Logo 图片路径
|
|
7
|
+
import logoImage from 'assets/logo.webp';
|
|
8
|
+
|
|
9
|
+
export const LoadingConfig = {
|
|
10
|
+
// 文案配置
|
|
11
|
+
LOGO_IMAGE: logoImage, // Logo 图片
|
|
12
|
+
APP_TITLE: 'Vita Mahjong', // 应用标题
|
|
13
|
+
APP_STARS: '★★★★★', // 评分星星
|
|
14
|
+
APP_DESC: 'Relaxing Vita Mahjong: Classic Tile\nMatching and Offline Puzzle Games!...', // 应用描述
|
|
15
|
+
LOADING_TEXT: 'Loading Playable Ads', // 加载文字
|
|
16
|
+
GAMEPAD_ICON: '🎮',
|
|
17
|
+
|
|
18
|
+
// 时间配置
|
|
19
|
+
SCENE_DURATION: 100, // Loading 页面最小显示时长(毫秒)
|
|
20
|
+
DOT_ANIM_DELAY: 200, // 点号动画间隔(毫秒)
|
|
21
|
+
|
|
22
|
+
// 跳跃动画配置
|
|
23
|
+
BOUNCE_HEIGHT_LANDSCAPE: 8, // 横屏跳跃高度
|
|
24
|
+
BOUNCE_HEIGHT_PORTRAIT: 10, // 竖屏跳跃高度
|
|
25
|
+
BOUNCE_DURATION: 300, // 跳跃动画时长(毫秒)
|
|
26
|
+
BOUNCE_REPEAT_DELAY: 100, // 跳跃重复延迟(毫秒)
|
|
27
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 主题配置接口
|
|
3
|
+
* 定义主题的数据结构,包括颜色、样式等配置
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ThemeConfig {
|
|
7
|
+
// 基础信息
|
|
8
|
+
name: string; // 主题名称
|
|
9
|
+
id: string; // 主题唯一标识
|
|
10
|
+
|
|
11
|
+
// 场景配置
|
|
12
|
+
sceneBackground: number; // 场景背景色(THREE.Color 值)
|
|
13
|
+
|
|
14
|
+
// 光照配置
|
|
15
|
+
ambientLightColor: number; // 环境光颜色
|
|
16
|
+
ambientLightIntensity: number; // 环境光强度
|
|
17
|
+
directionalLightColor: number; // 方向光颜色
|
|
18
|
+
directionalLightIntensity: number; // 方向光强度
|
|
19
|
+
|
|
20
|
+
// UI 配置
|
|
21
|
+
uiPrimaryColor: string; // 主色调(CSS 颜色)
|
|
22
|
+
uiTextColor: string; // 文字颜色
|
|
23
|
+
buttonStyle: {
|
|
24
|
+
fontSize: string;
|
|
25
|
+
fontWeight: string;
|
|
26
|
+
textShadow: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// 可选:游戏特定配置
|
|
30
|
+
modelScale?: number; // 模型缩放比例
|
|
31
|
+
cameraDistance?: number; // 相机距离
|
|
32
|
+
rotationSpeed?: number; // 旋转速度
|
|
33
|
+
|
|
34
|
+
// 可选:自定义配置
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全局类型声明
|
|
3
|
+
* 用于声明非 TypeScript 模块的类型
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 图片资源模块声明
|
|
7
|
+
declare module '*.png' {
|
|
8
|
+
const value: string;
|
|
9
|
+
export default value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module '*.jpg' {
|
|
13
|
+
const value: string;
|
|
14
|
+
export default value;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module '*.jpeg' {
|
|
18
|
+
const value: string;
|
|
19
|
+
export default value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare module '*.gif' {
|
|
23
|
+
const value: string;
|
|
24
|
+
export default value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare module '*.svg' {
|
|
28
|
+
const value: string;
|
|
29
|
+
export default value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare module '*.webp' {
|
|
33
|
+
const value: string;
|
|
34
|
+
export default value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare module '*.ico' {
|
|
38
|
+
const value: string;
|
|
39
|
+
export default value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare module '*.bmp' {
|
|
43
|
+
const value: string;
|
|
44
|
+
export default value;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 3D 模型文件声明
|
|
48
|
+
declare module '*.glb' {
|
|
49
|
+
const value: string;
|
|
50
|
+
export default value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module '*.gltf' {
|
|
54
|
+
const value: string;
|
|
55
|
+
export default value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare module '*.fbx' {
|
|
59
|
+
const value: string;
|
|
60
|
+
export default value;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare module '*.obj' {
|
|
64
|
+
const value: string;
|
|
65
|
+
export default value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 音频文件声明
|
|
69
|
+
declare module '*.mp3' {
|
|
70
|
+
const value: string;
|
|
71
|
+
export default value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare module '*.wav' {
|
|
75
|
+
const value: string;
|
|
76
|
+
export default value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare module '*.ogg' {
|
|
80
|
+
const value: string;
|
|
81
|
+
export default value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare module '*.m4a' {
|
|
85
|
+
const value: string;
|
|
86
|
+
export default value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 其他资源文件声明
|
|
90
|
+
declare module '*.json' {
|
|
91
|
+
const value: any;
|
|
92
|
+
export default value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare module '*.css' {
|
|
96
|
+
const value: any;
|
|
97
|
+
export default value;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare module '*.scss' {
|
|
101
|
+
const value: any;
|
|
102
|
+
export default value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare module '*.less' {
|
|
106
|
+
const value: any;
|
|
107
|
+
export default value;
|
|
108
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
body,
|
|
2
|
+
html {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
}
|
|
6
|
+
html {
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
body {
|
|
13
|
+
height: inherit;
|
|
14
|
+
width: inherit;
|
|
15
|
+
}
|
|
16
|
+
* {
|
|
17
|
+
-webkit-tap-highlight-color: transparent;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Game } from './Game';
|
|
2
|
+
import './index.css';
|
|
3
|
+
import { sdk } from '@playcraft/adsdk';
|
|
4
|
+
|
|
5
|
+
// Initialize the SDK
|
|
6
|
+
sdk.init((width: number, height: number) => {
|
|
7
|
+
// Initialize game with container dimensions
|
|
8
|
+
const game = new Game(width, height);
|
|
9
|
+
|
|
10
|
+
// Set up all event listeners
|
|
11
|
+
sdk.on('resize', game.resize, game);
|
|
12
|
+
sdk.on('pause', game.pause, game);
|
|
13
|
+
sdk.on('resume', game.resume, game);
|
|
14
|
+
sdk.on('volume', game.volume, game);
|
|
15
|
+
sdk.on('finish', game.finish, game);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (__DEV__) {
|
|
19
|
+
console.log('Development mode');
|
|
20
|
+
}
|