mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-27 17:09:37 +01:00
The settings keep only the keys master reads, Vulkan left out. The standard mode is the old starter's panel; the advanced mode opens behind a warning whose yes takes a click only after 20 seconds in front of the player. - Sliders go by fixed steps (SliderRanges), held to the standard ranges there: fpslimit up to 240, sleeperdistance up to 1000 m. - On the first start everyone is moved to the standard mode once: what is outside it goes back to its default, the sliders' values to their ranges, and a copy of eu07.ini is kept as eu07.ini.before-standard. - "Restore defaults" puts every setting back, the language, the simulator, the UART port and the control keys kept. - Monitors and renderers are found anew (Monitors, Renderers), Displays and SettingReach gone. - mousescale writes its second number as the old starter did, 0.5 or -0.5 for an inverted vertical axis; an axis that would not move gets the default. - Depot, in the standard mode: no AI or drivable-only filters, empty consists not listed, the crew shown but not changed. - Randomizing the textures of a whole scenery no longer rebuilds the view per consist, and finds its candidates by mini, so the window keeps answering. - A long operator in the vehicle list is cut short instead of over the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Avalonia.Controls;
|
|
using StarterNG.Domain.Settings;
|
|
|
|
namespace StarterNG.Views;
|
|
|
|
/// <summary>
|
|
/// A slider that moves through a list of values rather than along a range: its
|
|
/// position is an index, so the values sit evenly on the track however far apart
|
|
/// they are - 30 and 144 frames alike. A value the list lacks joins it while
|
|
/// shown, so opening and saving the settings never moves it.
|
|
/// </summary>
|
|
internal sealed class SliderSteps
|
|
{
|
|
private readonly Slider _slider;
|
|
private readonly IReadOnlyList<double> _steps;
|
|
private IReadOnlyList<double> _shown;
|
|
|
|
public SliderSteps(Slider slider, IReadOnlyList<double> steps)
|
|
{
|
|
_slider = slider;
|
|
_steps = steps;
|
|
_shown = steps;
|
|
slider.Minimum = 0;
|
|
slider.TickFrequency = 1;
|
|
slider.IsSnapToTickEnabled = true;
|
|
slider.Maximum = steps.Count - 1;
|
|
}
|
|
|
|
/// <summary>A value past either end of the list is put at that end, not added to it.</summary>
|
|
public bool Clamps { get; set; }
|
|
|
|
public double Value
|
|
{
|
|
get => _shown[Math.Clamp((int)Math.Round(_slider.Value), 0, _shown.Count - 1)];
|
|
set
|
|
{
|
|
if (Clamps)
|
|
value = Math.Clamp(value, _steps.Min(), _steps.Max());
|
|
_shown = Steps.With(_steps, value);
|
|
_slider.Maximum = _shown.Count - 1;
|
|
int at = Steps.IndexOf(_shown, value);
|
|
_slider.Value = at;
|
|
}
|
|
}
|
|
}
|