Exemple #1
0
        public static void Initialise()
        {
            //ini stuff

            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/British Policing Script.ini");

            ini.Create();
            try
            {
                ToggleMenuKey                   = (Keys)kc.ConvertFromString(ini.ReadString("General", "ToggleMenuKey", "F9"));
                ToggleMenuModifierKey           = (Keys)kc.ConvertFromString(ini.ReadString("General", "ToggleMenuModifierKey", "None"));
                FailtostopEnabled               = ini.ReadBoolean("Callouts", "FailToStopEnabled", true);
                FailtostopFrequency             = ini.ReadInt32("Callouts", "FailToStopFrequency", 2);
                ANPRHitEnabled                  = ini.ReadBoolean("Callouts", "ANPRHitEnabled", true);
                ANPRHitFrequency                = ini.ReadInt32("Callouts", "ANPRHitFrequency", 2);
                TWOCEnabled                     = ini.ReadBoolean("Callouts", "TWOCEnabled", true);
                TWOCFrequency                   = ini.ReadInt32("Callouts", "TWOCFrequency", 2);
                CourtSystem.RealisticCourtDates = ini.ReadBoolean("General", "RealisticCourtDates", true);
            }
            catch (Exception e)
            {
                Game.LogTrivial(e.ToString());
                Game.LogTrivial("Error loading British Policing Script INI file. Loading defaults");
                Game.DisplayNotification("~r~Error loading British Policing Script INI file. Loading defaults");
            }
            BetaCheck();
        }
Exemple #2
0
        public static void IniSetup()
        {
            minStandardUnits = panicIni.ReadInt32("PanicButtonConfig", "MinStandardUnits", 3);
            maxStandardUnits = panicIni.ReadInt32("PanicButtonConfig", "MaxStandardUnits", 5);

            minSwatUnits  = panicIni.ReadInt32("PanicButtonConfig", "MinSwatUnits", 0);
            maxSwatUnits  = panicIni.ReadInt32("PanicButtonConfig", "MaxSwatUnits", 2);
            soundDuration = panicIni.ReadInt32("PanicButtonConfig", "SoundDuration", 450);
            playSound     = panicIni.ReadBoolean("PanicButtonConfig", "PlaySound", true);
        }
        internal static void Init()
        {
            if (!InitializationFile.Exists())
            {
                GenerateConfig();
            }
            configuration = new Configuration();
            try
            {
                configuration.Version = InitializationFile.ReadInt32("Main", "Version");
            }
            catch (Exception e)
            {
                InitializationFile.Delete();
                Game.DisplayNotification("Please try reload this plug-in once!");
                Game.DisplayNotification("If still can't, grab logs and visit <strong>Service Desk</strong>, URL is in logs!");
                Game.LogTrivial("URL: https://hotworkshop.atlassian.net/servicedesk/customer/portal/2");
                var cr = new CrashReporter(e);
                cr.ReportAndCrashPlugin();
            }

            if (configuration.Version != 2)
            {
                InitializationFile.Delete();
                Game.DisplayHelp("Please reload the plug-in using the console!");
                Game.DisplayNotification("Please reload the plug-in using the console!");
                new CrashReporter(new FormatException("Invalid configuration version - please restart!")).ReportAndCrashPlugin();
            }
        }
        private static void getStolenVehicleChance()
        {
            InitializationFile ini = initialiseFile();

            stolenVehicleChance = ini.ReadInt32("Ambient Event Chances", "StolenVehicle", 190);
            stolenVehicleChance++;
        }
        private static int drugsRunnersFrequent()
        {
            InitializationFile ini = initialiseFile();
            int result             = ini.ReadInt32("Callouts", "DrugsRunnersFrequency", 2);

            if (result < 1)
            {
                result = 1;
            }
            return(result);
        }
        private static int ownerWantedFrequent()
        {
            InitializationFile ini = initialiseFile();
            int result             = ini.ReadInt32("Callouts", "OwnerWantedFrequency", 2);

            if (result < 1)
            {
                result = 1;
            }
            return(result);
        }
Exemple #7
0
        public static void Initialise()
        {
            //ini stuff

            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/LSPDFR+.ini");

            ini.Create();
            try
            {
                EnhancedTrafficStop.BringUpTrafficStopMenuControllerButton = ini.ReadEnum <ControllerButtons>("General", "BringUpTrafficStopMenuControllerButton", ControllerButtons.DPadRight);
                EnhancedTrafficStop.BringUpTrafficStopMenuKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "BringUpTrafficStopMenuKey", "E"));
                CourtSystem.OpenCourtMenuKey                        = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuKey", "F9"));
                CourtSystem.OpenCourtMenuModifierKey                = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuModifierKey", "None"));
                EnhancedTrafficStop.EnhancedTrafficStopsEnabled     = ini.ReadBoolean("General", "EnhancedTrafficStopsEnabled", true);
                EnhancedPursuitAI.EnhancedPursuitAIEnabled          = ini.ReadBoolean("General", "EnhancedPursuitAIEnabled", true);
                EnhancedPursuitAI.AutoPursuitBackupEnabled          = ini.ReadBoolean("General", "AutoPursuitBackupEnabled", false);
                EnhancedPursuitAI.OpenPursuitTacticsMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuKey", "Q"));
                EnhancedPursuitAI.OpenPursuitTacticsMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuModifierKey", "LShiftKey"));
                EnhancedPursuitAI.DefaultAutomaticAI                = ini.ReadBoolean("General", "DefaultAutomaticAI", true);

                Offence.maxpoints    = ini.ReadInt32("General", "MaxPoints", 12);
                Offence.pointincstep = ini.ReadInt32("General", "PointsIncrementalStep", 1);
                Offence.maxFine      = ini.ReadInt32("General", "MaxFine", 5000);

                Offence.OpenTicketMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuKey", "Q"));
                Offence.OpenTicketMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuModifierKey", "LShiftKey"));
                Offence.enablePoints = ini.ReadBoolean("General", "EnablePoints", true);

                CourtSystem.RealisticCourtDates = ini.ReadBoolean("OnlyWithoutBritishPolicingScriptInstalled", "RealisticCourtDates", true);
            }
            catch (Exception e)
            {
                Game.LogTrivial(e.ToString());
                Game.LogTrivial("Error loading LSPDFR+ INI file. Loading defaults");
                Game.DisplayNotification("~r~Error loading LSPDFR+ INI file. Loading defaults");
            }
            BetaCheck();
        }
        private static void getNextEventTimer()
        {
            InitializationFile ini = initialiseFile();

            nextEventTimer = ini.ReadInt32("Ambient Event Chances", "NextEventTimer", 35);
            if (nextEventTimer < 5)
            {
                nextEventTimer = 5;
            }
            if (nextEventTimer > 200)
            {
                nextEventTimer = 200;
            }
            nextEventTimer *= 1000;
        }
Exemple #9
0
        private static void SetupTextures()
        {
            GeneralIni.Create();
            SetupBackgroundSettings();
            ButtonsPerPage = PositioningIni.ReadInt32("General", "ButtonsPerPage", 4);
            for (int i = 1; i <= ButtonsPerPage; i++)
            {
                if (PositioningIni.DoesKeyExist("Button" + i, "XOffset") && PositioningIni.DoesKeyExist("Button" + i, "YOffset"))
                {
                    int XOffset = PositioningIni.ReadInt32("Button" + i, "XOffset", 0);
                    int YOffset = PositioningIni.ReadInt32("Button" + i, "YOffset", 0);
                    buttonOffsets.Add(new Point(XOffset, YOffset));
                }
                else
                {
                    Albo1125.Common.CommonLibrary.ExtensionMethods.DisplayPopupTextBoxWithConfirmation("PoliceSmartRadio DisplayPositioning.ini Error", "Your UI has set " + ButtonsPerPage + " buttons per page, but has not specified XOffsets and YOffsets for so many buttons. Aborting.", true);
                    return;
                }
            }

            OnFootButtonPages    = SetupButtonPage(onFootXML);
            InVehicleButtonPages = SetupButtonPage(inVehicleXML);
            if (firstTimeLaunch)
            {
                HandleFirstLaunch();
            }
            CurrentButtonPages = OnFootButtonPages;
            CurrentPage        = CurrentButtonPages.Count > 0 ? CurrentButtonPages[0] : new ButtonPage();

            DoneLoadingTextures = true;
            Game.LogTrivial("Police SmartRadio is done loading. Button actions ready to be added.");
            SetupUserGeneralSettings();
            ButtonSelectSound.Load();
            ButtonScrollSound.Load();
            MainLogic();
        }
        /// <summary>
        /// Loads the values from the .ini file, if there are none it gives them default values
        /// </summary>
        internal static void LoadSettings()
        {
            Globals.General.WhistleProbability = IniFile.ReadInt32("General", "WhistleProbability", 30);
            if (Globals.General.WhistleProbability <= 1 || 100 <= Globals.General.WhistleProbability)
            {
                Logging.Log("Incorrect value given for WhistleProbability defaulting to 30!");
                Globals.General.WhistleProbability = 30;
            }
            Globals.Controls.WhistleKey         = IniFile.ReadEnum("Keys", "WhistleKey", Keys.X);
            Globals.Controls.WhistleModifierKey = IniFile.ReadEnum("Keys", "WhistleModifierKey", Keys.LShiftKey);
            Globals.Debug.DebugMode             = IniFile.ReadBoolean("Debug", "DebugMode", false);
            Globals.Radar.IsTrafficStopped      = false;

            if (Globals.Debug.DebugMode)
            {
                Logging.DebugLog($"Settings loaded, values: WhistleProbability = {Globals.General.WhistleProbability}, WhistleKey = {Globals.Controls.WhistleKey}, WhistleModifierKey = {Globals.Controls.WhistleModifierKey}");
            }
        }
        public void CheckForUpdates(int versionIndex)
        {
            string temponaryPath = Path.GetTempFileName();

            client.DownloadFile(url, temponaryPath);
            downloadedFile = new InitializationFile(temponaryPath);
            if (downloadedFile.ReadBoolean("Main", "AcquireUpdates", false) || downloadedFile.ReadBoolean("Main", "ReleasedAVersion", false))
            {
                int index = downloadedFile.ReadInt32("Main", "Version", versionIndex);
                if (index != versionIndex)
                {
                    Game.DisplayNotification("Update available for " + Name);
                }
            }
            else
            {
                Game.LogTrivial("The update file is not released.");
            }
        }
Exemple #12
0
        internal static void RunConfigCheck()
        {
            if (!ini_file.Exists())
            {
                CreateINIFile();
            }
            user                 = ini_file.ReadString("SETTINGS", "LoginName");
            pass                 = ini_file.ReadString("SETTINGS", "LoginPass");
            skip                 = ini_file.ReadBoolean("SETTINGS", "SkipLogin");
            unit                 = ini_file.ReadString("SETTINGS", "UnitNumber");
            FontSize             = ini_file.ReadInt32("SETTINGS", "FontSize");
            FontName             = ini_file.ReadString("SETTINGS", "FontName");
            randomHistoryRecords = ini_file.ReadBoolean("SETTINGS", "RandomHistoryRecords", true);

            displayPedImage     = ini_file.ReadBoolean("SETTINGS", "DisplayPedImage", true);
            displayVehicleImage = ini_file.ReadBoolean("SETTINGS", "DisplayVehicleImage", true);

            enableLSPDFRPlusIntegration = ini_file.ReadBoolean("SETTINGS", "EnableLSPDFRPlusIntegration", true);

            if (String.IsNullOrWhiteSpace(user))
            {
                user = "******";
            }
            if (String.IsNullOrWhiteSpace(pass))
            {
                pass = "******";
            }
            if (String.IsNullOrWhiteSpace(unit))
            {
                unit = "1-A-12";
            }

            FontSize = FontSize > 0 ? FontSize : 16;
            FontName = !String.IsNullOrWhiteSpace(FontName) ? FontName : "Microsoft Sans Serif";

            foreach (string key in ini_file.GetKeyNames("VEHICLE BACKGROUNDS"))
            {
                bgs.Add(Game.GetHashKey(key), ini_file.ReadString("VEHICLE BACKGROUNDS", key));
            }

            ParseKeybindings();
        }
Exemple #13
0
        public static void LoadConfig()
        {
            InitializationFile settings = initialiseFile(Global.Application.ConfigPath + "EasyLoadout.ini");

            Global.Application.DebugLogging = LoadoutConfig.ToBoolean(settings.ReadString("General", "DebugLogging", "false"));
            Logger.DebugLog("General Config Loading Started.");

            KeysConverter kc = new KeysConverter();

            string opTemp, opmTemp, glTemp, glmTemp, dlnTemp, dlcTemp;

            opTemp  = settings.ReadString("Keybinds", "OpenMenu", "F8");
            opmTemp = settings.ReadString("Keybinds", "OpenMenuModifier", "None");
            glTemp  = settings.ReadString("Keybinds", "GiveLoadout", "F7");
            glmTemp = settings.ReadString("Keybinds", "GiveLoadoutModifier", "None");

            Global.Controls.OpenMenu            = (Keys)kc.ConvertFromString(opTemp);
            Global.Controls.OpenMenuModifier    = (Keys)kc.ConvertFromString(opmTemp);
            Global.Controls.GiveLoadout         = (Keys)kc.ConvertFromString(glTemp);
            Global.Controls.GiveLoadoutModifier = (Keys)kc.ConvertFromString(glmTemp);


            dlnTemp = settings.ReadString("General", "DefaultLoadout", "Loadout1");
            dlcTemp = settings.ReadString("General", dlnTemp, "Loadout1");
            Global.Application.DefaultLoadout = new LoadoutData(dlnTemp, dlcTemp);
            Global.Application.LoadoutCount   = settings.ReadInt32("MultiLoadout", "LoadoutCount", 3);

            //Ammo Count
            Global.LoadoutAmmo.PistolAmmo     = settings.ReadInt16("Ammo", "PistolAmmo", 10000);
            Global.LoadoutAmmo.MGAmmo         = settings.ReadInt16("Ammo", "MGAmmo", 10000);
            Global.LoadoutAmmo.ShotgunAmmo    = settings.ReadInt16("Ammo", "ShotgunAmmo", 10000);
            Global.LoadoutAmmo.RifleAmmo      = settings.ReadInt16("Ammo", "RifleAmmo", 10000);
            Global.LoadoutAmmo.SniperAmmo     = settings.ReadInt16("Ammo", "SniperAmmo", 10000);
            Global.LoadoutAmmo.HeavyAmmo      = settings.ReadInt16("Ammo", "HeavyAmmo", 10000);
            Global.LoadoutAmmo.ThrowableCount = settings.ReadInt16("Ammo", "ThrowableCount", 10000);

            Logger.DebugLog("General Config Loading Finished.");
        }
Exemple #14
0
        public void ReadLegacy(string iniFile)
        {
            IsLegacy = true;

            InitializationFile ini = new InitializationFile(iniFile);

            Data = new Dictionary <string, VehicleData>();

            string[] sections = ini.GetSectionNames();
            if (sections != null)
            {
                foreach (string modelName in sections)
                {
                    float x = VehicleData.DefaultOffsetX, y = VehicleData.DefaultOffsetY, z = VehicleData.DefaultOffsetZ;
                    bool  disableTurret       = VehicleData.DefaultDisableTurret;
                    int   spotlightExtraLight = VehicleData.DefaultSpotlightExtraLight;

                    bool             success = false;
                    System.Exception exc     = null;
                    try
                    {
                        if (ini.DoesKeyExist(modelName, VehicleData.IniKeyX) &&
                            ini.DoesKeyExist(modelName, VehicleData.IniKeyY) &&
                            ini.DoesKeyExist(modelName, VehicleData.IniKeyZ))
                        {
                            x = ini.ReadSingle(modelName, VehicleData.IniKeyX, VehicleData.DefaultOffsetX);
                            y = ini.ReadSingle(modelName, VehicleData.IniKeyY, VehicleData.DefaultOffsetY);
                            z = ini.ReadSingle(modelName, VehicleData.IniKeyZ, VehicleData.DefaultOffsetZ);
                            if (ini.DoesKeyExist(modelName, VehicleData.IniKeyDisableTurret))
                            {
                                disableTurret = ini.ReadBoolean(modelName, VehicleData.IniKeyDisableTurret, VehicleData.DefaultDisableTurret);
                            }
                            if (ini.DoesKeyExist(modelName, VehicleData.IniKeySpotlightExtraLight))
                            {
                                spotlightExtraLight = ini.ReadInt32(modelName, VehicleData.IniKeySpotlightExtraLight, VehicleData.DefaultSpotlightExtraLight);
                                if (spotlightExtraLight <= VehicleData.DefaultSpotlightExtraLight || spotlightExtraLight > 4) // there's only four possible extralight_* bones
                                {
                                    spotlightExtraLight = VehicleData.DefaultSpotlightExtraLight;
                                }
                            }

                            success = true;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        exc = ex;
                    }

                    if (!success)
                    {
                        if (exc != null)
                        {
                            Game.LogTrivial($"  <WARNING> Failed to load spotlight offset position settings for vehicle model: {modelName}");
                            Game.LogTrivial($"  <WARNING> {exc}");
                        }

                        x                   = VehicleData.DefaultOffsetX;
                        y                   = VehicleData.DefaultOffsetY;
                        z                   = VehicleData.DefaultOffsetZ;
                        disableTurret       = VehicleData.DefaultDisableTurret;
                        spotlightExtraLight = VehicleData.DefaultSpotlightExtraLight;
                    }

                    Data.Add(modelName, new VehicleData(new XYZ(x, y, z), disableTurret, spotlightExtraLight));
                }
            }
        }
        public static void Initialise()
        {
            //ini stuff

            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/LSPDFR+.ini");

            ini.Create();
            try
            {
                EnhancedTrafficStop.BringUpTrafficStopMenuControllerButton = ini.ReadEnum <ControllerButtons>("General", "BringUpTrafficStopMenuControllerButton", ControllerButtons.DPadRight);
                EnhancedTrafficStop.BringUpTrafficStopMenuKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "BringUpTrafficStopMenuKey", "D7"));

                try
                {
                    stockLSPDFRIni = new InitializationFile(LSPDFRKeyIniPath);
                    string[] stockinicontents = File.ReadAllLines(LSPDFRKeyIniPath);
                    //Alternative INI reading implementation, RPH doesn't work with sectionless INIs.
                    foreach (string line in stockinicontents)
                    {
                        if (line.StartsWith("TRAFFICSTOP_INTERACT_Key="))
                        {
                            stockTrafficStopInteractKey = (Keys)kc.ConvertFromString(line.Substring(line.IndexOf('=') + 1));
                        }
                        else if (line.StartsWith("TRAFFICSTOP_INTERACT_ModifierKey"))
                        {
                            stockTrafficStopInteractModifierKey = (Keys)kc.ConvertFromString(line.Substring(line.IndexOf('=') + 1));
                        }
                        else if (line.StartsWith("TRAFFICSTOP_INTERACT_ControllerKey"))
                        {
                            stockTrafficStopInteractControllerButton = (ControllerButtons)Enum.Parse(typeof(ControllerButtons), line.Substring(line.IndexOf('=') + 1));
                        }
                        else if (line.StartsWith("TRAFFICSTOP_INTERACT_ControllerModifierKey"))
                        {
                            stockTrafficStopInteractModifierControllerButton = (ControllerButtons)Enum.Parse(typeof(ControllerButtons), line.Substring(line.IndexOf('=') + 1));
                        }
                    }
                    if ((EnhancedTrafficStop.BringUpTrafficStopMenuKey == stockTrafficStopInteractKey && stockTrafficStopInteractModifierKey == Keys.None) || (EnhancedTrafficStop.BringUpTrafficStopMenuControllerButton == stockTrafficStopInteractControllerButton && stockTrafficStopInteractModifierControllerButton == ControllerButtons.None))
                    {
                        TrafficStopMenuPopup = new Popup("LSPDFR+: Traffic Stop Menu Conflict", "Your LSPDFR+ traffic stop menu keys (plugins/lspdfr/lspdfr+.ini) are the same as the default LSPDFR traffic stop keys (lspdfr/keys.ini TRAFFICSTOP_INTERACT_Key and TRAFFICSTOP_INTERACT_ControllerKey). How would you like to solve this?",
                                                         new List <string>()
                        {
                            "Recommended: Automatically disable the default LSPDFR traffic stop menu keys (this will edit keys.ini TRAFFICSTOP_INTERACT_Key and TRAFFICSTOP_INTERACT_ControllerKey to None)", "I know what I'm doing, I will change the keys in the INIs myself!"
                        }, false, true, TrafficStopMenuCb);
                        TrafficStopMenuPopup.Display();
                    }
                }
                catch (Exception e)
                {
                    Game.LogTrivial($"Failed to determine stock LSPDFR key bind/controller button for traffic stop keys: {e}");
                }

                CourtSystem.OpenCourtMenuKey                        = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuKey", "F9"));
                CourtSystem.OpenCourtMenuModifierKey                = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuModifierKey", "None"));
                EnhancedTrafficStop.EnhancedTrafficStopsEnabled     = ini.ReadBoolean("General", "EnhancedTrafficStopsEnabled", true);
                EnhancedPursuitAI.EnhancedPursuitAIEnabled          = ini.ReadBoolean("General", "EnhancedPursuitAIEnabled", true);
                EnhancedPursuitAI.AutoPursuitBackupEnabled          = ini.ReadBoolean("General", "AutoPursuitBackupEnabled", false);
                EnhancedPursuitAI.OpenPursuitTacticsMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuKey", "Q"));
                EnhancedPursuitAI.OpenPursuitTacticsMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuModifierKey", "LShiftKey"));
                EnhancedPursuitAI.DefaultAutomaticAI                = ini.ReadBoolean("General", "DefaultAutomaticAI", true);

                Offence.maxpoints    = ini.ReadInt32("General", "MaxPoints", 12);
                Offence.pointincstep = ini.ReadInt32("General", "PointsIncrementalStep", 1);
                Offence.maxFine      = ini.ReadInt32("General", "MaxFine", 5000);

                Offence.OpenTicketMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuKey", "Q"));
                Offence.OpenTicketMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuModifierKey", "LShiftKey"));
                Offence.enablePoints = ini.ReadBoolean("General", "EnablePoints", true);

                CourtSystem.RealisticCourtDates = ini.ReadBoolean("OnlyWithoutBritishPolicingScriptInstalled", "RealisticCourtDates", true);
            }
            catch (Exception e)
            {
                Game.LogTrivial(e.ToString());
                Game.LogTrivial("Error loading LSPDFR+ INI file. Loading defaults");
                Game.DisplayNotification("~r~Error loading LSPDFR+ INI file. Loading defaults");
            }
            BetaCheck();
        }
Exemple #16
0
        private static void SetupBackgroundSettings()
        {
            RadioBackgroundTexture       = Game.CreateTextureFromFile(PathModifier + "Background" + DisplayExtension);
            MasterScalingFactor          = DisplayIni.ReadSingle("DisplayConfig", "DisplayScalingFactor", 1.0f);
            RadioBackgroundTextureWidth  = RadioBackgroundTexture.Size.Width * MasterScalingFactor;
            RadioBackgroundTextureHeight = RadioBackgroundTexture.Size.Height * MasterScalingFactor;

            UIPositions Position = DisplayIni.ReadEnum <UIPositions>("DisplayConfig", "DisplayPosition", UIPositions.BottomRight);

            if (!string.IsNullOrWhiteSpace(DisplayIni.ReadString("DisplaySpecificPositioning", "X", "")) && !string.IsNullOrWhiteSpace(DisplayIni.ReadString("DisplaySpecificPositioning", "Y", "")))
            {
                BaseX = DisplayIni.ReadInt32("DisplaySpecificPositioning", "X");
                BaseY = DisplayIni.ReadInt32("DisplaySpecificPositioning", "Y");
                Game.LogTrivial("Setting Display position to specifics: " + BaseX + ":" + BaseY);
            }
            else
            {
                switch (Position)
                {
                case UIPositions.BottomRight:
                    BaseX = Game.Resolution.Width - (Int32)RadioBackgroundTextureWidth;
                    BaseY = Game.Resolution.Height - (Int32)RadioBackgroundTextureHeight;
                    break;

                case UIPositions.BottomLeft:
                    BaseX = 0;
                    BaseY = Game.Resolution.Height - (Int32)RadioBackgroundTextureHeight;
                    break;

                case UIPositions.TopLeft:
                    BaseX = 0;
                    BaseY = 0;
                    break;

                case UIPositions.TopRight:
                    BaseX = Game.Resolution.Width - (Int32)RadioBackgroundTextureWidth;
                    BaseY = 0;
                    break;

                case UIPositions.CentreLeft:
                    BaseX = 0;
                    BaseY = Game.Resolution.Height / 2 - (Int32)RadioBackgroundTextureHeight / 2;
                    break;

                case UIPositions.CentreRight:
                    BaseX = Game.Resolution.Width - (Int32)RadioBackgroundTextureWidth;
                    BaseY = Game.Resolution.Height / 2 - (Int32)RadioBackgroundTextureHeight / 2;
                    break;

                case UIPositions.CentreBottom:
                    BaseX = Game.Resolution.Width / 2 - (Int32)RadioBackgroundTextureWidth / 2;
                    BaseY = Game.Resolution.Height - (Int32)RadioBackgroundTextureHeight;
                    break;

                case UIPositions.CentreTop:
                    BaseX = Game.Resolution.Width / 2 - (Int32)RadioBackgroundTextureWidth / 2;
                    BaseY = 0;
                    break;
                }
                Game.LogTrivial("Setting Display position to " + Position.ToString());
                Game.LogTrivial(BaseX + ":" + BaseY);
            }
        }
Exemple #17
0
        private static void ReadCfg()
        {
            Logger.LogTrivial("Reading settings from config file...");

            ToggleKey                 = mCfgFile.ReadEnum <Keys>(ECfgSections.SETTINGS.ToString(), ESettings.ToggleKey.ToString(), Keys.F8);
            ToggleKeyModifier         = mCfgFile.ReadEnum <Keys>(ECfgSections.SETTINGS.ToString(), ESettings.ToggleKeyModifier.ToString(), Keys.None);
            PlayAlertSound            = mCfgFile.ReadBoolean(ECfgSections.SETTINGS.ToString(), ESettings.PlayAlertSound.ToString(), true);
            PlayScanSound             = mCfgFile.ReadBoolean(ECfgSections.SETTINGS.ToString(), ESettings.PlayScanSound.ToString(), true);
            AutoDisableOnTrafficStops = mCfgFile.ReadBoolean(ECfgSections.SETTINGS.ToString(), ESettings.AutoDisableOnTrafficStops.ToString(), true);
            AutoDisableOnPursuits     = mCfgFile.ReadBoolean(ECfgSections.SETTINGS.ToString(), ESettings.AutoDisableOnPursuits.ToString(), true);
            //BetaKey = mCfgFile.ReadString(ECfgSections.SETTINGS.ToString(), ESettings.BetaKey.ToString(), "YourBetaKeyHere");

            Logger.LogTrivial("ToggleKey = " + ToggleKey.ToString());

            CameraDegreesFOV    = mCfgFile.ReadInt32(ECfgSections.CAMERAS.ToString(), ECameras.CameraDegreesFOV.ToString(), cCameraDegreesFOV);
            CameraRange         = (float)mCfgFile.ReadDouble(ECfgSections.CAMERAS.ToString(), ECameras.CameraRange.ToString(), cCameraRange);
            CameraMinimum       = (float)mCfgFile.ReadDouble(ECfgSections.CAMERAS.ToString(), ECameras.CameraMinimum.ToString(), (float)cCameraMinRange);
            DriverFrontAngle    = mCfgFile.ReadInt32(ECfgSections.CAMERAS.ToString(), ECameras.DriverFrontAngle.ToString(), cDriverFrontAngle);
            DriverRearAngle     = mCfgFile.ReadInt32(ECfgSections.CAMERAS.ToString(), ECameras.DriverRearAngle.ToString(), cDriverRearAngle);
            PassengerRearAngle  = mCfgFile.ReadInt32(ECfgSections.CAMERAS.ToString(), ECameras.PassengerRearAngle.ToString(), cPassengerRearAngle);
            PassengerFrontAngle = mCfgFile.ReadInt32(ECfgSections.CAMERAS.ToString(), ECameras.PassengerFrontAngle.ToString(), cPassengerFrontAngle);
            VehicleRescanBuffer = mCfgFile.ReadInt32(ECfgSections.CAMERAS.ToString(), ECameras.VehicleRescanBuffer.ToString(), cVehicleRescanBuffer);

            SecondsBetweenAlerts        = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.SecondsBetweenAlerts.ToString(), cSecondsBetweenAlerts);
            ProbabilityOfAlerts         = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.ProbabilityOfAlerts.ToString(), cProbabilityOfAlerts);
            StolenVehicleWeight         = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.StolenVehicleWeight.ToString(), cDefaultStolenVehicleWeight);
            OwnerWantedWeight           = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.OwnerWantedWeight.ToString(), cDefaultOwnerWantedWeight);
            OwnerLicenseSuspendedWeight = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.OwnerLicenseSuspendedWeight.ToString(), cDefaultOwnerLicenseSuspendedWeight);
            OwnerLicenseExpiredWeight   = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.OwnerLicenseExpiredWeight.ToString(), cDefaultOwnerLicenseExpiredWeight);
            UnregisteredVehicleWeight   = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.UnregisteredVehicleWeight.ToString(), cDefaultUnregisteredVehicleWeight);
            RegisrationExpiredWeight    = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.RegisrationExpiredWeight.ToString(), cDefaultRegisrationExpiredWeight);
            NoInsuranceWeight           = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.NoInsuranceWeight.ToString(), cDefaultNoInsuranceWeight);
            InsuranceExpiredWeight      = mCfgFile.ReadInt32(ECfgSections.ALERTS.ToString(), EAlerts.InsuranceExpiredWeight.ToString(), cDefaultInsuranceExpiredWeight);

            AdjustAlertWeights();
        }