fix: 恢复 @esengine/ecs-framework 包名
上一个提交错误地将 npm 包名也改了,这里恢复正确的包名。 只更新 GitHub 仓库 URL,不改变 npm 包名。
This commit is contained in:
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -57,7 +57,7 @@ body:
|
|||||||
id: version
|
id: version
|
||||||
attributes:
|
attributes:
|
||||||
label: 版本 / Version
|
label: 版本 / Version
|
||||||
description: 使用的 @esengine/esengine 版本 / Version of @esengine/esengine
|
description: 使用的 @esengine/ecs-framework 版本 / Version of @esengine/ecs-framework
|
||||||
placeholder: 例如 / e.g., 2.2.8
|
placeholder: 例如 / e.g., 2.2.8
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
@@ -102,7 +102,7 @@ body:
|
|||||||
description: 如果可能,提供最小可复现代码 / If possible, provide minimal reproducible code
|
description: 如果可能,提供最小可复现代码 / If possible, provide minimal reproducible code
|
||||||
render: typescript
|
render: typescript
|
||||||
placeholder: |
|
placeholder: |
|
||||||
import { Core, Scene, Entity } from '@esengine/esengine';
|
import { Core, Scene, Entity } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 你的代码 / Your code here
|
// 你的代码 / Your code here
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
2
.github/workflows/batch-label-issues.yml
vendored
2
.github/workflows/batch-label-issues.yml
vendored
@@ -116,7 +116,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 检测 core
|
# 检测 core
|
||||||
if echo "$TITLE $BODY" | grep -iE "(@esengine/esengine|packages/core|core package|核心包)" > /dev/null; then
|
if echo "$TITLE $BODY" | grep -iE "(@esengine/ecs-framework|packages/core|core package|核心包)" > /dev/null; then
|
||||||
LABELS_TO_ADD="$LABELS_TO_ADD core"
|
LABELS_TO_ADD="$LABELS_TO_ADD core"
|
||||||
echo " 🎯 检测到: core"
|
echo " 🎯 检测到: core"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "@esengine/esengine (ESM)",
|
"name": "@esengine/ecs-framework (ESM)",
|
||||||
"path": "packages/core/dist/esm/index.js",
|
"path": "packages/core/dist/esm/index.js",
|
||||||
"import": "*",
|
"import": "*",
|
||||||
"limit": "50 KB",
|
"limit": "50 KB",
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"gzip": true
|
"gzip": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "@esengine/esengine (UMD)",
|
"name": "@esengine/ecs-framework (UMD)",
|
||||||
"path": "packages/core/dist/umd/ecs-framework.js",
|
"path": "packages/core/dist/umd/ecs-framework.js",
|
||||||
"limit": "60 KB",
|
"limit": "60 KB",
|
||||||
"webpack": false,
|
"webpack": false,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ This project follows the [Conventional Commits](https://www.conventionalcommits.
|
|||||||
|
|
||||||
### 范围 / Scope
|
### 范围 / Scope
|
||||||
|
|
||||||
- **core**: 核心包 @esengine/esengine
|
- **core**: 核心包 @esengine/ecs-framework
|
||||||
- **math**: 数学库包
|
- **math**: 数学库包
|
||||||
- **editor**: 编辑器
|
- **editor**: 编辑器
|
||||||
- **docs**: 文档
|
- **docs**: 文档
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ ESEngine is completely free and open source under the MIT license. No strings at
|
|||||||
### Using npm
|
### Using npm
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @esengine/esengine
|
npm install @esengine/ecs-framework
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building from Source
|
### Building from Source
|
||||||
@@ -42,7 +42,7 @@ Pre-built editor binaries are available on the [Releases](https://github.com/ese
|
|||||||
import {
|
import {
|
||||||
Core, Scene, Entity, Component, EntitySystem,
|
Core, Scene, Entity, Component, EntitySystem,
|
||||||
Matcher, Time, ECSComponent, ECSSystem
|
Matcher, Time, ECSComponent, ECSSystem
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('Position')
|
@ECSComponent('Position')
|
||||||
class Position extends Component {
|
class Position extends Component {
|
||||||
@@ -102,7 +102,7 @@ ESEngine is organized into modular packages. Each feature has a runtime module a
|
|||||||
|
|
||||||
| Package | Description |
|
| Package | Description |
|
||||||
|---------|-------------|
|
|---------|-------------|
|
||||||
| `@esengine/esengine` | Core ECS framework with entity management, component system, and queries |
|
| `@esengine/ecs-framework` | Core ECS framework with entity management, component system, and queries |
|
||||||
| `@esengine/math` | Vector, matrix, and mathematical utilities |
|
| `@esengine/math` | Vector, matrix, and mathematical utilities |
|
||||||
| `@esengine/engine` | Rust/WASM 2D renderer |
|
| `@esengine/engine` | Rust/WASM 2D renderer |
|
||||||
| `@esengine/engine-core` | Engine module system and lifecycle management |
|
| `@esengine/engine-core` | Engine module system and lifecycle management |
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ ESEngine 基于 MIT 协议完全免费开源。无附加条件,无版税。你
|
|||||||
### 通过 npm 安装
|
### 通过 npm 安装
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @esengine/esengine
|
npm install @esengine/ecs-framework
|
||||||
```
|
```
|
||||||
|
|
||||||
### 从源码构建
|
### 从源码构建
|
||||||
@@ -42,7 +42,7 @@ npm install @esengine/esengine
|
|||||||
import {
|
import {
|
||||||
Core, Scene, Entity, Component, EntitySystem,
|
Core, Scene, Entity, Component, EntitySystem,
|
||||||
Matcher, Time, ECSComponent, ECSSystem
|
Matcher, Time, ECSComponent, ECSSystem
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('Position')
|
@ECSComponent('Position')
|
||||||
class Position extends Component {
|
class Position extends Component {
|
||||||
@@ -102,7 +102,7 @@ ESEngine 采用模块化组织。每个功能都有运行时模块和可选的
|
|||||||
|
|
||||||
| 包名 | 描述 |
|
| 包名 | 描述 |
|
||||||
|------|------|
|
|------|------|
|
||||||
| `@esengine/esengine` | ECS 框架核心,包含实体管理、组件系统和查询 |
|
| `@esengine/ecs-framework` | ECS 框架核心,包含实体管理、组件系统和查询 |
|
||||||
| `@esengine/math` | 向量、矩阵和数学工具 |
|
| `@esengine/math` | 向量、矩阵和数学工具 |
|
||||||
| `@esengine/engine` | Rust/WASM 2D 渲染器 |
|
| `@esengine/engine` | Rust/WASM 2D 渲染器 |
|
||||||
| `@esengine/engine-core` | 引擎模块系统和生命周期管理 |
|
| `@esengine/engine-core` | 引擎模块系统和生命周期管理 |
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
本文档记录 `@esengine/esengine` 核心库的版本更新历史。
|
本文档记录 `@esengine/ecs-framework` 核心库的版本更新历史。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -198,5 +198,5 @@
|
|||||||
## 相关链接
|
## 相关链接
|
||||||
|
|
||||||
- [GitHub Releases](https://github.com/esengine/esengine/releases)
|
- [GitHub Releases](https://github.com/esengine/esengine/releases)
|
||||||
- [NPM Package](https://www.npmjs.com/package/@esengine/esengine)
|
- [NPM Package](https://www.npmjs.com/package/@esengine/ecs-framework)
|
||||||
- [文档首页](./index.md)
|
- [文档首页](./index.md)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
This document records the version update history of the `@esengine/esengine` core library.
|
This document records the version update history of the `@esengine/ecs-framework` core library.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -196,5 +196,5 @@ This document records the version update history of the `@esengine/esengine` cor
|
|||||||
## Related Links
|
## Related Links
|
||||||
|
|
||||||
- [GitHub Releases](https://github.com/esengine/esengine/releases)
|
- [GitHub Releases](https://github.com/esengine/esengine/releases)
|
||||||
- [NPM Package](https://www.npmjs.com/package/@esengine/esengine)
|
- [NPM Package](https://www.npmjs.com/package/@esengine/ecs-framework)
|
||||||
- [Documentation Home](./index.md)
|
- [Documentation Home](./index.md)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ This guide will help you get started with ECS Framework, from installation to cr
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Using npm
|
# Using npm
|
||||||
npm install @esengine/esengine
|
npm install @esengine/ecs-framework
|
||||||
```
|
```
|
||||||
|
|
||||||
## Initialize Core
|
## Initialize Core
|
||||||
@@ -18,7 +18,7 @@ npm install @esengine/esengine
|
|||||||
The core of ECS Framework is the `Core` class, a singleton that manages the entire framework lifecycle.
|
The core of ECS Framework is the `Core` class, a singleton that manages the entire framework lifecycle.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core } from '@esengine/esengine'
|
import { Core } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// Method 1: Using config object (recommended)
|
// Method 1: Using config object (recommended)
|
||||||
const core = Core.create({
|
const core = Core.create({
|
||||||
@@ -102,7 +102,7 @@ See engine integration examples: [Game Engine Integration](#game-engine-integrat
|
|||||||
Components are pure data containers that store entity state:
|
Components are pure data containers that store entity state:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, ECSComponent } from '@esengine/esengine'
|
import { Component, ECSComponent } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// Position component
|
// Position component
|
||||||
@ECSComponent('Position')
|
@ECSComponent('Position')
|
||||||
@@ -151,7 +151,7 @@ class Sprite extends Component {
|
|||||||
Systems contain game logic and process entities with specific components. ECS Framework provides Matcher-based entity filtering:
|
Systems contain game logic and process entities with specific components. ECS Framework provides Matcher-based entity filtering:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { EntitySystem, Matcher, Time, ECSSystem } from '@esengine/esengine'
|
import { EntitySystem, Matcher, Time, ECSSystem } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// Movement system - handles position and velocity
|
// Movement system - handles position and velocity
|
||||||
@ECSSystem('MovementSystem')
|
@ECSSystem('MovementSystem')
|
||||||
@@ -219,7 +219,7 @@ class RenderSystem extends EntitySystem {
|
|||||||
Recommended to extend Scene class for custom scenes:
|
Recommended to extend Scene class for custom scenes:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene } from '@esengine/esengine'
|
import { Scene } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// Recommended: Extend Scene for custom scene
|
// Recommended: Extend Scene for custom scene
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
@@ -264,7 +264,7 @@ player.addComponent(new Sprite("player.png", 64, 64));
|
|||||||
Core has built-in scene management, very simple to use:
|
Core has built-in scene management, very simple to use:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// Initialize Core
|
// Initialize Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -304,7 +304,7 @@ const player = Core.ecsAPI?.createEntity('Player')
|
|||||||
Only for complex server-side applications (MMO game servers, game room systems, etc.):
|
Only for complex server-side applications (MMO game servers, game room systems, etc.):
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, WorldManager } from '@esengine/esengine';
|
import { Core, WorldManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// Initialize Core
|
// Initialize Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -338,7 +338,7 @@ function gameLoop(deltaTime: number) {
|
|||||||
```typescript
|
```typescript
|
||||||
import { Stage } from "laya/display/Stage";
|
import { Stage } from "laya/display/Stage";
|
||||||
import { Laya } from "Laya";
|
import { Laya } from "Laya";
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// Initialize Laya
|
// Initialize Laya
|
||||||
Laya.init(800, 600).then(() => {
|
Laya.init(800, 600).then(() => {
|
||||||
@@ -358,7 +358,7 @@ Laya.init(800, 600).then(() => {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, _decorator } from 'cc';
|
import { Component, _decorator } from 'cc';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const { ccclass } = _decorator;
|
const { ccclass } = _decorator;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ In the ECS framework, entities have two lifecycle policies:
|
|||||||
### Creating a Persistent Entity
|
### Creating a Persistent Entity
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene } from '@esengine/esengine';
|
import { Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
protected initialize(): void {
|
protected initialize(): void {
|
||||||
@@ -38,7 +38,7 @@ class GameScene extends Scene {
|
|||||||
### Behavior During Scene Transitions
|
### Behavior During Scene Transitions
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// Initial scene
|
// Initial scene
|
||||||
class Level1Scene extends Scene {
|
class Level1Scene extends Scene {
|
||||||
@@ -147,7 +147,7 @@ public get lifecyclePolicy(): EEntityLifecyclePolicy
|
|||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
```typescript
|
```typescript
|
||||||
import { EEntityLifecyclePolicy } from '@esengine/esengine';
|
import { EEntityLifecyclePolicy } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
if (entity.lifecyclePolicy === EEntityLifecyclePolicy.Persistent) {
|
if (entity.lifecyclePolicy === EEntityLifecyclePolicy.Persistent) {
|
||||||
console.log('Persistent entity');
|
console.log('Persistent entity');
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ SceneManager is suitable for:
|
|||||||
This is the simplest and recommended approach, suitable for most applications:
|
This is the simplest and recommended approach, suitable for most applications:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 1. Initialize Core
|
// 1. Initialize Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -78,7 +78,7 @@ update(deltaTime: number) {
|
|||||||
If you need more control, you can use SceneManager directly:
|
If you need more control, you can use SceneManager directly:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, SceneManager, Scene } from '@esengine/esengine';
|
import { Core, SceneManager, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// Initialize Core
|
// Initialize Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ This document focuses on the usage of the Scene class itself. For detailed infor
|
|||||||
**Recommended: Inherit the Scene class to create custom scenes**
|
**Recommended: Inherit the Scene class to create custom scenes**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene, EntitySystem } from '@esengine/esengine';
|
import { Scene, EntitySystem } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
protected initialize(): void {
|
protected initialize(): void {
|
||||||
@@ -81,7 +81,7 @@ class GameScene extends Scene {
|
|||||||
### Using Scene Configuration
|
### Using Scene Configuration
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ISceneConfig } from '@esengine/esengine';
|
import { ISceneConfig } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const config: ISceneConfig = {
|
const config: ISceneConfig = {
|
||||||
name: "MainGame",
|
name: "MainGame",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ The framework provides several different system base classes:
|
|||||||
The most basic system class, all other systems inherit from it:
|
The most basic system class, all other systems inherit from it:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { EntitySystem, ECSSystem, Matcher } from '@esengine/esengine';
|
import { EntitySystem, ECSSystem, Matcher } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSSystem('Movement')
|
@ECSSystem('Movement')
|
||||||
class MovementSystem extends EntitySystem {
|
class MovementSystem extends EntitySystem {
|
||||||
@@ -586,7 +586,7 @@ class GameScene extends Scene {
|
|||||||
Systems implement the `IService` interface and support obtaining other services or systems through dependency injection:
|
Systems implement the `IService` interface and support obtaining other services or systems through dependency injection:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ECSSystem, Injectable, Inject } from '@esengine/esengine';
|
import { ECSSystem, Injectable, Inject } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ECSSystem('Physics')
|
@ECSSystem('Physics')
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 获取全局黑板服务
|
// 获取全局黑板服务
|
||||||
const globalBlackboard = Core.services.resolve(GlobalBlackboardService);
|
const globalBlackboard = Core.services.resolve(GlobalBlackboardService);
|
||||||
@@ -30,7 +30,7 @@ const playerCount = globalBlackboard.getValue<number>('playerCount');
|
|||||||
```typescript
|
```typescript
|
||||||
import { INodeExecutor, NodeExecutionContext, BindingHelper } from '@esengine/behavior-tree';
|
import { INodeExecutor, NodeExecutionContext, BindingHelper } from '@esengine/behavior-tree';
|
||||||
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
export class CheckGameState implements INodeExecutor {
|
export class CheckGameState implements INodeExecutor {
|
||||||
execute(context: NodeExecutionContext): TaskStatus {
|
execute(context: NodeExecutionContext): TaskStatus {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
### 基本使用
|
### 基本使用
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeAssetManager,
|
BehaviorTreeAssetManager,
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
@@ -365,7 +365,7 @@ function onLevelStart() {
|
|||||||
## 完整示例:多敌人类型的游戏
|
## 完整示例:多敌人类型的游戏
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreePlugin,
|
BehaviorTreePlugin,
|
||||||
BehaviorTreeAssetManager,
|
BehaviorTreeAssetManager,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
在你的 Cocos Creator 项目根目录下:
|
在你的 Cocos Creator 项目根目录下:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @esengine/esengine @esengine/behavior-tree
|
npm install @esengine/ecs-framework @esengine/behavior-tree
|
||||||
```
|
```
|
||||||
|
|
||||||
### 步骤2:配置 tsconfig.json
|
### 步骤2:配置 tsconfig.json
|
||||||
@@ -62,7 +62,7 @@ assets/
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { _decorator, Component } from 'cc';
|
import { _decorator, Component } from 'cc';
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
||||||
|
|
||||||
const { ccclass } = _decorator;
|
const { ccclass } = _decorator;
|
||||||
@@ -110,7 +110,7 @@ export class Main extends Component {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Component, Node } from 'cc';
|
||||||
import { Core, Entity } from '@esengine/esengine';
|
import { Core, Entity } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
BehaviorTreeStarter,
|
BehaviorTreeStarter,
|
||||||
@@ -313,7 +313,7 @@ export class PlayerDetector extends Component {
|
|||||||
框架提供了 `BehaviorTreeAssetManager` 来统一管理行为树资产,避免重复创建:
|
框架提供了 `BehaviorTreeAssetManager` 来统一管理行为树资产,避免重复创建:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeAssetManager,
|
BehaviorTreeAssetManager,
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
@@ -359,7 +359,7 @@ assets/
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { resources, JsonAsset } from 'cc';
|
import { resources, JsonAsset } from 'cc';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeAssetManager,
|
BehaviorTreeAssetManager,
|
||||||
BehaviorTreeAssetSerializer,
|
BehaviorTreeAssetSerializer,
|
||||||
@@ -422,7 +422,7 @@ export class BehaviorTreeLoader {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { _decorator, Component } from 'cc';
|
import { _decorator, Component } from 'cc';
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
||||||
import { BehaviorTreeLoader } from './BehaviorTreeLoader';
|
import { BehaviorTreeLoader } from './BehaviorTreeLoader';
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ export class Main extends Component {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { _decorator, Component } from 'cc';
|
import { _decorator, Component } from 'cc';
|
||||||
import { Core, Entity } from '@esengine/esengine';
|
import { Core, Entity } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeAssetManager,
|
BehaviorTreeAssetManager,
|
||||||
BehaviorTreeStarter
|
BehaviorTreeStarter
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ const tree = BehaviorTreeBuilder.create('BlackboardOps')
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const globalBlackboard = Core.services.resolve(GlobalBlackboardService);
|
const globalBlackboard = Core.services.resolve(GlobalBlackboardService);
|
||||||
|
|
||||||
@@ -347,7 +347,7 @@ const gameState = globalBlackboard.getValue('gameState');
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
import { GlobalBlackboardService } from '@esengine/behavior-tree';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
export class CheckGameState implements INodeExecutor {
|
export class CheckGameState implements INodeExecutor {
|
||||||
execute(context: NodeExecutionContext): TaskStatus {
|
execute(context: NodeExecutionContext): TaskStatus {
|
||||||
|
|||||||
@@ -626,7 +626,7 @@ import './executors/CheckHealth';
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// src/main.ts
|
// src/main.ts
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
||||||
|
|
||||||
// 导入自定义执行器
|
// 导入自定义执行器
|
||||||
@@ -650,7 +650,7 @@ async function main() {
|
|||||||
// my-behavior-plugin/src/plugin.ts
|
// my-behavior-plugin/src/plugin.ts
|
||||||
import type { IEditorPlugin } from '@esengine/editor-core';
|
import type { IEditorPlugin } from '@esengine/editor-core';
|
||||||
import { EditorPluginCategory } from '@esengine/editor-core';
|
import { EditorPluginCategory } from '@esengine/editor-core';
|
||||||
import type { Core, ServiceContainer } from '@esengine/esengine';
|
import type { Core, ServiceContainer } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 导入执行器(触发装饰器注册)
|
// 导入执行器(触发装饰器注册)
|
||||||
import './executors/AttackAction';
|
import './executors/AttackAction';
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ npm run tauri:dev
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { BehaviorTreeBuilder, BehaviorTreeStarter } from '@esengine/behavior-tree';
|
import { BehaviorTreeBuilder, BehaviorTreeStarter } from '@esengine/behavior-tree';
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 使用Builder创建行为树
|
// 使用Builder创建行为树
|
||||||
const tree = BehaviorTreeBuilder.create('EnemyAI')
|
const tree = BehaviorTreeBuilder.create('EnemyAI')
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ Root: Selector
|
|||||||
推荐使用Builder API在代码中创建行为树:
|
推荐使用Builder API在代码中创建行为树:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreePlugin,
|
BehaviorTreePlugin,
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
@@ -200,7 +200,7 @@ export class DebugAction implements INodeExecutor {
|
|||||||
## 完整示例
|
## 完整示例
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreePlugin,
|
BehaviorTreePlugin,
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ npm install @esengine/behavior-tree
|
|||||||
### 步骤1: 导入依赖
|
### 步骤1: 导入依赖
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene, Entity } from '@esengine/esengine';
|
import { Core, Scene, Entity } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
BehaviorTreeStarter,
|
BehaviorTreeStarter,
|
||||||
@@ -113,7 +113,7 @@ setTimeout(() => {
|
|||||||
## 完整代码
|
## 完整代码
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
BehaviorTreeStarter,
|
BehaviorTreeStarter,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
### 使用Builder创建
|
### 使用Builder创建
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
BehaviorTreeStarter,
|
BehaviorTreeStarter,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
在你的 Laya 项目根目录下:
|
在你的 Laya 项目根目录下:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @esengine/esengine @esengine/behavior-tree
|
npm install @esengine/ecs-framework @esengine/behavior-tree
|
||||||
```
|
```
|
||||||
|
|
||||||
## 项目结构
|
## 项目结构
|
||||||
@@ -40,7 +40,7 @@ resources/
|
|||||||
### 在Main.ts中初始化
|
### 在Main.ts中初始化
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
import { BehaviorTreePlugin } from '@esengine/behavior-tree';
|
||||||
|
|
||||||
export class Main {
|
export class Main {
|
||||||
@@ -85,7 +85,7 @@ new Main();
|
|||||||
## 创建AI组件
|
## 创建AI组件
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Entity } from '@esengine/esengine';
|
import { Core, Entity } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
BehaviorTreeStarter,
|
BehaviorTreeStarter,
|
||||||
@@ -156,7 +156,7 @@ import {
|
|||||||
BehaviorTreeRuntimeComponent
|
BehaviorTreeRuntimeComponent
|
||||||
} from '@esengine/behavior-tree';
|
} from '@esengine/behavior-tree';
|
||||||
import { TaskStatus, NodeType } from '@esengine/behavior-tree';
|
import { TaskStatus, NodeType } from '@esengine/behavior-tree';
|
||||||
import { Core, Entity } from '@esengine/esengine';
|
import { Core, Entity } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 自定义移动执行器
|
// 自定义移动执行器
|
||||||
@NodeExecutorMetadata({
|
@NodeExecutorMetadata({
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
### 安装
|
### 安装
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @esengine/esengine @esengine/behavior-tree
|
npm install @esengine/ecs-framework @esengine/behavior-tree
|
||||||
```
|
```
|
||||||
|
|
||||||
### TypeScript 配置
|
### TypeScript 配置
|
||||||
@@ -41,7 +41,7 @@ npm install @esengine/esengine @esengine/behavior-tree
|
|||||||
### 简单的游戏服务器 NPC
|
### 简单的游戏服务器 NPC
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreePlugin,
|
BehaviorTreePlugin,
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
@@ -109,7 +109,7 @@ startServer();
|
|||||||
创建一个基于行为树的智能聊天机器人:
|
创建一个基于行为树的智能聊天机器人:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene, Entity } from '@esengine/esengine';
|
import { Core, Scene, Entity } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreePlugin,
|
BehaviorTreePlugin,
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
@@ -273,7 +273,7 @@ main();
|
|||||||
### 房间管理系统
|
### 房间管理系统
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene, Entity } from '@esengine/esengine';
|
import { Core, Scene, Entity } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreePlugin,
|
BehaviorTreePlugin,
|
||||||
BehaviorTreeBuilder,
|
BehaviorTreeBuilder,
|
||||||
@@ -519,7 +519,7 @@ setInterval(() => {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const scene = new Scene();
|
const scene = new Scene();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
### 基础组件定义
|
### 基础组件定义
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, ECSComponent } from '@esengine/esengine';
|
import { Component, ECSComponent } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('Position')
|
@ECSComponent('Position')
|
||||||
class Position extends Component {
|
class Position extends Component {
|
||||||
@@ -105,7 +105,7 @@ class BadComponent extends Component {
|
|||||||
当组件需要支持序列化时,`@ECSComponent` 和 `@Serializable` 需要一起使用:
|
当组件需要支持序列化时,`@ECSComponent` 和 `@Serializable` 需要一起使用:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, ECSComponent, Serializable, Serialize } from '@esengine/esengine';
|
import { Component, ECSComponent, Serializable, Serialize } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('Player')
|
@ECSComponent('Player')
|
||||||
@Serializable({ version: 1 })
|
@Serializable({ version: 1 })
|
||||||
@@ -533,7 +533,7 @@ class BadFollower extends Component {
|
|||||||
#### 基本用法
|
#### 基本用法
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, ECSComponent, EntityRef, Entity } from '@esengine/esengine';
|
import { Component, ECSComponent, EntityRef, Entity } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('Parent')
|
@ECSComponent('Parent')
|
||||||
class ParentComponent extends Component {
|
class ParentComponent extends Component {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ QuerySystem 负责实际执行查询,内部使用响应式查询机制自动优
|
|||||||
### 基础用法
|
### 基础用法
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { EntitySystem, Matcher, Entity, Component } from '@esengine/esengine';
|
import { EntitySystem, Matcher, Entity, Component } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class PositionComponent extends Component {
|
class PositionComponent extends Component {
|
||||||
public x: number = 0;
|
public x: number = 0;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const player = scene.createEntity("Player");
|
|||||||
实体通过添加组件来获得功能:
|
实体通过添加组件来获得功能:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, ECSComponent } from '@esengine/esengine';
|
import { Component, ECSComponent } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 定义位置组件
|
// 定义位置组件
|
||||||
@ECSComponent('Position')
|
@ECSComponent('Position')
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ class GameScene extends Scene {
|
|||||||
对于跨场景的事件通信,可以使用全局事件总线:
|
对于跨场景的事件通信,可以使用全局事件总线:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { GlobalEventBus } from '@esengine/esengine';
|
import { GlobalEventBus } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameManager {
|
class GameManager {
|
||||||
private eventBus = GlobalEventBus.getInstance();
|
private eventBus = GlobalEventBus.getInstance();
|
||||||
@@ -374,7 +374,7 @@ class MovementSystem extends EntitySystem {
|
|||||||
框架提供了一些预定义的 ECS 生命周期事件:
|
框架提供了一些预定义的 ECS 生命周期事件:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ECSEventType } from '@esengine/esengine';
|
import { ECSEventType } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class ECSMonitor {
|
class ECSMonitor {
|
||||||
private eventBus = GlobalEventBus.getInstance();
|
private eventBus = GlobalEventBus.getInstance();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 使用 npm
|
# 使用 npm
|
||||||
npm install @esengine/esengine
|
npm install @esengine/ecs-framework
|
||||||
```
|
```
|
||||||
|
|
||||||
## 初始化 Core
|
## 初始化 Core
|
||||||
@@ -18,7 +18,7 @@ npm install @esengine/esengine
|
|||||||
ECS Framework 的核心是 `Core` 类,它是一个单例模式,负责管理整个框架的生命周期。
|
ECS Framework 的核心是 `Core` 类,它是一个单例模式,负责管理整个框架的生命周期。
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core } from '@esengine/esengine'
|
import { Core } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// 方式1:使用配置对象(推荐)
|
// 方式1:使用配置对象(推荐)
|
||||||
const core = Core.create({
|
const core = Core.create({
|
||||||
@@ -102,7 +102,7 @@ const instance = Core.Instance; // 获取当前实例,如果未创建则为 n
|
|||||||
组件是纯数据容器,用于存储实体的状态:
|
组件是纯数据容器,用于存储实体的状态:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, ECSComponent } from '@esengine/esengine'
|
import { Component, ECSComponent } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// 位置组件
|
// 位置组件
|
||||||
@ECSComponent('Position')
|
@ECSComponent('Position')
|
||||||
@@ -151,7 +151,7 @@ class Sprite extends Component {
|
|||||||
系统包含游戏逻辑,处理具有特定组件的实体。ECS Framework 提供了基于 Matcher 的实体过滤机制:
|
系统包含游戏逻辑,处理具有特定组件的实体。ECS Framework 提供了基于 Matcher 的实体过滤机制:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { EntitySystem, Matcher, Time, ECSSystem } from '@esengine/esengine'
|
import { EntitySystem, Matcher, Time, ECSSystem } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// 移动系统 - 处理位置和速度
|
// 移动系统 - 处理位置和速度
|
||||||
@ECSSystem('MovementSystem')
|
@ECSSystem('MovementSystem')
|
||||||
@@ -219,7 +219,7 @@ class RenderSystem extends EntitySystem {
|
|||||||
推荐继承 Scene 类来创建自定义场景:
|
推荐继承 Scene 类来创建自定义场景:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene } from '@esengine/esengine'
|
import { Scene } from '@esengine/ecs-framework'
|
||||||
|
|
||||||
// 推荐:继承Scene创建自定义场景
|
// 推荐:继承Scene创建自定义场景
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
@@ -264,7 +264,7 @@ player.addComponent(new Sprite("player.png", 64, 64));
|
|||||||
Core 内置了场景管理功能,使用非常简单:
|
Core 内置了场景管理功能,使用非常简单:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化Core
|
// 初始化Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -304,7 +304,7 @@ const player = Core.ecsAPI?.createEntity('Player')
|
|||||||
仅适用于复杂的服务器端应用(MMO游戏服务器、游戏房间系统等):
|
仅适用于复杂的服务器端应用(MMO游戏服务器、游戏房间系统等):
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, WorldManager } from '@esengine/esengine';
|
import { Core, WorldManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化Core
|
// 初始化Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -338,7 +338,7 @@ function gameLoop(deltaTime: number) {
|
|||||||
```typescript
|
```typescript
|
||||||
import { Stage } from "laya/display/Stage";
|
import { Stage } from "laya/display/Stage";
|
||||||
import { Laya } from "Laya";
|
import { Laya } from "Laya";
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化 Laya
|
// 初始化 Laya
|
||||||
Laya.init(800, 600).then(() => {
|
Laya.init(800, 600).then(() => {
|
||||||
@@ -358,7 +358,7 @@ Laya.init(800, 600).then(() => {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, _decorator } from 'cc';
|
import { Component, _decorator } from 'cc';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const { ccclass } = _decorator;
|
const { ccclass } = _decorator;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
存储层级关系数据的组件:
|
存储层级关系数据的组件:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { HierarchyComponent } from '@esengine/esengine';
|
import { HierarchyComponent } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// HierarchyComponent 的核心属性
|
// HierarchyComponent 的核心属性
|
||||||
interface HierarchyComponent {
|
interface HierarchyComponent {
|
||||||
@@ -36,7 +36,7 @@ interface HierarchyComponent {
|
|||||||
处理层级逻辑的系统,提供所有层级操作的 API:
|
处理层级逻辑的系统,提供所有层级操作的 API:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { HierarchySystem } from '@esengine/esengine';
|
import { HierarchySystem } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 获取系统
|
// 获取系统
|
||||||
const hierarchySystem = scene.getEntityProcessor(HierarchySystem);
|
const hierarchySystem = scene.getEntityProcessor(HierarchySystem);
|
||||||
@@ -47,7 +47,7 @@ const hierarchySystem = scene.getEntityProcessor(HierarchySystem);
|
|||||||
### 添加系统到场景
|
### 添加系统到场景
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene, HierarchySystem } from '@esengine/esengine';
|
import { Scene, HierarchySystem } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
protected initialize(): void {
|
protected initialize(): void {
|
||||||
@@ -256,7 +256,7 @@ import {
|
|||||||
Scene,
|
Scene,
|
||||||
HierarchySystem,
|
HierarchySystem,
|
||||||
HierarchyComponent
|
HierarchyComponent
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
private hierarchySystem!: HierarchySystem;
|
private hierarchySystem!: HierarchySystem;
|
||||||
@@ -319,7 +319,7 @@ class GameScene extends Scene {
|
|||||||
结合 Transform 组件实现层级变换:
|
结合 Transform 组件实现层级变换:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { EntitySystem, Matcher, HierarchySystem, HierarchyComponent } from '@esengine/esengine';
|
import { EntitySystem, Matcher, HierarchySystem, HierarchyComponent } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class HierarchyTransformSystem extends EntitySystem {
|
class HierarchyTransformSystem extends EntitySystem {
|
||||||
private hierarchySystem!: HierarchySystem;
|
private hierarchySystem!: HierarchySystem;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ECS 框架提供了功能强大的分级日志系统,支持多种日志级别
|
|||||||
## 日志级别
|
## 日志级别
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { LogLevel } from '@esengine/esengine';
|
import { LogLevel } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 日志级别从低到高
|
// 日志级别从低到高
|
||||||
LogLevel.Debug // 0 - 调试信息
|
LogLevel.Debug // 0 - 调试信息
|
||||||
@@ -29,7 +29,7 @@ LogLevel.None // 5 - 不输出任何日志
|
|||||||
### 使用默认日志器
|
### 使用默认日志器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Logger } from '@esengine/esengine';
|
import { Logger } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameSystem extends EntitySystem {
|
class GameSystem extends EntitySystem {
|
||||||
protected process(entities: readonly Entity[]): void {
|
protected process(entities: readonly Entity[]): void {
|
||||||
@@ -46,7 +46,7 @@ class GameSystem extends EntitySystem {
|
|||||||
### 创建命名日志器
|
### 创建命名日志器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { createLogger } from '@esengine/esengine';
|
import { createLogger } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class MovementSystem extends EntitySystem {
|
class MovementSystem extends EntitySystem {
|
||||||
private logger = createLogger('MovementSystem');
|
private logger = createLogger('MovementSystem');
|
||||||
@@ -103,7 +103,7 @@ class Scene {
|
|||||||
### 设置全局日志级别
|
### 设置全局日志级别
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { setGlobalLogLevel, LogLevel } from '@esengine/esengine';
|
import { setGlobalLogLevel, LogLevel } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 在开发环境显示所有日志
|
// 在开发环境显示所有日志
|
||||||
setGlobalLogLevel(LogLevel.Debug);
|
setGlobalLogLevel(LogLevel.Debug);
|
||||||
@@ -118,7 +118,7 @@ setGlobalLogLevel(LogLevel.None);
|
|||||||
### 创建自定义配置的日志器
|
### 创建自定义配置的日志器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ConsoleLogger, LogLevel } from '@esengine/esengine';
|
import { ConsoleLogger, LogLevel } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class CustomLoggerExample {
|
class CustomLoggerExample {
|
||||||
private debugLogger: ConsoleLogger;
|
private debugLogger: ConsoleLogger;
|
||||||
@@ -159,7 +159,7 @@ class CustomLoggerExample {
|
|||||||
### 使用预定义颜色
|
### 使用预定义颜色
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Colors, setLoggerColors } from '@esengine/esengine';
|
import { Colors, setLoggerColors } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 自定义颜色方案
|
// 自定义颜色方案
|
||||||
setLoggerColors({
|
setLoggerColors({
|
||||||
@@ -174,7 +174,7 @@ setLoggerColors({
|
|||||||
### 完整颜色示例
|
### 完整颜色示例
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { LoggerManager, Colors, LogLevel } from '@esengine/esengine';
|
import { LoggerManager, Colors, LogLevel } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class ColorLoggerDemo {
|
class ColorLoggerDemo {
|
||||||
private logger = createLogger('ColorDemo');
|
private logger = createLogger('ColorDemo');
|
||||||
@@ -211,7 +211,7 @@ class ColorLoggerDemo {
|
|||||||
### 分层日志器
|
### 分层日志器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { LoggerManager } from '@esengine/esengine';
|
import { LoggerManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class HierarchicalLoggingExample {
|
class HierarchicalLoggingExample {
|
||||||
private systemLogger = createLogger('GameSystems');
|
private systemLogger = createLogger('GameSystems');
|
||||||
@@ -247,7 +247,7 @@ class HierarchicalLoggingExample {
|
|||||||
#### 基本用法
|
#### 基本用法
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { setLoggerFactory } from '@esengine/esengine';
|
import { setLoggerFactory } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
setLoggerFactory((name?: string) => {
|
setLoggerFactory((name?: string) => {
|
||||||
// 返回实现 ILogger 接口的日志器实例
|
// 返回实现 ILogger 接口的日志器实例
|
||||||
@@ -285,7 +285,7 @@ class PlayerMovementSystem extends EntitySystem {
|
|||||||
### 自定义输出
|
### 自定义输出
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ConsoleLogger, LogLevel } from '@esengine/esengine';
|
import { ConsoleLogger, LogLevel } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class CustomOutputLogger {
|
class CustomOutputLogger {
|
||||||
private fileLogger: ConsoleLogger;
|
private fileLogger: ConsoleLogger;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
### 创建持久化实体
|
### 创建持久化实体
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene } from '@esengine/esengine';
|
import { Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
protected initialize(): void {
|
protected initialize(): void {
|
||||||
@@ -38,7 +38,7 @@ class GameScene extends Scene {
|
|||||||
### 场景切换时的行为
|
### 场景切换时的行为
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始场景
|
// 初始场景
|
||||||
class Level1Scene extends Scene {
|
class Level1Scene extends Scene {
|
||||||
@@ -147,7 +147,7 @@ public get lifecyclePolicy(): EEntityLifecyclePolicy
|
|||||||
|
|
||||||
**示例**:
|
**示例**:
|
||||||
```typescript
|
```typescript
|
||||||
import { EEntityLifecyclePolicy } from '@esengine/esengine';
|
import { EEntityLifecyclePolicy } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
if (entity.lifecyclePolicy === EEntityLifecyclePolicy.Persistent) {
|
if (entity.lifecyclePolicy === EEntityLifecyclePolicy.Persistent) {
|
||||||
console.log('持久化实体');
|
console.log('持久化实体');
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export interface PlatformWorker {
|
|||||||
根据你的运行环境选择对应的适配器:
|
根据你的运行环境选择对应的适配器:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { PlatformManager } from '@esengine/esengine';
|
import { PlatformManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 浏览器环境
|
// 浏览器环境
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
@@ -140,7 +140,7 @@ if (manager.hasAdapter()) {
|
|||||||
### 1. 实现接口
|
### 1. 实现接口
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import type { IPlatformAdapter, PlatformWorker, WorkerCreationOptions, PlatformConfig } from '@esengine/esengine';
|
import type { IPlatformAdapter, PlatformWorker, WorkerCreationOptions, PlatformConfig } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
export class CustomAdapter implements IPlatformAdapter {
|
export class CustomAdapter implements IPlatformAdapter {
|
||||||
public readonly name = 'custom';
|
public readonly name = 'custom';
|
||||||
@@ -189,7 +189,7 @@ export class CustomAdapter implements IPlatformAdapter {
|
|||||||
### 2. 注册自定义适配器
|
### 2. 注册自定义适配器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { PlatformManager } from '@esengine/esengine';
|
import { PlatformManager } from '@esengine/ecs-framework';
|
||||||
import { CustomAdapter } from './CustomAdapter';
|
import { CustomAdapter } from './CustomAdapter';
|
||||||
|
|
||||||
const customAdapter = new CustomAdapter();
|
const customAdapter = new CustomAdapter();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import type {
|
|||||||
PlatformWorker,
|
PlatformWorker,
|
||||||
WorkerCreationOptions,
|
WorkerCreationOptions,
|
||||||
PlatformConfig
|
PlatformConfig
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 浏览器平台适配器
|
* 浏览器平台适配器
|
||||||
@@ -231,7 +231,7 @@ class BrowserWorker implements PlatformWorker {
|
|||||||
### 2. 注册适配器
|
### 2. 注册适配器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { PlatformManager } from '@esengine/esengine';
|
import { PlatformManager } from '@esengine/ecs-framework';
|
||||||
import { BrowserAdapter } from './platform/BrowserAdapter';
|
import { BrowserAdapter } from './platform/BrowserAdapter';
|
||||||
|
|
||||||
// 创建并注册浏览器适配器
|
// 创建并注册浏览器适配器
|
||||||
@@ -246,7 +246,7 @@ PlatformManager.registerAdapter(browserAdapter);
|
|||||||
浏览器适配器与 WorkerEntitySystem 配合使用,框架会自动处理 Worker 脚本的创建:
|
浏览器适配器与 WorkerEntitySystem 配合使用,框架会自动处理 Worker 脚本的创建:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { WorkerEntitySystem, Matcher } from '@esengine/esengine';
|
import { WorkerEntitySystem, Matcher } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class PhysicsSystem extends WorkerEntitySystem {
|
class PhysicsSystem extends WorkerEntitySystem {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import type {
|
|||||||
WorkerCreationOptions,
|
WorkerCreationOptions,
|
||||||
PlatformConfig,
|
PlatformConfig,
|
||||||
NodeDeviceInfo
|
NodeDeviceInfo
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node.js 平台适配器
|
* Node.js 平台适配器
|
||||||
@@ -353,7 +353,7 @@ class NodeWorker implements PlatformWorker {
|
|||||||
### 2. 注册适配器
|
### 2. 注册适配器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { PlatformManager } from '@esengine/esengine';
|
import { PlatformManager } from '@esengine/ecs-framework';
|
||||||
import { NodeAdapter } from './platform/NodeAdapter';
|
import { NodeAdapter } from './platform/NodeAdapter';
|
||||||
|
|
||||||
// 检查是否在Node.js环境
|
// 检查是否在Node.js环境
|
||||||
@@ -368,7 +368,7 @@ if (typeof process !== 'undefined' && process.versions && process.versions.node)
|
|||||||
Node.js 适配器与 WorkerEntitySystem 配合使用,框架会自动处理 Worker 脚本的创建:
|
Node.js 适配器与 WorkerEntitySystem 配合使用,框架会自动处理 Worker 脚本的创建:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { WorkerEntitySystem, Matcher } from '@esengine/esengine';
|
import { WorkerEntitySystem, Matcher } from '@esengine/ecs-framework';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
|
|
||||||
class PhysicsSystem extends WorkerEntitySystem {
|
class PhysicsSystem extends WorkerEntitySystem {
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ function processSharedArrayBuffer(startIndex, endIndex, deltaTime, systemConfig)
|
|||||||
### 步骤 3:使用 WorkerEntitySystem
|
### 步骤 3:使用 WorkerEntitySystem
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { WorkerEntitySystem, Matcher, Entity } from '@esengine/esengine';
|
import { WorkerEntitySystem, Matcher, Entity } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
interface PhysicsData {
|
interface PhysicsData {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -295,7 +295,7 @@ import type {
|
|||||||
PlatformWorker,
|
PlatformWorker,
|
||||||
WorkerCreationOptions,
|
WorkerCreationOptions,
|
||||||
PlatformConfig
|
PlatformConfig
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信小游戏平台适配器
|
* 微信小游戏平台适配器
|
||||||
@@ -430,7 +430,7 @@ class WeChatWorker implements PlatformWorker {
|
|||||||
## 注册适配器
|
## 注册适配器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { PlatformManager } from '@esengine/esengine';
|
import { PlatformManager } from '@esengine/ecs-framework';
|
||||||
import { WeChatMiniGameAdapter } from './platform/WeChatMiniGameAdapter';
|
import { WeChatMiniGameAdapter } from './platform/WeChatMiniGameAdapter';
|
||||||
|
|
||||||
// 在游戏启动时注册适配器
|
// 在游戏启动时注册适配器
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
创建一个简单的调试插件:
|
创建一个简单的调试插件:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { IPlugin, Core, ServiceContainer } from '@esengine/esengine';
|
import { IPlugin, Core, ServiceContainer } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class DebugPlugin implements IPlugin {
|
class DebugPlugin implements IPlugin {
|
||||||
readonly name = 'debug-plugin';
|
readonly name = 'debug-plugin';
|
||||||
@@ -51,7 +51,7 @@ class DebugPlugin implements IPlugin {
|
|||||||
使用 `Core.installPlugin()` 安装插件:
|
使用 `Core.installPlugin()` 安装插件:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化Core
|
// 初始化Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -204,7 +204,7 @@ await Core.installPlugin(new AsyncPlugin());
|
|||||||
插件可以向服务容器注册自己的服务:
|
插件可以向服务容器注册自己的服务:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { IService } from '@esengine/esengine';
|
import { IService } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class NetworkService implements IService {
|
class NetworkService implements IService {
|
||||||
connect(url: string) {
|
connect(url: string) {
|
||||||
@@ -240,7 +240,7 @@ class NetworkPlugin implements IPlugin {
|
|||||||
插件可以向场景添加自定义系统:
|
插件可以向场景添加自定义系统:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { EntitySystem, Matcher } from '@esengine/esengine';
|
import { EntitySystem, Matcher } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class PhysicsSystem extends EntitySystem {
|
class PhysicsSystem extends EntitySystem {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -393,7 +393,7 @@ for (const meta of allMetadata) {
|
|||||||
### 网络同步插件
|
### 网络同步插件
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { IPlugin, IService, Core, ServiceContainer } from '@esengine/esengine';
|
import { IPlugin, IService, Core, ServiceContainer } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class NetworkSyncService implements IService {
|
class NetworkSyncService implements IService {
|
||||||
private ws?: WebSocket;
|
private ws?: WebSocket;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ SceneManager 适合以下场景:
|
|||||||
这是最简单和推荐的方式,适合大多数应用:
|
这是最简单和推荐的方式,适合大多数应用:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 1. 初始化 Core
|
// 1. 初始化 Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -78,7 +78,7 @@ update(deltaTime: number) {
|
|||||||
如果需要更多控制,可以直接使用 SceneManager:
|
如果需要更多控制,可以直接使用 SceneManager:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, SceneManager, Scene } from '@esengine/esengine';
|
import { Core, SceneManager, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化 Core
|
// 初始化 Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -146,7 +146,7 @@ class GameOverSystem extends EntitySystem {
|
|||||||
### 完整的场景切换示例
|
### 完整的场景切换示例
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene } from '@esengine/esengine';
|
import { Core, Scene } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -564,7 +564,7 @@ Core (全局服务)
|
|||||||
## 完整示例
|
## 完整示例
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, Scene, EntitySystem, Entity, Matcher } from '@esengine/esengine';
|
import { Core, Scene, EntitySystem, Entity, Matcher } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 定义组件
|
// 定义组件
|
||||||
class Transform {
|
class Transform {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ECS Framework 提供了两种场景管理方式:
|
|||||||
**推荐做法:继承 Scene 类来创建自定义场景**
|
**推荐做法:继承 Scene 类来创建自定义场景**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene, EntitySystem } from '@esengine/esengine';
|
import { Scene, EntitySystem } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
protected initialize(): void {
|
protected initialize(): void {
|
||||||
@@ -81,7 +81,7 @@ class GameScene extends Scene {
|
|||||||
### 使用场景配置
|
### 使用场景配置
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ISceneConfig } from '@esengine/esengine';
|
import { ISceneConfig } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const config: ISceneConfig = {
|
const config: ISceneConfig = {
|
||||||
name: "MainGame",
|
name: "MainGame",
|
||||||
@@ -558,7 +558,7 @@ class ProperInitScene extends Scene {
|
|||||||
## 完整示例
|
## 完整示例
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Scene, EntitySystem, Entity, Matcher } from '@esengine/esengine';
|
import { Scene, EntitySystem, Entity, Matcher } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 定义组件
|
// 定义组件
|
||||||
class Transform {
|
class Transform {
|
||||||
@@ -638,14 +638,14 @@ class GameScene extends Scene {
|
|||||||
|
|
||||||
// 使用场景
|
// 使用场景
|
||||||
// 方式1:通过 SceneManager(推荐)
|
// 方式1:通过 SceneManager(推荐)
|
||||||
import { Core, SceneManager } from '@esengine/esengine';
|
import { Core, SceneManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
const sceneManager = Core.services.resolve(SceneManager);
|
const sceneManager = Core.services.resolve(SceneManager);
|
||||||
sceneManager.setScene(new GameScene());
|
sceneManager.setScene(new GameScene());
|
||||||
|
|
||||||
// 方式2:通过 WorldManager(高级用例)
|
// 方式2:通过 WorldManager(高级用例)
|
||||||
import { WorldManager } from '@esengine/esengine';
|
import { WorldManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const worldManager = Core.services.resolve(WorldManager);
|
const worldManager = Core.services.resolve(WorldManager);
|
||||||
const world = worldManager.createWorld('game');
|
const world = worldManager.createWorld('game');
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
使用 `@Serializable` 和 `@Serialize` 装饰器标记需要序列化的组件和字段:
|
使用 `@Serializable` 和 `@Serialize` 装饰器标记需要序列化的组件和字段:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, ECSComponent, Serializable, Serialize } from '@esengine/esengine';
|
import { Component, ECSComponent, Serializable, Serialize } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('Player')
|
@ECSComponent('Player')
|
||||||
@Serializable({ version: 1 })
|
@Serializable({ version: 1 })
|
||||||
@@ -505,7 +505,7 @@ enum ChangeOperation {
|
|||||||
### 注册迁移函数
|
### 注册迁移函数
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { VersionMigrationManager } from '@esengine/esengine';
|
import { VersionMigrationManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 假设 PlayerComponent v1 有 hp 字段
|
// 假设 PlayerComponent v1 有 hp 字段
|
||||||
// v2 改为 health 和 maxHealth 字段
|
// v2 改为 health 和 maxHealth 字段
|
||||||
@@ -531,7 +531,7 @@ VersionMigrationManager.registerComponentMigration(
|
|||||||
### 使用迁移构建器
|
### 使用迁移构建器
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { MigrationBuilder } from '@esengine/esengine';
|
import { MigrationBuilder } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
new MigrationBuilder()
|
new MigrationBuilder()
|
||||||
.forComponent('Player')
|
.forComponent('Player')
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
服务是实现了 `IService` 接口的类,必须提供 `dispose()` 方法用于资源清理:
|
服务是实现了 `IService` 接口的类,必须提供 `dispose()` 方法用于资源清理:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { IService } from '@esengine/esengine';
|
import { IService } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class MyService implements IService {
|
class MyService implements IService {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -73,7 +73,7 @@ ECS Framework 提供了三级服务容器:
|
|||||||
应用程序全局服务容器,可以通过 `Core.services` 访问:
|
应用程序全局服务容器,可以通过 `Core.services` 访问:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化Core
|
// 初始化Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -87,7 +87,7 @@ const container = Core.services;
|
|||||||
每个 World 拥有独立的服务容器,用于管理 World 范围内的服务:
|
每个 World 拥有独立的服务容器,用于管理 World 范围内的服务:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { World } from '@esengine/esengine';
|
import { World } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 创建 World
|
// 创建 World
|
||||||
const world = new World({ name: 'GameWorld' });
|
const world = new World({ name: 'GameWorld' });
|
||||||
@@ -339,7 +339,7 @@ ECS Framework 提供了装饰器来简化依赖注入。
|
|||||||
标记类为可注入的服务:
|
标记类为可注入的服务:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Injectable, IService } from '@esengine/esengine';
|
import { Injectable, IService } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class GameService implements IService {
|
class GameService implements IService {
|
||||||
@@ -358,7 +358,7 @@ class GameService implements IService {
|
|||||||
通过属性装饰器注入依赖。注入时机是在构造函数执行后、`onInitialize()` 调用前完成:
|
通过属性装饰器注入依赖。注入时机是在构造函数执行后、`onInitialize()` 调用前完成:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Injectable, InjectProperty, IService } from '@esengine/esengine';
|
import { Injectable, InjectProperty, IService } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class PlayerService implements IService {
|
class PlayerService implements IService {
|
||||||
@@ -408,7 +408,7 @@ class CombatSystem extends EntitySystem {
|
|||||||
使用 `registerInjectable` 自动处理依赖注入:
|
使用 `registerInjectable` 自动处理依赖注入:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { registerInjectable } from '@esengine/esengine';
|
import { registerInjectable } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 注册服务(会自动解析 @InjectProperty 依赖)
|
// 注册服务(会自动解析 @InjectProperty 依赖)
|
||||||
registerInjectable(Core.services, PlayerService);
|
registerInjectable(Core.services, PlayerService);
|
||||||
@@ -422,7 +422,7 @@ const player = Core.services.resolve(PlayerService);
|
|||||||
标记服务为可更新的,使其在每帧自动被调用:
|
标记服务为可更新的,使其在每帧自动被调用:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Injectable, Updatable, IService, IUpdatable } from '@esengine/esengine';
|
import { Injectable, Updatable, IService, IUpdatable } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@Updatable() // 默认优先级为0
|
@Updatable() // 默认优先级为0
|
||||||
@@ -466,7 +466,7 @@ function gameLoop(deltaTime: number) {
|
|||||||
实现 `IService` 接口并注册到容器:
|
实现 `IService` 接口并注册到容器:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { IService } from '@esengine/esengine';
|
import { IService } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class AudioService implements IService {
|
class AudioService implements IService {
|
||||||
private sounds: Map<string, HTMLAudioElement> = new Map();
|
private sounds: Map<string, HTMLAudioElement> = new Map();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
最基础的系统类,所有其他系统都继承自它:
|
最基础的系统类,所有其他系统都继承自它:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { EntitySystem, ECSSystem, Matcher } from '@esengine/esengine';
|
import { EntitySystem, ECSSystem, Matcher } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSSystem('Movement')
|
@ECSSystem('Movement')
|
||||||
class MovementSystem extends EntitySystem {
|
class MovementSystem extends EntitySystem {
|
||||||
@@ -586,7 +586,7 @@ class GameScene extends Scene {
|
|||||||
系统实现了 `IService` 接口,支持通过依赖注入获取其他服务或系统:
|
系统实现了 `IService` 接口,支持通过依赖注入获取其他服务或系统:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { ECSSystem, Injectable, Inject } from '@esengine/esengine';
|
import { ECSSystem, Injectable, Inject } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ECSSystem('Physics')
|
@ECSSystem('Physics')
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Time 类是框架的时间管理核心,提供了游戏时间相关的所有功
|
|||||||
### 基本时间属性
|
### 基本时间属性
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Time } from '@esengine/esengine';
|
import { Time } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameSystem extends EntitySystem {
|
class GameSystem extends EntitySystem {
|
||||||
protected process(entities: readonly Entity[]): void {
|
protected process(entities: readonly Entity[]): void {
|
||||||
@@ -124,7 +124,7 @@ Core 提供了强大的定时器调度功能,可以创建一次性或重复执
|
|||||||
### 基本定时器使用
|
### 基本定时器使用
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class GameScene extends Scene {
|
class GameScene extends Scene {
|
||||||
protected initialize(): void {
|
protected initialize(): void {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ WorldManager 适合以下高级场景:
|
|||||||
WorldManager 是 Core 的内置服务,通过服务容器获取:
|
WorldManager 是 Core 的内置服务,通过服务容器获取:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, WorldManager } from '@esengine/esengine';
|
import { Core, WorldManager } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化 Core
|
// 初始化 Core
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
@@ -277,7 +277,7 @@ World 支持全局系统,这些系统在 World 级别运行,不依赖特定
|
|||||||
### 定义全局系统
|
### 定义全局系统
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { IGlobalSystem } from '@esengine/esengine';
|
import { IGlobalSystem } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 网络系统(World 级别)
|
// 网络系统(World 级别)
|
||||||
class NetworkSystem implements IGlobalSystem {
|
class NetworkSystem implements IGlobalSystem {
|
||||||
@@ -513,7 +513,7 @@ console.log(`清理了 ${cleanedCount} 个 World`);
|
|||||||
### MMO 游戏房间系统
|
### MMO 游戏房间系统
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Core, WorldManager, Scene, World } from '@esengine/esengine';
|
import { Core, WorldManager, Scene, World } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
Core.create({ debug: true });
|
Core.create({ debug: true });
|
||||||
|
|||||||
6
examples/core-demos/package-lock.json
generated
6
examples/core-demos/package-lock.json
generated
@@ -8,7 +8,7 @@
|
|||||||
"name": "ecs-core-demos",
|
"name": "ecs-core-demos",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@esengine/esengine": "file:../../packages/core"
|
"@esengine/ecs-framework": "file:../../packages/core"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.0.0",
|
"typescript": "^5.0.0",
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../../packages/core": {
|
"../../packages/core": {
|
||||||
"name": "@esengine/esengine",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.1.51",
|
"version": "2.1.51",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -417,7 +417,7 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esengine/esengine": {
|
"node_modules/@esengine/ecs-framework": {
|
||||||
"resolved": "../../packages/core",
|
"resolved": "../../packages/core",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,6 +13,6 @@
|
|||||||
"vite": "^4.0.0"
|
"vite": "^4.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@esengine/esengine": "file:../../packages/core"
|
"@esengine/ecs-framework": "file:../../packages/core"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
examples/core-demos/pnpm-lock.yaml
generated
6
examples/core-demos/pnpm-lock.yaml
generated
@@ -8,7 +8,7 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@esengine/esengine':
|
'@esengine/ecs-framework':
|
||||||
specifier: file:../../packages/core
|
specifier: file:../../packages/core
|
||||||
version: file:../../packages/core
|
version: file:../../packages/core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
@@ -153,7 +153,7 @@ packages:
|
|||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@esengine/esengine@file:../../packages/core':
|
'@esengine/ecs-framework@file:../../packages/core':
|
||||||
resolution: {directory: ../../packages/core, type: directory}
|
resolution: {directory: ../../packages/core, type: directory}
|
||||||
|
|
||||||
esbuild@0.18.20:
|
esbuild@0.18.20:
|
||||||
@@ -291,7 +291,7 @@ snapshots:
|
|||||||
'@esbuild/win32-x64@0.18.20':
|
'@esbuild/win32-x64@0.18.20':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@esengine/esengine@file:../../packages/core':
|
'@esengine/ecs-framework@file:../../packages/core':
|
||||||
dependencies:
|
dependencies:
|
||||||
tslib: 2.8.1
|
tslib: 2.8.1
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Scene, Core } from '@esengine/esengine';
|
import { Scene, Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
export interface DemoInfo {
|
export interface DemoInfo {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
Serializable,
|
Serializable,
|
||||||
Serialize,
|
Serialize,
|
||||||
IncrementalSerializer
|
IncrementalSerializer
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// ===== 组件定义 =====
|
// ===== 组件定义 =====
|
||||||
@ECSComponent('IncDemo_Position')
|
@ECSComponent('IncDemo_Position')
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
Serializable,
|
Serializable,
|
||||||
Serialize,
|
Serialize,
|
||||||
SerializeAsMap
|
SerializeAsMap
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
// ===== 组件定义 =====
|
// ===== 组件定义 =====
|
||||||
@ECSComponent('SerDemo_Position')
|
@ECSComponent('SerDemo_Position')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DemoBase, DemoInfo } from './DemoBase';
|
import { DemoBase, DemoInfo } from './DemoBase';
|
||||||
import { Component, ECSComponent, WorkerEntitySystem, EntitySystem, Matcher, Entity, ECSSystem, PlatformManager, Time } from '@esengine/esengine';
|
import { Component, ECSComponent, WorkerEntitySystem, EntitySystem, Matcher, Entity, ECSSystem, PlatformManager, Time } from '@esengine/ecs-framework';
|
||||||
import { BrowserAdapter } from '../platform/BrowserAdapter';
|
import { BrowserAdapter } from '../platform/BrowserAdapter';
|
||||||
|
|
||||||
// ============ 组件定义 ============
|
// ============ 组件定义 ============
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DEMO_REGISTRY, DemoBase } from './demos';
|
import { DEMO_REGISTRY, DemoBase } from './demos';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
class DemoManager {
|
class DemoManager {
|
||||||
private demos: Map<string, typeof DemoBase> = new Map();
|
private demos: Map<string, typeof DemoBase> = new Map();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type {
|
|||||||
PlatformWorker,
|
PlatformWorker,
|
||||||
WorkerCreationOptions,
|
WorkerCreationOptions,
|
||||||
PlatformConfig
|
PlatformConfig
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 浏览器平台适配器
|
* 浏览器平台适配器
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"deploy": "node deploy.js"
|
"deploy": "node deploy.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "^2.3.2",
|
"@esengine/ecs-framework": "^2.3.2",
|
||||||
"@esengine/worker-generator": "^1.0.1",
|
"@esengine/worker-generator": "^1.0.1",
|
||||||
"esbuild": "^0.19.0"
|
"esbuild": "^0.19.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* 组件定义
|
* 组件定义
|
||||||
* Component definitions
|
* Component definitions
|
||||||
*/
|
*/
|
||||||
import { Component, ECSComponent } from '@esengine/esengine';
|
import { Component, ECSComponent } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('Position')
|
@ECSComponent('Position')
|
||||||
export class Position extends Component {
|
export class Position extends Component {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
Matcher,
|
Matcher,
|
||||||
Entity,
|
Entity,
|
||||||
ECSSystem
|
ECSSystem
|
||||||
} from '@esengine/esengine';
|
} from '@esengine/ecs-framework';
|
||||||
import { Position, Velocity, Physics, Renderable } from '../components';
|
import { Position, Velocity, Physics, Renderable } from '../components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@esengine/esengine-monorepo",
|
"name": "@esengine/ecs-framework-monorepo",
|
||||||
"version": "2.1.29",
|
"version": "2.1.29",
|
||||||
"description": "ECS Framework Monorepo - 高性能ECS框架及其网络插件",
|
"description": "ECS Framework Monorepo - 高性能ECS框架及其网络插件",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"clean": "turbo run clean",
|
"clean": "turbo run clean",
|
||||||
"build": "turbo run build",
|
"build": "turbo run build",
|
||||||
"build:filter": "turbo run build --filter",
|
"build:filter": "turbo run build --filter",
|
||||||
"build:core": "turbo run build --filter=@esengine/esengine",
|
"build:core": "turbo run build --filter=@esengine/ecs-framework",
|
||||||
"build:math": "turbo run build --filter=@esengine/esengine-math",
|
"build:math": "turbo run build --filter=@esengine/ecs-framework-math",
|
||||||
"build:editor": "turbo run build --filter=@esengine/editor-app...",
|
"build:editor": "turbo run build --filter=@esengine/editor-app...",
|
||||||
"build:npm": "turbo run build:npm",
|
"build:npm": "turbo run build:npm",
|
||||||
"build:npm:core": "cd packages/core && npm run build:npm",
|
"build:npm:core": "cd packages/core && npm run build:npm",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
"author": "yhh",
|
"author": "yhh",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/build-config": "workspace:*",
|
"@esengine/build-config": "workspace:*",
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* Scans all components in a scene, collects resource references, batch-loads them, and assigns runtime IDs back to components
|
* Scans all components in a scene, collects resource references, batch-loads them, and assigns runtime IDs back to components
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Scene } from '@esengine/esengine';
|
import type { Scene } from '@esengine/ecs-framework';
|
||||||
import { isResourceComponent, type ResourceReference } from '../interfaces/IResourceComponent';
|
import { isResourceComponent, type ResourceReference } from '../interfaces/IResourceComponent';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
"clean": "rimraf dist"
|
"clean": "rimraf dist"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/build-config": "workspace:*",
|
"@esengine/build-config": "workspace:*",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { ComponentRegistry as ComponentRegistryType } from '@esengine/esengine';
|
import type { ComponentRegistry as ComponentRegistryType } from '@esengine/ecs-framework';
|
||||||
import type { IRuntimeModule, IPlugin, ModuleManifest } from '@esengine/engine-core';
|
import type { IRuntimeModule, IPlugin, ModuleManifest } from '@esengine/engine-core';
|
||||||
import { AudioSourceComponent } from './AudioSourceComponent';
|
import { AudioSourceComponent } from './AudioSourceComponent';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, ECSComponent, Serializable, Serialize, Property } from '@esengine/esengine';
|
import { Component, ECSComponent, Serializable, Serialize, Property } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
@ECSComponent('AudioSource')
|
@ECSComponent('AudioSource')
|
||||||
@Serializable({ version: 2, typeId: 'AudioSource' })
|
@Serializable({ version: 2, typeId: 'AudioSource' })
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"@esengine/behavior-tree": "workspace:*"
|
"@esengine/behavior-tree": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/editor-core": "workspace:*",
|
"@esengine/editor-core": "workspace:*",
|
||||||
"@esengine/editor-runtime": "workspace:*",
|
"@esengine/editor-runtime": "workspace:*",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Node as BehaviorTreeNode } from '../../domain/models/Node';
|
|||||||
import { Connection } from '../../domain/models/Connection';
|
import { Connection } from '../../domain/models/Connection';
|
||||||
import { ExecutionLog } from '../../utils/BehaviorTreeExecutor';
|
import { ExecutionLog } from '../../utils/BehaviorTreeExecutor';
|
||||||
import { BlackboardValue } from '../../domain/models/Blackboard';
|
import { BlackboardValue } from '../../domain/models/Blackboard';
|
||||||
import { createLogger } from '@esengine/esengine';
|
import { createLogger } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const logger = createLogger('ExecutionHooks');
|
const logger = createLogger('ExecutionHooks');
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { DOMCache } from '../../utils/DOMCache';
|
|||||||
import { EditorEventBus, EditorEvent } from '../../infrastructure/events/EditorEventBus';
|
import { EditorEventBus, EditorEvent } from '../../infrastructure/events/EditorEventBus';
|
||||||
import { ExecutionHooksManager } from '../interfaces/IExecutionHooks';
|
import { ExecutionHooksManager } from '../interfaces/IExecutionHooks';
|
||||||
import type { Breakpoint } from '../../types/Breakpoint';
|
import type { Breakpoint } from '../../types/Breakpoint';
|
||||||
import { createLogger } from '@esengine/esengine';
|
import { createLogger } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const logger = createLogger('ExecutionController');
|
const logger = createLogger('ExecutionController');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { type GlobalBlackboardConfig, BlackboardValueType, type BlackboardVariable } from '@esengine/behavior-tree';
|
import { type GlobalBlackboardConfig, BlackboardValueType, type BlackboardVariable } from '@esengine/behavior-tree';
|
||||||
import { createLogger } from '@esengine/esengine';
|
import { createLogger } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const logger = createLogger('GlobalBlackboardService');
|
const logger = createLogger('GlobalBlackboardService');
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* 行为树编辑器模块
|
* 行为树编辑器模块
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ServiceContainer } from '@esengine/esengine';
|
import type { ServiceContainer } from '@esengine/ecs-framework';
|
||||||
import { TransformComponent } from '@esengine/engine-core';
|
import { TransformComponent } from '@esengine/engine-core';
|
||||||
import {
|
import {
|
||||||
type IEditorModuleLoader,
|
type IEditorModuleLoader,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createLogger } from '@esengine/esengine';
|
import { createLogger } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
const logger = createLogger('EditorEventBus');
|
const logger = createLogger('EditorEventBus');
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { World, Entity, Scene, createLogger, Time, Core } from '@esengine/esengine';
|
import { World, Entity, Scene, createLogger, Time, Core } from '@esengine/ecs-framework';
|
||||||
import {
|
import {
|
||||||
BehaviorTreeRuntimeComponent,
|
BehaviorTreeRuntimeComponent,
|
||||||
BehaviorTreeAssetManager,
|
BehaviorTreeAssetManager,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
"author": "yhh",
|
"author": "yhh",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/asset-system": "workspace:*",
|
"@esengine/asset-system": "workspace:*",
|
||||||
"@esengine/build-config": "workspace:*",
|
"@esengine/build-config": "workspace:*",
|
||||||
|
|||||||
6
packages/behavior-tree/pnpm-lock.yaml
generated
6
packages/behavior-tree/pnpm-lock.yaml
generated
@@ -8,7 +8,7 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@esengine/esengine':
|
'@esengine/ecs-framework':
|
||||||
specifier: ^2.2.8
|
specifier: ^2.2.8
|
||||||
version: 2.2.13
|
version: 2.2.13
|
||||||
tslib:
|
tslib:
|
||||||
@@ -645,7 +645,7 @@ packages:
|
|||||||
'@bcoe/v8-coverage@0.2.3':
|
'@bcoe/v8-coverage@0.2.3':
|
||||||
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
|
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
|
||||||
|
|
||||||
'@esengine/esengine@2.2.13':
|
'@esengine/ecs-framework@2.2.13':
|
||||||
resolution: {integrity: sha512-RMRUCWMoVxEvWOeEI/r1snGLHPSdcNAzIO0qlMOfJEYoXRrl5CIhddZvhdE97rufynETUvOFaLq3DDZCeVV2kg==}
|
resolution: {integrity: sha512-RMRUCWMoVxEvWOeEI/r1snGLHPSdcNAzIO0qlMOfJEYoXRrl5CIhddZvhdE97rufynETUvOFaLq3DDZCeVV2kg==}
|
||||||
engines: {node: '>=16.0.0'}
|
engines: {node: '>=16.0.0'}
|
||||||
|
|
||||||
@@ -2739,7 +2739,7 @@ snapshots:
|
|||||||
|
|
||||||
'@bcoe/v8-coverage@0.2.3': {}
|
'@bcoe/v8-coverage@0.2.3': {}
|
||||||
|
|
||||||
'@esengine/esengine@2.2.13': {}
|
'@esengine/ecs-framework@2.2.13': {}
|
||||||
|
|
||||||
'@isaacs/cliui@8.0.2':
|
'@isaacs/cliui@8.0.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const banner = `/**
|
|||||||
* @license ${pkg.license}
|
* @license ${pkg.license}
|
||||||
*/`;
|
*/`;
|
||||||
|
|
||||||
const external = ['@esengine/esengine'];
|
const external = ['@esengine/ecs-framework'];
|
||||||
|
|
||||||
const commonPlugins = [
|
const commonPlugins = [
|
||||||
resolve({
|
resolve({
|
||||||
@@ -94,7 +94,7 @@ module.exports = [
|
|||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
exports: 'named',
|
exports: 'named',
|
||||||
globals: {
|
globals: {
|
||||||
'@esengine/esengine': 'ECS'
|
'@esengine/ecs-framework': 'ECS'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -181,6 +181,6 @@ module.exports = [
|
|||||||
respectExternal: true
|
respectExternal: true
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
external: ['@esengine/esengine']
|
external: ['@esengine/ecs-framework']
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { IScene, ServiceContainer } from '@esengine/esengine';
|
import type { IScene, ServiceContainer } from '@esengine/ecs-framework';
|
||||||
import { ComponentRegistry } from '@esengine/esengine';
|
import { ComponentRegistry } from '@esengine/ecs-framework';
|
||||||
import type { IRuntimeModule, IPlugin, ModuleManifest, SystemContext } from '@esengine/engine-core';
|
import type { IRuntimeModule, IPlugin, ModuleManifest, SystemContext } from '@esengine/engine-core';
|
||||||
import { AssetManagerToken } from '@esengine/asset-system';
|
import { AssetManagerToken } from '@esengine/asset-system';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Entity, Core } from '@esengine/esengine';
|
import { Entity, Core } from '@esengine/ecs-framework';
|
||||||
import { BehaviorTreeData } from './execution/BehaviorTreeData';
|
import { BehaviorTreeData } from './execution/BehaviorTreeData';
|
||||||
import { BehaviorTreeRuntimeComponent } from './execution/BehaviorTreeRuntimeComponent';
|
import { BehaviorTreeRuntimeComponent } from './execution/BehaviorTreeRuntimeComponent';
|
||||||
import { BehaviorTreeAssetManager } from './execution/BehaviorTreeAssetManager';
|
import { BehaviorTreeAssetManager } from './execution/BehaviorTreeAssetManager';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createLogger, BinarySerializer } from '@esengine/esengine';
|
import { createLogger, BinarySerializer } from '@esengine/ecs-framework';
|
||||||
import type { BehaviorTreeAsset } from './BehaviorTreeAsset';
|
import type { BehaviorTreeAsset } from './BehaviorTreeAsset';
|
||||||
import { BehaviorTreeAssetValidator } from './BehaviorTreeAsset';
|
import { BehaviorTreeAssetValidator } from './BehaviorTreeAsset';
|
||||||
import { EditorFormatConverter, type EditorFormat } from './EditorFormatConverter';
|
import { EditorFormatConverter, type EditorFormat } from './EditorFormatConverter';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { createLogger } from '@esengine/esengine';
|
import { createLogger } from '@esengine/ecs-framework';
|
||||||
import type { BehaviorTreeAsset, AssetMetadata, BehaviorTreeNodeData, BlackboardVariableDefinition, PropertyBinding } from './BehaviorTreeAsset';
|
import type { BehaviorTreeAsset, AssetMetadata, BehaviorTreeNodeData, BlackboardVariableDefinition, PropertyBinding } from './BehaviorTreeAsset';
|
||||||
import { NodeType, BlackboardValueType } from '../Types/TaskStatus';
|
import { NodeType, BlackboardValueType } from '../Types/TaskStatus';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IService } from '@esengine/esengine';
|
import { IService } from '@esengine/ecs-framework';
|
||||||
import { BlackboardValueType, BlackboardVariable } from '../Types/TaskStatus';
|
import { BlackboardValueType, BlackboardVariable } from '../Types/TaskStatus';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { BehaviorTreeData } from './BehaviorTreeData';
|
import { BehaviorTreeData } from './BehaviorTreeData';
|
||||||
import { createLogger, IService } from '@esengine/esengine';
|
import { createLogger, IService } from '@esengine/ecs-framework';
|
||||||
import { EditorToBehaviorTreeDataConverter } from '../Serialization/EditorToBehaviorTreeDataConverter';
|
import { EditorToBehaviorTreeDataConverter } from '../Serialization/EditorToBehaviorTreeDataConverter';
|
||||||
|
|
||||||
const logger = createLogger('BehaviorTreeAssetManager');
|
const logger = createLogger('BehaviorTreeAssetManager');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EntitySystem, Matcher, Entity, Time, Core, ECSSystem, ServiceContainer } from '@esengine/esengine';
|
import { EntitySystem, Matcher, Entity, Time, Core, ECSSystem, ServiceContainer } from '@esengine/ecs-framework';
|
||||||
import type { IAssetManager } from '@esengine/asset-system';
|
import type { IAssetManager } from '@esengine/asset-system';
|
||||||
import { BehaviorTreeRuntimeComponent } from './BehaviorTreeRuntimeComponent';
|
import { BehaviorTreeRuntimeComponent } from './BehaviorTreeRuntimeComponent';
|
||||||
import { BehaviorTreeAssetManager } from './BehaviorTreeAssetManager';
|
import { BehaviorTreeAssetManager } from './BehaviorTreeAssetManager';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Component, ECSComponent, Property } from '@esengine/esengine';
|
import { Component, ECSComponent, Property } from '@esengine/ecs-framework';
|
||||||
import { Serializable, Serialize, IgnoreSerialization } from '@esengine/esengine';
|
import { Serializable, Serialize, IgnoreSerialization } from '@esengine/ecs-framework';
|
||||||
import { NodeRuntimeState, createDefaultRuntimeState } from './BehaviorTreeData';
|
import { NodeRuntimeState, createDefaultRuntimeState } from './BehaviorTreeData';
|
||||||
import { TaskStatus } from '../Types/TaskStatus';
|
import { TaskStatus } from '../Types/TaskStatus';
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { TaskStatus, NodeType } from '../../Types/TaskStatus';
|
|||||||
import { INodeExecutor, NodeExecutionContext, BindingHelper } from '../NodeExecutor';
|
import { INodeExecutor, NodeExecutionContext, BindingHelper } from '../NodeExecutor';
|
||||||
import { NodeExecutorMetadata } from '../NodeMetadata';
|
import { NodeExecutorMetadata } from '../NodeMetadata';
|
||||||
import { BehaviorTreeAssetManager } from '../BehaviorTreeAssetManager';
|
import { BehaviorTreeAssetManager } from '../BehaviorTreeAssetManager';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SubTree执行器
|
* SubTree执行器
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Entity } from '@esengine/esengine';
|
import { Entity } from '@esengine/ecs-framework';
|
||||||
import { TaskStatus } from '../Types/TaskStatus';
|
import { TaskStatus } from '../Types/TaskStatus';
|
||||||
import { BehaviorNodeData, BehaviorTreeData, NodeRuntimeState } from './BehaviorTreeData';
|
import { BehaviorNodeData, BehaviorTreeData, NodeRuntimeState } from './BehaviorTreeData';
|
||||||
import { BehaviorTreeRuntimeComponent } from './BehaviorTreeRuntimeComponent';
|
import { BehaviorTreeRuntimeComponent } from './BehaviorTreeRuntimeComponent';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import type {
|
|||||||
IAssetContent,
|
IAssetContent,
|
||||||
AssetContentType
|
AssetContentType
|
||||||
} from '@esengine/asset-system';
|
} from '@esengine/asset-system';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import { BehaviorTreeData } from '../execution/BehaviorTreeData';
|
import { BehaviorTreeData } from '../execution/BehaviorTreeData';
|
||||||
import { BehaviorTreeAssetManager } from '../execution/BehaviorTreeAssetManager';
|
import { BehaviorTreeAssetManager } from '../execution/BehaviorTreeAssetManager';
|
||||||
import { EditorToBehaviorTreeDataConverter } from '../Serialization/EditorToBehaviorTreeDataConverter';
|
import { EditorToBehaviorTreeDataConverter } from '../Serialization/EditorToBehaviorTreeDataConverter';
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"@esengine/blueprint": "workspace:*"
|
"@esengine/blueprint": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/editor-core": "workspace:*",
|
"@esengine/editor-core": "workspace:*",
|
||||||
"@esengine/node-editor": "workspace:*",
|
"@esengine/node-editor": "workspace:*",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* 蓝图编辑器插件
|
* 蓝图编辑器插件
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Core, type ServiceContainer } from '@esengine/esengine';
|
import { Core, type ServiceContainer } from '@esengine/ecs-framework';
|
||||||
import type { ModuleManifest } from '@esengine/engine-core';
|
import type { ModuleManifest } from '@esengine/engine-core';
|
||||||
import type { IEditorPlugin, IEditorModuleLoader, PanelDescriptor, FileActionHandler, FileCreationTemplate } from '@esengine/editor-core';
|
import type { IEditorPlugin, IEditorModuleLoader, PanelDescriptor, FileActionHandler, FileCreationTemplate } from '@esengine/editor-core';
|
||||||
import { MessageHub, PanelPosition } from '@esengine/editor-core';
|
import { MessageHub, PanelPosition } from '@esengine/editor-core';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import { IFileSystemService, type IFileSystem } from '@esengine/editor-core';
|
import { IFileSystemService, type IFileSystem } from '@esengine/editor-core';
|
||||||
import { BlueprintCanvas } from './BlueprintCanvas';
|
import { BlueprintCanvas } from './BlueprintCanvas';
|
||||||
import { useBlueprintEditorStore } from '../stores/blueprintEditorStore';
|
import { useBlueprintEditorStore } from '../stores/blueprintEditorStore';
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
"author": "yhh",
|
"author": "yhh",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/build-config": "workspace:*",
|
"@esengine/build-config": "workspace:*",
|
||||||
"@types/node": "^20.19.17",
|
"@types/node": "^20.19.17",
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export default defineConfig({
|
|||||||
## Runtime vs Editor 分离规则
|
## Runtime vs Editor 分离规则
|
||||||
|
|
||||||
### ✅ runtime.ts 中可以:
|
### ✅ runtime.ts 中可以:
|
||||||
- 导入 @esengine/esengine
|
- 导入 @esengine/ecs-framework
|
||||||
- 导入 @esengine/ecs-components
|
- 导入 @esengine/ecs-components
|
||||||
- 导入其他包的 `/runtime` 路径
|
- 导入其他包的 `/runtime` 路径
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ export default defineConfig({
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// ✅ 正确
|
// ✅ 正确
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import { UIRuntimeModule } from '@esengine/ui/runtime';
|
import { UIRuntimeModule } from '@esengine/ui/runtime';
|
||||||
|
|
||||||
// ❌ 错误 - 会把编辑器代码打包进来
|
// ❌ 错误 - 会把编辑器代码打包进来
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"clean": "rimraf dist"
|
"clean": "rimraf dist"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/camera": "workspace:*",
|
"@esengine/camera": "workspace:*",
|
||||||
"@esengine/editor-core": "workspace:*",
|
"@esengine/editor-core": "workspace:*",
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
* 相机编辑器支持
|
* 相机编辑器支持
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Entity, ServiceContainer } from '@esengine/esengine';
|
import type { Entity, ServiceContainer } from '@esengine/ecs-framework';
|
||||||
import { Core } from '@esengine/esengine';
|
import { Core } from '@esengine/ecs-framework';
|
||||||
import { TransformComponent } from '@esengine/engine-core';
|
import { TransformComponent } from '@esengine/engine-core';
|
||||||
import type {
|
import type {
|
||||||
IEditorModuleLoader,
|
IEditorModuleLoader,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
"clean": "rimraf dist"
|
"clean": "rimraf dist"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/build-config": "workspace:*",
|
"@esengine/build-config": "workspace:*",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, ECSComponent, Serializable, Serialize, Property } from '@esengine/esengine';
|
import { Component, ECSComponent, Serializable, Serialize, Property } from '@esengine/ecs-framework';
|
||||||
|
|
||||||
export enum ECameraProjection {
|
export enum ECameraProjection {
|
||||||
Perspective = 'perspective',
|
Perspective = 'perspective',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { ComponentRegistry as ComponentRegistryType } from '@esengine/esengine';
|
import type { ComponentRegistry as ComponentRegistryType } from '@esengine/ecs-framework';
|
||||||
import type { IRuntimeModule, IPlugin, ModuleManifest } from '@esengine/engine-core';
|
import type { IRuntimeModule, IPlugin, ModuleManifest } from '@esengine/engine-core';
|
||||||
import { CameraComponent } from './CameraComponent';
|
import { CameraComponent } from './CameraComponent';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "core",
|
"id": "core",
|
||||||
"name": "@esengine/esengine",
|
"name": "@esengine/ecs-framework",
|
||||||
"displayName": "Core ECS",
|
"displayName": "Core ECS",
|
||||||
"outputPath": "dist/index.mjs",
|
"outputPath": "dist/index.mjs",
|
||||||
"description": "Core Entity-Component-System framework | 核心 ECS 框架",
|
"description": "Core Entity-Component-System framework | 核心 ECS 框架",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@esengine/esengine",
|
"name": "@esengine/ecs-framework",
|
||||||
"version": "2.3.2",
|
"version": "2.3.2",
|
||||||
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
||||||
"main": "dist/index.cjs",
|
"main": "dist/index.cjs",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const { readFileSync } = require('fs');
|
|||||||
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
|
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
|
||||||
|
|
||||||
const banner = `/**
|
const banner = `/**
|
||||||
* @esengine/esengine v${pkg.version}
|
* @esengine/ecs-framework v${pkg.version}
|
||||||
* 高性能ECS框架 - 适用于Cocos Creator和Laya等JavaScript游戏引擎
|
* 高性能ECS框架 - 适用于Cocos Creator和Laya等JavaScript游戏引擎
|
||||||
*
|
*
|
||||||
* @author ${pkg.author}
|
* @author ${pkg.author}
|
||||||
@@ -204,7 +204,7 @@ module.exports = [
|
|||||||
file: 'dist/index.d.ts',
|
file: 'dist/index.d.ts',
|
||||||
format: 'es',
|
format: 'es',
|
||||||
banner: `/**
|
banner: `/**
|
||||||
* @esengine/esengine v${pkg.version}
|
* @esengine/ecs-framework v${pkg.version}
|
||||||
* TypeScript definitions
|
* TypeScript definitions
|
||||||
*/`
|
*/`
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
"es-engine": "file:../engine/pkg"
|
"es-engine": "file:../engine/pkg"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esengine/esengine": "workspace:*",
|
"@esengine/ecs-framework": "workspace:*",
|
||||||
"@esengine/esengine-math": "workspace:*",
|
"@esengine/ecs-framework-math": "workspace:*",
|
||||||
"@esengine/engine-core": "workspace:*",
|
"@esengine/engine-core": "workspace:*",
|
||||||
"@esengine/sprite": "workspace:*",
|
"@esengine/sprite": "workspace:*",
|
||||||
"@esengine/camera": "workspace:*",
|
"@esengine/camera": "workspace:*",
|
||||||
|
|||||||
2
packages/ecs-engine-bindgen/pnpm-lock.yaml
generated
2
packages/ecs-engine-bindgen/pnpm-lock.yaml
generated
@@ -8,7 +8,7 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@esengine/esengine':
|
'@esengine/ecs-framework':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../core
|
version: link:../core
|
||||||
es-engine:
|
es-engine:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* 精灵渲染辅助工具。
|
* 精灵渲染辅助工具。
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Entity, Component } from '@esengine/esengine';
|
import { Entity, Component } from '@esengine/ecs-framework';
|
||||||
import type { EngineBridge } from './EngineBridge';
|
import type { EngineBridge } from './EngineBridge';
|
||||||
import { RenderBatcher } from './RenderBatcher';
|
import { RenderBatcher } from './RenderBatcher';
|
||||||
import { SpriteComponent } from '@esengine/sprite';
|
import { SpriteComponent } from '@esengine/sprite';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* 相机系统
|
* 相机系统
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { EntitySystem, Matcher, Entity, ECSSystem } from '@esengine/esengine';
|
import { EntitySystem, Matcher, Entity, ECSSystem } from '@esengine/ecs-framework';
|
||||||
import { CameraComponent } from '@esengine/camera';
|
import { CameraComponent } from '@esengine/camera';
|
||||||
import type { EngineBridge } from '../core/EngineBridge';
|
import type { EngineBridge } from '../core/EngineBridge';
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user