feat: add Lua runtime storage API
This commit is contained in:
@@ -24,6 +24,7 @@ import '../display/runtime_viewport.dart';
|
||||
import '../resources/game_resource_manager.dart';
|
||||
import '../scripting/runtime_script_services.dart';
|
||||
import '../scripting/script_engine.dart';
|
||||
import '../storage/runtime_storage_manager.dart';
|
||||
import 'runtime_locale.dart';
|
||||
import 'runtime_options.dart';
|
||||
|
||||
@@ -73,6 +74,7 @@ class FlameLuaGame extends FlameGame with PanDetector, ScrollDetector {
|
||||
late final PositionComponent _viewportRoot;
|
||||
RuntimeNetworkManager? _network;
|
||||
RuntimeHostBridgeManager? _hostBridgeManager;
|
||||
RuntimeStorageManager? _storage;
|
||||
RuntimeViewportConfig? _viewportConfig;
|
||||
late final CommandExecutor _commands;
|
||||
RuntimeSession? _session;
|
||||
@@ -117,6 +119,7 @@ class FlameLuaGame extends FlameGame with PanDetector, ScrollDetector {
|
||||
'initialized': true,
|
||||
'images': _resources.imagesDebugJson(),
|
||||
'audio': _audio.audioDebugJson(),
|
||||
'storage': _storage?.debugJson() ?? const {},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -142,6 +145,8 @@ class FlameLuaGame extends FlameGame with PanDetector, ScrollDetector {
|
||||
diagnostics: diagnostics,
|
||||
);
|
||||
_hostBridgeManager = hostBridgeManager;
|
||||
final storage = await RuntimeStorageManager.create(gameId: gameId);
|
||||
_storage = storage;
|
||||
final activation =
|
||||
await PackageActivationController(
|
||||
repository: _packageRepository,
|
||||
@@ -155,6 +160,7 @@ class FlameLuaGame extends FlameGame with PanDetector, ScrollDetector {
|
||||
scriptServices: RuntimeScriptServices(
|
||||
network: network,
|
||||
hostBridge: hostBridgeManager,
|
||||
storage: storage,
|
||||
),
|
||||
store: StablePackageStore(runtimeOptions: runtimeOptions),
|
||||
assetFallback: AssetGamePackageRepository(
|
||||
|
||||
Reference in New Issue
Block a user