using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using UnityEngine; using UnityEngine.Audio; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace HowToFish.WeatherExpansion; public enum WeatherKind { Clear, Rain, Storm, Snow, Hurricane } public struct WeatherWeights { public int Clear; public int Rain; public int Storm; public int Snow; public int Hurricane; public int Total => Clear + Rain + Storm + Snow + Hurricane; public static WeatherWeights Default => new WeatherWeights { Clear = 40, Rain = 30, Storm = 15, Snow = 10, Hurricane = 5 }; public static WeatherWeights Parse(string text, Action logWarning) { WeatherWeights result = default(WeatherWeights); if (string.IsNullOrEmpty(text)) { return Default; } string[] array = text.Split(new char[2] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); int num = text2.IndexOf(':'); if (num > 0 && num < text2.Length - 1) { string text3 = text2.Substring(0, num).Trim(); string text4 = text2.Substring(num + 1).Trim(); if (!int.TryParse(text4, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2) || result2 < 0) { logWarning?.Invoke("Invalid weight for weather '" + text3 + "': " + text4); } else if (string.Equals(text3, "Clear", StringComparison.OrdinalIgnoreCase)) { result.Clear = result2; } else if (string.Equals(text3, "Rain", StringComparison.OrdinalIgnoreCase)) { result.Rain = result2; } else if (string.Equals(text3, "Storm", StringComparison.OrdinalIgnoreCase)) { result.Storm = result2; } else if (string.Equals(text3, "Snow", StringComparison.OrdinalIgnoreCase)) { result.Snow = result2; } else if (string.Equals(text3, "Hurricane", StringComparison.OrdinalIgnoreCase)) { result.Hurricane = result2; } else { logWarning?.Invoke("Unknown weather kind '" + text3 + "'."); } } } if (result.Total <= 0) { logWarning?.Invoke("Total weather weight was 0; falling back to default weights."); return Default; } return result; } } public static class WeatherScheduler { public static WeatherKind Select(int islandIndex, long weatherSlot, int seed, WeatherWeights weights) { int total = weights.Total; if (total <= 0) { return WeatherKind.Clear; } uint num = HashSlot(islandIndex, weatherSlot, seed, 439041101u); int num2 = (int)(num % (uint)total); if (num2 < weights.Clear) { return WeatherKind.Clear; } num2 -= weights.Clear; if (num2 < weights.Rain) { return WeatherKind.Rain; } num2 -= weights.Rain; if (num2 < weights.Storm) { return WeatherKind.Storm; } num2 -= weights.Storm; if (num2 < weights.Snow) { return WeatherKind.Snow; } return WeatherKind.Hurricane; } public static float WindAngle(int islandIndex, long weatherSlot, int seed) { uint num = HashSlot(islandIndex, weatherSlot, seed, 1584364171u); return (float)(num % 3600) / 10f; } public static bool ShouldTriggerLightning(int islandIndex, long lightningBucket, int seed, int percentChance) { uint num = HashSlot(islandIndex, lightningBucket, seed, 2626518639u); return num % 100 < (uint)percentChance; } public static float LightningPitch(int islandIndex, long lightningBucket, int seed) { uint num = HashSlot(islandIndex, lightningBucket, seed, 866197255u); return 0.88f + (float)(num % 25) * 0.01f; } public static float GameplayVariation(int islandIndex, long pulseBucket, int seed, uint salt) { uint num = HashSlot(islandIndex, pulseBucket, seed, salt); return (float)(num % 1000) / 500f - 1f; } private static uint HashSlot(int islandIndex, long slot, int seed, uint salt) { uint num = 2166136261u; num = (num ^ (uint)islandIndex) * 16777619; num = (num ^ (uint)(int)(slot & 0xFFFFFFFFu)) * 16777619; num = (num ^ (uint)(int)((slot >> 32) & 0xFFFFFFFFu)) * 16777619; num = (num ^ (uint)seed) * 16777619; num = (num ^ salt) * 16777619; num ^= num >> 13; num *= 1540483477; return num ^ (num >> 15); } } internal sealed class GameBridge { private Type _gameInfoType; private Type _waterManagerType; private Type _audioManagerType; private Type _timeManagerType; private PropertyInfo _curCameraProperty; private PropertyInfo _mainLightProperty; private PropertyInfo _islandIndexProperty; private MethodInfo _isUnderWaterMethod; private FieldInfo _fxMixerGroupField; private FieldInfo _timeManagerInstanceField; private MethodInfo _getExactTicksMethod; private bool _reflectionCached; internal void EnsureReflection() { if (!_reflectionCached) { _gameInfoType = Type.GetType("GameInfo, Assembly-CSharp"); if (_gameInfoType != null) { _curCameraProperty = _gameInfoType.GetProperty("CurCamera", BindingFlags.Static | BindingFlags.Public); _mainLightProperty = _gameInfoType.GetProperty("MainLight", BindingFlags.Static | BindingFlags.Public); _islandIndexProperty = _gameInfoType.GetProperty("IslandIndex", BindingFlags.Static | BindingFlags.Public); } _waterManagerType = Type.GetType("WaterManager, Assembly-CSharp"); if (_waterManagerType != null) { _isUnderWaterMethod = _waterManagerType.GetMethod("IsUnderWater", BindingFlags.Static | BindingFlags.Public); } _audioManagerType = Type.GetType("AudioManager, Assembly-CSharp"); if (_audioManagerType != null) { _fxMixerGroupField = _audioManagerType.GetField("Fx", BindingFlags.Static | BindingFlags.Public) ?? _audioManagerType.GetField("fx", BindingFlags.Static | BindingFlags.Public); } _timeManagerType = Type.GetType("FishNet.Managing.Timing.TimeManager, FishNet.Runtime"); if (_timeManagerType != null) { _timeManagerInstanceField = _timeManagerType.GetField("Instance", BindingFlags.Static | BindingFlags.Public) ?? _timeManagerType.GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic); _getExactTicksMethod = _timeManagerType.GetMethod("GetExactTicks", BindingFlags.Instance | BindingFlags.Public); } _reflectionCached = true; } } internal Camera GetCamera() { EnsureReflection(); if (_curCameraProperty != null) { try { object? value = _curCameraProperty.GetValue(null, null); Camera val = (Camera)((value is Camera) ? value : null); if (Object.op_Implicit((Object)(object)val)) { return val; } } catch { } } return Camera.main; } internal Light GetMainLight() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 EnsureReflection(); if (_mainLightProperty != null) { try { object? value = _mainLightProperty.GetValue(null, null); Light val = (Light)((value is Light) ? value : null); if (Object.op_Implicit((Object)(object)val)) { return val; } } catch { } } Light[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if ((int)array[i].type == 1) { return array[i]; } } return null; } internal int GetIslandIndex() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) EnsureReflection(); if (_islandIndexProperty != null) { try { object value = _islandIndexProperty.GetValue(null, null); if (value is int result) { return result; } if (value is int result2) { return result2; } } catch { } } Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (string.IsNullOrEmpty(name)) { return -1; } if (name.IndexOf("Island", StringComparison.OrdinalIgnoreCase) >= 0) { for (int i = 1; i <= 6; i++) { if (name.IndexOf(i.ToString(), StringComparison.OrdinalIgnoreCase) >= 0) { return i - 1; } } return 0; } if (name.IndexOf("Game", StringComparison.OrdinalIgnoreCase) >= 0) { return 0; } return -1; } internal bool IsUnderWater(Vector3 position) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) EnsureReflection(); if (_isUnderWaterMethod != null) { try { if (_isUnderWaterMethod.Invoke(null, new object[1] { position }) is bool result) { return result; } } catch { } } return position.y < 0f; } internal AudioMixerGroup GetFxMixerGroup() { EnsureReflection(); if (_fxMixerGroupField != null) { try { object? value = _fxMixerGroupField.GetValue(null); return (AudioMixerGroup)((value is AudioMixerGroup) ? value : null); } catch { } } return null; } internal double GetSynchronizedTime(out bool isNetworkTime) { EnsureReflection(); if (_timeManagerInstanceField != null && _getExactTicksMethod != null) { try { object value = _timeManagerInstanceField.GetValue(null); if (value != null) { object obj = _getExactTicksMethod.Invoke(value, new object[1] { false }); if (obj is double) { isNetworkTime = true; return (double)obj; } } } catch { } } isNetworkTime = false; return DateTime.UtcNow.Subtract(new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds; } internal bool CanUseLocalGameplayOverride() { return true; } } internal sealed class WeatherEffects : IDisposable { private struct StarData { public Vector3 localPos; public float magnitude; public Color baseColor; public float twinkleFreq; public float twinklePhase; public float baseSize; } private readonly ManualLogSource _log; private GameObject _root; private ParticleSystem _rain; private ParticleSystem _snow; private ParticleSystem _spray; private ParticleSystem _debris; private ParticleSystem _stars; private ParticleSystem _meteors; private Particle[] _starParticles; private List _starDataList = new List(); private float _nextMeteorSpawn = 0f; private WindZone _windZone; private AudioSource _rainAudio; private AudioSource _rainDetailAudio; private AudioSource _windAudio; private AudioSource _thunderAudio; private AudioClip _rainClip; private AudioClip _rainDetailClip; private AudioClip _windClip; private AudioClip[] _thunderClips; private AudioLowPassFilter _rainLowPass; private AudioLowPassFilter _rainDetailLowPass; private AudioLowPassFilter _windLowPass; private AudioLowPassFilter _thunderLowPass; private Texture2D _rainTexture; private Texture2D _softTexture; private Texture2D _debrisTexture; private Texture2D _starTexture; private Material _rainMaterial; private Material _softMaterial; private Material _debrisMaterial; private Material _starMaterial; private Volume _volume; private VolumeProfile _volumeProfile; private ColorAdjustments _colorAdjustments; private bool _created; private bool _creationFailed; private bool _active; private long _lastLightningBucket = long.MinValue; private float _flashAge = 99f; private double _pendingThunderTime = double.PositiveInfinity; private int _pendingThunderIndex; private float _pendingThunderVolume; private AudioMixerGroup _mixerGroup; internal float RainAmount { get; private set; } internal float SnowAmount { get; private set; } internal float WindAmount { get; private set; } internal float CloudAmount { get; private set; } internal float LightningAmount { get; private set; } internal WeatherEffects(ManualLogSource log) { _log = log; } internal void Tick(Camera camera, WeatherKind weather, float transitionSeconds, float windAngle, float dayFactor, float nightExposure, float effectIntensity, float particleQuality, float audioVolume, AudioMixerGroup mixerGroup, double synchronizedTime, int islandIndex, int seed, bool underwater, bool enableStars, float starBrightness, float midnightPeak) { if (EnsureCreated()) { SetActive(camera); BindMixerGroup(mixerGroup); GetTargets(weather, out var rain, out var snow, out var wind, out var cloud); float num = Time.unscaledDeltaTime / Mathf.Max(0.1f, transitionSeconds); RainAmount = Mathf.MoveTowards(RainAmount, rain, num); SnowAmount = Mathf.MoveTowards(SnowAmount, snow, num); WindAmount = Mathf.MoveTowards(WindAmount, wind, num); CloudAmount = Mathf.MoveTowards(CloudAmount, cloud, num); UpdateLightning(weather, synchronizedTime, islandIndex, seed, audioVolume, underwater); UpdateEmitterPositions(camera, windAngle); UpdateParticles(windAngle, effectIntensity, particleQuality, underwater); UpdateStars(camera, dayFactor, starBrightness, weather, enableStars, midnightPeak); UpdateAudio(audioVolume, underwater); UpdatePostProcessing(dayFactor, nightExposure, effectIntensity, midnightPeak); UpdateWindZone(windAngle, effectIntensity); } } internal void FadeOut(float transitionSeconds) { if (_created) { float num = Time.unscaledDeltaTime / Mathf.Max(0.1f, transitionSeconds); RainAmount = Mathf.MoveTowards(RainAmount, 0f, num); SnowAmount = Mathf.MoveTowards(SnowAmount, 0f, num); WindAmount = Mathf.MoveTowards(WindAmount, 0f, num); CloudAmount = Mathf.MoveTowards(CloudAmount, 0f, num); LightningAmount = 0f; _lastLightningBucket = long.MinValue; _flashAge = 99f; _pendingThunderTime = double.PositiveInfinity; _pendingThunderVolume = 0f; UpdateParticleRate(_rain, 0f); UpdateParticleRate(_snow, 0f); UpdateParticleRate(_spray, 0f); UpdateParticleRate(_debris, 0f); _rain.Clear(true); _snow.Clear(true); _spray.Clear(true); _debris.Clear(true); if ((Object)(object)_stars != (Object)null) { _stars.Clear(); } if ((Object)(object)_meteors != (Object)null) { _meteors.Clear(); } _rainAudio.volume = Mathf.MoveTowards(_rainAudio.volume, 0f, Time.unscaledDeltaTime); _rainDetailAudio.volume = Mathf.MoveTowards(_rainDetailAudio.volume, 0f, Time.unscaledDeltaTime); _windAudio.volume = Mathf.MoveTowards(_windAudio.volume, 0f, Time.unscaledDeltaTime); _volume.weight = Mathf.MoveTowards(_volume.weight, 0f, Time.unscaledDeltaTime * 2f); _windZone.windMain = 0f; } } internal void SetInactiveImmediate() { if (_created) { RainAmount = 0f; SnowAmount = 0f; WindAmount = 0f; CloudAmount = 0f; LightningAmount = 0f; _lastLightningBucket = long.MinValue; _flashAge = 99f; _pendingThunderTime = double.PositiveInfinity; _pendingThunderVolume = 0f; UpdateParticleRate(_rain, 0f); UpdateParticleRate(_snow, 0f); UpdateParticleRate(_spray, 0f); UpdateParticleRate(_debris, 0f); _rain.Clear(true); _snow.Clear(true); _spray.Clear(true); _debris.Clear(true); if ((Object)(object)_stars != (Object)null) { _stars.Clear(); } if ((Object)(object)_meteors != (Object)null) { _meteors.Clear(); } _rainAudio.Stop(); _rainDetailAudio.Stop(); _windAudio.Stop(); _thunderAudio.Stop(); _rainAudio.volume = 0f; _rainDetailAudio.volume = 0f; _windAudio.volume = 0f; _thunderAudio.volume = 0f; _volume.weight = 0f; _windZone.windMain = 0f; _active = false; _root.SetActive(false); } } private bool EnsureCreated() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (_created) { return true; } if (_creationFailed) { return false; } try { _root = new GameObject("WeatherExpansion_EffectsRoot"); ((Object)_root).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)_root); CreateMaterials(); CreateParticles(); CreateStarCanopy(); CreateAudio(); CreatePostProcessing(); _created = true; _active = true; return true; } catch (Exception ex) { _creationFailed = true; _log.LogError((object)("Failed to create weather effects: " + ex)); DestroyResources(); return false; } } private void SetActive(Camera camera) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!_active) { _root.SetActive(true); _rainAudio.Play(); _rainDetailAudio.Play(); _windAudio.Play(); _active = true; } if (Object.op_Implicit((Object)(object)camera)) { _root.transform.position = ((Component)camera).transform.position; } } private void BindMixerGroup(AudioMixerGroup mixerGroup) { if (!((Object)(object)_mixerGroup == (Object)(object)mixerGroup)) { _mixerGroup = mixerGroup; _rainAudio.outputAudioMixerGroup = mixerGroup; _rainDetailAudio.outputAudioMixerGroup = mixerGroup; _windAudio.outputAudioMixerGroup = mixerGroup; _thunderAudio.outputAudioMixerGroup = mixerGroup; } } private static void GetTargets(WeatherKind weather, out float rain, out float snow, out float wind, out float cloud) { switch (weather) { case WeatherKind.Rain: rain = 0.58f; snow = 0f; wind = 0.35f; cloud = 0.65f; break; case WeatherKind.Storm: rain = 1f; snow = 0f; wind = 0.85f; cloud = 1f; break; case WeatherKind.Snow: rain = 0f; snow = 0.9f; wind = 0.4f; cloud = 0.7f; break; case WeatherKind.Hurricane: rain = 0.95f; snow = 0f; wind = 1f; cloud = 1f; break; default: rain = 0f; snow = 0f; wind = 0f; cloud = 0f; break; } } private void UpdateEmitterPositions(Camera camera, float windAngle) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)camera)) { Vector3 position = ((Component)camera).transform.position; Vector3 forward = ((Component)camera).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 0.001f) { ((Vector3)(ref forward)).Normalize(); } else { forward = Vector3.forward; } float num = windAngle * ((float)Math.PI / 180f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num)); Vector3 val2 = position + forward * 4.5f; ((Component)_rain).transform.position = val2 + Vector3.up * 13f - val * (WindAmount * 3.5f); ((Component)_rain).transform.rotation = Quaternion.Euler(80f - WindAmount * 28f, windAngle + 180f, 0f); ((Component)_snow).transform.position = val2 + Vector3.up * 11f; ((Component)_snow).transform.rotation = Quaternion.Euler(75f - WindAmount * 18f, windAngle + 180f, 0f); ((Component)_spray).transform.position = position + val * 5f + Vector3.up * 1.8f; ((Component)_spray).transform.rotation = Quaternion.Euler(0f, windAngle, 0f); ((Component)_debris).transform.position = position - val * 6f + Vector3.up * 2.2f; ((Component)_debris).transform.rotation = Quaternion.Euler(0f, windAngle, 0f); if ((Object)(object)_stars != (Object)null) { ((Component)_stars).transform.position = position; } if ((Object)(object)_meteors != (Object)null) { ((Component)_meteors).transform.position = position; } } } private void UpdateParticles(float windAngle, float intensity, float quality, bool underwater) { if (underwater) { UpdateParticleRate(_rain, 0f); UpdateParticleRate(_snow, 0f); UpdateParticleRate(_spray, 0f); UpdateParticleRate(_debris, 0f); return; } float rate = Mathf.Pow(RainAmount, 1.25f) * 1150f * quality * intensity; float rate2 = Mathf.Pow(SnowAmount, 1.15f) * 360f * quality * intensity; float rate3 = ((WindAmount > 0.45f) ? ((WindAmount - 0.45f) / 0.55f) : 0f) * ((RainAmount > 0.2f) ? 240f : 60f) * quality * intensity; float rate4 = ((WindAmount > 0.65f) ? ((WindAmount - 0.65f) / 0.35f) : 0f) * 35f * quality * intensity; UpdateParticleRate(_rain, rate); UpdateParticleRate(_snow, rate2); UpdateParticleRate(_spray, rate3); UpdateParticleRate(_debris, rate4); } private void CreateStarCanopy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = new GameObject("Weather_StarCanopy"); val.transform.SetParent(_root.transform, false); _stars = val.AddComponent(); MainModule main = _stars.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).maxParticles = 800; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = _stars.emission; ((EmissionModule)(ref emission)).enabled = false; ParticleSystemRenderer component = val.GetComponent(); ((Renderer)component).material = _starMaterial; component.renderMode = (ParticleSystemRenderMode)0; ((Renderer)component).sortingOrder = -95; InitStarField(); _starParticles = (Particle[])(object)new Particle[_starDataList.Count]; _stars.SetParticles(_starParticles, _starDataList.Count); GameObject val2 = new GameObject("Weather_Meteors"); val2.transform.SetParent(_root.transform, false); _meteors = val2.AddComponent(); MainModule main2 = _meteors.main; ((MainModule)(ref main2)).loop = true; ((MainModule)(ref main2)).playOnAwake = true; ((MainModule)(ref main2)).maxParticles = 30; ((MainModule)(ref main2)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main2)).startLifetime = new MinMaxCurve(2f, 3.2f); ((MainModule)(ref main2)).startSpeed = new MinMaxCurve(50f, 85f); ((MainModule)(ref main2)).startSize = new MinMaxCurve(1.5f, 3.2f); ((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(new Color(1f, 1f, 1f, 1f)); EmissionModule emission2 = _meteors.emission; ((EmissionModule)(ref emission2)).enabled = true; ((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(0f); ParticleSystemRenderer component2 = val2.GetComponent(); ((Renderer)component2).material = _starMaterial; component2.renderMode = (ParticleSystemRenderMode)1; component2.velocityScale = 0.035f; component2.lengthScale = 2f; ((Renderer)component2).sortingOrder = -94; } catch (Exception ex) { _log.LogWarning((object)("Star canopy initialization error: " + ex.Message)); } } private void InitStarField() { //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) _starDataList.Clear(); Random random = new Random(4001890); int num = 1200; float num2 = 220f; Color baseColor = default(Color); for (int i = 0; i < num; i++) { float num3 = (float)random.NextDouble(); float num4 = (float)random.NextDouble(); float num5 = num3 * 2f * (float)Math.PI; float num6 = Mathf.Acos(1f - num4 * 0.94f); float num7 = Mathf.Sin(num6); float num8 = num2 * num7 * Mathf.Cos(num5); float num9 = num2 * Mathf.Cos(num6) + 15f; float num10 = num2 * num7 * Mathf.Sin(num5); float num11 = (float)random.NextDouble(); float twinkleFreq = 0.8f + (float)random.NextDouble() * 2.5f; float twinklePhase = (float)random.NextDouble() * (float)Math.PI * 2f; double num12 = random.NextDouble(); if (num12 < 0.7) { ((Color)(ref baseColor))..ctor(1f, 1f, 1f, 1f); } else if (num12 < 0.88) { ((Color)(ref baseColor))..ctor(0.92f, 0.96f, 1f, 1f); } else { ((Color)(ref baseColor))..ctor(1f, 0.98f, 0.92f, 1f); } float baseSize = Mathf.Lerp(2.2f, 5.8f, Mathf.Pow(num11, 1.3f)); _starDataList.Add(new StarData { localPos = new Vector3(num8, num9, num10), magnitude = num11, baseColor = baseColor, twinkleFreq = twinkleFreq, twinklePhase = twinklePhase, baseSize = baseSize }); } } private void UpdateStars(Camera camera, float dayFactor, float starBrightness, WeatherKind weather, bool enableStars, float midnightPeak) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_stars == (Object)null || !enableStars || !Object.op_Implicit((Object)(object)camera)) { if ((Object)(object)_stars != (Object)null) { _stars.Clear(); } if ((Object)(object)_meteors != (Object)null) { UpdateParticleRate(_meteors, 0f); } return; } float num = Mathf.Clamp01((0.55f - dayFactor) / 0.4f); float num2 = weather switch { WeatherKind.Snow => 0.4f, WeatherKind.Clear => 1f, _ => 0f, }; float num3 = starBrightness * 3.5f * (1f + 0.65f * midnightPeak); float num4 = num * num2 * num3; if (num4 > 0.005f && _starDataList.Count > 0) { Vector3 position = ((Component)camera).transform.position; float time = Time.time; Quaternion val = Quaternion.Euler(0.02f * time, 25f, 0f); if (_starParticles == null || _starParticles.Length != _starDataList.Count) { _starParticles = (Particle[])(object)new Particle[_starDataList.Count]; } Color val2 = default(Color); for (int i = 0; i < _starDataList.Count; i++) { StarData starData = _starDataList[i]; float num5 = Mathf.Lerp(0.7f, 0.05f, starData.magnitude); float num6 = Mathf.Clamp01((num - num5) / 0.15f); if (num6 > 0f) { float num7 = 0.8f + 0.2f * Mathf.Sin(time * starData.twinkleFreq + starData.twinklePhase); float num8 = num6 * num7 * num2 * num3; ((Color)(ref val2))..ctor(Mathf.Min(4f, starData.baseColor.r * num8), Mathf.Min(4f, starData.baseColor.g * num8), Mathf.Min(4f, starData.baseColor.b * num8), Mathf.Clamp01(num8)); ((Particle)(ref _starParticles[i])).position = position + val * starData.localPos; ((Particle)(ref _starParticles[i])).startColor = Color32.op_Implicit(val2); ((Particle)(ref _starParticles[i])).startSize = starData.baseSize * (1f + 0.2f * midnightPeak); } else { ((Particle)(ref _starParticles[i])).startColor = Color32.op_Implicit(new Color(0f, 0f, 0f, 0f)); } } _stars.SetParticles(_starParticles, _starDataList.Count); if ((Object)(object)_meteors != (Object)null && num > 0.2f && weather == WeatherKind.Clear) { if (Time.time >= _nextMeteorSpawn) { float num9 = Mathf.Lerp(3.2f, 1.4f, midnightPeak); _nextMeteorSpawn = Time.time + Random.Range(num9 * 0.7f, num9 * 1.4f); SpawnShootingStar(position); } } else if ((Object)(object)_meteors != (Object)null) { UpdateParticleRate(_meteors, 0f); } } else { _stars.Clear(); if ((Object)(object)_meteors != (Object)null) { UpdateParticleRate(_meteors, 0f); } } } private void SpawnShootingStar(Vector3 camPos) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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) //IL_0135: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_meteors == (Object)null)) { float num = Random.Range(0f, 360f) * ((float)Math.PI / 180f); float num2 = Random.Range(90f, 160f); float num3 = Random.Range(70f, 140f); Vector3 position = camPos + new Vector3(Mathf.Cos(num) * num2, num3, Mathf.Sin(num) * num2); float num4 = Random.Range(65f, 105f); float num5 = Random.Range(0f, 360f) * ((float)Math.PI / 180f); Vector3 val = new Vector3(Mathf.Cos(num5), -0.4f, Mathf.Sin(num5)); Vector3 normalized = ((Vector3)(ref val)).normalized; EmitParams val2 = default(EmitParams); ((EmitParams)(ref val2)).position = position; ((EmitParams)(ref val2)).velocity = normalized * num4; ((EmitParams)(ref val2)).startLifetime = Random.Range(1.6f, 2.6f); ((EmitParams)(ref val2)).startSize = Random.Range(4f, 7.5f); ((EmitParams)(ref val2)).startColor = Color32.op_Implicit(new Color(3f, 3f, 3f, 1f)); _meteors.Emit(val2, 1); } } private void UpdateLightning(WeatherKind weather, double synchronizedTime, int islandIndex, int seed, float audioVolume, bool underwater) { if (weather != WeatherKind.Storm && weather != WeatherKind.Hurricane) { LightningAmount = 0f; _lastLightningBucket = long.MinValue; _flashAge = 99f; _pendingThunderTime = double.PositiveInfinity; return; } long num = (long)Math.Floor(synchronizedTime / 7.5); if (num != _lastLightningBucket) { _lastLightningBucket = num; int percentChance = ((weather == WeatherKind.Storm) ? 42 : 58); if (WeatherScheduler.ShouldTriggerLightning(islandIndex, num, seed, percentChance)) { _flashAge = 0f; _pendingThunderTime = synchronizedTime + 0.35 + (double)(num % 5) * 0.18; _pendingThunderIndex = (int)(num % (uint)_thunderClips.Length); _pendingThunderVolume = Mathf.Clamp01(0.72f + (float)(num % 4) * 0.08f) * audioVolume; _thunderAudio.pitch = WeatherScheduler.LightningPitch(islandIndex, num, seed); } } _flashAge += Time.unscaledDeltaTime; if (_flashAge < 0.28f) { float num2 = _flashAge / 0.28f; float num3 = 1f - Mathf.Clamp01(num2 / 0.35f); float num4 = ((num2 > 0.4f) ? (1f - Mathf.Clamp01((num2 - 0.4f) / 0.6f)) : 0f); LightningAmount = Mathf.Max(num3, num4 * 0.65f); } else { LightningAmount = 0f; } if (!underwater && synchronizedTime >= _pendingThunderTime) { _pendingThunderTime = double.PositiveInfinity; if (_thunderClips != null && _thunderClips.Length > 0 && _pendingThunderVolume > 0.001f) { _thunderAudio.PlayOneShot(_thunderClips[_pendingThunderIndex], _pendingThunderVolume); } } } private void UpdateAudio(float audioVolume, bool underwater) { float num = RainAmount * audioVolume; float num2 = WindAmount * audioVolume; _rainAudio.volume = Mathf.MoveTowards(_rainAudio.volume, num * 0.9f, Time.unscaledDeltaTime * 2f); _rainDetailAudio.volume = Mathf.MoveTowards(_rainDetailAudio.volume, num * 0.62f, Time.unscaledDeltaTime * 2f); _windAudio.volume = Mathf.MoveTowards(_windAudio.volume, num2 * 0.92f, Time.unscaledDeltaTime * 2f); float cutoffFrequency = (underwater ? 950f : 22000f); _rainLowPass.cutoffFrequency = cutoffFrequency; _rainDetailLowPass.cutoffFrequency = cutoffFrequency; _windLowPass.cutoffFrequency = cutoffFrequency; _thunderLowPass.cutoffFrequency = cutoffFrequency; } private void UpdatePostProcessing(float dayFactor, float nightExposure, float effectIntensity, float midnightPeak) { //IL_011d: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_colorAdjustments)) { float num = Mathf.Lerp(nightExposure, 0f, dayFactor); float num2 = -0.75f * midnightPeak * (1f - dayFactor); float num3 = (0f - CloudAmount) * 0.65f * effectIntensity; float num4 = LightningAmount * 1.55f * effectIntensity; ((VolumeParameter)(object)_colorAdjustments.postExposure).value = num + num2 + num3 + num4; ((VolumeParameter)(object)_colorAdjustments.contrast).value = Mathf.Lerp(18f, 0f, dayFactor) + CloudAmount * 8f; ((VolumeParameter)(object)_colorAdjustments.saturation).value = Mathf.Lerp(-22f, 0f, dayFactor) - CloudAmount * 18f; Color val = default(Color); ((Color)(ref val))..ctor(0.85f, 0.9f, 0.98f, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.35f, 0.44f, 0.6f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.55f, 0.68f, 0.88f, 1f); Color val4 = Color.Lerp(val3, val2, midnightPeak); Color val5 = Color.Lerp(val4, Color.white, dayFactor); val5 = Color.Lerp(val5, val, CloudAmount * 0.6f); ((VolumeParameter)(object)_colorAdjustments.colorFilter).value = val5; _volume.weight = Mathf.MoveTowards(_volume.weight, 1f, Time.unscaledDeltaTime * 3f); } } private void UpdateWindZone(float windAngle, float effectIntensity) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_windZone)) { ((Component)_windZone).transform.rotation = Quaternion.Euler(0f, windAngle, 0f); _windZone.windMain = WindAmount * 1.6f * effectIntensity; _windZone.windTurbulence = WindAmount * 1.2f * effectIntensity; _windZone.windPulseMagnitude = WindAmount * 0.65f * effectIntensity; _windZone.windPulseFrequency = 0.18f + WindAmount * 0.45f; } } private void CreateMaterials() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Universal Render Pipeline/Particles/Unlit") ?? Shader.Find("UI/Default") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Mobile/Particles/Alpha Blended"); _rainTexture = CreateRainTexture(); _softTexture = CreateSoftCircleTexture(); _debrisTexture = CreateDebrisTexture(); _starTexture = CreateStarTexture(); Material val2 = new Material(val); ((Object)val2).hideFlags = (HideFlags)61; val2.mainTexture = (Texture)(object)_rainTexture; _rainMaterial = val2; Material val3 = new Material(val); ((Object)val3).hideFlags = (HideFlags)61; val3.mainTexture = (Texture)(object)_softTexture; _softMaterial = val3; Material val4 = new Material(val); ((Object)val4).hideFlags = (HideFlags)61; val4.mainTexture = (Texture)(object)_debrisTexture; _debrisMaterial = val4; Material val5 = new Material(val); ((Object)val5).hideFlags = (HideFlags)61; val5.mainTexture = (Texture)(object)_starTexture; _starMaterial = val5; SetupMaterialBlendMode(_rainMaterial); SetupMaterialBlendMode(_softMaterial); SetupMaterialBlendMode(_debrisMaterial); SetupStarMaterialBlendMode(_starMaterial); } private static void SetupMaterialBlendMode(Material material) { if (Object.op_Implicit((Object)(object)material)) { if (material.HasProperty("_Surface")) { material.SetFloat("_Surface", 1f); } if (material.HasProperty("_Blend")) { material.SetFloat("_Blend", 0f); } if (material.HasProperty("_SrcBlend")) { material.SetFloat("_SrcBlend", 5f); } if (material.HasProperty("_DstBlend")) { material.SetFloat("_DstBlend", 10f); } if (material.HasProperty("_ZWrite")) { material.SetFloat("_ZWrite", 0f); } if (material.HasProperty("_Cull")) { material.SetFloat("_Cull", 0f); } material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); material.EnableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.DisableKeyword("_ALPHAMODULATE_ON"); material.DisableKeyword("_SURFACE_TYPE_OPAQUE"); material.renderQueue = 3050; } } private static void SetupStarMaterialBlendMode(Material material) { if (Object.op_Implicit((Object)(object)material)) { if (material.HasProperty("_Surface")) { material.SetFloat("_Surface", 1f); } if (material.HasProperty("_Blend")) { material.SetFloat("_Blend", 1f); } if (material.HasProperty("_SrcBlend")) { material.SetFloat("_SrcBlend", 5f); } if (material.HasProperty("_DstBlend")) { material.SetFloat("_DstBlend", 1f); } if (material.HasProperty("_ZWrite")) { material.SetFloat("_ZWrite", 0f); } if (material.HasProperty("_Cull")) { material.SetFloat("_Cull", 0f); } material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); material.EnableKeyword("_ALPHAPREMULTIPLY_ON"); material.DisableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_SURFACE_TYPE_OPAQUE"); material.renderQueue = 3100; } } private void CreateParticles() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Expected O, but got Unknown _rain = CreateEmitter("Rain", _rainMaterial, (ParticleSystemRenderMode)1, 2200); MainModule main = _rain.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.45f, 0.65f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(32f, 44f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.08f, 0.14f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.85f, 0.92f, 1f, 0.68f)); ShapeModule shape = _rain.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape)).scale = new Vector3(28f, 28f, 1f); ParticleSystemRenderer component = ((Component)_rain).GetComponent(); component.lengthScale = 3.2f; component.velocityScale = 0.05f; _snow = CreateEmitter("Snow", _softMaterial, (ParticleSystemRenderMode)0, 1400); MainModule main2 = _snow.main; ((MainModule)(ref main2)).startLifetime = new MinMaxCurve(3.5f, 5.5f); ((MainModule)(ref main2)).startSpeed = new MinMaxCurve(2.2f, 4.8f); ((MainModule)(ref main2)).startSize = new MinMaxCurve(0.12f, 0.28f); ((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(new Color(0.96f, 0.98f, 1f, 0.85f)); ShapeModule shape2 = _snow.shape; ((ShapeModule)(ref shape2)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape2)).scale = new Vector3(32f, 32f, 6f); NoiseModule noise = _snow.noise; ((NoiseModule)(ref noise)).enabled = true; ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.85f); ((NoiseModule)(ref noise)).frequency = 0.25f; _spray = CreateEmitter("Spray", _softMaterial, (ParticleSystemRenderMode)0, 900); MainModule main3 = _spray.main; ((MainModule)(ref main3)).startLifetime = new MinMaxCurve(0.8f, 1.4f); ((MainModule)(ref main3)).startSpeed = new MinMaxCurve(10f, 22f); ((MainModule)(ref main3)).startSize = new MinMaxCurve(0.6f, 1.8f); ((MainModule)(ref main3)).startColor = MinMaxGradient.op_Implicit(new Color(0.85f, 0.92f, 1f, 0.24f)); ShapeModule shape3 = _spray.shape; ((ShapeModule)(ref shape3)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape3)).angle = 22f; ((ShapeModule)(ref shape3)).radius = 4f; _debris = CreateEmitter("Debris", _debrisMaterial, (ParticleSystemRenderMode)0, 220); MainModule main4 = _debris.main; ((MainModule)(ref main4)).startLifetime = new MinMaxCurve(1.2f, 2.2f); ((MainModule)(ref main4)).startSpeed = new MinMaxCurve(14f, 28f); ((MainModule)(ref main4)).startSize = new MinMaxCurve(0.15f, 0.35f); ((MainModule)(ref main4)).startColor = MinMaxGradient.op_Implicit(new Color(0.35f, 0.45f, 0.3f, 0.8f)); ShapeModule shape4 = _debris.shape; ((ShapeModule)(ref shape4)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape4)).scale = new Vector3(18f, 6f, 12f); GameObject val = new GameObject("WindZone"); val.transform.SetParent(_root.transform, false); _windZone = val.AddComponent(); _windZone.mode = (WindZoneMode)0; } private ParticleSystem CreateEmitter(string name, Material material, ParticleSystemRenderMode mode, int maxParticles) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(_root.transform, false); ParticleSystem val2 = val.AddComponent(); MainModule main = val2.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = true; ((MainModule)(ref main)).maxParticles = maxParticles; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ParticleSystemRenderer component = val.GetComponent(); ((Renderer)component).material = material; component.renderMode = mode; ((Renderer)component).sortingOrder = 50; return val2; } private void CreateAudio() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("WeatherAudio"); val.transform.SetParent(_root.transform, false); _rainAudio = CreateAudioSource(val, "RainAudio", loop: true); _rainDetailAudio = CreateAudioSource(val, "RainDetailAudio", loop: true); _windAudio = CreateAudioSource(val, "WindAudio", loop: true); _thunderAudio = CreateAudioSource(val, "ThunderAudio", loop: false); _rainLowPass = ((Component)_rainAudio).gameObject.AddComponent(); _rainDetailLowPass = ((Component)_rainDetailAudio).gameObject.AddComponent(); _windLowPass = ((Component)_windAudio).gameObject.AddComponent(); _thunderLowPass = ((Component)_thunderAudio).gameObject.AddComponent(); _rainClip = SynthesizeRainLoop(44100, 6f); _rainDetailClip = SynthesizeRainDetailLoop(44100, 5f); _windClip = SynthesizeWindLoop(44100, 7f); _thunderClips = (AudioClip[])(object)new AudioClip[3] { SynthesizeThunder(44100, 3.8f, 0), SynthesizeThunder(44100, 4.4f, 1), SynthesizeThunder(44100, 5.2f, 2) }; _rainAudio.clip = _rainClip; _rainDetailAudio.clip = _rainDetailClip; _windAudio.clip = _windClip; } private AudioSource CreateAudioSource(GameObject parent, string name, bool loop) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent.transform, false); AudioSource val2 = val.AddComponent(); val2.loop = loop; val2.playOnAwake = false; val2.spatialBlend = 0f; val2.volume = 0f; return val2; } private void CreatePostProcessing() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("PostProcessingVolume"); val.transform.SetParent(_root.transform, false); _volume = val.AddComponent(); _volume.isGlobal = true; _volume.weight = 0f; _volumeProfile = ScriptableObject.CreateInstance(); ((Object)_volumeProfile).hideFlags = (HideFlags)61; _volume.profile = _volumeProfile; _colorAdjustments = _volumeProfile.Add(true); ((VolumeComponent)_colorAdjustments).active = true; ((VolumeParameter)_colorAdjustments.postExposure).overrideState = true; ((VolumeParameter)_colorAdjustments.contrast).overrideState = true; ((VolumeParameter)_colorAdjustments.colorFilter).overrideState = true; ((VolumeParameter)_colorAdjustments.saturation).overrideState = true; } private static Texture2D CreateRainTexture() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) int num = 4; int num2 = 32; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[num * num2]; for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)(num2 - 1); float num4 = Mathf.SmoothStep(0f, 1f, num3) * (1f - Mathf.Pow(num3, 6f)); for (int j = 0; j < num; j++) { float num5 = 1f - Mathf.Abs(((float)j - (float)(num - 1) / 2f) / ((float)(num - 1) / 2f)); num5 = Mathf.Clamp01(num5); ref Color reference = ref array[i * num + j]; reference = new Color(1f, 1f, 1f, num4 * num5); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D CreateSoftCircleTexture() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) int num = 64; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[num * num]; float num2 = (float)(num - 1) / 2f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)) / num2; float num4 = Mathf.Clamp01(1f - num3); num4 = Mathf.Pow(num4, 2.2f); ref Color reference = ref array[i * num + j]; reference = new Color(1f, 1f, 1f, num4); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D CreateDebrisTexture() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) int num = 32; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[num * num]; float num2 = (float)(num - 1) / 2f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)) / num2; float num4 = Mathf.Clamp01(1f - num3); num4 = Mathf.Pow(num4, 1.8f); ref Color reference = ref array[i * num + j]; reference = new Color(1f, 1f, 1f, num4); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D CreateStarTexture() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) int num = 64; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[num * num]; float num2 = (float)(num - 1) / 2f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = ((float)j - num2) / num2; float num4 = ((float)i - num2) / num2; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); float num6 = Mathf.Clamp01(1f - num5); float num7 = Mathf.Pow(num6, 3.5f) * 1.6f; float num8 = Mathf.Pow(num6, 1.4f) * 0.45f; float num9 = Mathf.Pow(Mathf.Clamp01(1f - Mathf.Abs(num3)), 16f) * Mathf.Pow(Mathf.Clamp01(1f - Mathf.Abs(num4 * 3.2f)), 2.2f); float num10 = Mathf.Pow(Mathf.Clamp01(1f - Mathf.Abs(num4)), 16f) * Mathf.Pow(Mathf.Clamp01(1f - Mathf.Abs(num3 * 3.2f)), 2.2f); float num11 = (num9 + num10) * 0.4f; float num12 = Mathf.Clamp01(num7 + num8 + num11); ref Color reference = ref array[i * num + j]; reference = new Color(1f, 1f, 1f, num12); } } val.SetPixels(array); val.Apply(); return val; } private static AudioClip SynthesizeRainLoop(int sampleRate, float lengthSeconds) { int num = Mathf.RoundToInt((float)sampleRate * lengthSeconds); int num2 = 2; int num3 = num + sampleRate; float[] array = new float[num3 * num2]; Random random = new Random(1337); float num4 = 0f; float num5 = 0f; for (int i = 0; i < num3; i++) { float num6 = (float)(random.NextDouble() * 2.0 - 1.0); float num7 = (float)(random.NextDouble() * 2.0 - 1.0); num4 = num4 * 0.94f + num6 * 0.06f; num5 = num5 * 0.94f + num7 * 0.06f; array[i * 2] = Mathf.Clamp(num4 * 1.8f + num6 * 0.15f, -0.95f, 0.95f); array[i * 2 + 1] = Mathf.Clamp(num5 * 1.8f + num7 * 0.15f, -0.95f, 0.95f); } float[] array2 = BuildLoop(array, num, num2, sampleRate / 2); AudioClip val = AudioClip.Create("WeatherExpansion.RainLoop", num, num2, sampleRate, false); ((Object)val).hideFlags = (HideFlags)61; val.SetData(array2, 0); return val; } private static AudioClip SynthesizeRainDetailLoop(int sampleRate, float lengthSeconds) { int num = Mathf.RoundToInt((float)sampleRate * lengthSeconds); int num2 = 2; int num3 = num + sampleRate; float[] array = new float[num3 * num2]; Random random = new Random(2442); for (int i = 0; i < num3; i++) { array[i * 2 + 1] = (array[i * 2] = ((random.NextDouble() < 0.008) ? ((float)(random.NextDouble() * 1.6 - 0.8)) : 0f)) * 0.85f; } float[] array2 = BuildLoop(array, num, num2, sampleRate / 2); AudioClip val = AudioClip.Create("WeatherExpansion.RainDetailLoop", num, num2, sampleRate, false); ((Object)val).hideFlags = (HideFlags)61; val.SetData(array2, 0); return val; } private static AudioClip SynthesizeWindLoop(int sampleRate, float lengthSeconds) { int num = Mathf.RoundToInt((float)sampleRate * lengthSeconds); int num2 = 2; int num3 = num + sampleRate; float[] array = new float[num3 * num2]; Random random = new Random(3553); float num4 = 0f; float num5 = 0f; for (int i = 0; i < num3; i++) { float num6 = (float)i / (float)sampleRate; float num7 = 0.75f + 0.25f * Mathf.Sin(num6 * 1.4f); float num8 = (float)(random.NextDouble() * 2.0 - 1.0); float num9 = (float)(random.NextDouble() * 2.0 - 1.0); num4 = num4 * 0.985f + num8 * 0.015f; num5 = num5 * 0.985f + num9 * 0.015f; array[i * 2] = Mathf.Clamp(num4 * 2.8f * num7, -0.95f, 0.95f); array[i * 2 + 1] = Mathf.Clamp(num5 * 2.8f * num7, -0.95f, 0.95f); } float[] array2 = BuildLoop(array, num, num2, sampleRate / 2); AudioClip val = AudioClip.Create("WeatherExpansion.WindLoop", num, num2, sampleRate, false); ((Object)val).hideFlags = (HideFlags)61; val.SetData(array2, 0); return val; } private static AudioClip SynthesizeThunder(int sampleRate, float lengthSeconds, int variant) { int num = Mathf.RoundToInt((float)sampleRate * lengthSeconds); int num2 = 2; float[] array = new float[num * num2]; Random random = new Random(4664 + variant * 101); float num3 = 0f; float num4 = 0f; int num5 = Mathf.RoundToInt((float)sampleRate * (0.24f + (float)variant * 0.06f)); float num6 = 34f + (float)variant * 8f; for (int i = 0; i < num; i++) { float num7 = (float)i / (float)sampleRate; float num8 = Mathf.Exp((0f - num7) * (1.1f + (float)variant * 0.2f)); float num9 = (float)(random.NextDouble() * 2.0 - 1.0); float num10 = (float)(random.NextDouble() * 2.0 - 1.0); num3 = num3 * 0.982f + num9 * 0.018f; num4 = num4 * 0.982f + num10 * 0.018f; float num11 = Mathf.Sin(num7 * (float)Math.PI * 2f * num6) * 0.18f + Mathf.Sin(num7 * (float)Math.PI * 2f * (num6 * 0.57f)) * 0.11f; float num12 = ((num7 < 0.085f) ? (1f - num7 / 0.085f) : 0f); float num13 = (num3 * 2.4f + num11 + num9 * num12 * 0.78f) * num8; float num14 = (num4 * 2.4f + num11 + num10 * num12 * 0.78f) * num8; if (i >= num5) { num13 += array[(i - num5) * num2 + 1] * 0.18f; num14 += array[(i - num5) * num2] * 0.18f; } array[i * num2] = Mathf.Clamp(num13, -0.96f, 0.96f); array[i * num2 + 1] = Mathf.Clamp(num14, -0.96f, 0.96f); } AudioClip val = AudioClip.Create("WeatherExpansion.Thunder" + (variant + 1), num, num2, sampleRate, false); ((Object)val).hideFlags = (HideFlags)61; val.SetData(array, 0); return val; } private static float[] BuildLoop(float[] raw, int frames, int channels, int fadeFrames) { float[] array = new float[frames * channels]; Array.Copy(raw, array, array.Length); int num = raw.Length / channels - frames; fadeFrames = Mathf.Clamp(fadeFrames, 2, Mathf.Min(frames / 3, num)); for (int i = 0; i < fadeFrames; i++) { float num2 = Mathf.SmoothStep(0f, 1f, (float)i / (float)(fadeFrames - 1)); for (int j = 0; j < channels; j++) { int num3 = i * channels + j; int num4 = (frames + i) * channels + j; array[num3] = Mathf.Lerp(raw[num4], raw[num3], num2); } } return array; } private static void UpdateParticleRate(ParticleSystem system, float rate) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)system == (Object)null)) { EmissionModule emission = system.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Max(0f, rate)); } } public void Dispose() { DestroyResources(); _created = false; } private void DestroyResources() { if (Object.op_Implicit((Object)(object)_root)) { Object.Destroy((Object)(object)_root); } if (Object.op_Implicit((Object)(object)_volumeProfile)) { Object.Destroy((Object)(object)_volumeProfile); } if (Object.op_Implicit((Object)(object)_rainMaterial)) { Object.Destroy((Object)(object)_rainMaterial); } if (Object.op_Implicit((Object)(object)_softMaterial)) { Object.Destroy((Object)(object)_softMaterial); } if (Object.op_Implicit((Object)(object)_debrisMaterial)) { Object.Destroy((Object)(object)_debrisMaterial); } if (Object.op_Implicit((Object)(object)_starMaterial)) { Object.Destroy((Object)(object)_starMaterial); } if (Object.op_Implicit((Object)(object)_rainTexture)) { Object.Destroy((Object)(object)_rainTexture); } if (Object.op_Implicit((Object)(object)_softTexture)) { Object.Destroy((Object)(object)_softTexture); } if (Object.op_Implicit((Object)(object)_debrisTexture)) { Object.Destroy((Object)(object)_debrisTexture); } if (Object.op_Implicit((Object)(object)_starTexture)) { Object.Destroy((Object)(object)_starTexture); } if (Object.op_Implicit((Object)(object)_rainClip)) { Object.Destroy((Object)(object)_rainClip); } if (Object.op_Implicit((Object)(object)_rainDetailClip)) { Object.Destroy((Object)(object)_rainDetailClip); } if (Object.op_Implicit((Object)(object)_windClip)) { Object.Destroy((Object)(object)_windClip); } if (_thunderClips != null) { AudioClip[] thunderClips = _thunderClips; foreach (AudioClip val in thunderClips) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } } _root = null; _volumeProfile = null; _rainMaterial = null; _softMaterial = null; _debrisMaterial = null; _starMaterial = null; _rainTexture = null; _softTexture = null; _debrisTexture = null; _starTexture = null; _rainClip = null; _rainDetailClip = null; _windClip = null; _thunderClips = null; _mixerGroup = null; _stars = null; _meteors = null; _starParticles = null; _starDataList.Clear(); } } internal sealed class GameplayEffects : IDisposable { private struct MovementBaseline { internal float Acceleration; internal float BackwardAcceleration; internal float Deceleration; internal float MaxVelocity; internal float SlopeLimit; internal bool Captured; } private struct GameplayProfile { internal float PlayerTraction; internal float PlayerFriction; internal float PlayerSlopeModifier; internal float PlayerGust; internal float BoatWind; internal float BoatYaw; internal float BiteTimeMultiplier; internal static GameplayProfile For(WeatherKind weather) { return weather switch { WeatherKind.Rain => new GameplayProfile { PlayerTraction = 0.88f, PlayerFriction = 0.9f, PlayerSlopeModifier = -4f, PlayerGust = 0.45f, BoatWind = 0.85f, BoatYaw = 0.45f, BiteTimeMultiplier = 0.82f }, WeatherKind.Storm => new GameplayProfile { PlayerTraction = 0.76f, PlayerFriction = 0.8f, PlayerSlopeModifier = -8f, PlayerGust = 1.65f, BoatWind = 2.45f, BoatYaw = 1.35f, BiteTimeMultiplier = 0.72f }, WeatherKind.Snow => new GameplayProfile { PlayerTraction = 0.68f, PlayerFriction = 0.72f, PlayerSlopeModifier = -10f, PlayerGust = 0.65f, BoatWind = 0.6f, BoatYaw = 0.3f, BiteTimeMultiplier = 1.15f }, WeatherKind.Hurricane => new GameplayProfile { PlayerTraction = 0.58f, PlayerFriction = 0.62f, PlayerSlopeModifier = -14f, PlayerGust = 3.2f, BoatWind = 4.6f, BoatYaw = 2.4f, BiteTimeMultiplier = 0.65f }, _ => new GameplayProfile { PlayerTraction = 1f, PlayerFriction = 1f, PlayerSlopeModifier = 0f, PlayerGust = 0f, BoatWind = 0f, BoatYaw = 0f, BiteTimeMultiplier = 1f }, }; } } private readonly ManualLogSource _log; private MovementBaseline _movementBaseline; private object _lastMovementObject; private double _lastWarnTime; private PropertyInfo _movementAccelerationProperty; private PropertyInfo _movementBackwardAccelerationProperty; private PropertyInfo _movementDecelerationProperty; private PropertyInfo _movementMaxVelocityProperty; private PropertyInfo _movementSlopeLimitProperty; private PropertyInfo _movementOnBoatProperty; private PropertyInfo _movementVelocityProperty; private PropertyInfo _movementGroundedProperty; private Type _playerManagerType; private PropertyInfo _playersProperty; private PropertyInfo _localPlayerProperty; private PropertyInfo _movementProperty; private Type _boatManagerType; private PropertyInfo _boatProperty; private PropertyInfo _boatHiddenRigProperty; private PropertyInfo _boatPropellerInWaterField; private PropertyInfo _isServerInitializedProperty; private Type _creatureManagerType; private PropertyInfo _creatureManagerInstanceProperty; private FieldInfo _biteTimeField; private float _baselineBiteTime = -1f; private bool _reflectionCached; internal GameplayEffects(ManualLogSource log) { _log = log; } internal void Tick(WeatherKind weather, float windAngle, double synchronizedTime, int islandIndex, int seed, bool underwater, float strength, float transitionSeconds) { if (underwater || strength <= 0f) { Restore(); return; } EnsureReflectionCache(); GameplayProfile profile = GameplayProfile.For(weather); float amount = Mathf.Clamp01(strength); UpdateFishing(profile, amount); UpdatePlayer(profile, windAngle, synchronizedTime, islandIndex, seed, amount); } internal void FixedTick(WeatherKind weather, float windAngle, double synchronizedTime, int islandIndex, int seed, float strength) { //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) if (strength <= 0f) { return; } EnsureReflectionCache(); GameplayProfile gameplayProfile = GameplayProfile.For(weather); float num = Mathf.Clamp01(strength); if (num <= 0f || gameplayProfile.BoatWind <= 0f) { return; } try { object obj = ((_boatProperty != null) ? _boatProperty.GetValue(null, null) : null); if (IsAlive(obj) && ReadBool(_isServerInitializedProperty, obj) && ReadBool(_boatPropellerInWaterField, obj)) { Rigidbody val = (Rigidbody)((_boatHiddenRigProperty != null) ? /*isinst with value type is only supported in some contexts*/: null); if (Object.op_Implicit((Object)(object)val) && !val.isKinematic) { float num2 = windAngle * ((float)Math.PI / 180f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); long pulseBucket = (long)Math.Floor(synchronizedTime * 0.55); float num3 = WeatherScheduler.GameplayVariation(islandIndex, pulseBucket, seed, 45127u); float num4 = 0.78f + 0.22f * Mathf.Sin((float)synchronizedTime * 1.71f + num3 * (float)Math.PI); val.AddForce(val2 * (gameplayProfile.BoatWind * num * num4), (ForceMode)5); Vector3 val3 = Vector3.Cross(Vector3.up, val2); Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.up * (gameplayProfile.BoatYaw * num3) + normalized * (gameplayProfile.BoatYaw * 0.32f * num4); val.AddTorque(val4 * num, (ForceMode)5); } } } catch (Exception ex) { WarnOccasionally("Boat wind physics skipped: " + ex.Message); } } private void UpdatePlayer(GameplayProfile profile, float windAngle, double synchronizedTime, int islandIndex, int seed, float amount) { //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) object localPlayerMovement = GetLocalPlayerMovement(); if (!IsAlive(localPlayerMovement)) { RestoreMovement(); return; } CaptureMovementBaseline(localPlayerMovement); float num = Mathf.Lerp(1f, profile.PlayerTraction, amount); float num2 = Mathf.Lerp(1f, profile.PlayerFriction, amount); float num3 = Mathf.Lerp(0f, profile.PlayerSlopeModifier, amount); WriteFloat(_movementAccelerationProperty, localPlayerMovement, _movementBaseline.Acceleration * num); WriteFloat(_movementBackwardAccelerationProperty, localPlayerMovement, _movementBaseline.BackwardAcceleration * num); WriteFloat(_movementDecelerationProperty, localPlayerMovement, _movementBaseline.Deceleration * num2); WriteFloat(_movementMaxVelocityProperty, localPlayerMovement, _movementBaseline.MaxVelocity * (0.85f + 0.15f * num)); WriteFloat(_movementSlopeLimitProperty, localPlayerMovement, Mathf.Clamp(_movementBaseline.SlopeLimit + num3, 15f, 75f)); if (!ReadBool(_movementGroundedProperty, localPlayerMovement) || profile.PlayerGust <= 0f || ReadBool(_movementOnBoatProperty, localPlayerMovement) || _movementVelocityProperty == null) { return; } try { long pulseBucket = (long)Math.Floor(synchronizedTime * 0.75); float num4 = WeatherScheduler.GameplayVariation(islandIndex, pulseBucket, seed, 49427u); if (!(num4 <= 0.15f)) { float num5 = windAngle * ((float)Math.PI / 180f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num5), 0f, Mathf.Sin(num5)); Vector3 val2 = (Vector3)_movementVelocityProperty.GetValue(localPlayerMovement, null); float num6 = profile.PlayerGust * amount * (num4 - 0.15f) * Time.deltaTime * 0.65f; _movementVelocityProperty.SetValue(localPlayerMovement, val2 + val * num6, null); } } catch (Exception ex) { WarnOccasionally("Player wind gust skipped: " + ex.Message); } } private void UpdateFishing(GameplayProfile profile, float amount) { if (_biteTimeField == null) { return; } try { object obj = ((_creatureManagerInstanceProperty != null) ? _creatureManagerInstanceProperty.GetValue(null, null) : null); if (!IsAlive(obj)) { return; } if (_baselineBiteTime < 0f) { object value = _biteTimeField.GetValue(obj); if (value is float) { _baselineBiteTime = (float)value; } } if (_baselineBiteTime > 0f) { float num = Mathf.Lerp(1f, profile.BiteTimeMultiplier, amount); _biteTimeField.SetValue(obj, Mathf.Max(0.5f, _baselineBiteTime * num)); } } catch (Exception ex) { WarnOccasionally("Bite time adjustment skipped: " + ex.Message); } } internal void Restore() { RestoreMovement(); RestoreFishing(); } private void RestoreMovement() { if (!_movementBaseline.Captured || !IsAlive(_lastMovementObject)) { _movementBaseline = default(MovementBaseline); _lastMovementObject = null; return; } WriteFloat(_movementAccelerationProperty, _lastMovementObject, _movementBaseline.Acceleration); WriteFloat(_movementBackwardAccelerationProperty, _lastMovementObject, _movementBaseline.BackwardAcceleration); WriteFloat(_movementDecelerationProperty, _lastMovementObject, _movementBaseline.Deceleration); WriteFloat(_movementMaxVelocityProperty, _lastMovementObject, _movementBaseline.MaxVelocity); WriteFloat(_movementSlopeLimitProperty, _lastMovementObject, _movementBaseline.SlopeLimit); _movementBaseline = default(MovementBaseline); _lastMovementObject = null; } private void RestoreFishing() { if (_baselineBiteTime <= 0f || _biteTimeField == null) { return; } try { object obj = ((_creatureManagerInstanceProperty != null) ? _creatureManagerInstanceProperty.GetValue(null, null) : null); if (IsAlive(obj)) { _biteTimeField.SetValue(obj, _baselineBiteTime); } } catch { } _baselineBiteTime = -1f; } public void Dispose() { Restore(); } private void CaptureMovementBaseline(object movement) { if (!_movementBaseline.Captured || _lastMovementObject != movement) { if (_movementBaseline.Captured && _lastMovementObject != null && _lastMovementObject != movement) { RestoreMovement(); } _movementBaseline = new MovementBaseline { Acceleration = ReadFloat(_movementAccelerationProperty, movement, 35f), BackwardAcceleration = ReadFloat(_movementBackwardAccelerationProperty, movement, 22f), Deceleration = ReadFloat(_movementDecelerationProperty, movement, 28f), MaxVelocity = ReadFloat(_movementMaxVelocityProperty, movement, 5.5f), SlopeLimit = ReadFloat(_movementSlopeLimitProperty, movement, 45f), Captured = true }; _lastMovementObject = movement; } } private object GetLocalPlayerMovement() { EnsureReflectionCache(); if (_localPlayerProperty != null) { try { object value = _localPlayerProperty.GetValue(null, null); if (IsAlive(value) && _movementProperty != null) { return _movementProperty.GetValue(value, null); } } catch { } } if (_playersProperty != null) { try { if (_playersProperty.GetValue(null, null) is IDictionary dictionary) { foreach (object value2 in dictionary.Values) { if (IsAlive(value2)) { PropertyInfo property = value2.GetType().GetProperty("IsOwner", BindingFlags.Instance | BindingFlags.Public); if (property != null && (bool)property.GetValue(value2, null) && _movementProperty != null) { return _movementProperty.GetValue(value2, null); } } } } } catch { } } return null; } private void EnsureReflectionCache() { if (!_reflectionCached) { Type type = Type.GetType("PlayerMovement, Assembly-CSharp"); if (type != null) { _movementAccelerationProperty = type.GetProperty("Acceleration", BindingFlags.Instance | BindingFlags.Public); _movementBackwardAccelerationProperty = type.GetProperty("BackwardAcceleration", BindingFlags.Instance | BindingFlags.Public); _movementDecelerationProperty = type.GetProperty("Deceleration", BindingFlags.Instance | BindingFlags.Public); _movementMaxVelocityProperty = type.GetProperty("MaxVelocity", BindingFlags.Instance | BindingFlags.Public); _movementSlopeLimitProperty = type.GetProperty("SlopeLimit", BindingFlags.Instance | BindingFlags.Public); _movementOnBoatProperty = type.GetProperty("OnBoat", BindingFlags.Instance | BindingFlags.Public); _movementVelocityProperty = type.GetProperty("Velocity", BindingFlags.Instance | BindingFlags.Public); _movementGroundedProperty = type.GetProperty("Grounded", BindingFlags.Instance | BindingFlags.Public); } _playerManagerType = Type.GetType("PlayerManager, Assembly-CSharp"); if (_playerManagerType != null) { _playersProperty = _playerManagerType.GetProperty("Players", BindingFlags.Static | BindingFlags.Public); _localPlayerProperty = _playerManagerType.GetProperty("LocalPlayer", BindingFlags.Static | BindingFlags.Public); } Type type2 = Type.GetType("Player, Assembly-CSharp"); if (type2 != null) { _movementProperty = type2.GetProperty("Movement", BindingFlags.Instance | BindingFlags.Public); } _boatManagerType = Type.GetType("BoatManager, Assembly-CSharp"); if (_boatManagerType != null) { _boatProperty = _boatManagerType.GetProperty("Boat", BindingFlags.Static | BindingFlags.Public); } Type type3 = Type.GetType("Boat, Assembly-CSharp"); if (type3 != null) { _boatHiddenRigProperty = type3.GetProperty("HiddenRig", BindingFlags.Instance | BindingFlags.Public); _boatPropellerInWaterField = type3.GetProperty("PropellerInWater", BindingFlags.Instance | BindingFlags.Public); } Type type4 = Type.GetType("FishNet.Object.NetworkBehaviour, FishNet.Runtime"); if (type4 != null) { _isServerInitializedProperty = type4.GetProperty("IsServerInitialized", BindingFlags.Instance | BindingFlags.Public); } _creatureManagerType = Type.GetType("CreatureManager, Assembly-CSharp"); if (_creatureManagerType != null) { _creatureManagerInstanceProperty = _creatureManagerType.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); _biteTimeField = _creatureManagerType.GetField("BiteTime", BindingFlags.Instance | BindingFlags.Public) ?? _creatureManagerType.GetField("_biteTime", BindingFlags.Instance | BindingFlags.NonPublic); } _reflectionCached = true; } } private static bool IsAlive(object target) { if (target == null) { return false; } Object val = (Object)((target is Object) ? target : null); if (val != (Object)null) { return val != (Object)null; } return true; } private static float ReadFloat(PropertyInfo property, object target, float fallback) { if (property == null || target == null) { return fallback; } try { if (property.GetValue(target, null) is float result) { return result; } } catch { } return fallback; } private static void WriteFloat(PropertyInfo property, object target, float value) { if (property == null || target == null || !property.CanWrite) { return; } try { property.SetValue(target, value, null); } catch { } } private static bool ReadBool(PropertyInfo property, object target) { if (property == null || target == null) { return false; } try { if (property.GetValue(target, null) is bool result) { return result; } } catch { } return false; } private void WarnOccasionally(string message) { if ((double)Time.unscaledTime - _lastWarnTime > 5.0) { _lastWarnTime = Time.unscaledTime; _log.LogWarning((object)message); } } } public enum ModLanguage { English, Russian } [BepInProcess("How to Fish.exe")] [BepInPlugin("com.howToFish.weatherexpansion", "WeatherExpansion", "1.0.0")] public sealed class Plugin : BaseUnityPlugin { private struct EnvironmentBaseline { internal ulong ActiveSceneHandle; internal bool Fog; internal FogMode FogMode; internal Color FogColor; internal float FogDensity; internal float FogStartDistance; internal float FogEndDistance; internal float AmbientIntensity; internal Color AmbientLight; internal Color AmbientSkyColor; internal Color AmbientEquatorColor; internal Color AmbientGroundColor; internal float ReflectionIntensity; internal Light Light; internal Quaternion LightRotation; internal Vector3 LightEuler; internal float LightIntensity; internal Color LightColor; internal float ShadowStrength; } public const string PluginGuid = "com.howToFish.weatherexpansion"; public const string PluginName = "WeatherExpansion"; public const string PluginVersion = "1.0.0"; private readonly GameBridge _bridge = new GameBridge(); private WeatherEffects _effects; private GameplayEffects _gameplay; private ConfigEntry _enabled; private ConfigEntry _dayLengthMinutes; private ConfigEntry _startingHour; private ConfigEntry _weatherDurationMinutes; private ConfigEntry _transitionSeconds; private ConfigEntry _nightExposure; private ConfigEntry _enableNightStars; private ConfigEntry _starBrightness; private ConfigEntry _effectIntensity; private ConfigEntry _particleQuality; private ConfigEntry _weatherVolumePercent; private ConfigEntry _gameplayEnabled; private ConfigEntry _gameplayStrengthPercent; private ConfigEntry _seed; private readonly ConfigEntry[] _profileConfigs = new ConfigEntry[6]; private readonly WeatherWeights[] _profiles = new WeatherWeights[6]; private GameObject _flashlightHolder; private Light _flashlightSpotLight; private Light _flashlightFillLight; private GameObject _radarGlowHolder; private Light _radarGlowLight; private bool _isTimePaused = false; private float? _forcedTimeHour = null; private float _frozenDayPhase = 0.5f; private EnvironmentBaseline _baseline; private bool _environmentCaptured; private bool _fogBaselineCaptured; private int _surfaceFrames; private bool _worldActive; private int _lastIsland = -1; private long _lastWeatherSlot = long.MinValue; private WeatherKind _automaticWeather = WeatherKind.Clear; private WeatherKind? _forcedWeather; private WeatherKind _currentWeather = WeatherKind.Clear; private WeatherKind _gameplayWeather = WeatherKind.Clear; private bool _manualGameplayOverrideAllowed = true; private float _windAngle; private double _clock; private float _dayPhase; private float _dayFactor; private float _midnightPeak; private bool _networkClock; private bool _clockStateKnown; private bool _lastNetworkClock; private bool _underwater; private bool _showMenu = false; private Rect _windowRect = new Rect(40f, 40f, 580f, 580f); private int _currentTab = 0; private Texture2D _modIcon; private bool _isResizing = false; private Vector2 _resizeStartMouse; private Vector2 _resizeStartSize; private Vector2 _scrollPos; private Texture2D _winBgTex; private Texture2D _cardBgTex; private Texture2D _btnNormalTex; private Texture2D _btnHoverTex; private Texture2D _btnActiveTex; private Texture2D _tabNormalTex; private Texture2D _tabActiveTex; private Texture2D _accentBadgeTex; private Texture2D _greenBadgeTex; private Texture2D _goldBadgeTex; private Texture2D _scrollBgTex; private Texture2D _scrollThumbTex; private Texture2D _scrollThumbHoverTex; private GUIStyle _winStyle; private GUIStyle _cardStyle; private GUIStyle _titleStyle; private GUIStyle _subTitleStyle; private GUIStyle _tabStyle; private GUIStyle _tabActiveStyle; private GUIStyle _labelStyle; private GUIStyle _sectionHeaderStyle; private GUIStyle _btnStyle; private GUIStyle _weatherBtnActiveStyle; private GUIStyle _toggleActiveStyle; private GUIStyle _toggleInactiveStyle; private GUIStyle _badgeStyle; private GUIStyle _greenBadgeStyle; private GUIStyle _goldBadgeStyle; private GUIStyle _gripStyle; private GUIStyle _scrollBarStyle; private GUIStyle _scrollThumbStyle; private float _lastToggleTime = 0f; private float _lastFlashlightToggleTime = 0f; public static Plugin Instance { get; private set; } public static ConfigEntry SelectedLanguage { get; private set; } public static ConfigEntry MenuKey { get; private set; } public static ConfigEntry FlashlightKey { get; private set; } public static ConfigEntry EnablePlayerFlashlight { get; private set; } public static ConfigEntry FlashlightBrightness { get; private set; } public static bool IsRussian => SelectedLanguage != null && SelectedLanguage.Value == ModLanguage.Russian; public static string T(string en, string ru) { return IsRussian ? ru : en; } private void Awake() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) Instance = this; BindConfiguration(); ParseProfiles(); _effects = new WeatherEffects(((BaseUnityPlugin)this).Logger); _gameplay = new GameplayEffects(((BaseUnityPlugin)this).Logger); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; SceneManager.activeSceneChanged += OnActiveSceneChanged; ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Concat("WeatherExpansion v1.0.0 initialized. Press [", MenuKey.Value, "] for menu, [", FlashlightKey.Value, "] for flashlight.")); } public void SetMenuOpen(bool open) { _showMenu = open; try { PlayerCamera.ToggleMouse(open); } catch { } if (open) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } else { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } } private bool IsHotkeyPressed() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Invalid comparison between Unknown and I4 //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Invalid comparison between Unknown and I4 try { Keyboard current = Keyboard.current; if (current != null) { if (Enum.TryParse(((object)MenuKey.Value).ToString(), ignoreCase: true, out Key result) && ((ButtonControl)current[result]).wasPressedThisFrame) { return true; } if ((int)MenuKey.Value == 287 && ((ButtonControl)current.f6Key).wasPressedThisFrame) { return true; } if ((int)MenuKey.Value == 286 && ((ButtonControl)current.f5Key).wasPressedThisFrame) { return true; } if ((int)MenuKey.Value == 277 && ((ButtonControl)current.insertKey).wasPressedThisFrame) { return true; } if ((int)MenuKey.Value == 96 && ((ButtonControl)current.backquoteKey).wasPressedThisFrame) { return true; } } } catch { } try { if (Input.GetKeyDown(MenuKey.Value)) { return true; } } catch { } return false; } private bool IsFlashlightHotkeyPressed() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 try { Keyboard current = Keyboard.current; if (current != null) { if (Enum.TryParse(((object)FlashlightKey.Value).ToString(), ignoreCase: true, out Key result) && ((ButtonControl)current[result]).wasPressedThisFrame) { return true; } if ((int)FlashlightKey.Value == 108 && ((ButtonControl)current.lKey).wasPressedThisFrame) { return true; } if ((int)FlashlightKey.Value == 102 && ((ButtonControl)current.fKey).wasPressedThisFrame) { return true; } } } catch { } try { if (Input.GetKeyDown(FlashlightKey.Value)) { return true; } } catch { } return false; } private void Update() { //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (IsHotkeyPressed() && Time.unscaledTime - _lastToggleTime > 0.2f) { _lastToggleTime = Time.unscaledTime; SetMenuOpen(!_showMenu); } if (IsFlashlightHotkeyPressed() && Time.unscaledTime - _lastFlashlightToggleTime > 0.2f) { _lastFlashlightToggleTime = Time.unscaledTime; EnablePlayerFlashlight.Value = !EnablePlayerFlashlight.Value; } if (_showMenu) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } UpdateFlashlight(); if (!_enabled.Value) { DeactivateWorld(immediate: true); return; } int islandIndex = _bridge.GetIslandIndex(); Camera camera = _bridge.GetCamera(); if (islandIndex < 0 || !Object.op_Implicit((Object)(object)camera)) { DeactivateWorld(immediate: true); return; } _underwater = _bridge.IsUnderWater(((Component)camera).transform.position); if (!_worldActive) { ActivateWorld(_underwater); } if (_underwater) { _surfaceFrames = 0; } else if (!_fogBaselineCaptured && ++_surfaceFrames >= 2) { CaptureFogBaseline(); } Light mainLight = _bridge.GetMainLight(); EnsureLightBaseline(mainLight); _clock = _bridge.GetSynchronizedTime(out _networkClock); if (!_clockStateKnown || _networkClock != _lastNetworkClock) { _clockStateKnown = true; _lastNetworkClock = _networkClock; ((BaseUnityPlugin)this).Logger.LogInfo((object)(_networkClock ? "Weather clock synchronized with FishNet network time." : "FishNet unavailable; using deterministic UTC clock fallback.")); } double num = Math.Max(60.0, (double)_dayLengthMinutes.Value * 60.0); double num2 = (double)Mathf.Repeat(_startingHour.Value, 24f) / 24.0 * num; if (_forcedTimeHour.HasValue) { _dayPhase = Mathf.Repeat(_forcedTimeHour.Value / 24f, 1f); _frozenDayPhase = _dayPhase; } else if (_isTimePaused) { _dayPhase = _frozenDayPhase; } else { _dayPhase = (float)((_clock + num2) % num / num); if (_dayPhase < 0f) { _dayPhase += 1f; } _frozenDayPhase = _dayPhase; } float num3 = _dayPhase * 24f; float num4 = Mathf.Sin((_dayPhase - 0.25f) * (float)Math.PI * 2f); _dayFactor = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(-0.08f, 0.22f, num4)); float num5 = Mathf.Abs(Mathf.DeltaAngle(num3 / 24f * 360f, 15f)); _midnightPeak = Mathf.Clamp01(1f - num5 / 45f); double num6 = Math.Max(30.0, (double)_weatherDurationMinutes.Value * 60.0); long num7 = (long)Math.Floor(_clock / num6); if (islandIndex != _lastIsland || num7 != _lastWeatherSlot) { _lastIsland = islandIndex; _lastWeatherSlot = num7; WeatherWeights weights = _profiles[Mathf.Clamp(islandIndex, 0, _profiles.Length - 1)]; _automaticWeather = WeatherScheduler.Select(islandIndex, num7, _seed.Value, weights); _windAngle = WeatherScheduler.WindAngle(islandIndex, num7, _seed.Value); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Island " + (islandIndex + 1) + ": automatic weather is now " + LocalizedWeather(_automaticWeather) + ".")); } WeatherKind weatherKind = (_currentWeather = _forcedWeather ?? _automaticWeather); _effects.Tick(camera, weatherKind, Mathf.Max(0.1f, _transitionSeconds.Value), _windAngle, _dayFactor, Mathf.Clamp(_nightExposure.Value, -5f, 0f), Mathf.Clamp(_effectIntensity.Value, 0f, 2f), Mathf.Clamp(_particleQuality.Value, 0.2f, 1.5f), Mathf.Clamp01((float)_weatherVolumePercent.Value / 100f), _bridge.GetFxMixerGroup(), _clock, islandIndex, _seed.Value, _underwater, _enableNightStars.Value, Mathf.Clamp(_starBrightness.Value, 0.1f, 3f), _midnightPeak); float strength = (_gameplayEnabled.Value ? Mathf.Clamp01((float)_gameplayStrengthPercent.Value / 100f) : 0f); _manualGameplayOverrideAllowed = !_forcedWeather.HasValue || _bridge.CanUseLocalGameplayOverride(); _gameplayWeather = (_manualGameplayOverrideAllowed ? weatherKind : _automaticWeather); _gameplay.Tick(_gameplayWeather, _windAngle, _clock, islandIndex, _seed.Value, _underwater, strength, Mathf.Max(0.5f, _transitionSeconds.Value)); ApplyEnvironment(mainLight, num4); Boat boat = null; try { if ((Object)(object)BoatManager.Boat != (Object)null && ((Component)BoatManager.Boat).gameObject.activeInHierarchy) { boat = BoatManager.Boat; } else { Boat[] array = Object.FindObjectsOfType(); if (array != null && array.Length > 0) { for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && ((Component)array[i]).gameObject.activeInHierarchy) { boat = array[i]; break; } } } } } catch { } UpdateRadarEnhancement(boat); } private void UpdateFlashlight() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) try { Camera camera = _bridge.GetCamera(); if ((Object)(object)camera != (Object)null && EnablePlayerFlashlight.Value) { if ((Object)(object)_flashlightHolder == (Object)null || (Object)(object)_flashlightHolder.transform.parent != (Object)(object)((Component)camera).transform) { if ((Object)(object)_flashlightHolder != (Object)null) { Object.Destroy((Object)(object)_flashlightHolder); } _flashlightHolder = new GameObject("WeatherExpansion_PlayerFlashlight"); _flashlightHolder.transform.SetParent(((Component)camera).transform, false); _flashlightHolder.transform.localPosition = new Vector3(0f, 0f, 0.05f); _flashlightHolder.transform.localRotation = Quaternion.identity; _flashlightSpotLight = _flashlightHolder.AddComponent(); _flashlightSpotLight.type = (LightType)0; _flashlightSpotLight.spotAngle = 76f; _flashlightSpotLight.innerSpotAngle = 42f; _flashlightSpotLight.range = 140f; _flashlightSpotLight.color = new Color(1f, 0.98f, 0.92f); _flashlightSpotLight.shadows = (LightShadows)0; _flashlightSpotLight.cullingMask = -1; GameObject val = new GameObject("FlashlightFill"); val.transform.SetParent(_flashlightHolder.transform, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; _flashlightFillLight = val.AddComponent(); _flashlightFillLight.type = (LightType)0; _flashlightFillLight.spotAngle = 115f; _flashlightFillLight.innerSpotAngle = 50f; _flashlightFillLight.range = 30f; _flashlightFillLight.color = new Color(1f, 0.96f, 0.88f); _flashlightFillLight.shadows = (LightShadows)0; _flashlightFillLight.cullingMask = -1; } float num = Mathf.Max(1f, FlashlightBrightness.Value) * 7.5f; if ((Object)(object)_flashlightSpotLight != (Object)null) { ((Behaviour)_flashlightSpotLight).enabled = true; _flashlightSpotLight.intensity = num; } if ((Object)(object)_flashlightFillLight != (Object)null) { ((Behaviour)_flashlightFillLight).enabled = true; _flashlightFillLight.intensity = num * 0.3f; } } else { if ((Object)(object)_flashlightSpotLight != (Object)null) { ((Behaviour)_flashlightSpotLight).enabled = false; } if ((Object)(object)_flashlightFillLight != (Object)null) { ((Behaviour)_flashlightFillLight).enabled = false; } } } catch { } } private void UpdateRadarEnhancement(Boat boat) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)boat == (Object)null) { if ((Object)(object)_radarGlowLight != (Object)null) { ((Behaviour)_radarGlowLight).enabled = false; } return; } FieldInfo field = typeof(Boat).GetField("_radarHolder", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); GameObject val = (GameObject)((field != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val != (Object)null && val.activeInHierarchy) { if ((Object)(object)_radarGlowHolder == (Object)null || (Object)(object)_radarGlowHolder.transform.parent != (Object)(object)val.transform) { if ((Object)(object)_radarGlowHolder != (Object)null) { Object.Destroy((Object)(object)_radarGlowHolder); } _radarGlowHolder = new GameObject("Weather_RadarGlowLight"); _radarGlowHolder.transform.SetParent(val.transform, false); _radarGlowHolder.transform.localPosition = new Vector3(0f, 0.05f, 0.1f); _radarGlowLight = _radarGlowHolder.AddComponent(); _radarGlowLight.type = (LightType)2; _radarGlowLight.range = 1.4f; _radarGlowLight.intensity = 2.2f; _radarGlowLight.color = new Color(0.2f, 1f, 0.7f); _radarGlowLight.shadows = (LightShadows)0; } if ((Object)(object)_radarGlowLight != (Object)null) { ((Behaviour)_radarGlowLight).enabled = true; } FieldInfo field2 = typeof(Boat).GetField("_radar", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); RadarUI val2 = (RadarUI)((field2 != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val2 != (Object)null) { EnhanceRadarUI(val2); } } else if ((Object)(object)_radarGlowLight != (Object)null) { ((Behaviour)_radarGlowLight).enabled = false; } } catch { } } private void EnhanceRadarUI(RadarUI radar) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)radar == (Object)null) { return; } FieldInfo field = typeof(RadarUI).GetField("_canvasGroup", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(radar); CanvasGroup val = (CanvasGroup)((value is CanvasGroup) ? value : null); if ((Object)(object)val != (Object)null) { val.alpha = 1f; } } FieldInfo field2 = typeof(RadarUI).GetField("_localPlayerDot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { object? value2 = field2.GetValue(radar); RectTransform val2 = (RectTransform)((value2 is RectTransform) ? value2 : null); if ((Object)(object)val2 != (Object)null) { Image component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = new Color(0.35f, 1f, 1f, 1f); } } } FieldInfo field3 = typeof(RadarUI).GetField("_islandDots", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field4; if (field3 != null && field3.GetValue(radar) is MapDot[] array) { for (int i = 0; i < array.Length; i++) { if (array[i] == null) { continue; } field4 = typeof(MapDot).GetField("_dot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field4 != null) { object? value3 = field4.GetValue(array[i]); Image val3 = (Image)((value3 is Image) ? value3 : null); if ((Object)(object)val3 != (Object)null) { ((Graphic)val3).color = new Color(1f, 0.85f, 0.25f, 1f); } } } } FieldInfo field5 = typeof(RadarUI).GetField("_otherPlayerDots", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field5 != null && field5.GetValue(radar) is MapDot[] array2) { for (int i = 0; i < array2.Length; i++) { if (array2[i] == null) { continue; } field4 = typeof(MapDot).GetField("_dot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field4 != null) { object? value4 = field4.GetValue(array2[i]); Image val3 = (Image)((value4 is Image) ? value4 : null); if ((Object)(object)val3 != (Object)null) { ((Graphic)val3).color = new Color(0.3f, 1f, 0.5f, 1f); } } } } FieldInfo field6 = typeof(RadarUI).GetField("_lastDeathDot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field6 != null)) { return; } object? value5 = field6.GetValue(radar); MapDot val4 = (MapDot)((value5 is MapDot) ? value5 : null); if (val4 == null) { return; } field4 = typeof(MapDot).GetField("_dot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field4 != null) { object? value6 = field4.GetValue(val4); Image val3 = (Image)((value6 is Image) ? value6 : null); if ((Object)(object)val3 != (Object)null) { ((Graphic)val3).color = new Color(1f, 0.25f, 0.25f, 1f); } } } catch { } } private void FixedUpdate() { if (_worldActive && _enabled.Value && _lastIsland >= 0 && _gameplayEnabled.Value) { _gameplay.FixedTick(_gameplayWeather, _windAngle, _clock, _lastIsland, _seed.Value, Mathf.Clamp01((float)_gameplayStrengthPercent.Value / 100f)); } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.sceneUnloaded -= OnSceneUnloaded; SceneManager.activeSceneChanged -= OnActiveSceneChanged; RestoreEnvironment(); if ((Object)(object)_flashlightHolder != (Object)null) { Object.Destroy((Object)(object)_flashlightHolder); } if ((Object)(object)_radarGlowHolder != (Object)null) { Object.Destroy((Object)(object)_radarGlowHolder); } if (_effects != null) { _effects.Dispose(); } if (_gameplay != null) { _gameplay.Dispose(); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { DeactivateWorld(immediate: true); _lastIsland = -1; _lastWeatherSlot = long.MinValue; _radarGlowHolder = null; } private void OnSceneUnloaded(Scene scene) { DeactivateWorld(immediate: true); _lastIsland = -1; _lastWeatherSlot = long.MinValue; _radarGlowHolder = null; } private void OnActiveSceneChanged(Scene previous, Scene next) { DeactivateWorld(immediate: true); _lastIsland = -1; _lastWeatherSlot = long.MinValue; _radarGlowHolder = null; } private void BindConfiguration() { //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown SelectedLanguage = ((BaseUnityPlugin)this).Config.Bind("0. Interface", "Language", ModLanguage.Russian, "Mod language (English or Russian)."); MenuKey = ((BaseUnityPlugin)this).Config.Bind("0. Interface", "MenuKey", (KeyCode)287, "Hotkey to toggle the in-game AMOLED control panel."); FlashlightKey = ((BaseUnityPlugin)this).Config.Bind("0. Interface", "FlashlightKey", (KeyCode)108, "Hotkey to toggle the shoulder beam flashlight."); EnablePlayerFlashlight = ((BaseUnityPlugin)this).Config.Bind("0. Interface", "EnablePlayerFlashlight", false, "State of the player flashlight."); FlashlightBrightness = ((BaseUnityPlugin)this).Config.Bind("0. Interface", "FlashlightBrightness", 8.5f, "Flashlight beam intensity."); _enabled = ((BaseUnityPlugin)this).Config.Bind("1. General", "Enabled", true, "Enables day/night cycle and dynamic atmospheric weather."); _dayLengthMinutes = ((BaseUnityPlugin)this).Config.Bind("2. Time & Atmosphere", "DayLengthMinutes", 24f, "Duration of full 24-hour cycle in real minutes."); _startingHour = ((BaseUnityPlugin)this).Config.Bind("2. Time & Atmosphere", "StartingHour", 8f, "Starting hour when a session starts (0 to 24)."); _weatherDurationMinutes = ((BaseUnityPlugin)this).Config.Bind("2. Time & Atmosphere", "WeatherDurationMinutes", 5f, "Duration of each weather state before next transition."); _transitionSeconds = ((BaseUnityPlugin)this).Config.Bind("2. Time & Atmosphere", "TransitionSeconds", 9f, "Smoothness of weather transitions in seconds."); _nightExposure = ((BaseUnityPlugin)this).Config.Bind("2. Time & Atmosphere", "NightExposure", -3.2f, "Darkness of the night sky (-5.0 to 0.0)."); _enableNightStars = ((BaseUnityPlugin)this).Config.Bind("2. Time & Atmosphere", "EnableNightStars", true, "Procedural starry sky canopy and shooting stars at night."); _starBrightness = ((BaseUnityPlugin)this).Config.Bind("2. Time & Atmosphere", "StarBrightness", 1f, "Brightness multiplier for stars and meteors."); _effectIntensity = ((BaseUnityPlugin)this).Config.Bind("3. Visuals", "EffectIntensity", 1f, "Atmospheric effects visual multiplier (0 to 2)."); _particleQuality = ((BaseUnityPlugin)this).Config.Bind("3. Visuals", "ParticleQuality", 1f, "Particle density multiplier (0.2 to 1.5)."); _weatherVolumePercent = ((BaseUnityPlugin)this).Config.Bind("4. Audio", "WeatherVolume", 75, new ConfigDescription("Volume of rain, wind and thunder (0 to 100).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), new object[0])); _gameplayEnabled = ((BaseUnityPlugin)this).Config.Bind("5. Gameplay", "WeatherAffectsGameplay", true, "Enables wind force, waves, player mobility, traction and fishing modifiers."); _gameplayStrengthPercent = ((BaseUnityPlugin)this).Config.Bind("5. Gameplay", "WeatherStrength", 100, new ConfigDescription("Strength of gameplay modifiers (0 to 100).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), new object[0])); _seed = ((BaseUnityPlugin)this).Config.Bind("6. Sync", "WeatherSeed", 4001890, "Multiplayer weather seed for synchronization."); _profileConfigs[0] = ((BaseUnityPlugin)this).Config.Bind("IslandProfiles", "Island1_Lighthouse", "Clear:60,Rain:30,Storm:10,Snow:0,Hurricane:0", "Weather weights for Island 1 (Lighthouse)."); _profileConfigs[1] = ((BaseUnityPlugin)this).Config.Bind("IslandProfiles", "Island2_Forest", "Clear:25,Rain:30,Storm:20,Snow:25,Hurricane:0", "Weather weights for Island 2 (Forest)."); _profileConfigs[2] = ((BaseUnityPlugin)this).Config.Bind("IslandProfiles", "Island3_Tropical", "Clear:35,Rain:25,Storm:20,Snow:0,Hurricane:20", "Weather weights for Island 3 (Tropical)."); _profileConfigs[3] = ((BaseUnityPlugin)this).Config.Bind("IslandProfiles", "Island4_Rocky", "Clear:35,Rain:25,Storm:25,Snow:0,Hurricane:15", "Weather weights for Island 4 (Rocky / Casino)."); _profileConfigs[4] = ((BaseUnityPlugin)this).Config.Bind("IslandProfiles", "Island5_Volcano", "Clear:40,Rain:5,Storm:35,Snow:0,Hurricane:20", "Weather weights for Island 5 (Volcano)."); _profileConfigs[5] = ((BaseUnityPlugin)this).Config.Bind("IslandProfiles", "Island6_Secret", "Clear:25,Rain:10,Storm:10,Snow:55,Hurricane:0", "Weather weights for Island 6 (Dev / Secret)."); ((BaseUnityPlugin)this).Config.Save(); } private void ParseProfiles() { for (int i = 0; i < _profileConfigs.Length; i++) { int displayIndex = i + 1; ref WeatherWeights reference = ref _profiles[i]; reference = WeatherWeights.Parse(_profileConfigs[i].Value, delegate(string message) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Island " + displayIndex + ": " + message)); }); } } private void ActivateWorld(bool underwater) { CaptureEnvironment(underwater); _worldActive = true; } private void DeactivateWorld(bool immediate) { if (_gameplay != null) { _gameplay.Restore(); } if (!_worldActive) { return; } if (immediate) { if (_effects != null) { _effects.SetInactiveImmediate(); } } else if (_effects != null) { _effects.FadeOut(Mathf.Min(2f, Mathf.Max(0.1f, _transitionSeconds.Value))); } RestoreEnvironment(); _worldActive = false; _currentWeather = WeatherKind.Clear; _lastIsland = -1; _lastWeatherSlot = long.MinValue; } private void CaptureEnvironment(bool underwater) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!_environmentCaptured) { EnvironmentBaseline baseline = default(EnvironmentBaseline); Scene activeScene = SceneManager.GetActiveScene(); SceneHandle handle = ((Scene)(ref activeScene)).handle; baseline.ActiveSceneHandle = ((SceneHandle)(ref handle)).GetRawData(); baseline.AmbientIntensity = RenderSettings.ambientIntensity; baseline.AmbientLight = RenderSettings.ambientLight; baseline.AmbientSkyColor = RenderSettings.ambientSkyColor; baseline.AmbientEquatorColor = RenderSettings.ambientEquatorColor; baseline.AmbientGroundColor = RenderSettings.ambientGroundColor; baseline.ReflectionIntensity = RenderSettings.reflectionIntensity; _baseline = baseline; _fogBaselineCaptured = false; _surfaceFrames = 0; if (!underwater) { CaptureFogBaseline(); } EnsureLightBaseline(_bridge.GetMainLight()); _environmentCaptured = true; } } private void CaptureFogBaseline() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002c: Unknown result type (might be due to invalid IL or missing references) _baseline.Fog = RenderSettings.fog; _baseline.FogMode = RenderSettings.fogMode; _baseline.FogColor = RenderSettings.fogColor; _baseline.FogDensity = RenderSettings.fogDensity; _baseline.FogStartDistance = RenderSettings.fogStartDistance; _baseline.FogEndDistance = RenderSettings.fogEndDistance; _fogBaselineCaptured = true; } private void EnsureLightBaseline(Light light) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)light) && (!Object.op_Implicit((Object)(object)_baseline.Light) || !((Object)(object)_baseline.Light == (Object)(object)light))) { _baseline.Light = light; _baseline.LightRotation = ((Component)light).transform.rotation; _baseline.LightEuler = ((Component)light).transform.eulerAngles; _baseline.LightIntensity = Mathf.Max(0.01f, light.intensity); _baseline.LightColor = light.color; _baseline.ShadowStrength = light.shadowStrength; } } private void ApplyEnvironment(Light light, float solarAltitude) { //IL_025b: 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) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Invalid comparison between Unknown and I4 if (!_environmentCaptured) { return; } float num = Mathf.Clamp(_effectIntensity.Value, 0f, 2f); float num2 = Mathf.Clamp01(_effects.CloudAmount * num); float num3 = Mathf.Lerp(1f, 0.5f, num2); float num4 = _effects.LightningAmount * num; if (Object.op_Implicit((Object)(object)light)) { EnsureLightBaseline(light); float num5 = _dayPhase * 360f - 90f; float num6 = ((solarAltitude >= 0f) ? num5 : (num5 + 180f)); ((Component)light).transform.rotation = Quaternion.Euler(num6, _baseline.LightEuler.y, _baseline.LightEuler.z); float num7 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.08f, 0.82f, solarAltitude)); Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.58f, 0.31f, 1f); Color val2 = Color.Lerp(val, _baseline.LightColor, num7); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.12f, 0.18f, 0.35f, 1f); light.color = Color.Lerp(val3, val2, _dayFactor); light.intensity = Mathf.Lerp(0.005f, _baseline.LightIntensity, _dayFactor) * num3 + num4 * _baseline.LightIntensity * 1.6f; light.shadowStrength = Mathf.Lerp(_baseline.ShadowStrength * 0.3f, _baseline.ShadowStrength, _dayFactor); } float num8 = Mathf.Lerp(0.025f, 0.06f, 1f - _midnightPeak); float num9 = Mathf.Lerp(num8, 1f, _dayFactor); RenderSettings.ambientIntensity = _baseline.AmbientIntensity * num9 * Mathf.Lerp(1f, 0.56f, num2) + num4 * 0.35f; Color val4 = default(Color); ((Color)(ref val4))..ctor(0.006f, 0.01f, 0.024f, 1f); Color val5 = default(Color); ((Color)(ref val5))..ctor(0.015f, 0.028f, 0.065f, 1f); Color val6 = Color.Lerp(val5, val4, _midnightPeak); Color val7 = default(Color); ((Color)(ref val7))..ctor(0.01f, 0.018f, 0.04f, 1f); Color val8 = default(Color); ((Color)(ref val8))..ctor(0.004f, 0.006f, 0.012f, 1f); Color val9 = default(Color); ((Color)(ref val9))..ctor(0.25f, 0.3f, 0.35f, 1f); RenderSettings.ambientLight = Color.Lerp(val7, _baseline.AmbientLight, _dayFactor) * num3; RenderSettings.ambientSkyColor = Color.Lerp(val6, _baseline.AmbientSkyColor, _dayFactor) * num3; RenderSettings.ambientEquatorColor = Color.Lerp(val7, _baseline.AmbientEquatorColor, _dayFactor) * num3; RenderSettings.ambientGroundColor = Color.Lerp(val8, _baseline.AmbientGroundColor, _dayFactor) * num3; RenderSettings.reflectionIntensity = _baseline.ReflectionIntensity * Mathf.Lerp(0.1f, 1f, _dayFactor) * Mathf.Lerp(1f, 0.48f, num2); if (!_underwater && _fogBaselineCaptured) { float num10 = Mathf.Max(num2, 1f - _dayFactor); RenderSettings.fog = _baseline.Fog || num10 > 0.04f; RenderSettings.fogMode = _baseline.FogMode; Color val10 = Color.Lerp(val6, _baseline.FogColor, _dayFactor); RenderSettings.fogColor = Color.Lerp(val10, val9, num2 * 0.68f); if ((int)_baseline.FogMode == 1) { RenderSettings.fogStartDistance = Mathf.Lerp(_baseline.FogStartDistance, Mathf.Min(_baseline.FogStartDistance, 22f), num2); RenderSettings.fogEndDistance = Mathf.Lerp(_baseline.FogEndDistance, Mathf.Min(_baseline.FogEndDistance, 82f), num2); } else { RenderSettings.fogDensity = _baseline.FogDensity + num2 * 0.0115f + (1f - _dayFactor) * 0.001f; } } } private void RestoreEnvironment() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) if (!_environmentCaptured) { return; } Scene activeScene = SceneManager.GetActiveScene(); SceneHandle handle = ((Scene)(ref activeScene)).handle; if (((SceneHandle)(ref handle)).GetRawData() != _baseline.ActiveSceneHandle) { _environmentCaptured = false; _fogBaselineCaptured = false; _surfaceFrames = 0; _baseline = default(EnvironmentBaseline); return; } if (!_underwater && _fogBaselineCaptured) { RenderSettings.fog = _baseline.Fog; RenderSettings.fogMode = _baseline.FogMode; RenderSettings.fogColor = _baseline.FogColor; RenderSettings.fogDensity = _baseline.FogDensity; RenderSettings.fogStartDistance = _baseline.FogStartDistance; RenderSettings.fogEndDistance = _baseline.FogEndDistance; } RenderSettings.ambientIntensity = _baseline.AmbientIntensity; RenderSettings.ambientLight = _baseline.AmbientLight; RenderSettings.ambientSkyColor = _baseline.AmbientSkyColor; RenderSettings.ambientEquatorColor = _baseline.AmbientEquatorColor; RenderSettings.ambientGroundColor = _baseline.AmbientGroundColor; RenderSettings.reflectionIntensity = _baseline.ReflectionIntensity; if (Object.op_Implicit((Object)(object)_baseline.Light)) { ((Component)_baseline.Light).transform.rotation = _baseline.LightRotation; _baseline.Light.intensity = _baseline.LightIntensity; _baseline.Light.color = _baseline.LightColor; _baseline.Light.shadowStrength = _baseline.ShadowStrength; } _environmentCaptured = false; _fogBaselineCaptured = false; _surfaceFrames = 0; _baseline = default(EnvironmentBaseline); } internal static string LocalizedWeather(WeatherKind weather) { return weather switch { WeatherKind.Rain => T("Rain", "Дождь"), WeatherKind.Storm => T("Thunderstorm", "Гроза"), WeatherKind.Snow => T("Snow", "Снег"), WeatherKind.Hurricane => T("Hurricane", "Ураган"), _ => T("Clear Sky", "Ясно"), }; } private Texture2D MakeTex(int w, int h, Color bg, Color border, int bWidth) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) Texture2D val = new Texture2D(w, h); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { bool flag = j < bWidth || j >= w - bWidth || i < bWidth || i >= h - bWidth; array[i * w + j] = (flag ? border : bg); } } val.SetPixels(array); val.Apply(); return val; } private Texture2D MakeSolid(int w, int h, Color col) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(w, h); val.SetPixels(array); val.Apply(); return val; } private void LoadIcon() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if ((Object)(object)_modIcon != (Object)null) { return; } try { string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "icon.png"); if (File.Exists(path)) { _modIcon = new Texture2D(2, 2); ImageConversion.LoadImage(_modIcon, File.ReadAllBytes(path)); } } catch { } } private void InitStyles() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Expected O, but got Unknown //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Expected O, but got Unknown //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Expected O, but got Unknown //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Expected O, but got Unknown //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Expected O, but got Unknown //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Expected O, but got Unknown //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Expected O, but got Unknown //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Expected O, but got Unknown //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Expected O, but got Unknown //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Expected O, but got Unknown //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Expected O, but got Unknown //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Expected O, but got Unknown //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Expected O, but got Unknown //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Expected O, but got Unknown //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Expected O, but got Unknown //IL_07f8: Unknown result type (might be due to invalid IL or missing references) //IL_080e: Unknown result type (might be due to invalid IL or missing references) //IL_0818: Expected O, but got Unknown //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_0883: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Expected O, but got Unknown //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08d0: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Expected O, but got Unknown //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0917: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Expected O, but got Unknown //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Expected O, but got Unknown //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09c4: Expected O, but got Unknown //IL_09d0: Unknown result type (might be due to invalid IL or missing references) //IL_09da: Expected O, but got Unknown if (!((Object)(object)_winBgTex != (Object)null)) { LoadIcon(); Color bg = default(Color); ((Color)(ref bg))..ctor(0.04f, 0.05f, 0.07f, 0.98f); Color bg2 = default(Color); ((Color)(ref bg2))..ctor(0.08f, 0.1f, 0.13f, 1f); Color border = default(Color); ((Color)(ref border))..ctor(0.18f, 0.22f, 0.28f, 1f); Color val = default(Color); ((Color)(ref val))..ctor(0.15f, 0.65f, 0.95f, 1f); Color bg3 = default(Color); ((Color)(ref bg3))..ctor(0.11f, 0.14f, 0.18f, 1f); Color bg4 = default(Color); ((Color)(ref bg4))..ctor(0.16f, 0.2f, 0.26f, 1f); Color border2 = default(Color); ((Color)(ref border2))..ctor(0.12f, 0.55f, 0.35f, 1f); Color border3 = default(Color); ((Color)(ref border3))..ctor(0.95f, 0.75f, 0.2f, 1f); _winBgTex = MakeTex(8, 8, bg, border, 1); _cardBgTex = MakeTex(8, 8, bg2, new Color(0.14f, 0.17f, 0.22f, 1f), 1); _btnNormalTex = MakeTex(8, 8, bg3, border, 1); _btnHoverTex = MakeTex(8, 8, bg4, val, 1); _btnActiveTex = MakeSolid(4, 4, val); _tabNormalTex = MakeTex(8, 8, new Color(0.07f, 0.09f, 0.11f, 1f), new Color(0.14f, 0.17f, 0.22f, 1f), 1); _tabActiveTex = MakeTex(8, 8, new Color(0.08f, 0.18f, 0.28f, 1f), val, 1); _accentBadgeTex = MakeTex(8, 8, new Color(0.07f, 0.15f, 0.24f, 1f), val, 1); _greenBadgeTex = MakeTex(8, 8, new Color(0.07f, 0.22f, 0.14f, 1f), border2, 1); _goldBadgeTex = MakeTex(8, 8, new Color(0.24f, 0.18f, 0.05f, 1f), border3, 1); _scrollBgTex = MakeSolid(4, 4, new Color(0.04f, 0.05f, 0.07f, 0.95f)); _scrollThumbTex = MakeTex(6, 6, new Color(0.18f, 0.22f, 0.28f, 1f), new Color(0.24f, 0.3f, 0.38f, 1f), 1); _scrollThumbHoverTex = MakeTex(6, 6, new Color(0.15f, 0.65f, 0.95f, 1f), new Color(0.3f, 0.75f, 1f, 1f), 1); _winStyle = new GUIStyle(GUI.skin.window); _winStyle.border = new RectOffset(4, 4, 4, 4); _winStyle.padding = new RectOffset(16, 16, 14, 14); _winStyle.normal.background = _winBgTex; _winStyle.onNormal.background = _winBgTex; _cardStyle = new GUIStyle(GUI.skin.box); _cardStyle.border = new RectOffset(4, 4, 4, 4); _cardStyle.padding = new RectOffset(14, 14, 12, 12); _cardStyle.margin = new RectOffset(0, 0, 6, 8); _cardStyle.normal.background = _cardBgTex; _titleStyle = new GUIStyle(); _titleStyle.fontSize = 16; _titleStyle.fontStyle = (FontStyle)1; _titleStyle.alignment = (TextAnchor)3; _titleStyle.normal.textColor = Color.white; _subTitleStyle = new GUIStyle(); _subTitleStyle.fontSize = 10; _subTitleStyle.alignment = (TextAnchor)3; _subTitleStyle.normal.textColor = new Color(0.55f, 0.65f, 0.75f); _sectionHeaderStyle = new GUIStyle(); _sectionHeaderStyle.fontSize = 12; _sectionHeaderStyle.fontStyle = (FontStyle)1; _sectionHeaderStyle.margin = new RectOffset(0, 0, 4, 6); _sectionHeaderStyle.normal.textColor = new Color(0.4f, 0.75f, 1f); _labelStyle = new GUIStyle(GUI.skin.label); _labelStyle.fontSize = 12; _labelStyle.alignment = (TextAnchor)3; _labelStyle.normal.textColor = new Color(0.86f, 0.9f, 0.94f); _btnStyle = new GUIStyle(GUI.skin.button); _btnStyle.fontSize = 12; _btnStyle.fontStyle = (FontStyle)0; _btnStyle.padding = new RectOffset(10, 10, 6, 6); _btnStyle.border = new RectOffset(4, 4, 4, 4); _btnStyle.normal.background = _btnNormalTex; _btnStyle.hover.background = _btnHoverTex; _btnStyle.active.background = _btnActiveTex; _btnStyle.normal.textColor = new Color(0.92f, 0.95f, 0.98f); _btnStyle.hover.textColor = Color.white; _weatherBtnActiveStyle = new GUIStyle(_btnStyle); _weatherBtnActiveStyle.fontStyle = (FontStyle)1; _weatherBtnActiveStyle.normal.background = MakeTex(8, 8, new Color(0.08f, 0.22f, 0.16f, 1f), border2, 2); _weatherBtnActiveStyle.normal.textColor = new Color(0.45f, 1f, 0.65f); _tabStyle = new GUIStyle(_btnStyle); _tabStyle.fontSize = 12; _tabStyle.fontStyle = (FontStyle)1; _tabStyle.normal.background = _tabNormalTex; _tabStyle.normal.textColor = new Color(0.65f, 0.72f, 0.8f); _tabActiveStyle = new GUIStyle(_tabStyle); _tabActiveStyle.normal.background = _tabActiveTex; _tabActiveStyle.normal.textColor = new Color(0.4f, 0.85f, 1f); _toggleActiveStyle = new GUIStyle(_btnStyle); _toggleActiveStyle.alignment = (TextAnchor)3; _toggleActiveStyle.normal.background = MakeTex(8, 8, new Color(0.08f, 0.22f, 0.16f, 1f), border2, 1); _toggleActiveStyle.normal.textColor = new Color(0.45f, 1f, 0.65f); _toggleInactiveStyle = new GUIStyle(_btnStyle); _toggleInactiveStyle.alignment = (TextAnchor)3; _toggleInactiveStyle.normal.background = _btnNormalTex; _toggleInactiveStyle.normal.textColor = new Color(0.6f, 0.65f, 0.7f); _badgeStyle = new GUIStyle(GUI.skin.box); _badgeStyle.fontStyle = (FontStyle)1; _badgeStyle.fontSize = 11; _badgeStyle.alignment = (TextAnchor)4; _badgeStyle.normal.background = _accentBadgeTex; _badgeStyle.normal.textColor = new Color(0.4f, 0.85f, 1f); _greenBadgeStyle = new GUIStyle(_badgeStyle); _greenBadgeStyle.normal.background = _greenBadgeTex; _greenBadgeStyle.normal.textColor = new Color(0.45f, 1f, 0.65f); _goldBadgeStyle = new GUIStyle(_badgeStyle); _goldBadgeStyle.normal.background = _goldBadgeTex; _goldBadgeStyle.normal.textColor = new Color(1f, 0.85f, 0.35f); _gripStyle = new GUIStyle(); _gripStyle.fontSize = 12; _gripStyle.fontStyle = (FontStyle)1; _gripStyle.alignment = (TextAnchor)8; _gripStyle.normal.textColor = new Color(0.4f, 0.75f, 1f, 0.8f); _scrollBarStyle = new GUIStyle(GUI.skin.verticalScrollbar); _scrollBarStyle.normal.background = _scrollBgTex; _scrollBarStyle.fixedWidth = 6f; _scrollBarStyle.margin = new RectOffset(2, 2, 0, 0); _scrollThumbStyle = new GUIStyle(GUI.skin.verticalScrollbarThumb); _scrollThumbStyle.normal.background = _scrollThumbTex; _scrollThumbStyle.hover.background = _scrollThumbHoverTex; _scrollThumbStyle.active.background = _scrollThumbHoverTex; _scrollThumbStyle.fixedWidth = 6f; } } private void OnGUI() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Invalid comparison between Unknown and I4 //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Invalid comparison between Unknown and I4 //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (!_showMenu) { return; } try { InitStyles(); GUI.depth = -9999; Event current = Event.current; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref _windowRect)).x + ((Rect)(ref _windowRect)).width - 24f, ((Rect)(ref _windowRect)).y + ((Rect)(ref _windowRect)).height - 24f, 24f, 24f); if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref val)).Contains(current.mousePosition)) { _isResizing = true; _resizeStartMouse = current.mousePosition; _resizeStartSize = new Vector2(((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height); current.Use(); } if (_isResizing) { if ((int)current.type == 3 || (int)current.type == 7) { Vector2 val2 = current.mousePosition - _resizeStartMouse; ((Rect)(ref _windowRect)).width = Mathf.Clamp(_resizeStartSize.x + val2.x, 480f, (float)Screen.width - ((Rect)(ref _windowRect)).x); ((Rect)(ref _windowRect)).height = Mathf.Clamp(_resizeStartSize.y + val2.y, 420f, (float)Screen.height - ((Rect)(ref _windowRect)).y); } if ((int)current.rawType == 1) { _isResizing = false; } } ((Rect)(ref _windowRect)).x = Mathf.Clamp(((Rect)(ref _windowRect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _windowRect)).width)); ((Rect)(ref _windowRect)).y = Mathf.Clamp(((Rect)(ref _windowRect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _windowRect)).height)); GUI.backgroundColor = Color.white; _windowRect = GUI.Window(849312, _windowRect, new WindowFunction(DrawMenuWindow), "", _winStyle); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("OnGUI Exception: " + ex)); } } private void DrawMenuWindow(int id) { //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_18e8: Unknown result type (might be due to invalid IL or missing references) //IL_16e9: Unknown result type (might be due to invalid IL or missing references) //IL_176d: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: Unknown result type (might be due to invalid IL or missing references) try { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if ((Object)(object)_modIcon != (Object)null) { GUILayout.Label((Texture)(object)_modIcon, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(38f), GUILayout.Height(38f) }); GUILayout.Space(10f); } GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("WeatherExpansion", _titleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(string.Format("v{0} | {1}", "1.0.0", T("AMOLED Control Panel", "Панель Управления Погодой")), _subTitleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); string text = ((SelectedLanguage.Value == ModLanguage.Russian) ? "RU" : "EN"); if (GUILayout.Button(text, _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(28f), GUILayout.Width(54f) })) { SelectedLanguage.Value = ((SelectedLanguage.Value != ModLanguage.Russian) ? ModLanguage.Russian : ModLanguage.English); } GUILayout.Space(6f); if (GUILayout.Button("X", _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(32f), GUILayout.Height(28f) })) { SetMenuOpen(open: false); } GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); string[] array = new string[4] { T("Weather", "Погода"), T("Day & Night", "Время и Небо"), T("Physics & Waves", "Физика и Волны"), T("Settings", "Настройки") }; for (int i = 0; i < array.Length; i++) { if (GUILayout.Button(array[i], (_currentTab == i) ? _tabActiveStyle : _tabStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { _currentTab = i; } } GUILayout.EndHorizontal(); GUILayout.Space(10f); GUI.skin.verticalScrollbar = _scrollBarStyle; GUI.skin.verticalScrollbarThumb = _scrollThumbStyle; _scrollPos = GUILayout.BeginScrollView(_scrollPos, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (_currentTab == 0) { GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("CURRENT WEATHER STATUS", "ТЕКУЩЕЕ СОСТОЯНИЕ ПОГОДЫ"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(4f); int num = Mathf.FloorToInt(_dayPhase * 24f * 60f) % 1440; string arg = ((_lastIsland < 0) ? T("Outside Island", "Вне острова") : string.Format(T("Island {0}", "Остров {0}"), _lastIsland + 1)); string arg2 = $"{num / 60:D2}:{num % 60:D2}"; string arg3 = LocalizedWeather(_currentWeather); bool hasValue = _forcedWeather.HasValue; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{arg} • {arg2} • {arg3}", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Box(hasValue ? T("MANUAL", "РУЧНОЙ") : T("AUTOMATIC", "АВТОМАТИКА"), hasValue ? _badgeStyle : _greenBadgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("SET INSTANT WEATHER", "УСТАНОВКА ПОГОДЫ"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (DrawWeatherButton("☀\ufe0f " + T("Clear", "Ясно"), _currentWeather == WeatherKind.Clear && _forcedWeather.HasValue)) { _forcedWeather = WeatherKind.Clear; } if (DrawWeatherButton("\ud83c\udf27\ufe0f " + T("Rain", "Дождь"), _currentWeather == WeatherKind.Rain && _forcedWeather.HasValue)) { _forcedWeather = WeatherKind.Rain; } if (DrawWeatherButton("⛈\ufe0f " + T("Storm", "Гроза"), _currentWeather == WeatherKind.Storm && _forcedWeather.HasValue)) { _forcedWeather = WeatherKind.Storm; } GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (DrawWeatherButton("❄\ufe0f " + T("Snow", "Снег"), _currentWeather == WeatherKind.Snow && _forcedWeather.HasValue)) { _forcedWeather = WeatherKind.Snow; } if (DrawWeatherButton("\ud83c\udf2a\ufe0f " + T("Hurricane", "Ураган"), _currentWeather == WeatherKind.Hurricane && _forcedWeather.HasValue)) { _forcedWeather = WeatherKind.Hurricane; } if (GUILayout.Button("\ud83d\udd04 " + T("Auto Weather", "Авто-погода"), hasValue ? _btnStyle : _weatherBtnActiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { _forcedWeather = null; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("FLASHLIGHT & ATMOSPHERE", "ФОНАРИК И АТМОСФЕРА"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); string text2 = (EnablePlayerFlashlight.Value ? string.Format(T("[v] High-Power Flashlight: ON [{0}]", "[v] Мощный налобный фонарик: ВКЛ [{0}]"), FlashlightKey.Value) : string.Format(T("[ ] High-Power Flashlight: OFF [{0}]", "[ ] Мощный налобный фонарик: ВЫКЛ [{0}]"), FlashlightKey.Value)); if (GUILayout.Button(text2, EnablePlayerFlashlight.Value ? _toggleActiveStyle : _toggleInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { EnablePlayerFlashlight.Value = !EnablePlayerFlashlight.Value; } if (EnablePlayerFlashlight.Value) { GUILayout.Space(6f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Flashlight Brightness:", "Яркость луча фонарика:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{FlashlightBrightness.Value:F1}x", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(50f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); FlashlightBrightness.Value = GUILayout.HorizontalSlider(FlashlightBrightness.Value, 2f, 16f, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Weather Audio Volume:", "Громкость звуков погоды:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_weatherVolumePercent.Value}%", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(50f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _weatherVolumePercent.Value = (int)GUILayout.HorizontalSlider((float)_weatherVolumePercent.Value, 0f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Visual Effect Intensity:", "Интенсивность визуальных эффектов:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_effectIntensity.Value:F1}x", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(50f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _effectIntensity.Value = GUILayout.HorizontalSlider(_effectIntensity.Value, 0f, 2f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Particle Density (Quality):", "Плотность частиц (Качество):"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_particleQuality.Value:F1}x", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(50f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _particleQuality.Value = GUILayout.HorizontalSlider(_particleQuality.Value, 0.2f, 1.5f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); } else if (_currentTab == 1) { GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("TIME OF DAY & PRESETS", "ВРЕМЯ СУТОК И ПРЕСЕТЫ"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(4f); int num2 = Mathf.FloorToInt(_dayPhase * 24f * 60f) % 1440; int num3 = num2 / 60; int num4 = num2 % 60; string arg4 = ((_midnightPeak > 0.35f) ? T("\ud83c\udf0c Deep Midnight (Authentic Dark Night)", "\ud83c\udf0c Глубокая полночь (Настоящая ночь)") : ((_dayFactor < 0.2f) ? T("\ud83c\udf03 Night Sky", "\ud83c\udf03 Ночное небо") : ((!(_dayFactor < 0.7f)) ? T("☀\ufe0f Daylight", "☀\ufe0f День") : T("\ud83c\udf05 Twilight / Dawn", "\ud83c\udf05 Сумерки / Закат")))); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"⏰ {num3:D2}:{num4:D2} • {arg4}", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (_isTimePaused) { GUILayout.Box(T("TIME FROZEN", "ВРЕМЯ НА ПАУЗЕ"), _goldBadgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }); } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button("\ud83c\udf05 " + T("Dawn (06:00)", "Рассвет (06:00)"), _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _forcedTimeHour = 6f; } if (GUILayout.Button("☀\ufe0f " + T("Noon (12:00)", "Полдень (12:00)"), _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _forcedTimeHour = 12f; } GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button("\ud83c\udf07 " + T("Sunset (18:30)", "Закат (18:30)"), _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _forcedTimeHour = 18.5f; } if (GUILayout.Button("\ud83c\udf0c " + T("Midnight (01:00)", "Полночь (01:00)"), _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _forcedTimeHour = 1f; } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); string text3 = (_isTimePaused ? T("[v] Freeze Time Progression: ON", "[v] Заморозка времени: ВКЛ") : T("[ ] Freeze Time Progression: OFF", "[ ] Заморозка времени: ВЫКЛ")); if (GUILayout.Button(text3, _isTimePaused ? _toggleActiveStyle : _toggleInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _isTimePaused = !_isTimePaused; } if (_forcedTimeHour.HasValue) { GUILayout.Space(4f); if (GUILayout.Button("\ud83d\udd04 " + T("Resume Clock", "Авто-время"), _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { _forcedTimeHour = null; _isTimePaused = false; } } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Set Exact Hour (0 - 24):", "Точный час суток (0 - 24):"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); float num5 = (_forcedTimeHour.HasValue ? _forcedTimeHour.Value : (_dayPhase * 24f)); GUILayout.Label($"{num5:F1}h", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(60f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); float num6 = GUILayout.HorizontalSlider(num5, 0f, 24f, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (Mathf.Abs(num6 - num5) > 0.05f) { _forcedTimeHour = num6; } GUILayout.EndVertical(); GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("STARS & METEORS", "ЗВЁЗДЫ И МЕТЕОРЫ"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); string text4 = (_enableNightStars.Value ? T("[v] Night Stars & Falling Meteors: ENABLED", "[v] Ночные звёзды и метеоры: ВКЛ") : T("[ ] Night Stars & Falling Meteors: DISABLED", "[ ] Ночные звёзды и метеоры: ВЫКЛ")); if (GUILayout.Button(text4, _enableNightStars.Value ? _toggleActiveStyle : _toggleInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _enableNightStars.Value = !_enableNightStars.Value; } if (_enableNightStars.Value) { GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Star & Meteor Brightness:", "Яркость звёзд и метеоров:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_starBrightness.Value:F1}x", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(50f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _starBrightness.Value = GUILayout.HorizontalSlider(_starBrightness.Value, 0.2f, 3f, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.EndVertical(); GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("CYCLE DURATION & ATMOSPHERE", "ДЛИТЕЛЬНОСТЬ И ПЛАВНОСТЬ"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Day Length (Real Minutes):", "Длительность суток (в минутах):"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_dayLengthMinutes.Value:F0} min", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(65f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _dayLengthMinutes.Value = GUILayout.HorizontalSlider(_dayLengthMinutes.Value, 1f, 60f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Night Sky Darkness Exposure:", "Затемнение ночного неба:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_nightExposure.Value:F2}", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(65f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _nightExposure.Value = GUILayout.HorizontalSlider(_nightExposure.Value, -5f, 0f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Weather Transition Smoothness (Seconds):", "Плавность смены погоды (в секундах):"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_transitionSeconds.Value:F0}s", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(65f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _transitionSeconds.Value = GUILayout.HorizontalSlider(_transitionSeconds.Value, 1f, 30f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); } else if (_currentTab == 2) { GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("WEATHER GAMEPLAY & PHYSICS", "ФИЗИКА И ВЛИЯНИЕ НА ГЕЙМПЛЕЙ"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); string text5 = (_gameplayEnabled.Value ? T("[v] Physical Weather Effects: ENABLED", "[v] Физика погоды: ВКЛЮЧЕНА") : T("[ ] Physical Weather Effects: DISABLED", "[ ] Физика погоды: ВЫКЛЮЧЕНА")); if (GUILayout.Button(text5, _gameplayEnabled.Value ? _toggleActiveStyle : _toggleInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { _gameplayEnabled.Value = !_gameplayEnabled.Value; if (!_gameplayEnabled.Value && _gameplay != null) { _gameplay.Restore(); } } if (_gameplayEnabled.Value) { GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Gameplay Physics Strength:", "Сила влияния погоды:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label($"{_gameplayStrengthPercent.Value}%", _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(50f), GUILayout.Height(22f) }); GUILayout.EndHorizontal(); _gameplayStrengthPercent.Value = (int)GUILayout.HorizontalSlider((float)_gameplayStrengthPercent.Value, 0f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); GUILayout.Label(T("• Rain: slightly slippery ground, subtle waves, quicker bite rate.\n• Storm: wind gusts on player, boat rocking, large ocean waves.\n• Snow: slower walking traction, cold water, calmer fish.\n• Hurricane: heavy wind push, high waves, intense boat drift.", "• Дождь: влажная поверхность, лёгкие волны, быстрый клёв.\n• Гроза: порывы ветра на игрока, качка лодки, большие волны.\n• Снег: сниженное сцепление с землёй, спокойная рыба.\n• Ураган: мощный снос ветром, огромные волны, дрейф катера."), _subTitleStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.EndVertical(); } else if (_currentTab == 3) { GUILayout.BeginVertical(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("MASTER MOD SETTINGS", "ОБЩИЕ НАСТРОЙКИ МОДА"), _sectionHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); string text6 = (_enabled.Value ? T("[v] WeatherExpansion Mod: ACTIVE", "[v] Мод WeatherExpansion: ВКЛЮЧЕН") : T("[ ] WeatherExpansion Mod: DISABLED", "[ ] Мод WeatherExpansion: ВЫКЛЮЧЕН")); if (GUILayout.Button(text6, _enabled.Value ? _toggleActiveStyle : _toggleInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { _enabled.Value = !_enabled.Value; } GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Menu Toggle Key:", "Клавиша открытия меню:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Box(((object)MenuKey.Value).ToString(), _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(24f) }); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Flashlight Key:", "Клавиша фонарика:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Box(((object)FlashlightKey.Value).ToString(), _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(24f) }); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(T("Multiplayer Sync Seed:", "Сид синхронизации в сети:"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_seed.Value.ToString(), _badgeStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(24f) }); GUILayout.EndHorizontal(); GUILayout.Space(12f); if (GUILayout.Button(T("Save Config File", "Сохранить файл конфигурации"), _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ((BaseUnityPlugin)this).Config.Save(); } GUILayout.EndVertical(); } GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); GUILayout.Label("///", _gripStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(14f) }); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width - 90f, 45f)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("DrawMenuWindow Exception: " + ex)); } } private bool DrawWeatherButton(string label, bool isActive) { return GUILayout.Button(label, isActive ? _weatherBtnActiveStyle : _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }); } }