Files
flutter_lua_runtime/lib/runtime/scripting/script_engine.dart
gem 8ddc3be3a7 feat: multi-package loading with base framework support
- Add RuntimeOptions.basePackages for loading framework packages before game package
- Add ScriptEngine.loadPackages() for multi-package module merging
- LuaDardoScriptEngine merges modules from all packages, game overrides framework
- PackageActivationController loads base packages first, then game package
- GamePackageManifest parses optional 'base' field
- Update docs: README, quick-start, lua-package-format, architecture
- Update all test mocks with loadPackages() implementation
2026-06-10 00:04:00 +08:00

26 lines
820 B
Dart

import '../models/game_diff.dart';
import '../models/runtime_event.dart';
import '../packages/game_package.dart';
import 'runtime_script_services.dart';
abstract interface class ScriptEngine {
// 加载单个包(向后兼容,内部调 loadPackages([package]))。
Future<void> loadPackage(
GamePackage package, {
RuntimeScriptServices services = const RuntimeScriptServices(),
});
// 加载多个包,按顺序合并模块,后加载的同名模块覆盖先加载的。
// 入口脚本使用最后一个包。
Future<void> loadPackages(
List<GamePackage> packages, {
RuntimeScriptServices services = const RuntimeScriptServices(),
});
bool smokeTest(Map<String, Object?> context);
GameDiff init(Map<String, Object?> context);
GameDiff dispatchEvent(RuntimeEvent event);
}