Exemple #1
0
        public override void OnUpdate(float realTimeDelta, float simulationTimeDelta)
        {
            var control = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl));

            if (control && Input.GetKey(KeyCode.Period))
            {
                if (_processed)
                {
                    return;
                }

                if (TrueLodTogglerMod.Mode != LodTogglerMode.Normal)
                {
                    TrueLodTogglerMod.Mode = LodTogglerMode.Normal;
                }
                else if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
                {
                    TrueLodTogglerMod.Mode = LodTogglerMode.Lod;
                }
                else if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                {
                    TrueLodTogglerMod.Mode = LodTogglerMode.Vanilla;
                }
                else
                {
                    TrueLodTogglerMod.Mode = LodTogglerMode.Max;
                }

                LodUpdater.UpdateTrees();
                LodUpdater.UpdateProps();
                LodUpdater.UpdateBuildings();
                LodUpdater.UpdateNetworks();
                LodUpdater.UpdateVehicles();
                LodUpdater.UpdateShadowDistance();

                TrueLodTogglerMod.UpdateFreeCameraButton();

                _processed = true;
            }
            else
            {
                // not both keys pressed: Reset processed state
                _processed = false;
            }
        }
Exemple #2
0
 public override void OnLevelLoaded(LoadMode mode)
 {
     base.OnLevelLoaded(mode);
     TrueLodTogglerMod.UpdateFreeCameraButton();
     LodUpdater.UpdateShadowDistance();
 }
Exemple #3
0
        public static void OnSettingsUI(UIHelperBase helper)
        {
            var config = Configuration <TrueLodTogglerConfiguration> .Load();

            if (RenderManager.LevelOfDetailFactor < 1.4)
            {
                helper.AddGroup("Warning: Set your 'Level Of Detail' graphics option to 'Very High' for good results!");
            }

            var group = helper.AddGroup("Ultimate Level Of Detail");

            var treeLodDistanceOptions = new LodDropdownOption[]
            {
                new LodDropdownOption("1m :P", 1f),
                new LodDropdownOption("50m", 50f),
                new LodDropdownOption("100m", 100f),
                new LodDropdownOption("200m", 200f),
                new LodDropdownOption("300m", 300f),
                new LodDropdownOption("425m (Game Default)", 425f),
                new LodDropdownOption("500m", 500f),
                new LodDropdownOption("625m", 625f),
                new LodDropdownOption("750m", 750f),
                new LodDropdownOption("875m", 875f),
                new LodDropdownOption("1000m", 1000f),
                new LodDropdownOption("1250m", 1250f),
                new LodDropdownOption("1500m", 1500f),
                new LodDropdownOption("2000m", 2000f),
                new LodDropdownOption("3000m", 3000f),
                new LodDropdownOption("4000m", 4000f),
                new LodDropdownOption("5000m", 5000f),
                new LodDropdownOption("10000m (Good luck!)", 10000f),
                new LodDropdownOption("100000m (Goodbye!)", 100000f),
            };

            group.AddDropdown(
                "Tree LOD Distance",
                LodDropdownOption.BuildLabels(treeLodDistanceOptions),
                LodDropdownOption.FindIndex(treeLodDistanceOptions, config.TreeLodDistance),
                sel =>
            {
                // Change config value and save config
                config.TreeLodDistance = treeLodDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateTrees();
            });

            var lodDistanceOptions = new LodDropdownOption[]
            {
                new LodDropdownOption("1m :P", 1f),
                new LodDropdownOption("50m", 50f),
                new LodDropdownOption("100m", 100f),
                new LodDropdownOption("200m", 200f),
                new LodDropdownOption("300m", 300f),
                new LodDropdownOption("400m", 400f),
                new LodDropdownOption("500m", 500f),
                new LodDropdownOption("750m", 750f),
                new LodDropdownOption("1000m (Game Default)", 1000f),
                new LodDropdownOption("1125m", 1125f),
                new LodDropdownOption("1250m", 1250f),
                new LodDropdownOption("1500m", 1500f),
                new LodDropdownOption("1750m", 1750f),
                new LodDropdownOption("2000m", 2000f),
                new LodDropdownOption("3000m", 3000f),
                new LodDropdownOption("4000m", 4000f),
                new LodDropdownOption("5000m", 5000f),
                new LodDropdownOption("10000m (Good luck!)", 10000f),
                new LodDropdownOption("100000m (Goodbye!)", 100000f),
            };

            group.AddDropdown(
                "Prop LOD Distance",
                LodDropdownOption.BuildLabels(lodDistanceOptions),
                LodDropdownOption.FindIndex(lodDistanceOptions, config.PropLodDistance),
                sel =>
            {
                // Change config value and save config
                config.PropLodDistance = lodDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateProps();
            });

            var decalFadeDistanceOptions = new LodDropdownOption[]
            {
                new LodDropdownOption("1m :P", 1f),
                new LodDropdownOption("50m", 50f),
                new LodDropdownOption("100m", 100f),
                new LodDropdownOption("200m", 200f),
                new LodDropdownOption("300m", 300f),
                new LodDropdownOption("400m", 400f),
                new LodDropdownOption("500m", 500f),
                new LodDropdownOption("750m", 750f),
                new LodDropdownOption("1000m (Game Default)", 1000f),
                new LodDropdownOption("1250m", 1250f),
                new LodDropdownOption("1500m", 1500f),
                new LodDropdownOption("1750m", 1750f),
                new LodDropdownOption("2000m", 2000f),
                new LodDropdownOption("3000m", 3000f),
                new LodDropdownOption("4000m", 4000f),
                new LodDropdownOption("5000m", 5000f),
                new LodDropdownOption("10000m", 10000f),
                new LodDropdownOption("15000m", 15000f),
                new LodDropdownOption("20000m", 20000f),
                new LodDropdownOption("25000m", 25000f),
                new LodDropdownOption("100000m (Goodbye!)", 100000f),
            };

            group.AddDropdown(
                "Decal Prop Fade Distance",
                LodDropdownOption.BuildLabels(decalFadeDistanceOptions),
                LodDropdownOption.FindIndex(decalFadeDistanceOptions, config.DecalPropFadeDistance),
                sel =>
            {
                // Change config value and save config
                config.DecalPropFadeDistance = decalFadeDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateProps();
            });

            group.AddDropdown(
                "Building LOD Distance",
                LodDropdownOption.BuildLabels(lodDistanceOptions),
                LodDropdownOption.FindIndex(lodDistanceOptions, config.BuildingLodDistance),
                sel =>
            {
                // Change config value and save config
                config.BuildingLodDistance = lodDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateBuildings();
            });

            group.AddDropdown(
                "Network LOD Distance",
                LodDropdownOption.BuildLabels(lodDistanceOptions),
                LodDropdownOption.FindIndex(lodDistanceOptions, config.NetworkLodDistance),
                sel =>
            {
                // Change config value and save config
                config.NetworkLodDistance = lodDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateNetworks();
            });

            var vehicleLodDistanceOptions = new LodDropdownOption[]
            {
                new LodDropdownOption("1m :P", 1f),
                new LodDropdownOption("50m", 50f),
                new LodDropdownOption("100m", 100f),
                new LodDropdownOption("200m", 200f),
                new LodDropdownOption("300m", 300f),
                new LodDropdownOption("400m (Game Default)", 400f),
                new LodDropdownOption("500m", 500f),
                new LodDropdownOption("625m", 625f),
                new LodDropdownOption("750m", 750f),
                new LodDropdownOption("875m", 875f),
                new LodDropdownOption("1000m", 1000f),
                new LodDropdownOption("1250m", 1250f),
                new LodDropdownOption("1500m", 1500f),
                new LodDropdownOption("2000m", 2000f),
                new LodDropdownOption("3000m", 3000f),
                new LodDropdownOption("4000m", 4000f),
                new LodDropdownOption("5000m", 5000f),
                new LodDropdownOption("10000m (Good luck!)", 10000f),
                new LodDropdownOption("100000m (Goodbye!)", 100000f),
            };

            group.AddDropdown(
                "Vehicle LOD Distance",
                LodDropdownOption.BuildLabels(vehicleLodDistanceOptions),
                LodDropdownOption.FindIndex(vehicleLodDistanceOptions, config.VehicleLodDistance),
                sel => {
                // Change config value and save config
                config.VehicleLodDistance = vehicleLodDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateVehicles();
            });

            var vehicleRenderDistanceOptions = new LodDropdownOption[]
            {
                new LodDropdownOption("1m :P", 1f),
                new LodDropdownOption("50m", 50f),
                new LodDropdownOption("100m", 100f),
                new LodDropdownOption("250m", 250f),
                new LodDropdownOption("500m", 500f),
                new LodDropdownOption("750m", 750f),
                new LodDropdownOption("1000m", 1000f),
                new LodDropdownOption("1250m", 1250f),
                new LodDropdownOption("1500m", 1500f),
                new LodDropdownOption("2000m (Game Default)", 2000f),
                new LodDropdownOption("2500m", 2500f),
                new LodDropdownOption("3000m", 3000f),
                new LodDropdownOption("4000m", 4000f),
                new LodDropdownOption("5000m", 5000f),
                new LodDropdownOption("6000m", 6000f),
                new LodDropdownOption("10000m", 10000f),
                new LodDropdownOption("15000m", 15000f),
                new LodDropdownOption("20000m", 20000f),
                new LodDropdownOption("25000m (Good luck!)", 25000f),
                new LodDropdownOption("100000m (Goodbye!)", 100000f),
            };

            group.AddDropdown(
                "Vehicle Render Distance",
                LodDropdownOption.BuildLabels(vehicleRenderDistanceOptions),
                LodDropdownOption.FindIndex(vehicleRenderDistanceOptions, config.VehicleRenderDistance),
                sel => {
                // Change config value and save config
                config.VehicleRenderDistance = vehicleRenderDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateVehicles();
            });

            var shadowDistanceOptions = new LodDropdownOption[]
            {
                new LodDropdownOption("1m :P", 1f),
                new LodDropdownOption("50m", 50f),
                new LodDropdownOption("100m", 100f),
                new LodDropdownOption("250m", 250f),
                new LodDropdownOption("500m", 500f),
                new LodDropdownOption("750m", 750f),
                new LodDropdownOption("1000m", 1000f),
                new LodDropdownOption("1250m", 1250f),
                new LodDropdownOption("1500m", 1500f),
                new LodDropdownOption("2000m", 2000f),
                new LodDropdownOption("2500m", 2500f),
                new LodDropdownOption("3000m", 3000f),
                new LodDropdownOption("4000m (Game Default)", 4000f),
                new LodDropdownOption("5000m", 5000f),
                new LodDropdownOption("6000m", 6000f),
                new LodDropdownOption("10000m", 10000f),
                new LodDropdownOption("15000m", 15000f),
                new LodDropdownOption("20000m", 20000f),
                new LodDropdownOption("25000m (Good luck!)", 25000f),
                new LodDropdownOption("100000m (Goodbye!)", 100000f),
            };

            group.AddDropdown(
                "Shadow Distance",
                LodDropdownOption.BuildLabels(shadowDistanceOptions),
                LodDropdownOption.FindIndex(shadowDistanceOptions, config.ShadowDistance),
                sel => {
                // Change config value and save config
                config.ShadowDistance = shadowDistanceOptions[sel].Value;
                Configuration <TrueLodTogglerConfiguration> .Save();
                LodUpdater.UpdateShadowDistance();
            });

            group.AddCheckbox("Disable on startup (press CTRL + SHIFT + [.] to enable)", config.VanillaModeOnStartup, sel =>
            {
                config.VanillaModeOnStartup = sel;
                Configuration <TrueLodTogglerConfiguration> .Save();
            });

            group.AddCheckbox("Display current ULOD mode in Free Camera Button", config.FreeCameraButtonDisplay, sel =>
            {
                config.FreeCameraButtonDisplay = sel;
                Configuration <TrueLodTogglerConfiguration> .Save();
                TrueLodTogglerMod.UpdateFreeCameraButton();
            });
        }