refactor: reorganize package structure and decouple framework packages (#338)

* refactor: reorganize package structure and decouple framework packages

## Package Structure Reorganization
- Reorganized 55 packages into categorized subdirectories:
  - packages/framework/ - Generic framework (Laya/Cocos compatible)
  - packages/engine/ - ESEngine core modules
  - packages/rendering/ - Rendering modules (WASM dependent)
  - packages/physics/ - Physics modules
  - packages/streaming/ - World streaming
  - packages/network-ext/ - Network extensions
  - packages/editor/ - Editor framework and plugins
  - packages/rust/ - Rust WASM engine
  - packages/tools/ - Build tools and SDK

## Framework Package Decoupling
- Decoupled behavior-tree and blueprint packages from ESEngine dependencies
- Created abstracted interfaces (IBTAssetManager, IBehaviorTreeAssetContent)
- ESEngine-specific code moved to esengine/ subpath exports
- Framework packages now usable with Cocos/Laya without ESEngine

## CI Configuration
- Updated CI to only type-check and lint framework packages
- Added type-check:framework and lint:framework scripts

## Breaking Changes
- Package import paths changed due to directory reorganization
- ESEngine integrations now use subpath imports (e.g., '@esengine/behavior-tree/esengine')

* fix: update es-engine file path after directory reorganization

* docs: update README to focus on framework over engine

* ci: only build framework packages, remove Rust/WASM dependencies

* fix: remove esengine subpath from behavior-tree and blueprint builds

ESEngine integration code will only be available in full engine builds.
Framework packages are now purely engine-agnostic.

* fix: move network-protocols to framework, build both in CI

* fix: update workflow paths from packages/core to packages/framework/core

* fix: exclude esengine folder from type-check in behavior-tree and blueprint

* fix: update network tsconfig references to new paths

* fix: add test:ci:framework to only test framework packages in CI

* fix: only build core and math npm packages in CI

* fix: exclude test files from CodeQL and fix string escaping security issue
This commit is contained in:
YHH
2025-12-26 14:50:35 +08:00
committed by GitHub
parent a84ff902e4
commit 155411e743
1936 changed files with 4147 additions and 11578 deletions

View File

@@ -0,0 +1,159 @@
import { GTweener } from './GTweener';
import { TweenManager } from './TweenManager';
import { TweenValue } from './TweenValue';
/**
* GTween
*
* Main entry point for the tween system.
* Provides static factory methods for creating tweens.
*
* 补间系统的主入口点
* 提供创建补间的静态工厂方法
*
* @example
* ```typescript
* // Simple tween
* GTween.to(0, 100, 0.5)
* .setTarget(sprite, 'x')
* .setEase(EEaseType.QuadOut);
*
* // Vector tween
* GTween.to2(0, 0, 100, 200, 0.5)
* .setTarget(sprite)
* .onUpdate((tweener) => {
* sprite.x = tweener.value.x;
* sprite.y = tweener.value.y;
* });
*
* // Delayed call
* GTween.delayedCall(1.0)
* .onComplete(() => console.log('Done!'));
* ```
*/
export class GTween {
/**
* Catch all uncaught tween callback exceptions
* 捕获所有未捕获的补间回调异常
*/
public static catchCallbackExceptions: boolean = true;
/**
* Create a tween from start to end value
* 创建从起始值到结束值的补间
*/
public static to(start: number, end: number, duration: number): GTweener {
return TweenManager.createTween()._to(start, end, duration);
}
/**
* Create a 2D tween
* 创建2D补间
*/
public static to2(
startX: number,
startY: number,
endX: number,
endY: number,
duration: number
): GTweener {
return TweenManager.createTween()._to2(startX, startY, endX, endY, duration);
}
/**
* Create a 3D tween
* 创建3D补间
*/
public static to3(
startX: number,
startY: number,
startZ: number,
endX: number,
endY: number,
endZ: number,
duration: number
): GTweener {
return TweenManager.createTween()._to3(startX, startY, startZ, endX, endY, endZ, duration);
}
/**
* Create a 4D tween
* 创建4D补间
*/
public static to4(
startX: number,
startY: number,
startZ: number,
startW: number,
endX: number,
endY: number,
endZ: number,
endW: number,
duration: number
): GTweener {
return TweenManager.createTween()._to4(
startX,
startY,
startZ,
startW,
endX,
endY,
endZ,
endW,
duration
);
}
/**
* Create a color tween
* 创建颜色补间
*/
public static toColor(start: number, end: number, duration: number): GTweener {
return TweenManager.createTween()._toColor(start, end, duration);
}
/**
* Create a delayed call
* 创建延迟调用
*/
public static delayedCall(delay: number): GTweener {
return TweenManager.createTween().setDelay(delay);
}
/**
* Create a shake tween
* 创建震动补间
*/
public static shake(
startX: number,
startY: number,
amplitude: number,
duration: number
): GTweener {
return TweenManager.createTween()._shake(startX, startY, amplitude, duration);
}
/**
* Check if target is being tweened
* 检查目标是否正在被补间
*/
public static isTweening(target: any, propType?: any): boolean {
return TweenManager.isTweening(target, propType);
}
/**
* Kill all tweens on target
* 终止目标上的所有补间
*/
public static kill(target: any, bComplete?: boolean, propType?: any): void {
TweenManager.killTweens(target, bComplete, propType);
}
/**
* Get tween for target
* 获取目标的补间
*/
public static getTween(target: any, propType?: any): GTweener | null {
return TweenManager.getTween(target, propType);
}
}