Icon culling hides car icons when zoomed out past a configurable threshold (default 40%), keeping only locomotive icons visible. Locos scale up automatically when culling is active (configurable boost). An option also hides MU trailing units. All managed by the new MapIconCuller class with smooth fade transitions. EOTD (End-of-Train Device): a blinking red dot at the rear of each consist. Shown by default when car icons are hidden. Dot size and visibility conditions are configurable. Implemented in EotdSystem as a programmatically generated circle texture to avoid asset dependencies. Added an Icons submenu to the gear menu containing all icon and EOTD settings. Controls grey out to reflect dependencies: culling sub-settings (MU hide, loco boost, EOTD) grey out when culling is off; EOTD dot size and hide-when-visible grey out when EOTD is off. Changes round-trip via UICmd events, persist to PopoutSettings, and call MapIconCuller.Refresh(). Native state is seeded from C# on window init via RRPOPOUT_SetIconCullingState. Settings completeness: added Right-click recenters toggle and Map BG opacity slider to the UMM settings panel (were only accessible from the gear menu). Replaced four FindObjectOfType<MapWindow> calls with PanelFinder.GetMapWindow(). Fixed AV false-positive on release zips: ImGui's built-in font blob contained the substring "UPX", matching the heuristic for UPX-packed binaries. Added IMGUI_DISABLE_DEFAULT_FONT to strip the blob; ProggyClean.ttf is now shipped as a separate file alongside the DLL and loaded at runtime instead.
70 lines
3.2 KiB
C#
70 lines
3.2 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace S3.Modules.Popout;
|
|
|
|
// Flat settings block for the Map Popout module (own file: S3.popout.json).
|
|
// Hotkey is stored as flat primitives rather than a UMM KeyBinding so JsonUtility
|
|
// round-trips it reliably (no nested custom-class serialization).
|
|
// customTheme is a [Serializable] struct — JsonUtility inlines value-type structs
|
|
// correctly (unlike nested classes, which Mono silently drops).
|
|
[Serializable]
|
|
public class PopoutSettings
|
|
{
|
|
public bool enabled = false;
|
|
|
|
// UMM modifier bitmask: 1=Shift, 2=Ctrl, 4=Alt. Default: F9, no modifier.
|
|
public int hotkeyModifiers = 0;
|
|
public int hotkeyKeyCode = (int)KeyCode.F9;
|
|
|
|
// When true, dragging the map cancels follow modes (MapEnhancer follow +
|
|
// follow-player) so the drag takes over — like grab-to-pan in Google Maps.
|
|
public bool panDisablesFollow = true;
|
|
|
|
// Active theme index (0-4 = named preset, 5 = Custom).
|
|
// See MapTheme enum in MapThemes.cs.
|
|
public int mapTheme = 0;
|
|
|
|
// In-game overlay chrome (window + toolbar + compass) alpha [0.1, 1.0].
|
|
public float overlayAlpha = 1.0f;
|
|
|
|
// In-game overlay map image alpha [0.0, 1.0]. Independent of chrome alpha.
|
|
public float overlayMapAlpha = 1.0f;
|
|
|
|
// Map camera clear-colour opacity [0.0, 1.0]. At 0 the void/sky areas of the
|
|
// map are transparent, letting the game world show through in empty regions.
|
|
public float overlayMapBgAlpha = 1.0f;
|
|
|
|
// When true, right-clicking anywhere on the map image recenters on the player.
|
|
public bool rightClickRecenter = true;
|
|
|
|
// --- Icon culling ---
|
|
// When the map is zoomed out past iconCullingThreshold (NormalizedScale 0=close, 1=far),
|
|
// non-locomotive car icons are hidden to reduce Canvas draw calls.
|
|
public bool iconCullingEnabled = true;
|
|
public float iconCullingThreshold = 0.40f;
|
|
// When culling is active, hide MU trailing units (locos with another loco on their A-end).
|
|
public bool hideMuLocos = true;
|
|
// Scale multiplier applied to visible loco icons when culling is active.
|
|
public float locoBoostedScale = 1.5f;
|
|
// Show a blinking red dot on the map at the rear end of each train (EOTD).
|
|
public bool eotdEnabled = true;
|
|
// Hide the EOTD when car icons are visible (i.e. zoom is inside the cull threshold).
|
|
public bool eotdOnlyWhenCulled = true;
|
|
// Dot size: 1 (tiny) to 10 (large). Applied as orthographicSize * value * 0.002.
|
|
public float eotdSizeScale = 8f;
|
|
|
|
// Custom theme colors — edited live in the Settings color picker.
|
|
// Initialized to S3 Dark so first-launch looks reasonable before the user tunes it.
|
|
public MapThemeData customTheme = new MapThemeData {
|
|
wBgR=0.12f, wBgG=0.12f, wBgB=0.12f, wBgA=1.00f,
|
|
accR=0.26f, accG=0.59f, accB=0.98f, accA=1.00f,
|
|
txtR=1.00f, txtG=1.00f, txtB=1.00f, txtA=1.00f,
|
|
popR=0.08f, popG=0.08f, popB=0.08f, popA=0.94f,
|
|
mapR=1.00f, mapG=1.00f, mapB=1.00f, mapA=1.00f,
|
|
cmpR=0.086f,cmpG=0.086f,cmpB=0.086f,cmpA=0.784f,
|
|
nNR=0.804f, nNG=0.196f, nNB=0.196f, nNA=1.00f,
|
|
nSR=0.804f, nSG=0.804f, nSB=0.804f, nSA=0.863f,
|
|
mapBgR=0.082f,mapBgG=0.122f,mapBgB=0.157f,mapBgA=1.00f,
|
|
};
|
|
}
|