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,22 @@
/**
* Client Multiplayer 模式启动器
*/
import { Component } from 'cc';
import { PinballManager } from '../../PinballManager';
import { BaseBooter } from '../BaseBooter';
import { PinballBootConfig } from '../BootTypes';
export class ClientMultiplayerBooter extends BaseBooter {
async boot(hostComponent: Component, config: PinballBootConfig): Promise<PinballManager> {
this.log('[ClientMultiplayerBooter] 正在启动客户端多人模式...', config.debugMode);
// TODO: 实现客户端多人模式启动逻辑
// 1. 连接到游戏服务器
// 2. 加入游戏房间
// 3. 设置网络同步和状态管理
throw new Error('客户端多人模式尚未实现');
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "57dd41d5-1108-443c-8888-9aa695b552ce",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,22 @@
/**
* Server Multiplayer 模式启动器
*/
import { Component } from 'cc';
import { PinballManager } from '../../PinballManager';
import { BaseBooter } from '../BaseBooter';
import { PinballBootConfig } from '../BootTypes';
export class ServerMultiplayerBooter extends BaseBooter {
async boot(hostComponent: Component, config: PinballBootConfig): Promise<PinballManager> {
this.log('[ServerMultiplayerBooter] 正在启动服务器多人模式...', config.debugMode);
// TODO: 实现服务器多人模式启动逻辑
// 1. 连接到 SpacetimeDB
// 2. 创建房间或加入现有房间
// 3. 设置网络同步
throw new Error('服务器多人模式尚未实现');
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "6f237677-8531-40fc-af0a-c1e9f020528a",
"files": [],
"subMetas": {},
"userData": {}
}

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;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b1ed032a-5ed8-4dee-b821-8d4a4558ae00",
"files": [],
"subMetas": {},
"userData": {}
}