cocos基础工程

This commit is contained in:
janing
2025-11-28 18:10:10 +08:00
parent 4e4863c7e6
commit 9742bf21fa
88 changed files with 4626 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
/**
* Standalone 模式启动器
*/
import { Component } from 'cc';
import { PinballManager, PinballMode } from '../../PinballManager';
import { BaseBooter } from '../BaseBooter';
import { PinballBootConfig } from '../BootTypes';
export class StandaloneBooter extends BaseBooter {
async boot(hostComponent: Component, config: PinballBootConfig): Promise<PinballManager> {
this.log('[StandaloneBooter] 正在启动 Standalone 模式...', config.debugMode);
// 创建或获取 PinballManager 组件
let pinballManager = hostComponent.getComponent(PinballManager);
if (!pinballManager) {
pinballManager = hostComponent.addComponent(PinballManager);
}
// 应用配置
this.applyConfiguration(pinballManager, config);
// 设置默认模式
pinballManager.defaultMode = PinballMode.STANDALONE;
// 启动 PinballManager在配置应用后
const startSuccess = await pinballManager.Start();
if (!startSuccess) {
throw new Error('PinballManager 启动失败');
}
// 启动 Standalone 模式
const success = await pinballManager.startGame(PinballMode.STANDALONE);
if (!success) {
throw new Error('Standalone 模式启动失败');
}
this.log('[StandaloneBooter] Standalone 模式启动完成', config.debugMode);
return pinballManager;
}
}