Files
flutter_lua_runtime/lib/runtime/scripting/script_engine.dart

32 lines
1.0 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
/// 设置翻译字典和当前语言Lua 侧可通过 runtime.i18n.t(key, fallback) 查询。
void setTranslations({
required String locale,
required Map<String, Map<String, String>> translations,
});
}