public VehiclesQueryHandlers(IRepository <VehiclePosition> vehiclePositionRepository, IMapAPI mapAPI)
 {
     this._vehiclePositionRepository = vehiclePositionRepository;
     this._mapAPI = mapAPI;
 }
Пример #2
0
 public MapEngine(IMapAPI vm)
 {
     _api = vm;
 }
        public override void Entry(IModHelper helper)
        {
            instance   = this;
            _helper    = helper;
            tempFolder = Path.Combine(helper.DirectoryPath, "Temp");
            if (!Directory.Exists(tempFolder))
            {
                Directory.CreateDirectory(tempFolder);
            }
            config = helper.ReadConfig <Config>();

            helper.Events.Input.ButtonPressed += Input_ButtonPressed;

            helper.Events.GameLoop.GameLaunched += (s, e) =>
            {
                SetUpConfigMenu();

                if (Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone") is IMobilePhoneApi api)
                {
                    Texture2D appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "mobile_app_icon.png"));
                    bool      success = api.AddApp(Helper.ModRegistry.ModID + "MobileWarpMenu", "Warp Menu", () =>
                    {
                        OpenUpMenu();
                    }, appIcon);
                }

                if (Helper.ModRegistry.GetApi <IMapAPI>("Platonymous.Toolkit") is IMapAPI pApi)
                {
                    pytk = pApi;
                }
            };

            var  harmony = HarmonyInstance.Create("Platonymous.PlatoWarpMenu");
            bool patched = false;

            if (!config.CompatibilityMode || Constants.TargetPlatform == GamePlatform.Android)
            {
                try
                {
                    harmony.Patch(Type.GetType("System.Drawing.Image, System.Drawing").GetMethod("Save", new Type[] { typeof(string), Type.GetType("System.Drawing.Imaging.ImageFormat, System.Drawing") }), prefix: new HarmonyMethod(this.GetType().GetMethod("InterceptScreenshot", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public)));
                    patched = true;
                }
                catch
                {
                }
            }

            var displayDevice = Game1.mapDisplayDevice;

            helper.Events.GameLoop.UpdateTicked += (s, e) =>
            {
                displayDevice = Game1.mapDisplayDevice;
            };

            helper.Events.GameLoop.UpdateTicking += (s, e) =>
            {
                if (Game1.activeClickableMenu is IUIMenu uim)
                {
                    uim.ShouldDraw = () =>
                    {
                        return(Game1.mapDisplayDevice == displayDevice);
                    };
                }
            };
        }
Пример #4
0
 public MapEngine(IMapAPI vm)
 {
     _api = vm;
 }