map_watch.dart 866 B

1234567891011121314151617181920212223242526272829303132
  1. import 'package:common_pub/service/controller.dart';
  2. import 'package:common_pub/ui/map_view/map_view.dart';
  3. import '../service/api.dart';
  4. import 'package:fixnum/fixnum.dart';
  5. typedef MapId = Int64;
  6. class MapWatchService extends PlugController{
  7. static final Rx<MapWatchService?> _instance = Rx(null);
  8. static MapWatchService? get instance => _instance.value;
  9. static Future<void> setMapById(MapId id)async{
  10. final info = await ApiService.to.stub.toMapDetailV2(IdRequest()
  11. ..id = id);
  12. final thisInstance = MapWatchService(
  13. id: id)
  14. ..name = info.mapName
  15. ..plugMap.gameMap = info.zipImage.toGameMap() ;
  16. thisInstance.addPlugs([thisInstance.plugMap]);
  17. _instance.value = thisInstance;
  18. thisInstance.init();
  19. }
  20. MapWatchService({required this.id});
  21. final MapId id;
  22. String name= '';
  23. final plugMap = PlugMap();
  24. }