Decompiled source of OnTogether Day and Night v1.0.2

BepInEx/plugins/On-Together_Day_and_Night/On-Together_Day_and_Night.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace OnTogetherDayAndNight;

[BepInPlugin("cn.ontogether.dayandnight", "On-Together: Day and Night", "1.0.1.10")]
public sealed class DayAndNightPlugin : BaseUnityPlugin
{
	private sealed class CameraSkyboxState
	{
		public Skybox Skybox;

		public Material OriginalMaterial;
	}

	private sealed class ShadowRendererState
	{
		public Renderer Renderer;

		public ShadowCastingMode OriginalMode;

		public bool OriginalReceiveShadows;
	}

	private sealed class SpecialLocalLight
	{
		public float DayIntensity;

		public float NightIntensity;

		public bool ReserveBudget;
	}

	private sealed class CampfireEmissionState
	{
		public GameObject Overlay;

		public Material[] Materials;

		public bool[] Visible;
	}

	private sealed class DeviceScreenState
	{
		public Renderer Source;

		public Renderer OverlayRenderer;

		public GameObject Overlay;

		public Material[] Materials;

		public Light Light;

		public bool HasScreenAnchor;

		public Vector3 ScreenLocalCenter;

		public Vector3 ScreenLocalNormal;

		public bool IsGameConsole;

		public Color DisplayColor;

		public Color TargetDisplayColor;

		public float NextDisplayChangeAt;
	}

	private sealed class SeasonRecolor
	{
		public readonly string Material;

		public readonly string[] Properties;

		public readonly float Hue;

		public readonly float SaturationScale;

		public readonly float ValueScale;

		public readonly bool Ground;

		public readonly bool Absolute;

		public readonly Color Target;

		public SeasonRecolor(string material, string properties, float hue, float saturationScale, float valueScale, bool ground)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			Material = material;
			Properties = properties.Split(new char[1] { ',' });
			Hue = hue;
			SaturationScale = saturationScale;
			ValueScale = valueScale;
			Ground = ground;
			Absolute = false;
			Target = Color.white;
		}

		public SeasonRecolor(string material, string properties, Color target, bool ground)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Material = material;
			Properties = properties.Split(new char[1] { ',' });
			Hue = 0f;
			SaturationScale = 1f;
			ValueScale = 1f;
			Ground = ground;
			Absolute = true;
			Target = target;
		}
	}

	private sealed class CanopyCluster
	{
		public Vector3 Centre;

		public float Radius;

		public float BottomY;

		public float TopY;

		public int Palette;

		public int Members;
	}

	private sealed class SeasonMaterialState
	{
		public Material Material;

		public int[] PropertyIds;

		public string[] PropertyNames;

		public Color[] Originals;
	}

	private sealed class SeasonCanopyState
	{
		public BushInstancing Batch;

		public Vector4[] OriginalColor1;

		public Vector4[] OriginalColor2;

		public float[] OriginalThreshold1;

		public int[] Cluster;
	}

	private sealed class LeafEmitterState
	{
		public ParticleSystem System;

		public ParticleSystemRenderer Renderer;

		public Material OriginalMaterial;

		public float OriginalRate;

		public bool OriginalSheetEnabled;

		public ParticleSystemAnimationMode OriginalSheetMode;

		public int OriginalTilesX;

		public int OriginalTilesY;

		public ParticleSystemAnimationType OriginalAnimation;

		public MinMaxCurve OriginalFrameOverTime;

		public MinMaxCurve OriginalStartFrame;

		public int OriginalCycleCount;

		public float OriginalShapeRadius;

		public bool ShapeAdjusted;

		public bool OriginalExternalForces;

		public bool OriginalVelocityEnabled;

		public ParticleSystemSimulationSpace OriginalVelocitySpace;

		public MinMaxCurve OriginalVelocityX;

		public MinMaxCurve OriginalVelocityY;

		public MinMaxCurve OriginalVelocityZ;

		public bool NoiseCaptured;

		public bool NoiseBoosted;

		public bool OriginalNoiseEnabled;

		public float OriginalNoiseStrength;

		public float OriginalNoiseFrequency;

		public bool Cloned;

		public Vector3 WindVelocity;

		public float WindSampleAt;
	}

	private sealed class CanopyShadowState
	{
		public BushInstancing Batch;

		public ShadowCastingMode OriginalMode;

		public bool Captured;
	}

	private sealed class WindMaterial
	{
		public Material Material;

		public float Original;

		public string SpeedProperty;

		public float OriginalSpeed;
	}

	private struct LeafLampSample
	{
		public Vector3 Position;

		public Vector3 Forward;

		public Color Radiance;

		public float Range;

		public float SpotEdge;
	}

	private sealed class GroundLeaf
	{
		public Vector3 Position;

		public Vector3 Right;

		public Vector3 Forward;

		public Vector3 Normal;

		public int Frame;

		public float BornAt;

		public Color Illumination;

		public float LiftedAt = -1f;

		public Vector3 Velocity;

		public Vector3 Drift;

		public float Spin;

		public float DriftFactor;

		public bool OnWater;

		public float BobPhase;

		public Vector3 WaterTarget;

		public float NextWaterStep;

		public float FlowSpeed = 0.6f;

		public float StepSpeed = 0.6f;

		public float Lane;

		public float WanderAngle;

		public float WanderTurn;

		public int WaterBody = -1;

		public bool InCurrent;

		public float StillExpiry = -1f;

		public Vector3 StuckAt;

		public float StuckSince;

		public bool InWaterfall;

		public int WaterfallSegment = -1;

		public float WaterfallAlong;

		public float WaterfallOffset;

		public Transform WaterfallTransform;
	}

	private sealed class WaterMaterial
	{
		public Material Material;

		public int[] PropertyIds;

		public string[] PropertyNames;

		public Color[] Originals;

		public Color[] DrivenColors;

		public bool HasReflectionStrength;

		public float OriginalReflectionStrength;

		public bool IsWaterfall;

		public bool IsOpenWater;

		public float[] SkyMirrorWeights;
	}

	private sealed class WaterParticleState
	{
		public ParticleSystem System;

		public MinMaxGradient OriginalStartColor;
	}

	private sealed class FaceInstanceInfo
	{
		public Material Instance;

		public Color BaseColor;

		public int TintProperty;

		public bool HasSourceTint;

		public int SourceTintProperty;

		public Color LastSourceTint;

		public bool HasSourceTexture;

		public int SourceTextureProperty;

		public int InstanceTextureProperty;

		public Texture LastSourceTexture;
	}

	private sealed class NativeFeatureMaterial
	{
		public int Slot;

		public Material Original;

		public Material Instance;

		public Color BaseColor;

		public int TintProperty;

		public FaceInstanceInfo Info;

		public bool InPlace;

		public bool HasWritten;

		public Color LastWritten;

		public string TextureProperty;

		public Texture SourceTexture;

		public Texture2D DimTexture;

		public Color32[] SourcePixels;

		public Color32[] Scratch;

		public int Bucket;
	}

	private sealed class NativeFeatureRenderer
	{
		public Renderer Renderer;

		public Material[] Assigned;

		public readonly List<NativeFeatureMaterial> Materials = new List<NativeFeatureMaterial>();

		public readonly Dictionary<int, FaceInstanceInfo> Instances = new Dictionary<int, FaceInstanceInfo>();

		public readonly Dictionary<int, FaceInstanceInfo> ByInstance = new Dictionary<int, FaceInstanceInfo>();

		public readonly Dictionary<int, NativeFeatureMaterial> InPlaceEntries = new Dictionary<int, NativeFeatureMaterial>();

		public readonly List<Material> Owned = new List<Material>();

		public float Brightness = -1f;

		public float SmoothedBrightness = -1f;

		public int ConsecutiveReassigns;

		public bool Abandoned;
	}

	private sealed class HiddenCloudRendererState
	{
		public Renderer Renderer;

		public bool OriginalForceRenderingOff;

		public bool OriginalEnabled;
	}

	private sealed class HiddenWorldCloudRootState
	{
		public GameObject Root;

		public bool OriginalActive;
	}

	private sealed class CloudInstancingState
	{
		public CloudInstancing Instancing;

		public bool OriginalEnabled;
	}

	private sealed class ToonMaterial
	{
		public Material Material;

		public bool HadSystemShadows;

		public float OrigSystemShadows;

		public bool HadSystemShadowLevel;

		public float OrigSystemShadowLevel;

		public bool HadBaseColorStep;

		public float OrigBaseColorStep;

		public bool HadUseBaseAs1st;

		public float OrigUseBaseAs1st;

		public bool HadUse1stAs2nd;

		public float OrigUse1stAs2nd;

		public bool PlayerShadowAdjusted;

		public bool SurfaceShadowAdjusted;

		public bool Has1st;

		public Color Orig1st;

		public bool Has2nd;

		public Color Orig2nd;
	}

	public const string PluginVersion = "1.0.1.10";

	private const float CanopyLowerScaleDark = 0.5f;

	private const float CanopyLowerScaleLight = 0.98f;

	private const float CanopyShadeLowDark = 0.58f;

	private const float CanopyShadeLowLight = 0.98f;

	private const float CanopyShadeHigh = 1.08f;

	private const float CanopyShadeJitter = 0.07f;

	private const float CanopyClusterRadius = 9f;

	private const float AutumnMaxSaturation = 0.86f;

	private const int CanopyShadowGrid = 18;

	private const float CanopyShadowVertexJitter = 0.78f;

	private const int CanopyDapplePatterns = 8;

	private const float GroundLeafViewerRange = 70f;

	private const float GroundLeafFadeSeconds = 3f;

	private const float RiverLeafReach = 4.5f;

	private const float PondLeafHalfWidth = 4f;

	private const float PondLeafBackEdge = 4f;

	private const float PondLeafLipZ = -5.78f;

	private const float PondLeafLipHalfWidth = 0.42f;

	private const int FaceBrightnessSteps = 24;

	private const int FaceDecalMaxSize = 256;

	private const string FaceInstanceSuffix = " (DayNight Facial Light)";

	private const float CloudFieldRadius = 210f;

	private const int LeafTileSize = 128;

	private const float ClonedLeafBaseRate = 0.4f;

	private const float LeafTileDarken = 0.92f;

	private const int GlitterRings = 26;

	private const int GlitterColumns = 5;

	private ConfigEntry<bool> _gradingEnabled;

	private ConfigEntry<float> _temperature;

	private ConfigEntry<float> _tint;

	private ConfigEntry<float> _postExposure;

	private ConfigEntry<float> _contrast;

	private ConfigEntry<float> _saturation;

	private ConfigEntry<Color> _dayColorFilter;

	private ConfigEntry<float> _shadowCooling;

	private ConfigEntry<string> _tonemapping;

	private ConfigEntry<bool> _disableFilmGrain;

	private ConfigEntry<bool> _disableDepthOfField;

	private ConfigEntry<bool> _disableMotionBlur;

	private ConfigEntry<bool> _disableBloom;

	private ConfigEntry<bool> _disableVignette;

	private ConfigEntry<bool> _neutralizeSplitToning;

	private ConfigEntry<bool> _adjustSun;

	private ConfigEntry<float> _sunElevation;

	private ConfigEntry<float> _sunAzimuth;

	private ConfigEntry<float> _sunIntensity;

	private ConfigEntry<float> _sunShadowStrength;

	private ConfigEntry<float> _sunNeutralize;

	private ConfigEntry<bool> _forceShadowCasting;

	private ConfigEntry<bool> _restoreTreeShadows;

	private ConfigEntry<bool> _hardShadows;

	private ConfigEntry<int> _shadowMapResolution;

	private ConfigEntry<int> _shadowCascadeCount;

	private ConfigEntry<bool> _stabilizeShadowEdges;

	private ConfigEntry<bool> _dappledCanopyShadows;

	private ConfigEntry<float> _canopyShadowGaps;

	private ConfigEntry<string> _seasonTheme;

	private ConfigEntry<float> _autumnStrength;

	private ConfigEntry<bool> _autumnGroundRecolor;

	private ConfigEntry<float> _canopyShading;

	private ConfigEntry<float> _canopyShadeBrightness;

	private ConfigEntry<float> _autumnWarmFilter;

	private ConfigEntry<float> _leafFallRate;

	private ConfigEntry<int> _leafFallTrees;

	private ConfigEntry<int> _groundLeafLimit;

	private ConfigEntry<float> _groundLeafLifetime;

	private ConfigEntry<float> _autumnWaterTint;

	private ConfigEntry<float> _autumnSunElevation;

	private ConfigEntry<bool> _harvestMoon;

	private ConfigEntry<bool> _leavesOnWater;

	private ConfigEntry<bool> _halloweenStringLights;

	private ConfigEntry<bool> _dayCycleEnabled;

	private ConfigEntry<float> _cycleMinutes;

	private ConfigEntry<float> _noonMinute;

	private ConfigEntry<float> _maxElevation;

	private ConfigEntry<float> _nightBrightness;

	private ConfigEntry<float> _minimumNightLight;

	private ConfigEntry<float> _nightExposureDip;

	private ConfigEntry<float> _shadowDistance;

	private ConfigEntry<bool> _lampsEnabled;

	private ConfigEntry<string> _lampStyle;

	private ConfigEntry<string> _lampKeywords;

	private ConfigEntry<int> _maxLitLamps;

	private ConfigEntry<float> _lampRange;

	private ConfigEntry<float> _lampIntensity;

	private ConfigEntry<float> _haloSize;

	private ConfigEntry<bool> _deckStringLightsEnabled;

	private ConfigEntry<float> _deckStringLightRange;

	private ConfigEntry<float> _deckStringLightIntensity;

	private ConfigEntry<float> _deckStringColorCycleSeconds;

	private ConfigEntry<float> _deskLampRange;

	private ConfigEntry<float> _deskLampIntensity;

	private ConfigEntry<bool> _campfireLightsEnabled;

	private ConfigEntry<bool> _treeLanternLightsEnabled;

	private ConfigEntry<bool> _playTowerSunLightEnabled;

	private ConfigEntry<bool> _deviceScreensGlow;

	private ConfigEntry<bool> _waterDaylight;

	private ConfigEntry<float> _nightWaterBrightness;

	private ConfigEntry<Color> _dayWaterPatternColor;

	private ConfigEntry<Color> _nightWaterPatternColor;

	private ConfigEntry<float> _waterWaveBrightness;

	private ConfigEntry<float> _nightWaterfallFoamBrightness;

	private ConfigEntry<float> _seaSkyReflection;

	private ConfigEntry<float> _twilightSeaBrightness;

	private ConfigEntry<bool> _sunGlitterEnabled;

	private ConfigEntry<float> _sunGlitterStrength;

	private ConfigEntry<float> _sunGlitterCoverage;

	private ConfigEntry<float> _sunGlitterSpread;

	private ConfigEntry<bool> _waterShadowOverlayEnabled;

	private ConfigEntry<float> _waterShadowOverlayStrength;

	private ConfigEntry<bool> _toonShading;

	private ConfigEntry<float> _shadeDarkness;

	private ConfigEntry<float> _surfaceShadeStep;

	private ConfigEntry<float> _surfaceNoonShadeStep;

	private ConfigEntry<float> _surfaceSystemShadowLevel;

	private ConfigEntry<float> _playerShadeDarkness;

	private ConfigEntry<float> _playerSystemShadowLevel;

	private ConfigEntry<float> _playerShadeStep;

	private ConfigEntry<bool> _replaceSkybox;

	private ConfigEntry<float> _atmosphereThickness;

	private ConfigEntry<float> _skyExposure;

	private ConfigEntry<float> _sunSize;

	private ConfigEntry<Color> _skyTint;

	private ConfigEntry<Color> _groundColor;

	private ConfigEntry<bool> _moonEnabled;

	private ConfigEntry<float> _lunarCycleDays;

	private ConfigEntry<float> _newMoonBrightness;

	private ConfigEntry<float> _moonSize;

	private ConfigEntry<Color> _moonColor;

	private ConfigEntry<bool> _sunsetGlowEnabled;

	private ConfigEntry<float> _sunsetGlowStrength;

	private ConfigEntry<bool> _freezeTime;

	private ConfigEntry<float> _frozenHour;

	private ConfigEntry<int> _twilightVariantOverride;

	private float _lastCyclePhase;

	private int _lastVariantOverride = -1;

	private ConfigEntry<float> _pinkDuskChance;

	private ConfigEntry<float> _redDuskChance;

	private ConfigEntry<float> _twilightWorldTint;

	private ConfigEntry<float> _twilightWidth;

	private ConfigEntry<float> _twilightFalloff;

	private ConfigEntry<bool> _starsEnabled;

	private ConfigEntry<int> _starCount;

	private ConfigEntry<float> _meteorChance;

	private ConfigEntry<bool> _cloudsEnabled;

	private ConfigEntry<int> _cloudCount;

	private ConfigEntry<bool> _cloudShadows;

	private ConfigEntry<float> _cloudSpeed;

	private ConfigEntry<float> _cloudDirection;

	private ConfigEntry<float> _cloudAltitude;

	private ConfigEntry<float> _cloudScale;

	private ConfigEntry<bool> _hideVanillaClouds;

	private ConfigEntry<bool> _weatherEnabled;

	private ConfigEntry<bool> _randomRain;

	private ConfigEntry<bool> _alwaysRain;

	private ConfigEntry<float> _rainChance;

	private ConfigEntry<string> _rainToggleKey;

	private ConfigEntry<float> _rainMinutesMin;

	private ConfigEntry<float> _rainMinutesMax;

	private ConfigEntry<float> _weatherTransitionSeconds;

	private ConfigEntry<float> _rainLightMultiplier;

	private ConfigEntry<float> _rainExposureDip;

	private ConfigEntry<float> _rainAudioVolume;

	private ConfigEntry<float> _thunderChancePerMinute;

	private ConfigEntry<float> _rainDropSize;

	private ConfigEntry<float> _rainDensity;

	private ConfigEntry<bool> _gustsEnabled;

	private ConfigEntry<float> _gustInterval;

	private ConfigEntry<float> _gustStrengthScale;

	private ConfigEntry<bool> _decorDimming;

	private ConfigEntry<float> _nightDecorBrightness;

	private ConfigEntry<string> _decorExcludeKeywords;

	private ConfigEntry<float> _ambientCoolShift;

	private ConfigEntry<float> _ambientIntensity;

	private ConfigEntry<bool> _natureAmbienceEnabled;

	private ConfigEntry<float> _noonCicadaVolume;

	private ConfigEntry<float> _nightNatureVolume;

	private ConfigEntry<float> _natureFadeSeconds;

	private ConfigEntry<float> _rainNatureMultiplier;

	private ConfigEntry<float> _leafStepVolume;

	private ConfigEntry<float> _windVolume;

	private ConfigEntry<float> _crowVolume;

	private ConfigEntry<float> _crowCallsPerMinute;

	private ConfigEntry<bool> _leafStepPuffs;

	private ConfigEntry<bool> _configMenuEnabled;

	private ConfigEntry<string> _configMenuKey;

	private ConfigEntry<string> _configMenuLanguage;

	private ConfigEntry<int> _configRevision;

	private GameObject _volumeObject;

	private Volume _volume;

	private VolumeProfile _profile;

	private Material _skyMaterial;

	private Material _originalSkybox;

	private bool _skyApplied;

	private bool _skyRuntimeEnabled;

	private GameObject _moonObject;

	private Material _moonMaterial;

	private Texture2D _moonTexture;

	private Mesh _moonMesh;

	private float _moonPhase;

	private float _moonIllumination = 1f;

	private float _lastMoonTexturePhase = -10f;

	private float _nextMoonPhaseUpdate;

	private bool _ambientCaptured;

	private AmbientMode _origAmbientMode;

	private Color _origAmbientLight;

	private Color _origAmbientSky;

	private Color _origAmbientEquator;

	private Color _origAmbientGround;

	private float _origAmbientIntensity;

	private Coroutine _applyRoutine;

	private Light _sunLight;

	private bool _sunCaptured;

	private Quaternion _origSunRotation;

	private Color _origSunColor;

	private float _origSunIntensity;

	private float _origSunShadowStrength;

	private int _postForcedCount;

	private int _skyboxForcedCount;

	private int _cameraSkyboxForcedCount;

	private float _nextPostCheck;

	private float _nextDayCycleUpdate;

	private Camera _worldCamera;

	private static readonly FieldInfo ProfilePhotoCameraField = typeof(PhotoController).GetField("_photoCamera", BindingFlags.Instance | BindingFlags.NonPublic);

	private Camera _profilePhotoCamera;

	private bool _profilePhotoLookupAttempted;

	private Camera _neutralPhotoRenderCamera;

	private bool _neutralPhotoVolumeEnabled;

	private Quaternion _neutralPhotoSunRotation;

	private Color _neutralPhotoSunColor;

	private float _neutralPhotoSunIntensity;

	private float _neutralPhotoSunShadowStrength;

	private Color _neutralPhotoAmbientLight;

	private Color _neutralPhotoAmbientSky;

	private Color _neutralPhotoAmbientEquator;

	private Color _neutralPhotoAmbientGround;

	private float _neutralPhotoAmbientIntensity;

	private float _neutralPhotoReflectionIntensity;

	private readonly Dictionary<int, CameraSkyboxState> _cameraSkyboxStates = new Dictionary<int, CameraSkyboxState>();

	private readonly Dictionary<int, ShadowRendererState> _shadowRendererStates = new Dictionary<int, ShadowRendererState>();

	private LightShadows _origSunShadows;

	private float _nextGiUpdate;

	private float _nextShadowRescan;

	private float _nextPlayerShadowRefresh;

	private float _nextSceneFeatureLampRescan;

	private bool _playerDiagnosticsWritten;

	private ColorAdjustments _colorAdjustments;

	private bool _colorGradingModeCaptured;

	private ColorGradingMode _originalColorGradingMode;

	private readonly List<Light> _lampLights = new List<Light>();

	private readonly List<GameObject> _lampHolders = new List<GameObject>();

	private readonly List<Transform> _lampHalos = new List<Transform>();

	private readonly Dictionary<Light, float> _deckStringLightHues = new Dictionary<Light, float>();

	private readonly Dictionary<Renderer, float> _deckStringHaloHues = new Dictionary<Renderer, float>();

	private readonly Dictionary<Light, SpecialLocalLight> _specialLocalLights = new Dictionary<Light, SpecialLocalLight>();

	private readonly List<CampfireEmissionState> _campfireEmissionStates = new List<CampfireEmissionState>();

	private readonly List<DeviceScreenState> _deviceScreenStates = new List<DeviceScreenState>();

	private static readonly Color[] DeckStringPastelColors = (Color[])(object)new Color[6]
	{
		new Color(1f, 0.68f, 0.66f, 1f),
		new Color(0.98f, 0.82f, 0.56f, 1f),
		new Color(0.71f, 0.88f, 0.64f, 1f),
		new Color(0.57f, 0.82f, 0.88f, 1f),
		new Color(0.65f, 0.7f, 0.96f, 1f),
		new Color(0.88f, 0.66f, 0.92f, 1f)
	};

	private static readonly Color[] DeckStringHalloweenColors = (Color[])(object)new Color[2]
	{
		new Color(1f, 0.42f, 0.05f, 1f),
		new Color(0.56f, 0.17f, 0.88f, 1f)
	};

	private Material _haloMaterial;

	private Mesh _haloMesh;

	private float _nextLampUpdate;

	private float _lastDayWeight = 1f;

	private float _lampWeight;

	private static readonly SeasonRecolor[] AutumnRecolors = new SeasonRecolor[14]
	{
		new SeasonRecolor("ToonWaveInstance", "_Color_3", new Color(0.361f, 0.18f, 0.078f, 1f), ground: false),
		new SeasonRecolor("Green 10", "_BaseColor,_Color", new Color(0.851f, 0.561f, 0.235f, 1f), ground: false),
		new SeasonRecolor("Green 10 2", "_BaseColor,_Color", new Color(0.851f, 0.561f, 0.235f, 1f), ground: false),
		new SeasonRecolor("M_Grass_01", "_BaseColor,_Color", new Color(0.788f, 0.541f, 0.22f, 1f), ground: false),
		new SeasonRecolor("Flower 3 Green Circle", "_BaseColor,_Color", new Color(0.784f, 0.486f, 0.2f, 1f), ground: false),
		new SeasonRecolor("Flower 2", "_BaseColor,_Color", 0.095f, 1.4f, 1f, ground: false),
		new SeasonRecolor("Flower 3 White Circle 1", "_BaseColor,_Color", 0.095f, 1.4f, 1f, ground: false),
		new SeasonRecolor("Flower 4", "_BaseColor,_Color", 0.085f, 1.4f, 1f, ground: false),
		new SeasonRecolor("M_GroundGrass 30", "_BaseColor,_Color", 0.098f, 1.4f, 0.96f, ground: true),
		new SeasonRecolor("M_GroundGrass 10", "_BaseColor,_Color", 0.098f, 1.4f, 0.96f, ground: true),
		new SeasonRecolor("M_PathNature 1", "_BaseColor,_Color", 0.085f, 1.3f, 1f, ground: true),
		new SeasonRecolor("M_PathNature Mid", "_BaseColor,_Color", 0.088f, 1.25f, 1f, ground: true),
		new SeasonRecolor("M_PathNature Long", "_BaseColor,_Color", 0.088f, 1.25f, 1f, ground: true),
		new SeasonRecolor("M_PathNature Short", "_BaseColor,_Color", 0.088f, 1.25f, 1f, ground: true)
	};

	private static readonly Color[] AutumnCanopyPalette = (Color[])(object)new Color[4]
	{
		new Color(0.949f, 0.776f, 0.235f, 1f),
		new Color(0.929f, 0.655f, 0.2f, 1f),
		new Color(0.91f, 0.486f, 0.18f, 1f),
		new Color(0.847f, 0.286f, 0.173f, 1f)
	};

	private static readonly int[] AutumnCanopyWeights = new int[8] { 0, 0, 0, 1, 1, 2, 2, 3 };

	private static readonly Color CanopyBandDark = new Color(0.3f, 0.14f, 0.06f, 1f);

	private static readonly Color CanopyBandLight = new Color(0.8f, 0.52f, 0.24f, 1f);

	private static readonly Color AutumnWarmFilter = new Color(1.02f, 0.9f, 0.62f, 1f);

	private static readonly Color HarvestMoonColor = new Color(1f, 0.78f, 0.42f, 1f);

	private readonly List<SeasonMaterialState> _seasonMaterials = new List<SeasonMaterialState>();

	private readonly HashSet<Material> _seasonSeen = new HashSet<Material>();

	private readonly List<SeasonCanopyState> _seasonCanopies = new List<SeasonCanopyState>();

	private readonly List<CanopyCluster> _canopyClusters = new List<CanopyCluster>();

	private readonly List<CanopyShadowState> _canopyShadows = new List<CanopyShadowState>();

	private readonly List<GameObject> _canopyShadowObjects = new List<GameObject>();

	private readonly List<Mesh> _canopyShadowMeshes = new List<Mesh>();

	private Material _canopyShadowMaterial;

	private bool[][] _canopyDappleMasks;

	private float _canopyDappleMaskGaps = -1f;

	private readonly List<LeafEmitterState> _leafEmitters = new List<LeafEmitterState>();

	private Material _autumnLeafMaterial;

	private Texture2D _autumnLeafAtlas;

	private readonly Material[] _treeLeafMaterials = (Material[])(object)new Material[4];

	private readonly Dictionary<GameObject, bool> _lighthouseOriginalActive = new Dictionary<GameObject, bool>();

	private float _nextLighthouseScan;

	private float _nextLeafEmitterLight;

	private GameObject _leafKickObject;

	private ParticleSystem _leafKick;

	private ParticleSystemRenderer _leafKickRenderer;

	private Vector3 _lastWalkerPosition;

	private Transform _walkerTransform;

	private float _nextWalkerLookup;

	private bool _walkerTracked;

	private float _nextLeafStepAt;

	private AudioSource _leafStepSource;

	private AudioSource _windAudioSource;

	private AudioSource _crowAudioSource;

	private AudioClip _leafStepClip;

	private AudioClip _windAudioClip;

	private readonly List<AudioClip> _crowClips = new List<AudioClip>();

	private float _crowStopAt;

	private float _leafStepStopAt;

	private float _nextCrowAt;

	private bool _windGenerated;

	private float[] _windSamples;

	private int _windReadPosition;

	private readonly List<WindMaterial> _windMaterials = new List<WindMaterial>();

	private bool _windCaptured;

	private float _gustStrength;

	private float _appliedGustWind = -1f;

	private float _nextGustAt;

	private float _scheduledGustInterval = -1f;

	private float _gustQuietSince;

	private int _leafEmitterLightCursor;

	private float _nextLeafLampSnapshot;

	private readonly List<LeafLampSample> _leafLampSamples = new List<LeafLampSample>();

	private float _gustEndAt;

	private Vector3 _gustDirection = Vector3.forward;

	private GameObject _gustFieldObject;

	private ParticleSystemForceField _gustField;

	private bool _leafForcesActive;

	private readonly List<GroundLeaf> _groundLeaves = new List<GroundLeaf>();

	private readonly List<Vector3> _groundLeafVertices = new List<Vector3>();

	private readonly List<Vector2> _groundLeafUvs = new List<Vector2>();

	private readonly List<int> _groundLeafTriangles = new List<int>();

	private readonly List<Color> _groundLeafColors = new List<Color>();

	private readonly List<int> _groundLeafDrawn = new List<int>();

	private float _nextGroundLeafLight;

	private int _groundLeafLightCursor;

	private GameObject _groundLeafObject;

	private Mesh _groundLeafMesh;

	private MeshRenderer _groundLeafRenderer;

	private Material _groundLeafMaterial;

	private float _nextGroundLeafSpawn;

	private bool _groundLeafDirty;

	private int _groundLeafRayMask;

	private bool _groundLeafRayMaskReady;

	private static readonly Func<ParticleSystem, Particle[], int, int, int> ReadLeafParticles = (Func<ParticleSystem, Particle[], int, int, int>)Delegate.CreateDelegate(typeof(Func<ParticleSystem, Particle[], int, int, int>), typeof(ParticleSystem).GetMethod("GetParticles", new Type[3]
	{
		typeof(Particle[]),
		typeof(int),
		typeof(int)
	}));

	private static readonly Action<ParticleSystem, Particle[], int, int> WriteLeafParticles = (Action<ParticleSystem, Particle[], int, int>)Delegate.CreateDelegate(typeof(Action<ParticleSystem, Particle[], int, int>), typeof(ParticleSystem).GetMethod("SetParticles", new Type[3]
	{
		typeof(Particle[]),
		typeof(int),
		typeof(int)
	}));

	private Particle[] _leafLightParticles = (Particle[])(object)new Particle[128];

	private readonly List<MeshCollider> _leafWaterProbes = new List<MeshCollider>();

	private float _nextLeafWaterScan;

	private float _nextLeafStatus;

	private Vector3 _airborneLeafWind;

	private readonly List<Vector3> _riverLeafRoute = new List<Vector3>();

	private readonly List<Transform> _pondLeafTransforms = new List<Transform>();

	private static readonly Vector3[] PondLeafRoute = (Vector3[])(object)new Vector3[7]
	{
		new Vector3(0f, 15.62f, 2f),
		new Vector3(0f, 15.62f, 0f),
		new Vector3(0f, 15.62f, -2.85f),
		new Vector3(0f, 15.562f, -5.783f),
		new Vector3(0f, 15.414f, -6.051f),
		new Vector3(0f, 15.315f, -6.105f),
		new Vector3(0f, -1.199f, -8.151f)
	};

	private int _waterLeafAttempts;

	private int _waterLeafHits;

	private int _waterLeafBlocked;

	private int _waterLeafSpawned;

	private readonly List<int> _stillLeafPerBody = new List<int>();

	private int _stillLeafCount;

	private int _appliedSeason = -1;

	private float _nextSeasonRescan;

	private int _seasonRescanAttempts;

	private readonly List<WaterMaterial> _waterMaterials = new List<WaterMaterial>();

	private readonly HashSet<Material> _waterSeen = new HashSet<Material>();

	private readonly List<WaterParticleState> _waterParticles = new List<WaterParticleState>();

	private readonly HashSet<int> _waterParticleIds = new HashSet<int>();

	private Color _seaSkyMirrorColor = Color.white;

	private Color _seaDrivenBodyColor = new Color(0.2f, 0.4f, 0.5f, 1f);

	private float _lastTwilightGlow;

	private float _lastSunVisibility;

	private float _seaSurfaceY;

	private Bounds _seaBounds;

	private bool _seaSurfaceValid;

	private float _nextWaterEffectScan;

	private float _origReflectionIntensity = 1f;

	private Material _waterShadowOverlayMaterial;

	private readonly List<GameObject> _waterShadowOverlayObjects = new List<GameObject>();

	private readonly HashSet<int> _waterShadowOverlaySourceIds = new HashSet<int>();

	private readonly List<WaterMaterial> _decorMaterials = new List<WaterMaterial>();

	private readonly HashSet<Material> _decorSeen = new HashSet<Material>();

	private float _nextDecorRescan;

	private readonly Dictionary<int, NativeFeatureRenderer> _nativeFeatureRenderers = new Dictionary<int, NativeFeatureRenderer>();

	private readonly List<Renderer> _faceRenderers = new List<Renderer>();

	private readonly List<Light> _faceLightSources = new List<Light>();

	private readonly List<int> _nativeFeatureCleanupIds = new List<int>();

	private Shader _faceTintShader;

	private float _nextFaceRendererScan;

	private float _nextFaceBrightnessUpdate;

	private float _nextFaceAssignCheck;

	private float _nextFaceStatusLog;

	private int _nativeFeatureLogged;

	private static readonly int BaseColorPropertyId = Shader.PropertyToID("_BaseColor");

	private static readonly int CanopyColor1PropertyId = Shader.PropertyToID("_Color_1");

	private static readonly int CanopyColor2PropertyId = Shader.PropertyToID("_Color_2");

	private static readonly int CanopyThresholdPropertyId = Shader.PropertyToID("_Threshold_1");

	private static readonly int BaseMapPropertyId = Shader.PropertyToID("_BaseMap");

	private static readonly string[] FaceTintPropertyNames = new string[4] { "_BaseColor", "_Color", "_Tint", "_TintColor" };

	private static readonly string[] FaceTexturePropertyNames = new string[3] { "_MainTex", "_Texture2D", "_BaseMap" };

	private int _lastTwilightId = int.MinValue;

	private string _twilightVariantName = "golden dusk";

	private Color _twilightGlowColor = new Color(1f, 0.42f, 0.1f, 1f);

	private Color _twilightSkyTint = new Color(0.82f, 0.44f, 0.18f, 1f);

	private Color _twilightSunColor = new Color(1f, 0.7f, 0.38f, 1f);

	private GameObject _sunsetGlowObject;

	private Material _sunsetGlowMaterial;

	private Texture2D _sunsetGlowTexture;

	private GameObject _duskShadeObject;

	private Material _duskShadeMaterial;

	private GameObject _sunGlitterObject;

	private Material _sunGlitterMaterial;

	private Mesh _sunGlitterMesh;

	private Vector3[] _glitterVertices;

	private Color[] _glitterColors;

	private GameObject _sunObject;

	private Material _sunMaterial;

	private Texture2D _sunTexture;

	private int _sunDiskState = -1;

	private bool _celestialValid;

	private float _lastSignedElevation;

	private float _lastSunAzimuth;

	private Camera _shadowAaCamera;

	private AntialiasingMode _originalAntialiasing;

	private AntialiasingQuality _originalAntialiasingQuality;

	private bool _shadowAaCaptured;

	private GameObject _starObject;

	private Material _starMaterial;

	private Mesh _starMesh;

	private Texture2D _starTexture;

	private readonly List<Color> _starBaseColors = new List<Color>();

	private readonly List<float> _starTwinklePhases = new List<float>();

	private readonly List<float> _starTwinkleSpeeds = new List<float>();

	private readonly List<float> _starTwinkleAmounts = new List<float>();

	private readonly List<Color> _starAnimatedColors = new List<Color>();

	private float _nextStarTwinkleUpdate;

	private GameObject _meteorObject;

	private Material _meteorMaterial;

	private bool _meteorActive;

	private Vector3 _meteorDir;

	private Vector3 _meteorVelocity;

	private float _meteorStartTime;

	private float _nextMeteorRoll;

	private readonly Random _visualRandom = new Random();

	private readonly Dictionary<int, HiddenCloudRendererState> _hiddenVanillaClouds = new Dictionary<int, HiddenCloudRendererState>();

	private readonly Dictionary<int, HiddenWorldCloudRootState> _hiddenWorldCloudRoots = new Dictionary<int, HiddenWorldCloudRootState>();

	private readonly Dictionary<int, CloudInstancingState> _hiddenCloudInstancers = new Dictionary<int, CloudInstancingState>();

	private float _nextVanillaCloudScan;

	private readonly HashSet<int> _cloudSuspectsLogged = new HashSet<int>();

	private readonly HashSet<int> _skyRenderersLogged = new HashSet<int>();

	private GameObject _cloudRoot;

	private Material _cloudMaterial;

	private readonly List<Transform> _cloudTransforms = new List<Transform>();

	private readonly List<Vector3> _cloudBaseScales = new List<Vector3>();

	private readonly List<Mesh> _cloudMeshList = new List<Mesh>();

	private bool _rainTarget;

	private float _rainBlend;

	private float _nextWeatherChange;

	private float _nextWorldProbe;

	private bool _worldSceneReady;

	private KeyCode _weatherToggleKey = (KeyCode)291;

	private readonly Random _weatherRandom = new Random();

	private GameObject _stormCloudRoot;

	private Material _stormCloudMaterial;

	private readonly List<Transform> _stormCloudTransforms = new List<Transform>();

	private readonly List<Vector3> _stormCloudBaseScales = new List<Vector3>();

	private readonly List<Mesh> _stormCloudMeshes = new List<Mesh>();

	private GameObject _rainObject;

	private ParticleSystem _rainParticles;

	private Material _rainMaterial;

	private Texture2D _rainTexture;

	private bool _rainUsesNativeMaterial;

	private GameObject _splashObject;

	private ParticleSystem _splashParticles;

	private Material _splashMaterial;

	private Texture2D _splashTexture;

	private float _splashAccumulator;

	private bool _splashDiagnosticWritten;

	private GameObject _weatherAudioObject;

	private AudioSource _rainAudioSource;

	private AudioSource _rainDetailAudioSource;

	private AudioSource _thunderAudioSource;

	private AudioClip _rainAudioClip;

	private AudioClip _rainDetailAudioClip;

	private AudioClip _thunderAudioClip;

	private string _weatherAudioPairSignature = "";

	private float _nextWeatherAudioProbe;

	private bool _weatherAudioWarningWritten;

	private float _nextThunderRoll;

	private float _lightningFlash;

	private bool _weatherFogCaptured;

	private bool _originalFogEnabled;

	private FogMode _originalFogMode;

	private Color _originalFogColor;

	private float _originalFogDensity;

	private float _originalFogStart;

	private float _originalFogEnd;

	private GameObject _natureAudioObject;

	private AudioSource _cicadaAudioSource;

	private AudioSource _nightNatureAudioSource;

	private AudioClip _cicadaAudioClip;

	private AudioClip _nightNatureAudioClip;

	private Coroutine _natureAudioLoadRoutine;

	private bool _natureAudioLoadAttempted;

	private int _lastNatureAudioPhase = -1;

	private KeyCode _configMenuKeyCode = (KeyCode)292;

	private bool _configMenuVisible;

	private bool _hotConfigDirty;

	private float _hotConfigApplyAt;

	private Rect _configMenuRect = new Rect(36f, 36f, 680f, 700f);

	private Vector2 _configMenuScroll;

	private int _configMenuTab;

	private CursorLockMode _cursorLockBeforeMenu;

	private bool _cursorVisibleBeforeMenu;

	private GUIStyle _menuTitleStyle;

	private GUIStyle _menuSectionStyle;

	private GUIStyle _menuNoteStyle;

	private GUIStyle _menuValueStyle;

	private Font _configMenuFont;

	private bool _ownsConfigMenuFont;

	private readonly HashSet<int> _lampRootIds = new HashSet<int>();

	private readonly HashSet<int> _sceneFeatureLightSourceIds = new HashSet<int>();

	private readonly List<ToonMaterial> _toonMaterials = new List<ToonMaterial>();

	private readonly List<ToonMaterial> _surfaceToonEntries = new List<ToonMaterial>();

	private readonly HashSet<Material> _toonSeen = new HashSet<Material>();

	private readonly HashSet<Material> _surfaceToonMaterials = new HashSet<Material>();

	private readonly HashSet<Material> _basketCourtToonMaterials = new HashSet<Material>();

	private static readonly float[] MapleLobeAngles = new float[5] { 0f, 0.95f, -0.95f, 2.3f, -2.3f };

	private static readonly float[] MapleLobeLengths = new float[5] { 0.95f, 0.86f, 0.86f, 0.68f, 0.68f };

	private static readonly Color[] LeafTileColors = (Color[])(object)new Color[4]
	{
		new Color(0.87308f, 0.71392006f, 0.21620001f, 1f),
		new Color(0.85468006f, 0.6026f, 0.184f, 1f),
		new Color(0.83720005f, 0.44712f, 0.16560002f, 1f),
		new Color(0.77924f, 0.26312003f, 0.15916f, 1f)
	};

	private static readonly float[] GlitterColumnOffset = new float[5] { -1f, -0.5f, 0f, 0.5f, 1f };

	private static readonly float[] GlitterColumnAlpha = new float[5] { 0f, 0.55f, 1f, 0.55f, 0f };

	private void Awake()
	{
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		//IL_03da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f03: Unknown result type (might be due to invalid IL or missing references)
		//IL_1716: Unknown result type (might be due to invalid IL or missing references)
		//IL_172c: Unknown result type (might be due to invalid IL or missing references)
		_gradingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Grading", "Enabled", true, "Master switch for the Day and Night colour grade (white balance, exposure, contrast, shadow tone). F6 toggles it live for A/B comparison.");
		_temperature = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Temperature", 0f, "White balance temperature, -100 (cold) to 100 (warm). Negative values counteract the game's warm cast.");
		_tint = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Tint", 10f, "White balance green-magenta tint, -100 to 100. Positive counteracts the green cast of the grass-dominated daylight scenes.");
		_postExposure = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Post exposure", 0f, "Exposure adjustment in EV. Zero preserves the clear authored highlights and sun disc.");
		_contrast = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Contrast", 14f, "Contrast, -100 to 100. Positive values give shadows more presence.");
		_saturation = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Saturation", 3f, "Saturation, -100 to 100.");
		_dayColorFilter = ((BaseUnityPlugin)this).Config.Bind<Color>("Grading", "Day color filter", new Color(1f, 0.98f, 1f, 1f), "Final daylight RGB multiplier. Kept very close to white so the grade removes only the green bias without laying a gray/magenta veil over the whole image.");
		_shadowCooling = ((BaseUnityPlugin)this).Config.Bind<float>("Grading", "Shadow cooling", 0.08f, "0-1. Shifts shadow regions toward a cooler, slightly deeper tone so they read as natural shade instead of warm haze.");
		_tonemapping = ((BaseUnityPlugin)this).Config.Bind<string>("Grading", "Tonemapping", "None", "None, Neutral or ACES. None preserves crisp pastel highlights and keeps the sun from being compressed into a gray disc; Neutral/ACES intentionally roll highlights off.");
		_disableFilmGrain = ((BaseUnityPlugin)this).Config.Bind<bool>("Grading", "Disable film grain", true, "Removes the game's film grain overlay, which contributes to the washed-out look.");
		_disableDepthOfField = ((BaseUnityPlugin)this).Config.Bind<bool>("Grading", "Disable depth of field", true, "Removes the game's depth-of-field blur. Sharper distance view and slightly cheaper on the GPU.");
		_disableMotionBlur = ((BaseUnityPlugin)this).Config.Bind<bool>("Grading", "Disable motion blur", true, "Removes the game's motion blur, which smears the image at sub-60 frame rates.");
		_disableBloom = ((BaseUnityPlugin)this).Config.Bind<bool>("Grading", "Disable bloom", true, "The game's own bloom (never visible before, since it shipped with post-processing off) washes the bright pastel scene into haze, especially at noon.");
		_disableVignette = ((BaseUnityPlugin)this).Config.Bind<bool>("Grading", "Disable vignette", true, "Removes the game's corner darkening.");
		_neutralizeSplitToning = ((BaseUnityPlugin)this).Config.Bind<bool>("Grading", "Neutralize split toning", true, "Overrides the game's own shadow/highlight color toning with neutral gray. Try this if the image still feels tinted after the white balance change.");
		_replaceSkybox = ((BaseUnityPlugin)this).Config.Bind<bool>("Sky", "Replace skybox", true, "Replaces the flat sky with a procedural atmosphere: deep blue zenith fading to a pale horizon, plus a visible sun disc that follows the scene's directional light. F5 toggles it live.");
		_atmosphereThickness = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Atmosphere thickness", 0.7f, "0.5-2. Higher values deepen the blue but also whiten the horizon haze.");
		_skyExposure = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Exposure", 1.2f, "Skybox brightness.");
		_sunSize = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Sun size", 0.028f, "Apparent size of the daytime sun. The default keeps it compact and consistent through dawn and dusk.");
		_skyTint = ((BaseUnityPlugin)this).Config.Bind<Color>("Sky", "Sky tint", new Color(0.5f, 0.5f, 0.5f, 1f), "Tint applied to the atmosphere. Neutral gray gives a natural blue sky.");
		_groundColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Sky", "Ground color", new Color(0.6f, 0.8f, 0.85f, 1f), "Color of the skybox below the horizon. Keep it close to the sea color so the strip between the ocean edge and the sky blends in instead of showing a pale band.");
		_moonEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sky", "Enable moon phases", true, "Replaces the night-time miniature sun disc with a dedicated procedural moon whose lit face changes through a lunar cycle.");
		_lunarCycleDays = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Lunar cycle game days", 8f, "Number of in-game day/night cycles per complete lunar cycle. Eight gives the familiar eight recognizable moon phases; with a 30-minute day this is a four-hour lunar cycle.");
		_newMoonBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "New moon light multiplier", 0.6f, "0-1. Night directional-light brightness at new moon relative to full moon. Full moon always uses the existing Night brightness value as its baseline.");
		_moonSize = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Moon angular size", 0.075f, "Apparent size of the moon in the night sky.");
		_moonColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Sky", "Moon color", new Color(0.82f, 0.9f, 1f, 1f), "Tint of the illuminated lunar surface and its subtle halo.");
		_sunsetGlowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sky", "Sunset glow", true, "Directional dawn/dusk color: a soft glow band hugs the horizon around the sun, so the sky blushes on the sun side while the opposite side stays dim, like a real sunset.");
		_sunsetGlowStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Sunset glow strength", 1f, "0-2. Opacity multiplier for the horizon glow band.");
		_freezeTime = ((BaseUnityPlugin)this).Config.Bind<bool>("Sky", "Hold time of day", false, "Keeps it at one time of day forever, instead of the clock moving on. Everything else still works normally. Turn it off and the day starts moving again.");
		_frozenHour = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Time to hold", 18f, "Which time to stay at. 12 is midday, 0 and 24 are midnight, 18 is about sunset and 6 is about sunrise.");
		_twilightVariantOverride = ((BaseUnityPlugin)this).Config.Bind<int>("Sky", "Always use this sunset colour", 0, "Normally the colour of each sunset is picked at random. Set this to always get the one you want. 0 random, 1 golden, 2 yellow morning, 3 pink, 4 deep red.");
		_pinkDuskChance = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Pink twilight chance", 0.05f, "0-1. Probability that a twilight rolls a pink sky instead of its usual color. Rolled once per twilight, deterministically from the real clock, and colors the glow band, sky tint and low-sun light together. A dusk normally comes up golden orange and a dawn plain yellow; dawns take this roll at 45% of the configured chance, because the haze that makes a sky burn builds up over the day.");
		_redDuskChance = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Crimson twilight chance", 0.03f, "0-1. Probability of a deep crimson twilight. Checked before the pink roll. Dawns take this roll at 30% of the configured chance.");
		_twilightWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Twilight width", 18f, "2-90 degrees of sun elevation. How far above and below the horizon a dawn or dusk reaches at all. Larger makes twilight last longer.");
		_twilightFalloff = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Twilight falloff", 3f, "0.2-8. Shape of the twilight inside that width. 1 is a straight ramp, so the sky starts colouring while the sun is still high. Higher pushes the colour into the last few degrees before the horizon and keeps the rest of the day clean.");
		_twilightWorldTint = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Twilight world tint", 0.5f, "0-1. How strongly the whole frame (ground, buildings, characters, sea) is pulled toward the twilight color while the sun crosses the horizon. 0 = only the sky and the low sun change color, like before.");
		_starsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Sky", "Stars", true, "Starfield that fades in at dusk and out at dawn, slowly wheeling across the night sky.");
		_starCount = ((BaseUnityPlugin)this).Config.Bind<int>("Sky", "Star count", 180, "40-800. Number of stylized stars. A restrained count fits the game's clean cartoon sky better.");
		_meteorChance = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "Shooting star chance", 0.035f, "0-1. Probability per second (at deep night) that a shooting star streaks across the sky. 0.035 is roughly one every half minute.");
		_cloudsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Clouds", "Enabled", true, "Stylized puffy clouds that drift across the sky. They tint with dawn/dusk, darken under the night moon and can throw drifting shadows onto the island.");
		_cloudCount = ((BaseUnityPlugin)this).Config.Bind<int>("Clouds", "Cloud count", 24, "1-40. Number of clouds around the camera.");
		_cloudShadows = ((BaseUnityPlugin)this).Config.Bind<bool>("Clouds", "Cast cloud shadows", false, "Clouds write the shadow map, so soft shadow patches sweep across the ground as they drift. Costs some shadow-pass GPU; turn off first if the frame rate dips.");
		_cloudSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Clouds", "Wind speed", 0.8f, "Cloud drift speed in meters per second (0-30). Asset excavation proved every cloud in the sky is generated by this mod (the baked PR_CloudBase set is deactivated), so a clearly visible drift doubles as proof: a cloud that visibly moves is ours, and they all move.");
		_cloudDirection = ((BaseUnityPlugin)this).Config.Bind<float>("Clouds", "Wind direction", 25f, "Compass direction the clouds drift toward, in degrees.");
		_cloudAltitude = ((BaseUnityPlugin)this).Config.Bind<float>("Clouds", "Altitude", 50f, "Cloud base height in world units (25-150).");
		_cloudScale = ((BaseUnityPlugin)this).Config.Bind<float>("Clouds", "Cloud scale", 1f, "0.3-3. Overall cloud size multiplier.");
		_hideVanillaClouds = ((BaseUnityPlugin)this).Config.Bind<bool>("Clouds", "Hide vanilla clouds", true, "Hides the original clouds in the main world so they do not overlap the mod's clouds. Menu clouds and nearby player weather effects are preserved.");
		_weatherEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Enabled", true, "Enables Day and Night rain events, visuals and the game's own rain ambience audio.");
		_randomRain = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Random rain", true, "Starts and stops rain automatically. How often is set by 'Rain chance' below.");
		_alwaysRain = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Always raining", false, "Holds the rain on and stops the random schedule. Stopping the rain by hand - the button in the menu, or the toggle key - clears this as well.");
		_rainChance = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain chance", 0.25f, "0.02-0.9. Roughly the share of the time it rains. A shower's own length is set by the two entries below; the clear stretch between showers is worked out from this and them, so 0.25 means about one hour in four is wet. Replaces the pair of 'Clear minutes' entries, which said the same thing in a way nobody could read the answer off.");
		_rainToggleKey = ((BaseUnityPlugin)this).Config.Bind<string>("Weather", "Toggle rain key", "F10", "Keyboard key that immediately starts or stops rain. F10 avoids FrameCare's F7-F9 keys.");
		_rainMinutesMin = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain minutes minimum", 2.5f, "Minimum duration of a random rain event.");
		_rainMinutesMax = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain minutes maximum", 5.5f, "Maximum duration of a random rain event.");
		_weatherTransitionSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Transition seconds", 14f, "Seconds used to build or clear the storm instead of popping instantly.");
		_rainLightMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain light multiplier", 0.58f, "0.2-1. Directional and ambient light multiplier under full rain cover.");
		_rainExposureDip = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain exposure dip", -0.18f, "Additional post exposure in EV during full rain.");
		_rainAudioVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain audio volume", 0.62f, "0-1. Combined volume of the game's long StormRain and Rain ambience layers.");
		_thunderChancePerMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Thunder chance per minute", 0.06f, "Average per-minute chance of a brief lightning flash and the game's built-in Thunder clip.");
		_rainDropSize = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain drop size multiplier", 0.4f, "Visible size of raindrops (0.4-1.4). This does not change their fall speed.");
		_rainDensity = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Rain density multiplier", 1.66f, "Amount of visible rain (0.5-2.0). Higher values may have a small performance cost.");
		_gustsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Gusts of wind", true, "Every so often a gust crosses the island: the tree canopies lean and sway together, falling leaves are blown sideways, and leaves lying on the ground skitter along and are carried off. Works in both seasons - the canopies sway either way, there are simply no leaves to move in summer.");
		_gustInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Gust interval seconds", 480f, "Average quiet time between gusts. Each one lasts four to nine seconds and comes from a new direction.");
		_gustStrengthScale = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Gust strength", 0.4f, "0-2. How hard a gust blows: how far the canopies lean, how hard the airborne leaves are pushed, and how quickly leaves on the ground are carried away.");
		_adjustSun = ((BaseUnityPlugin)this).Config.Bind<bool>("Sun", "Adjust sun", true, "The game parks its directional light at a permanent overhead noon (90 degrees, straight down) with shadow strength 0.22, which makes the world look flat. This tilts the sun to a pleasant afternoon angle and restores shadow definition. Purely visual, does not affect gameplay.");
		_sunElevation = ((BaseUnityPlugin)this).Config.Bind<float>("Sun", "Elevation", 45f, "Sun height above the horizon in degrees. 90 restores the game's original overhead angle.");
		_sunAzimuth = ((BaseUnityPlugin)this).Config.Bind<float>("Sun", "Azimuth", 330f, "Compass direction the sunlight comes from, 0-360 degrees.");
		_sunIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Sun", "Intensity multiplier", 1f, "Multiplier on the sun light intensity.");
		_sunShadowStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Sun", "Shadow strength", 0.65f, "0-1. How dark sun shadows are. The game's original value is 0.22 (nearly invisible).");
		_shadowDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Sun", "Shadow distance", 220f, "Distance in world units within which shadows render, measured from the CAMERA. Zoomed-out views put the whole frame beyond a short distance and every shadow in view vanishes at once (the giant Circle_Hill cylinders made this obvious). Lower this first if shadow cost is too high.");
		_hardShadows = ((BaseUnityPlugin)this).Config.Bind<bool>("Sun", "Hard shadows", false, "Uses crisp shadow edges instead of the smoother default. Smooth shadows usually look better on moving characters.");
		_shadowMapResolution = ((BaseUnityPlugin)this).Config.Bind<int>("Sun", "Shadow map resolution", 4096, "Main directional-light shadow atlas resolution. 4096 keeps character and tree shadows clear across the long 220-unit shadow distance; lower values trade sharpness for performance.");
		_shadowCascadeCount = ((BaseUnityPlugin)this).Config.Bind<int>("Sun", "Shadow cascade count", 4, "Directional shadow cascades (1-4). Four preserves nearby shadow detail while the camera also covers distant scenery.");
		_stabilizeShadowEdges = ((BaseUnityPlugin)this).Config.Bind<bool>("Sun", "Stabilize moving shadow edges", true, "Uses high-quality spatial edge smoothing without frame-history blending. This avoids making transparent character outlines fade while the character moves.");
		_sunNeutralize = ((BaseUnityPlugin)this).Config.Bind<float>("Sun", "Neutralize warm tint", 0.25f, "0-1. Blends the sun color from the game's warm cream toward neutral white.");
		_forceShadowCasting = ((BaseUnityPlugin)this).Config.Bind<bool>("Sun", "Force shadow casting", true, "The game disables shadow casting on most environment objects (built for its shadowless overhead sun). This re-enables it so the tilted sun casts consistent shadows everywhere. Turn off if the shadow pass costs too much on your GPU.");
		_restoreTreeShadows = ((BaseUnityPlugin)this).Config.Bind<bool>("Sun", "Restore tree shadows", true, "Forces confirmed tree crowns and trunks to cast and receive directional shadows. This restores crown self-shadowing/back-side depth and lets trunks/crowns project onto the ground. Disable only if the additional moving foliage shadow casters are too expensive.");
		_dayCycleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Day cycle", "Enabled", true, "Real-clock day/night cycle: 'Noon at minute' of every hour is high noon and one full day lasts 'Cycle minutes'. With the current defaults (0/60), a full day matches one real hour. Overrides the static sun elevation/azimuth while active.");
		_cycleMinutes = ((BaseUnityPlugin)this).Config.Bind<float>("Day cycle", "Cycle minutes", 60f, "Length of one full day-night cycle in real minutes (5-1440). 1440 follows a full real day.");
		_noonMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Day cycle", "Noon at minute", 0f, "Minute of the hour that counts as high noon.");
		_maxElevation = ((BaseUnityPlugin)this).Config.Bind<float>("Day cycle", "Max sun elevation", 80f, "Sun height above the horizon at noon, in degrees (20-80). Higher noon sun keeps shadows short.");
		_nightBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Day cycle", "Night brightness", 0.58f, "0-1. Moonlight intensity relative to daylight, so nights stay cozy instead of pitch black.");
		_minimumNightLight = ((BaseUnityPlugin)this).Config.Bind<float>("Day cycle", "Minimum visible night light", 0.34f, "0-1. Main-light floor after moon phase and rain multipliers. Keeps characters, trees and paths readable during rainy new-moon nights without removing night color or lamp contrast.");
		_nightExposureDip = ((BaseUnityPlugin)this).Config.Bind<float>("Day cycle", "Night exposure dip", -0.12f, "Extra post exposure in EV applied at deep night. This darkens EVERYTHING on screen - including water, chalkboards and other glowing unlit materials that ignore the sun.");
		_lampsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Lamps", "Enabled", true, "EXPERIMENTAL: attaches warm point lights to lamp/lantern objects, lit automatically at dusk and night (needs the day cycle). Only works if the game's shaders support additional lights - check the ADDITIONAL LIGHTS log line.");
		_lampKeywords = ((BaseUnityPlugin)this).Config.Bind<string>("Lamps", "Name keywords", "lamp,lantern,streetlight,street_light,lamppost", "Comma-separated name fragments used to recognize lamp objects. The last run only found 5 lamps, so if some street lights stay dark, add a fragment of their object name here and press F4. 'lighthouse' is always excluded.");
		_lampStyle = ((BaseUnityPlugin)this).Config.Bind<string>("Lamps", "Style", "Both", "Light = real point lights that illuminate surroundings; Halo = a cartoon glow sprite on the lamp itself, matching the vanilla art style; Both = the two combined.");
		_maxLitLamps = ((BaseUnityPlugin)this).Config.Bind<int>("Lamps", "Max lit lamps", 48, "Only the N nearest local lights (lamps and hanging string bulbs) are active at once. Range: 1-256. Halos remain visible on every recognized light.");
		_haloSize = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Halo size", 1.3f, "Diameter of the glow sprite in world units.");
		_lampRange = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Range", 9f, "Point light range in world units.");
		_lampIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Intensity", 3.5f, "Point light intensity at deep night.");
		_deckStringLightsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Lamps", "Colorful hanging string lights", true, "Adds point lights and visible halos to the original Tool Shop deck-light bulbs. Their colors travel smoothly through a rainbow at night.");
		_deckStringLightRange = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Hanging string light range", 2f, "2-12. Point-light range for each hanging bulb.");
		_deckStringLightIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Hanging string light intensity", 0.2f, "0-5. Brightness for each hanging bulb before the shared local-light budget is applied.");
		_deckStringColorCycleSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Hanging string color cycle seconds", 18f, "4-90. Seconds for the hanging bulbs to complete one smooth rainbow cycle.");
		_deskLampRange = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Desk lamp range", 3f, "1-8. Range of the dedicated player-desk and library-table lamp lights.");
		_deskLampIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Lamps", "Desk lamp intensity", 0.42f, "0-3. Brightness of the dedicated player-desk and library-table lamp lights at deep night.");
		_campfireLightsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Lamps", "Permanent campfire lights", true, "Adds real orange point lights to the two native CampFire roots. They remain on during the day at reduced intensity, reserve two slots in the shared local-light budget, and make the native Fire Red/Fire Yellow flame meshes emissive.");
		_treeLanternLightsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Lamps", "Wicker hanging lantern lights", true, "Adds warm-white light only to the small woven hanging lamps under the large tree and by the canteen. Swings and coloured string bulbs are not affected.");
		_playTowerSunLightEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Lamps", "Play Tower sun lamp", true, "Adds a warm-yellow point light to the native MD_PlayTower_PlanetSun ornament.");
		_deviceScreensGlow = ((BaseUnityPlugin)this).Config.Bind<bool>("Lamps", "Personal device screen glow", true, "Adds a subtle self-lit look to the player's phone, laptop, and handheld game-console screens.");
		_waterDaylight = ((BaseUnityPlugin)this).Config.Bind<bool>("Water", "Match water to daylight", true, "Water uses unlit materials that ignore the sun and glow at night. This drives the water material colors with the day cycle instead: dark and blue-shifted at night, untouched at noon, so sea and sky stay in the same palette.");
		_nightWaterBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Night water brightness", 0.09f, "0-1. Water body brightness at deep night relative to daytime. Rain applies an additional body-only reduction so the sea stays below its wave highlights.");
		_dayWaterPatternColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Water", "Day water pattern color", new Color(0.78f, 0.88f, 0.92f, 1f), "RGB color used by sea, fountain and waterfall patterns in full daylight. It blends smoothly with the night pattern color through dawn and dusk.");
		_nightWaterPatternColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Water", "Night water pattern color", new Color(0.25f, 0.33f, 0.42f, 1f), "RGB color used by sea, fountain and waterfall patterns at deep night. Adjust it from the F11 menu while viewing the water; changes are saved and shown immediately.");
		_waterWaveBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Wave brightness above surface", 1.1f, "Final brightness multiplier for the selected water-pattern colors. It is independent of dark water-body colors so ocean, fountain and waterfall patterns cannot turn black at night.");
		_nightWaterfallFoamBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Night waterfall foam brightness", 0.55f, "Brightness of actual fountain and waterfall spray particles at deep night. Only the particle start color is adjusted; the original particle materials remain untouched.");
		_seaSkyReflection = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Sea reflects sky color", 0.68f, "0-1. How strongly the sea mirrors the color of the sky this plugin is currently drawing. It drives the water's horizon color hardest, its shallow and deep body colors less, so a pink or golden dusk sky produces a pink or golden sea instead of a grey in-between step. Costs nothing: the sky color is computed, not rendered into a reflection texture.");
		_sunGlitterEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Water", "Sun glitter path", true, "Draws the specular track a low sun lays across the water, from the viewer out to the horizon. Water material colors are uniform over the whole sea, so this is the only part of a sunset that changes with which way you are facing.");
		_sunGlitterStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Sun glitter strength", 1f, "0-2. Opacity multiplier for the sun's track on the water.");
		_sunGlitterCoverage = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Sun glitter coverage", 52f, "10-80 degrees. How far down from the horizon the track reaches, measured on screen rather than in metres, so it covers the same share of the water whether you are standing on the beach or looking down from the air. Higher covers more sea.");
		_sunGlitterSpread = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Sun glitter spread", 26f, "5-60 degrees. Half-width of the track where it is widest, next to the viewer. It narrows toward the sun on its own, the way a real specular path does.");
		_twilightSeaBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Twilight sea brightness", 0.66f, "0-1. Lowest brightness the sea may reach while the sun is crossing the horizon, relative to noon. The plain day-to-night fade darkens the sea long before the sky stops burning, which is what turns dawn and dusk water grey. Raising this keeps the sea as luminous as the sky above it.");
		_waterShadowOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Water", "Directional shadow overlay", true, "Adds a transparent real-shadow receiver over the original horizontal water mesh. The native Stylized Water material, including waves, foam and reflections, is left unchanged.");
		_waterShadowOverlayStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Water", "Directional shadow overlay strength", 0.36f, "0.02-0.60. Opacity of the additional receiver: lower is subtler, higher makes sun shadows on water easier to read.");
		_decorDimming = ((BaseUnityPlugin)this).Config.Bind<bool>("Decor", "Dim light-ignoring decor at night", true, "Ground flowers, grass tufts and some other props use materials that ignore the sun entirely (UTS light-color binding off, or unlit shaders), so they keep full daytime brightness and appear to glow in the dark. This drives their colors with the day cycle, like the water. Matched materials are listed in the log as DECOR lines.");
		_nightDecorBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Decor", "Night decor brightness", 0.55f, "0-1. Brightness of these props at deep night relative to daytime. These materials cannot receive lamp light, so anywhere near a lit lamp they read darker than their surroundings - keep this well above the water's night brightness.");
		_decorExcludeKeywords = ((BaseUnityPlugin)this).Config.Bind<string>("Decor", "Exclude keywords", "", "Comma-separated material-name fragments that should be left untouched (keep glowing at night). Check the DECOR log lines for the exact material names.");
		_toonShading = ((BaseUnityPlugin)this).Config.Bind<bool>("Shading", "Boost toon shadow contrast", true, "Improves light and shadow definition on scenery and characters while preserving their colors.");
		_shadeDarkness = ((BaseUnityPlugin)this).Config.Bind<float>("Shading", "Shade darkness", 0.66f, "Shadowed areas show the base color multiplied by this factor. Lower = darker, higher-contrast shadows. 1 restores the (invisible) vanilla look.");
		_surfaceShadeStep = ((BaseUnityPlugin)this).Config.Bind<float>("Shading", "Main island surface shade step", 0.42f, "Controls how clearly shadows appear on the main island when the sun is low.");
		_surfaceNoonShadeStep = ((BaseUnityPlugin)this).Config.Bind<float>("Shading", "Main island noon shade step", 0.8f, "Controls how clearly soft shadows appear on the main island around noon.");
		_surfaceSystemShadowLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Shading", "Main island system shadow level", -0.12f, "Fine adjustment for keeping shadows consistent across grass, paths, and roads (-0.5 to 0.5).");
		_playerShadeDarkness = ((BaseUnityPlugin)this).Config.Bind<float>("Shading", "Player shade darkness", 0.83f, "0.3-1. Player-only shade brightness. Kept higher than world shadows so faces and clothing do not turn into a flat dark silhouette.");
		_playerSystemShadowLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Shading", "Player system shadow level", -0.05f, "Fine adjustment for shadow visibility on characters only (-0.5 to 0.5).");
		_playerShadeStep = ((BaseUnityPlugin)this).Config.Bind<float>("Shading", "Player shade step", 0.45f, "Controls how much of a character is covered by the darker shade (0-1). Lower values keep faces brighter.");
		_ambientCoolShift = ((BaseUnityPlugin)this).Config.Bind<float>("Ambient", "Cool shift", 0.16f, "0-1. Nudges ambient light (what fills the shadows) toward a cooler blue-gray.");
		_ambientIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Ambient", "Intensity multiplier", 1f, "Multiplier for ambient light intensity.");
		_natureAmbienceEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Nature ambience", "Enabled", true, "Plays quiet CC0 outdoor ambience that follows the Day and Night cycle. All bundled sources and license links are documented in audio/THIRD_PARTY_AUDIO.md.");
		_noonCicadaVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Noon cicada volume", 0.055f, "0-1. Stereo cicada bed near high noon. The source recording is naturally loud, so the default is deliberately low enough to sit behind work and conversation audio.");
		_nightNatureVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Night insects and frogs volume", 0.06f, "0-1. Long rural-night recording with field crickets and occasional frogs at deep night.");
		_natureFadeSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Transition seconds", 12f, "Seconds used to fade nature beds in and out. Twilight stays mostly quiet between them.");
		_rainNatureMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Rain volume multiplier", 0.18f, "0-1. Remaining nature-bed volume under full rain, keeping rain from becoming a noisy wall.");
		_seasonTheme = ((BaseUnityPlugin)this).Config.Bind<string>("Season", "Theme", "Summer", "Summer or Autumn. Summer is the game as authored. Autumn repaints the round tree canopies, bushes, flower beds, grass tufts and - unless the ground switch below is off - the lawn and its paths into red, orange and gold, drops leaves far more often, and puts the hanging string lights on a Halloween palette.");
		_autumnStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Autumn colour strength", 1f, "0-1. How far the autumn palette is mixed in over the summer colours. 1 is the full repaint; lower values leave some green in the scene for an early-autumn look.");
		_autumnGroundRecolor = ((BaseUnityPlugin)this).Config.Bind<bool>("Season", "Recolour lawn and paths", true, "Includes the island lawn and the nature paths crossing it in the autumn repaint. Turn this off to keep the ground green and change only the planting.");
		_canopyShadeBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Canopy shade brightness", 0.6f, "0.3-1. How light the shaded side of a round tree canopy is, the same way the [Shading] shade sliders work for everything else. 1 is almost no shading; lower deepens the underside of every canopy, the band beneath it, and the difference between the upper and lower discs of one tree.");
		_canopyShading = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Canopy shading", 0.5f, "0-1. How much of each round canopy is taken up by the dark band along its underside. The shader that draws these canopies has no lighting of its own, so this band, plus the ramp inside each disc, is where all of their light and shade comes from. 0 makes them flat blocks of colour; too high and the crowns go dark.");
		_autumnWarmFilter = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Warm filter", 0.75f, "0-1. Strength of a warm amber cast over the whole autumn frame. It works on top of the normal colour grade and follows the day cycle, so nights stay cool.");
		_leafFallRate = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Leaf fall rate", 1.5f, "Multiplier on the falling-leaf emitters in autumn. 1 leaves the game's own three exactly as the game has them. Note that the game's leaves are almost weightless - one percent gravity - so they hang in the air for their full ten seconds rather than falling past. Rate multiplies how many are in the air at once, not how fast they go by: at the default this and the setting below put about 240 leaves in the sky across the island, against the game's own 80.");
		_leafFallTrees = ((BaseUnityPlugin)this).Config.Bind<int>("Season", "Shedding trees", 20, "Autumn only. The game only sheds leaves at three fixed spots on the whole island, so this many tree canopies get an emitter of their own, largest trees first. Each one holds about six leaves in the air at the default rate; 0 disables it and leaves the game's three.");
		_groundLeafLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Season", "Leaves on the ground", 400, "Autumn only. How many fallen leaves may lie on the ground at once. They build up around wherever you are and stay there. 0 turns the ground layer off. This is the one autumn setting worth lowering on a weak GPU, though the leaves are flat quads in a single draw call and 400 costs very little.");
		_groundLeafLifetime = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Ground leaf lifetime", 0f, "Seconds a leaf lies on the ground before fading out. 0 means they never fade: the layer fills to the limit above and then stays.");
		_autumnSunElevation = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Sun elevation multiplier", 0.76f, "0.4-1. Scales the noon sun height in autumn. The sun sitting lower all day is most of what makes autumn light read as autumn: longer shadows, and everything lit more from the side than from above. 1 keeps the summer arc.");
		_harvestMoon = ((BaseUnityPlugin)this).Config.Bind<bool>("Season", "Harvest moon", true, "Autumn nights get a larger, deep golden moon low over the sea, the way a harvest moon looks.");
		_leavesOnWater = ((BaseUnityPlugin)this).Config.Bind<bool>("Season", "Leaves land on water", true, "Fallen leaves may also settle on the sea and the ponds, where they drift slowly instead of lying still. They count against the same ground-leaf limit.");
		_autumnWaterTint = ((BaseUnityPlugin)this).Config.Bind<float>("Season", "Water depth tint", 0.5f, "0-1. Pulls the sea and the ponds toward a deeper, colder blue in autumn. The horizon band takes only a third of it: where sea meets sky it has to keep following the sky, or dusk lands on grey.");
		_halloweenStringLights = ((BaseUnityPlugin)this).Config.Bind<bool>("Season", "Halloween string lights", true, "Autumn only. Puts the hanging string lights on pumpkin orange, candle amber, witch purple, toxic green and blood red instead of the usual pastel rainbow.");
		_dappledCanopyShadows = ((BaseUnityPlugin)this).Config.Bind<bool>("Sun", "Dappled canopy shadows", true, "The island's round tree canopies are solid ellipsoids, so each one casts a single filled oval on the ground. With this on they stop casting themselves and a perforated copy of the canopy is drawn into the shadow map in their place, which breaks the shadow up into dapples. Costs one extra instanced draw per canopy batch, shadow-only, and the holes make the shadow pass cheaper rather than dearer.");
		_canopyShadowGaps = ((BaseUnityPlugin)this).Config.Bind<float>("Sun", "Dapple density", 0.42f, "0-1. How much of the perforated canopy is holes. Holes are weighted toward the edge of the crown, so the middle of the shadow stays solid the way a real canopy does.");
		_leafStepVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Leaf step volume", 0.32f, "0-1. Volume of the dry-leaf crunch when you walk over fallen leaves in autumn. Needs audio/autumn_leaf_step.ogg (or .wav/.mp3); silent without it.");
		_windVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Wind volume", 0.45f, "0-1. Volume of the wind during a gust; it rises and falls with the gust itself. Needs audio/wind_gust.ogg (or .wav/.mp3); silent without it.");
		_crowVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Crow volume", 0.4f, "0-1. Volume of the occasional crow call that replaces the cicadas in autumn. Needs audio/crow_call.ogg (or .wav/.mp3); silent without it.");
		_crowCallsPerMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Nature ambience", "Crow calls per minute", 0.7f, "How often a crow calls during an autumn day. 0 turns them off.");
		_leafStepPuffs = ((BaseUnityPlugin)this).Config.Bind<bool>("Season", "Kick up leaves when walking", true, "Walking over fallen leaves in autumn scatters a few scraps of leaf backwards from your feet, which bounce and settle.");
		_configMenuEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Interface", "Enable in-game config menu", true, "Enables the in-game settings menu. Changes are saved and applied automatically.");
		_configMenuKey = ((BaseUnityPlugin)this).Config.Bind<string>("Interface", "Config menu key", "F11", "Keyboard key used to open or close the settings menu. Esc also closes it.");
		_configMenuLanguage = ((BaseUnityPlugin)this).Config.Bind<string>("Interface", "Menu language", "Auto", "Language used by the in-game settings menu: Auto, Chinese, English or Japanese.");
		_configRevision = ((BaseUnityPlugin)this).Config.Bind<int>("Internal", "Config revision", 0, "Internal migration marker. Do not edit.");
		ApplySafePerformanceDefaults();
		EnsureChineseConfigNotes();
		RefreshWeatherConfig();
		SceneManager.sceneLoaded += OnSceneLoaded;
		RenderPipelineManager.beginCameraRendering += OnBeginCameraRendering;
		RenderPipelineManager.endCameraRendering += OnEndCameraRendering;
		ScheduleApply(6f);
		((BaseUnityPlugin)this).Logger.LogInfo((object)string.Concat("On-Together: Day and Night 1.0.1.10 loaded. F4: reload config  F5: toggle sky  F6: toggle grading  ", _weatherToggleKey, ": toggle rain  ", _configMenuKeyCode, ": config menu"));
	}

	private void ApplySafePerformanceDefaults()
	{
		bool flag = false;
		if (_configRevision.Value < 1)
		{
			if (_maxLitLamps.Value == 128)
			{
				_maxLitLamps.Value = 48;
			}
			if (_cloudShadows.Value)
			{
				_cloudShadows.Value = false;
			}
			_configRevision.Value = 1;
			flag = true;
		}
		if (_configRevision.Value < 2)
		{
			if (_shadowMapResolution.Value == 2048 && _shadowCascadeCount.Value == 2)
			{
				_shadowMapResolution.Value = 4096;
				_shadowCascadeCount.Value = 4;
			}
			_configRevision.Value = 2;
			flag = true;
		}
		if (_configRevision.Value < 3)
		{
			if (Mathf.Abs(_leafFallRate.Value - 4f) < 0.001f)
			{
				_leafFallRate.Value = 1.5f;
			}
			if (_leafFallTrees.Value == 40)
			{
				_leafFallTrees.Value = 20;
			}
			_configRevision.Value = 3;
			flag = true;
		}
		if (flag)
		{
			((BaseUnityPlugin)this).Config.Save();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("PERFORMANCE/QUALITY migrated 1.0.0 defaults: shadowAtlas=" + _shadowMapResolution.Value + " cascades=" + _shadowCascadeCount.Value + " maxLocalLights=" + _maxLitLamps.Value + " cloudShadows=" + _cloudShadows.Value));
		}
	}

	private void OnDestroy()
	{
		if (_configMenuVisible)
		{
			RestoreCursorAfterMenu();
		}
		if (_ownsConfigMenuFont && (Object)(object)_configMenuFont != (Object)null)
		{
			Object.Destroy((Object)(object)_configMenuFont);
		}
		SceneManager.sceneLoaded -= OnSceneLoaded;
		RenderPipelineManager.beginCameraRendering -= OnBeginCameraRendering;
		RenderPipelineManager.endCameraRendering -= OnEndCameraRendering;
		EndNeutralProfilePhotoRender();
		RestoreSky();
		RestoreLighthouse();
		RestoreAmbient();
		RestoreSun();
		RestoreShadowAntialiasing();
		RestoreShadowCasting();
		RestoreVanillaClouds();
		RestoreWaterParticles();
		ClearWaterShadowOverlays();
		RestoreWeather();
		RestoreNatureAudio();
		ClearLamps();
		RestoreCampfireEmission();
		RestoreDeviceScreenGlow();
		RestoreWaterMaterials();
		RestoreDecorMaterials();
		RestoreSeasonTheme();
		RestoreGusts();
		DestroyLeafKick();
		RestoreCanopyShadows();
		if ((Object)(object)_canopyShadowMaterial != (Object)null)
		{
			Object.Destroy((Object)(object)_canopyShadowMaterial);
		}
		DestroyGroundLeaves();
		RestoreNativeFeatureMaterials();
		RestoreToonShading();
		DestroyMoon();
		DestroySunsetGlow();
		DestroyStars();
		DestroyMeteor();
		if ((Object)(object)_starTexture != (Object)null)
		{
			Object.Destroy((Object)(object)_starTexture);
		}
		if ((Object)(object)_autumnLeafMaterial != (Object)null)
		{
			Object.Destroy((Object)(object)_autumnLeafMaterial);
		}
		for (int i = 0; i < _treeLeafMaterials.Length; i++)
		{
			if ((Object)(object)_treeLeafMaterials[i] != (Object)null)
			{
				Object.Destroy((Object)(object)_treeLeafMaterials[i].mainTexture);
				Object.Destroy((Object)(object)_treeLeafMaterials[i]);
			}
		}
		if ((Object)(object)_autumnLeafAtlas != (Object)null)
		{
			Object.Destroy((Object)(object)_autumnLeafAtlas);
		}
		ClearClouds();
		if ((Object)(object)_cloudMaterial != (Object)null)
		{
			Object.Destroy((Object)(object)_cloudMaterial);
		}
		RestoreColorGradingMode();
		if ((Object)(object)_volumeObject != (Object)null)
		{
			Object.Destroy((Object)(object)_volumeObject);
		}
		if ((Object)(object)_profile != (Object)null)
		{
			Object.Destroy((Object)(object)_profile);
		}
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Invalid comparison between Unknown and I4
		if ((int)mode == 1)
		{
			float unscaledTime = Time.unscaledTime;
			if ((Object)(object)_profilePhotoCamera == (Object)null)
			{
				_profilePhotoLookupAttempted = false;
			}
			if (!_sunCaptured || (Object)(object)_sunLight == (Object)null || !_skyApplied)
			{
				ScheduleApply(1f);
				return;
			}
			_nextShadowRescan = unscaledTime + 0.25f;
			_nextPlayerShadowRefresh = unscaledTime + 0.25f;
			_nextSceneFeatureLampRescan = unscaledTime + 0.25f;
			_nextVanillaCloudScan = unscaledTime + 0.25f;
			_nextDecorRescan = unscaledTime + 0.25f;
			_nextWaterEffectScan = unscaledTime + 0.25f;
			_nextSeasonRescan = unscaledTime + 1.5f;
			_seasonRescanAttempts = 0;
			_nextLighthouseScan = 0f;
			return;
		}
		RestoreLighthouse();
		RestoreShadowAntialiasing();
		RestoreCameraSkyboxes();
		RestoreShadowCasting();
		RestoreVanillaClouds();
		ClearWaterShadowOverlays();
		RestoreCampfireEmission();
		RestoreDeviceScreenGlow();
		RestoreNativeFeatureMaterials();
		_weatherFogCaptured = false;
		_skyApplied = false;
		_skyRuntimeEnabled = false;
		_ambientCaptured = false;
		_originalSkybox = null;
		_sunCaptured = false;
		_sunLight = null;
		_worldCamera = null;
		_profilePhotoCamera = null;
		_profilePhotoLookupAttempted = false;
		_playerDiagnosticsWritten = false;
		ClearLamps();
		ClearClouds();
		ClearStormClouds();
		RestoreCanopyShadows();
		_seasonCanopies.Clear();
		_canopyClusters.Clear();
		_leafEmitters.Clear();
		DestroyGroundLeaves();
		DestroyLeafKick();
		_walkerTracked = false;
		_walkerTransform = null;
		_appliedSeason = -1;
		_seasonRescanAttempts = 0;
		_nextSeasonRescan = 0f;
		_celestialValid = false;
		_worldSceneReady = false;
		_nextWorldProbe = 0f;
		HideCelestialVisuals();
		ScheduleApply(6f);
	}

	private void Update()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown((KeyCode)285))
		{
			ReloadConfigFromDisk();
		}
		if (_configMenuEnabled.Value && Input.GetKeyDown(_configMenuKeyCode))
		{
			ToggleConfigMenu();
		}
		if (_configMenuVisible && Input.GetKeyDown((KeyCode)27))
		{
			ToggleConfigMenu();
		}
		if (Input.GetKeyDown((KeyCode)286))
		{
			ToggleSky();
		}
		if (Input.GetKeyDown((KeyCode)287) && (Object)(object)_volume != (Object)null)
		{
			((Behaviour)_volume).enabled = !((Behaviour)_volume).enabled;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("GRADING " + (((Behaviour)_volume).enabled ? "ON" : "OFF")));
		}
		if (_weatherEnabled.Value && Input.GetKeyDown(_weatherToggleKey))
		{
			SetRainTarget(!_rainTarget, manual: true);
		}
		if (_hotConfigDirty && Time.unscaledTime >= _hotConfigApplyAt)
		{
			_hotConfigDirty = false;
			((BaseUnityPlugin)this).Config.Save();
			EnsureChineseConfigNotes();
			RefreshWeatherConfig();
			RestoreAmbient();
			_ambientCaptured = false;
			ScheduleApply(0.05f);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LIVE CONFIG saved and reapplied.");
		}
		UpdateWeather();
		UpdateDayCycle();
		UpdateLighthouse();
		RefreshNativeFeatureMaterials();
		UpdateDeviceScreenLights();
		UpdateNatureAmbience();
		UpdateGusts();
		UpdateLeafSteps();
		UpdateGroundLeaves();
		UpdateLeafEmitterLighting();
		UpdateMoonVisual();
		UpdateClouds();
		if (!_dayCycleEnabled.Value)
		{
			HideCelestialVisuals();
		}
		if (_lampsEnabled.Value && Time.unscaledTime >= _nextLampUpdate)
		{
			_nextLampUpdate = Time.unscaledTime + 1.5f;
			ScanForNewLamps(initialScan: false);
			if (Time.unscaledTime >= _nextSceneFeatureLampRescan)
			{
				_nextSceneFeatureLampRescan = Time.unscaledTime + 5f;
				AddSceneFeatureLights();
			}
			UpdateLampSelection();
		}
		if (_lampHalos.Count > 0 && _lampWeight > 0.01f)
		{
			Camera main = Camera.main;
			if ((Object)(object)main != (Object)null)
			{
				Quaternion rotation = ((Component)main).transform.rotation;
				for (int i = 0; i < _lampHalos.Count; i++)
				{
					if ((Object)(object)_lampHalos[i] != (Object)null)
					{
						_lampHalos[i].rotation = rotation;
					}
				}
			}
		}
		if (_adjustSun.Value && Time.unscaledTime >= _nextShadowRescan)
		{
			_nextShadowRescan = Time.unscaledTime + 60f;
			ApplyShadowCasting();
		}
		if (_hideVanillaClouds.Value && Time.unscaledTime >= _nextVanillaCloudScan)
		{
			_nextVanillaCloudScan = Time.unscaledTime + 5f;
			ApplyVanillaCloudHiding();
		}
		if (_worldSceneReady && Time.unscaledTime >= _nextSeasonRescan)
		{
			_nextSeasonRescan = Time.unscaledTime + 8f;
			if (SeasonNeedsRescan())
			{
				_seasonRescanAttempts++;
				ApplySeasonTheme();
				ApplyCanopyShadows();
			}
		}
		if (_decorDimming.Value && _worldSceneReady && Time.unscaledTime >= _nextDecorRescan)
		{
			_nextDecorRescan = Time.unscaledTime + 10f;
			ScanDecorMaterials();
		}
		if (_waterDaylight.Value && _worldSceneReady && Time.unscaledTime >= _nextWaterEffectScan)
		{
			_nextWaterEffectScan = Time.unscaledTime + 10f;
			ScanWaterParticles();
			EnsureWaterShadowOverlays();
		}
		if (_adjustSun.Value && Time.unscaledTime >= _nextPlayerShadowRefresh)
		{
			_nextPlayerShadowRefresh = Time.unscaledTime + 5f;
			ApplyPlayerShadows();
		}
	}

	private void ReloadConfigFromDisk()
	{
		((BaseUnityPlugin)this).Config.Reload();
		EnsureChineseConfigNotes();
		RefreshWeatherConfig();
		RestoreAmbient();
		_ambientCaptured = false;
		ScheduleApply(0.1f);
		if (!_configMenuEnabled.Value && _configMenuVisible)
		{
			ToggleConfigMenu();
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Config reloaded from disk, reapplying.");
	}

	private void QueueHotConfigApply()
	{
		_hotConfigDirty = true;
		_hotConfigApplyAt = Time.unscaledTime + 0.25f;
	}

	private void ApplyHotConfigNow()
	{
		_hotConfigDirty = false;
		((BaseUnityPlugin)this).Config.Save();
		EnsureChineseConfigNotes();
		RefreshWeatherConfig();
		RestoreAmbient();
		_ambientCaptured = false;
		ScheduleApply(0.05f);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"LIVE CONFIG applied from menu.");
	}

	private void EnsureChineseConfigNotes()
	{
		try
		{
			string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath;
			if (string.IsNullOrEmpty(configFilePath) || !File.Exists(configFilePath))
			{
				return;
			}
			List<string> list = new List<string>(File.ReadAllLines(configFilePath));
			bool flag = false;
			bool flag2 = false;
			for (int i = 0; i < Mathf.Min(8, list.Count); i++)
			{
				if (list[i].StartsWith("## 中文提示", StringComparison.Ordinal))
				{
					flag2 = true;
					break;
				}
			}
			if (!flag2)
			{
				list.Insert(Mathf.Min(2, list.Count), "## 中文提示:游戏内按 F11 打开多语言实时设置;修改配置文件后按 F4 可重新读取。");
				flag = true;
			}
			for (int num = list.Count - 1; num >= 0; num--)
			{
				string text = list[num].Trim();
				if (text.Length >= 3 && text[0] == '[' && text[text.Length - 1] == ']')
				{
					string section = text.Substring(1, text.Length - 2);
					string text2 = ChineseSectionNote(section);
					if (text2 != null)
					{
						bool flag3 = false;
						for (int j = num + 1; j < Mathf.Min(list.Count, num + 5); j++)
						{
							if (list[j] == text2 || list[j].StartsWith("## 中文:", StringComparison.Ordinal))
							{
								flag3 = true;
								break;
							}
						}
						if (!flag3)
						{
							list.Insert(num + 1, text2);
							list.Insert(num + 1, "");
							flag = true;
						}
					}
				}
			}
			if (flag)
			{
				File.WriteAllLines(configFilePath, list.ToArray());
			}
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not add Chinese config notes: " + ex.GetType().Name));
		}
	}

	private static string ChineseSectionNote(string section)
	{
		return section switch
		{
			"Ambient" => "## 中文:环境光的冷暖与整体亮度。", 
			"Clouds" => "## 中文:模组卡通云、移动速度、尺寸、阴影与原版主世界云隐藏。", 
			"Day cycle" => "## 中文:按现实时间运行的昼夜循环、周期和日夜亮度。", 
			"Decor" => "## 中文:夜间压暗不受光照影响的花草和装饰材质。", 
			"Grading" => "## 中文:白平衡、曝光、对比度、饱和度与后处理开关。", 
			"Interface" => "## 中文:游戏内实时配置菜单与快捷键。", 
			"Lamps" => "## 中文:夜间路灯点光与卡通光晕。", 
			"Nature ambience" => "## 中文:正午蝉鸣、夜间虫蛙声及雨天音量衰减。", 
			"Season" => "## 中文:季节主题。秋季会把树冠、灌木、花坛、草坪与小路换成红橙黄配色,加大落叶,并把彩灯灯串换成万圣节配色。", 
			"Shading" => "## 中文:主岛与人物的阴影清晰度和明暗层次。", 
			"Sky" => "## 中文:自定义天空、太阳、月相、暮光与星空。", 
			"Sun" => "## 中文:太阳角度、亮度、阴影距离和质量。", 
			"Water" => "## 中文:海面、波纹、瀑布水花在昼夜及雨天中的亮度。", 
			"Weather" => "## 中文:随机或手动雨天、过渡、雨滴、雨声与雷声。F10 手动切换下雨。", 
			_ => null, 
		};
	}

	private void ToggleConfigMenu()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		_configMenuVisible = !_configMenuVisible;
		if (_configMenuVisible)
		{
			_cursorLockBeforeMenu = Cursor.lockState;
			_cursorVisibleBeforeMenu = Cursor.visible;
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}
		else
		{
			RestoreCursorAfterMenu();
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)("CONFIG MENU " + (_configMenuVisible ? "OPEN" : "CLOSED")));
	}

	private void RestoreCursorAfterMenu()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		Cursor.lockState = _cursorLockBeforeMenu;
		Cursor.visible = _cursorVisibleBeforeMenu;
	}

	private void EnsureConfigMenuStyles()
	{
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Expected O, but got Unknown
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Expected O, but got Unknown
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Expected O, but got Unknown
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		if (_menuTitleStyle != null)
		{
			return;
		}
		Font[] array = Resources.FindObjectsOfTypeAll<Font>();
		foreach (Font val in array)
		{
			if ((Object)(object)val != (Object)null && val.HasCharacter('中') && val.HasCharacter('あ'))
			{
				_configMenuFont = val;
				break;
			}
		}
		if ((Object)(object)_configMenuFont == (Object)null)
		{
			try
			{
				_configMenuFont = Font.CreateDynamicFontFromOSFont(new string[4] { "Microsoft YaHei UI", "Yu Gothic UI", "Meiryo UI", "Arial Unicode MS" }, 16);
				_ownsConfigMenuFont = (Object)(object)_configMenuFont != (Object)null;
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Chinese config-menu font fallback failed: " + ex.GetType().Name));
			}
		}
		_menuTitleStyle = new GUIStyle(GUI.skin.label);
		_menuTitleStyle.font = _configMenuFont;
		_menuTitleStyle.fontSize = 18;
		_menuTitleStyle.fontStyle = (FontStyle)1;
		_menuTitleStyle.normal.textColor = new Color(0.94f, 0.97f, 1f, 1f);
		_menuSectionStyle = new GUIStyle(GUI.skin.label);
		_menuSectionStyle.font = _configMenuFont;
		_menuSectionStyle.fontSize = 16;
		_menuSectionStyle.fontStyle = (FontStyle)1;
		_menuSectionStyle.normal.textColor = new Color(0.72f, 0.88f, 1f, 1f);
		_menuNoteStyle = new GUIStyle(GUI.skin.label);
		_menuNoteStyle.font = _configMenuFont;
		_menuNoteStyle.fontSize = 12;
		_menuNoteStyle.wordWrap = true;
		_menuNoteStyle.normal.textColor = new Color(0.76f, 0.8f, 0.86f, 1f);
		_menuValueStyle = new GUIStyle(GUI.skin.label);
		_menuValueStyle.font = _configMenuFont;
		_menuValueStyle.alignment = (TextAnchor)5;
		_menuValueStyle.normal.textColor = Color.white;
	}

	private void OnGUI()
	{
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Expected O, but got Unknown
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		if (_configMenuVisible && _configMenuEnabled.Value)
		{
			EnsureConfigMenuStyles();
			((Rect)(ref _configMenuRect)).width = Mathf.Min(680f, Mathf.Max(420f, (float)Screen.width - 40f));
			((Rect)(ref _configMenuRect)).height = Mathf.Min(700f, Mathf.Max(360f, (float)Screen.height - 40f));
			Color backgroundColor = GUI.backgroundColor;
			Font font = GUI.skin.font;
			if ((Object)(object)_configMenuFont != (Object)null)
			{
				GUI.skin.font = _configMenuFont;
			}
			GUI.backgroundColor = new Color(0.34f, 0.43f, 0.58f, 0.98f);
			_configMenuRect = GUILayout.Window(190019, _configMenuRect, new WindowFunction(DrawConfigMenuWindow), "On-Together: Day and Night 1.0.1.10  " + MenuText("实时设置"), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(((Rect)(ref _configMenuRect)).width),
				GUILayout.Height(((Rect)(ref _configMenuRect)).height)
			});
			GUI.backgroundColor = backgroundColor;
			GUI.skin.font = font;
			((Rect)(ref _configMenuRect)).x = Mathf.Clamp(((Rect)(ref _configMenuRect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _configMenuRect)).width));
			((Rect)(ref _configMenuRect)).y = Mathf.Clamp(((Rect)(ref _configMenuRect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _configMenuRect)).height));
		}
	}

	private void DrawConfigMenuWindow(int windowId)
	{
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.Label(MenuText("修改后会自动保存并立即应用;按 F11 或 Esc 关闭。"), _menuTitleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label(MenuText("这里提供常用设置;更多选项仍可在配置文件中修改,并用 F4 重新读取。"), _menuNoteStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Space(5f);
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label(MenuText("语言"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
		DrawLanguageButton("Auto", MenuText("自动"));
		DrawLanguageButton("Chinese", "中文");
		DrawLanguageButton("English", "English");
		DrawLanguageButton("Japanese", "日本語");
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		DrawMenuTab(0, "常用");
		DrawMenuTab(1, "季节");
		DrawMenuTab(2, "天空与光照");
		DrawMenuTab(3, "天气与云");
		DrawMenuTab(4, "画面");
		GUILayout.EndHorizontal();
		GUILayout.Space(5f);
		_configMenuScroll = GUILayout.BeginScrollView(_configMenuScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(Mathf.Max(230f, ((Rect)(ref _configMenuRect)).height - 190f)) });
		if (_configMenuTab == 0)
		{
			DrawCommonConfigTab();
		}
		else if (_configMenuTab == 1)
		{
			DrawSeasonConfigTab();
		}
		else if (_configMenuTab == 2)
		{
			DrawSkyConfigTab();
		}
		else if (_configMenuTab == 3)
		{
			DrawWeatherConfigTab();
		}
		else
		{
			DrawGradingConfigTab();
		}
		GUILayout.EndScrollView();
		GUILayout.Space(5f);
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (GUILayout.Button(MenuText("保存并立即应用"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			ApplyHotConfigNow();
		}
		if (GUILayout.Button(MenuText("从配置文件重新读取 (F4)"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			ReloadConfigFromDisk();
		}
		if (GUILayout.Button(MenuText("关闭"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			ToggleConfigMenu();
		}
		GUILayout.EndHorizontal();
		GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _configMenuRect)).width, 28f));
	}

	private void DrawMenuTab(int index, string label)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		bool flag = _configMenuTab == index;
		Color backgroundColor = GUI.backgroundColor;
		if (flag)
		{
			GUI.backgroundColor = new Color(0.4f, 0.68f, 0.88f, 1f);
		}
		if (GUILayout.Button(MenuText(label), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
		{
			_configMenuTab = index;
			_configMenuScroll = Vector2.zero;
		}
		GUI.backgroundColor = backgroundColor;
	}

	private void DrawLanguageButton(string value, string label)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		bool flag = string.Equals(_configMenuLanguage.Value, value, StringComparison.OrdinalIgnoreCase);
		Color backgroundColor = GUI.backgroundColor;
		if (flag)
		{
			GUI.backgroundColor = new Color(0.4f, 0.68f, 0.88f, 1f);
		}
		if (GUILayout.Button(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
		{
			_configMenuLanguage.Value = value;
			((BaseUnityPlugin)this).Config.Save();
			EnsureChineseConfigNotes();
		}
		GUI.backgroundColor = backgroundColor;
	}

	private int GetMenuLanguage()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		switch ((_configMenuLanguage.Value ?? "Auto").Trim().ToLowerInvariant())
		{
		case "english":
		case "en":
			return 1;
		case "japanese":
		case "ja":
			return 2;
		case "chinese":
		case "zh":
			return 0;
		default:
		{
			string text = ((object)Application.systemLanguage).ToString().ToLowerInvariant();
			if (text.IndexOf("japanese") >= 0)
			{
				return 2;
			}
			if (text.IndexOf("chinese") >= 0)
			{
				return 0;
			}
			return 1;
		}
		}
	}

	private string MenuText(string chinese)
	{
		int menuLanguage = GetMenuLanguage();
		if (menuLanguage == 0)
		{
			return chinese;
		}
		switch (chinese)
		{
		case "实时设置":
			if (menuLanguage != 1)
			{
				return "リアルタイム設定";
			}
			return "Live Settings";
		case "修改后会自动保存并立即应用;按 F11 或 Esc 关闭。":
			if (menuLanguage != 1)
			{
				return "変更は自動で保存・反映され