using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("HTFDayNight")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HTFDayNight")] [assembly: AssemblyTitle("HTFDayNight")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [BepInPlugin("yoxi.htf.daynight", "HTF Day and Night", "1.0.0")] public class DayNightPlugin : BaseUnityPlugin { public const string Id = "yoxi.htf.daynight"; internal static ManualLogSource Log; private ConfigEntry _minutesPerDay; private ConfigEntry _backKey; private ConfigEntry _forwardKey; private ConfigEntry _scrubSeconds; private ConfigEntry _savedTime; private ConfigEntry _savedOffset; private ConfigEntry _resyncKey; private ConfigEntry _nightSun; private ConfigEntry _nightSunColor; private ConfigEntry _nightFogColor; private ConfigEntry _nightFogMul; private GameObject _skyPrefab; private GameObject _sky; private float _poll; private Func _netClock; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; _minutesPerDay = ((BaseUnityPlugin)this).Config.Bind("Sky", "MinutesPerDay", 20f, "How many real minutes one full day (sunrise to sunrise) lasts."); _backKey = ((BaseUnityPlugin)this).Config.Bind("Sky", "TimeBackKey", (KeyCode)276, "Hold to roll time backwards. Set to None to disable."); _forwardKey = ((BaseUnityPlugin)this).Config.Bind("Sky", "TimeForwardKey", (KeyCode)275, "Hold to run time forwards. Set to None to disable."); _scrubSeconds = ((BaseUnityPlugin)this).Config.Bind("Sky", "TimeScrubSeconds", 8f, "Holding a time key crosses one whole day in this many real seconds."); _nightSun = ((BaseUnityPlugin)this).Config.Bind("Night", "MoonlightIntensity", 0.35f, "Strength of the moonlight at full night."); _nightSunColor = ((BaseUnityPlugin)this).Config.Bind("Night", "MoonlightColor", "#9EB3EB", "Hex colour of the moonlight."); _nightFogColor = ((BaseUnityPlugin)this).Config.Bind("Night", "FogColor", "#080D1A", "Hex colour of the night fog above water. Underwater fog is never touched."); _nightFogMul = ((BaseUnityPlugin)this).Config.Bind("Night", "FogDensityMultiplier", 2f, "Night fog density as a multiple of the day's."); _resyncKey = ((BaseUnityPlugin)this).Config.Bind("Sky", "ResyncKey", (KeyCode)290, "Press to drop your personal time shift and rejoin the shared clock (or reset the arrow-key shift when playing offline)."); _savedOffset = ((BaseUnityPlugin)this).Config.Bind("Sky", "SavedTimeOffset", 0f, "Your arrow-key time shift. Offline it is folded into the saved clock; in a synced co-op game it shifts only YOUR view of the shared server time."); _savedTime = ((BaseUnityPlugin)this).Config.Bind("Sky", "SavedTimeOfDay", 0.25f, "Where the clock stood when you last left the world (0..1, noon is 0.25). The day pauses while you are away and resumes here. Set it back to 0.25 to start a fresh day at noon."); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "htfsky.bundle"); if (!File.Exists(text)) { Log.LogWarning((object)"htfsky.bundle is missing beside HTFDayNight.dll - the world keeps its endless day. Reinstall the mod so both files sit in the same folder."); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Log.LogError((object)"htfsky.bundle would not load."); return; } GameObject[] array = val.LoadAllAssets(); foreach (GameObject val2 in array) { if (((Object)val2).name == "NightSky") { _skyPrefab = val2; break; } } if ((Object)(object)_skyPrefab == (Object)null) { Log.LogError((object)"htfsky.bundle holds no NightSky prefab."); } else { Log.LogInfo((object)("The sky is loaded. Day and night will cycle over " + _minutesPerDay.Value + " real minutes.")); } } private static Func MakeNetClock() { try { Type type = Type.GetType("FishNet.InstanceFinder, FishNet.Runtime"); if (type == null) { return null; } PropertyInfo tmProp = type.GetProperty("TimeManager", BindingFlags.Static | BindingFlags.Public); if (tmProp == null) { return null; } PropertyInfo tickProp = null; PropertyInfo deltaProp = null; return delegate { try { object value = tmProp.GetValue(null, null); if (value == null) { return -1.0; } if (tickProp == null) { tickProp = value.GetType().GetProperty("Tick"); deltaProp = value.GetType().GetProperty("TickDelta"); } if (tickProp == null || deltaProp == null) { return -1.0; } uint num = Convert.ToUInt32(tickProp.GetValue(value, null)); if (num == 0) { return -1.0; } double num2 = Convert.ToDouble(deltaProp.GetValue(value, null)); return (double)num * num2; } catch (Exception) { return -1.0; } }; } catch (Exception) { return null; } } private void SaveClock() { if (!((Object)(object)_sky == (Object)null)) { NightKeeper component = _sky.GetComponent(); if ((Object)(object)component != (Object)null) { _savedTime.Value = component.TimeOfDay; _savedOffset.Value = component.TimeOffset; } } } private void OnApplicationQuit() { SaveClock(); } private void OnDestroy() { SaveClock(); } private void Update() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0118: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_skyPrefab == (Object)null) { return; } _poll -= Time.deltaTime; if (_poll > 0f) { return; } _poll = 2f; bool flag = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)0).Length != 0; if (flag && (Object)(object)_sky == (Object)null) { _sky = Object.Instantiate(_skyPrefab); ((Object)_sky).name = "NightSky"; Object.DontDestroyOnLoad((Object)(object)_sky); NightKeeper nightKeeper = _sky.AddComponent(); nightKeeper.Cycle = true; nightKeeper.TimeOfDay = _savedTime.Value; nightKeeper.TimeOffset = _savedOffset.Value; nightKeeper.ResyncKey = _resyncKey.Value; nightKeeper.NightLightIntensity = _nightSun.Value; Color val = default(Color); if (ColorUtility.TryParseHtmlString(_nightSunColor.Value, ref val)) { nightKeeper.NightLightColor = val; } if (ColorUtility.TryParseHtmlString(_nightFogColor.Value, ref val)) { nightKeeper.NightFogColor = val; } nightKeeper.NightFogDensityMul = _nightFogMul.Value; nightKeeper.NetworkSeconds = _netClock ?? (_netClock = MakeNetClock()); Log.LogInfo((object)((_netClock != null) ? "Co-op sync armed: time rides the FishNet server tick." : "No FishNet found - local clock only.")); nightKeeper.DayMinutes = Mathf.Max(1f, _minutesPerDay.Value); nightKeeper.BackKey = _backKey.Value; nightKeeper.ForwardKey = _forwardKey.Value; nightKeeper.ScrubSeconds = Mathf.Max(1f, _scrubSeconds.Value); Log.LogInfo((object)"The wheel begins to turn."); } else if (!flag && (Object)(object)_sky != (Object)null) { SaveClock(); Object.Destroy((Object)(object)_sky); _sky = null; Log.LogInfo((object)"The heavens rest until the next voyage."); } } } public class NightKeeper : MonoBehaviour { private class CloudPaint { public Material M; public int[] Ids; public Color[] Day; public bool[] Disc; public float[] Weight; public byte[] Mode; public int DepthFadeId = -1; public float DepthFadeDay; } private class ProbeMemory { public ReflectionProbe P; public ReflectionProbeMode Mode; public Texture Baked; } public bool Cycle; public float DayMinutes = 20f; public KeyCode BackKey = (KeyCode)276; public KeyCode ForwardKey = (KeyCode)275; public KeyCode ResyncKey = (KeyCode)290; public float ScrubSeconds = 8f; private static int _inputMode; private bool _censusDone; public Func NetworkSeconds; public Color NightLightColor = new Color(0.62f, 0.7f, 0.92f); public float NightLightIntensity = 0.35f; public Color NightFogColor = new Color(0.03f, 0.05f, 0.1f); public float NightFogDensityMul = 2f; private float _localT = 0.25f; private float _offset; private float _dayFogDensity; private float _t = 0.25f; private Light[] _lights = (Light[])(object)new Light[0]; private readonly Dictionary _dayColor = new Dictionary(); private readonly Dictionary _dayAim = new Dictionary(); private readonly Dictionary _dayIntensity = new Dictionary(); private readonly List _hiddenSky = new List(); private Renderer[] _ours = (Renderer[])(object)new Renderer[0]; private MaterialPropertyBlock _tint; private readonly List _clouds = new List(); private readonly HashSet _cloudSeen = new HashSet(); private readonly List _water = new List(); private readonly HashSet _waterSeen = new HashSet(); private Cubemap _envCube; private float _envTick; private DefaultReflectionMode _dayReflMode; private Texture _dayReflTexture; private bool _tookRefl; private readonly List _probes = new List(); private readonly HashSet _probeSeen = new HashSet(); private Color _skyNow = new Color(0.6f, 0.78f, 0.93f); private MaterialPropertyBlock _shade; private MaterialPropertyBlock _sunTint; private MaterialPropertyBlock _full; private readonly Dictionary _wasFlagsBy = new Dictionary(); private readonly Dictionary _wasBackgroundBy = new Dictionary(); private Material _wasSkybox; private float _rescan; private Color _dayAmbient; private float _dayAmbientStrength; private Color _dayFog; private float _dayReflection = 1f; private float _sunHeight = 1f; private bool _tookWorld; private static readonly Color NightSky = new Color(0.02f, 0.03f, 0.07f); private static readonly Vector3 PolarAxis = Vector3.Normalize(new Vector3(1f, 0f, 0.35f)); private static readonly Vector3 SunHome = SunHomeDir(); private static readonly Vector3 MoonHome = -SunHomeDir(); private bool _photoSwap; private Color _photoAmbient; private float _photoAmbientStrength; private Color _photoFog; private float _photoReflStrength; private Texture _photoReflTexture; private DefaultReflectionMode _photoReflMode; private readonly Dictionary _photoIntensity = new Dictionary(); private readonly Dictionary _photoColor = new Dictionary(); private readonly Dictionary _photoAimWas = new Dictionary(); private static ManualLogSource DayNightLogTarget => DayNightPlugin.Log; public float TimeOfDay { get { return _t; } set { _localT = Mathf.Repeat(value, 1f); _t = _localT; } } public float TimeOffset { get { return _offset; } set { _offset = Mathf.Repeat(value, 1f); } } private unsafe static bool Held(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if ((int)key == 0) { return false; } if (_inputMode <= 1) { try { bool key2 = Input.GetKey(key); _inputMode = 1; return key2; } catch (Exception) { _inputMode = 2; } } if (_inputMode == 2) { try { Keyboard current = Keyboard.current; if (current == null) { return false; } if (!Enum.TryParse(((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString(), ignoreCase: true, out Key result)) { return false; } return ((ButtonControl)current[result]).isPressed; } catch (Exception) { _inputMode = -1; } } return false; } private static Vector3 SunHomeDir() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return Vector3.down; } private float Nightness() { if (!Cycle) { return 1f; } if (_t < 0.03f) { return Mathf.SmoothStep(1f, 0f, (_t + 0.03f) / 0.06f); } if (_t < 0.47f) { return 0f; } if (_t < 0.53f) { return Mathf.SmoothStep(0f, 1f, (_t - 0.47f) / 0.06f); } if (_t < 0.97f) { return 1f; } return Mathf.SmoothStep(1f, 0f, (_t - 0.97f) / 0.06f); } private void LateUpdate() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown //IL_0193: 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_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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Expected O, but got Unknown //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Expected O, but got Unknown //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0d5e: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d63: Unknown result type (might be due to invalid IL or missing references) //IL_101e: Unknown result type (might be due to invalid IL or missing references) //IL_1023: Unknown result type (might be due to invalid IL or missing references) //IL_1059: Unknown result type (might be due to invalid IL or missing references) //IL_105e: Unknown result type (might be due to invalid IL or missing references) //IL_1063: Unknown result type (might be due to invalid IL or missing references) //IL_1065: Unknown result type (might be due to invalid IL or missing references) //IL_1067: Unknown result type (might be due to invalid IL or missing references) //IL_106c: Unknown result type (might be due to invalid IL or missing references) //IL_1071: Unknown result type (might be due to invalid IL or missing references) //IL_1073: Unknown result type (might be due to invalid IL or missing references) //IL_0f0d: Unknown result type (might be due to invalid IL or missing references) //IL_0f12: Unknown result type (might be due to invalid IL or missing references) //IL_1103: Unknown result type (might be due to invalid IL or missing references) //IL_108f: Unknown result type (might be due to invalid IL or missing references) //IL_1081: Unknown result type (might be due to invalid IL or missing references) //IL_1083: Unknown result type (might be due to invalid IL or missing references) //IL_1088: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Invalid comparison between Unknown and I4 //IL_0f8e: Unknown result type (might be due to invalid IL or missing references) //IL_0f9b: Unknown result type (might be due to invalid IL or missing references) //IL_0fa8: Unknown result type (might be due to invalid IL or missing references) //IL_0fb5: Unknown result type (might be due to invalid IL or missing references) //IL_0fd2: Unknown result type (might be due to invalid IL or missing references) //IL_0fd4: Unknown result type (might be due to invalid IL or missing references) //IL_0fd7: Unknown result type (might be due to invalid IL or missing references) //IL_0f35: Unknown result type (might be due to invalid IL or missing references) //IL_0f42: Unknown result type (might be due to invalid IL or missing references) //IL_0f4f: Unknown result type (might be due to invalid IL or missing references) //IL_0f77: Unknown result type (might be due to invalid IL or missing references) //IL_0f79: Unknown result type (might be due to invalid IL or missing references) //IL_0f7d: Unknown result type (might be due to invalid IL or missing references) //IL_1091: Unknown result type (might be due to invalid IL or missing references) //IL_1094: Unknown result type (might be due to invalid IL or missing references) //IL_10a0: Unknown result type (might be due to invalid IL or missing references) //IL_10b4: Unknown result type (might be due to invalid IL or missing references) //IL_10cf: Unknown result type (might be due to invalid IL or missing references) //IL_10d4: Unknown result type (might be due to invalid IL or missing references) //IL_10d9: Unknown result type (might be due to invalid IL or missing references) //IL_10de: Unknown result type (might be due to invalid IL or missing references) //IL_0db4: Unknown result type (might be due to invalid IL or missing references) //IL_0db9: Unknown result type (might be due to invalid IL or missing references) //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dc2: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0dc9: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Unknown result type (might be due to invalid IL or missing references) //IL_113a: Unknown result type (might be due to invalid IL or missing references) //IL_114e: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Invalid comparison between Unknown and I4 //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Invalid comparison between Unknown and I4 //IL_1160: Unknown result type (might be due to invalid IL or missing references) //IL_1165: Unknown result type (might be due to invalid IL or missing references) //IL_1167: Unknown result type (might be due to invalid IL or missing references) //IL_1178: Unknown result type (might be due to invalid IL or missing references) //IL_1189: Unknown result type (might be due to invalid IL or missing references) //IL_118e: Unknown result type (might be due to invalid IL or missing references) //IL_1194: Unknown result type (might be due to invalid IL or missing references) //IL_1199: Unknown result type (might be due to invalid IL or missing references) //IL_0e8b: Unknown result type (might be due to invalid IL or missing references) //IL_0e90: Unknown result type (might be due to invalid IL or missing references) //IL_0e94: Unknown result type (might be due to invalid IL or missing references) //IL_0e99: Unknown result type (might be due to invalid IL or missing references) //IL_0ab7: Unknown result type (might be due to invalid IL or missing references) //IL_0abd: Invalid comparison between Unknown and I4 //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_125c: Unknown result type (might be due to invalid IL or missing references) //IL_1265: Unknown result type (might be due to invalid IL or missing references) //IL_1267: Unknown result type (might be due to invalid IL or missing references) //IL_1206: Unknown result type (might be due to invalid IL or missing references) //IL_120c: Invalid comparison between Unknown and I4 //IL_1365: Unknown result type (might be due to invalid IL or missing references) //IL_1210: Unknown result type (might be due to invalid IL or missing references) //IL_1216: Invalid comparison between Unknown and I4 //IL_1393: Unknown result type (might be due to invalid IL or missing references) //IL_1398: Unknown result type (might be due to invalid IL or missing references) //IL_13d1: Unknown result type (might be due to invalid IL or missing references) //IL_1405: Unknown result type (might be due to invalid IL or missing references) //IL_140b: Unknown result type (might be due to invalid IL or missing references) //IL_1415: Unknown result type (might be due to invalid IL or missing references) //IL_141a: Unknown result type (might be due to invalid IL or missing references) //IL_1447: Unknown result type (might be due to invalid IL or missing references) //IL_1537: Unknown result type (might be due to invalid IL or missing references) //IL_153c: Unknown result type (might be due to invalid IL or missing references) //IL_154d: Unknown result type (might be due to invalid IL or missing references) //IL_1552: Unknown result type (might be due to invalid IL or missing references) //IL_1230: Unknown result type (might be due to invalid IL or missing references) //IL_1245: Unknown result type (might be due to invalid IL or missing references) //IL_15e2: Unknown result type (might be due to invalid IL or missing references) //IL_15e7: Unknown result type (might be due to invalid IL or missing references) //IL_1937: Unknown result type (might be due to invalid IL or missing references) //IL_194b: Unknown result type (might be due to invalid IL or missing references) //IL_1951: Unknown result type (might be due to invalid IL or missing references) //IL_161a: Unknown result type (might be due to invalid IL or missing references) //IL_161f: Unknown result type (might be due to invalid IL or missing references) //IL_1622: Unknown result type (might be due to invalid IL or missing references) //IL_162c: Unknown result type (might be due to invalid IL or missing references) //IL_1631: Unknown result type (might be due to invalid IL or missing references) //IL_1640: Unknown result type (might be due to invalid IL or missing references) //IL_164a: Unknown result type (might be due to invalid IL or missing references) //IL_164f: Unknown result type (might be due to invalid IL or missing references) //IL_160f: Unknown result type (might be due to invalid IL or missing references) //IL_1619: Expected O, but got Unknown //IL_17d2: Unknown result type (might be due to invalid IL or missing references) //IL_17d8: Invalid comparison between Unknown and I4 //IL_1984: Unknown result type (might be due to invalid IL or missing references) //IL_19a7: Unknown result type (might be due to invalid IL or missing references) //IL_19ad: Unknown result type (might be due to invalid IL or missing references) //IL_184f: Unknown result type (might be due to invalid IL or missing references) //IL_1854: Unknown result type (might be due to invalid IL or missing references) //IL_180c: Unknown result type (might be due to invalid IL or missing references) //IL_183b: Unknown result type (might be due to invalid IL or missing references) //IL_166d: Unknown result type (might be due to invalid IL or missing references) //IL_166f: Unknown result type (might be due to invalid IL or missing references) //IL_1672: Invalid comparison between Unknown and I4 //IL_18e0: Unknown result type (might be due to invalid IL or missing references) //IL_18e3: Unknown result type (might be due to invalid IL or missing references) //IL_18e9: Unknown result type (might be due to invalid IL or missing references) //IL_19cb: Unknown result type (might be due to invalid IL or missing references) //IL_19d0: Unknown result type (might be due to invalid IL or missing references) //IL_19d2: Unknown result type (might be due to invalid IL or missing references) //IL_19d5: Unknown result type (might be due to invalid IL or missing references) //IL_19db: Unknown result type (might be due to invalid IL or missing references) //IL_1680: Unknown result type (might be due to invalid IL or missing references) //IL_1683: Invalid comparison between Unknown and I4 //IL_167a: Unknown result type (might be due to invalid IL or missing references) //IL_167c: Unknown result type (might be due to invalid IL or missing references) //IL_18bc: Unknown result type (might be due to invalid IL or missing references) //IL_18c1: Unknown result type (might be due to invalid IL or missing references) //IL_1894: Unknown result type (might be due to invalid IL or missing references) //IL_1899: Unknown result type (might be due to invalid IL or missing references) //IL_189d: Unknown result type (might be due to invalid IL or missing references) //IL_18a2: Unknown result type (might be due to invalid IL or missing references) //IL_1691: Unknown result type (might be due to invalid IL or missing references) //IL_1693: Unknown result type (might be due to invalid IL or missing references) //IL_169e: Unknown result type (might be due to invalid IL or missing references) //IL_16a3: Unknown result type (might be due to invalid IL or missing references) //IL_168b: Unknown result type (might be due to invalid IL or missing references) //IL_168d: Unknown result type (might be due to invalid IL or missing references) //IL_1766: Unknown result type (might be due to invalid IL or missing references) //IL_176b: Unknown result type (might be due to invalid IL or missing references) //IL_18d5: Unknown result type (might be due to invalid IL or missing references) //IL_16b0: Unknown result type (might be due to invalid IL or missing references) //IL_16b6: Unknown result type (might be due to invalid IL or missing references) if (Cycle) { float num = 0f; float num2 = Time.deltaTime / Mathf.Max(1f, ScrubSeconds); if (Held(BackKey)) { num -= num2; } if (Held(ForwardKey)) { num += num2; } if (Held(ResyncKey)) { _offset = 0f; } double num3 = ((NetworkSeconds != null) ? NetworkSeconds() : (-1.0)); if (num3 >= 0.0) { _offset = Mathf.Repeat(_offset + num, 1f); _t = Mathf.Repeat((float)(num3 / ((double)DayMinutes * 60.0) % 1.0) + 0.25f + _offset, 1f); } else { _localT = Mathf.Repeat(_localT + Time.deltaTime / Mathf.Max(1f, DayMinutes * 60f) + num, 1f); _t = _localT; } } float num4 = Nightness(); foreach (Transform item3 in ((Component)this).transform) { Transform val = item3; if (((Object)val).name == "Clouds") { val.Rotate(Vector3.up, Time.deltaTime * 0.45f, (Space)0); } else if (Cycle) { val.localRotation = Quaternion.AngleAxis((_t - 0.75f) * 360f, PolarAxis); } else { val.Rotate(Vector3.up, Time.deltaTime * 0.14f, (Space)0); } } float num5 = Mathf.Clamp01((num4 - 0.55f) / 0.45f); if (_tint == null) { _tint = new MaterialPropertyBlock(); } _tint.SetColor("_Tint", new Color(1f, 1f, 1f, num5)); if (_full == null) { _full = new MaterialPropertyBlock(); _full.SetColor("_Tint", Color.white); } float num6 = Mathf.Sin(num4 * (float)Math.PI); num6 = num6 * num6 * 0.95f; float num7 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num4 - 0.4f) / 0.45f)); if (_shade == null) { _shade = new MaterialPropertyBlock(); } Renderer[] ours = _ours; foreach (Renderer val2 in ours) { if (!((Object)(object)val2 != (Object)null)) { continue; } string name = ((Object)((Component)val2).gameObject).name; if (name == "Clouds") { val2.enabled = false; } else if (name.StartsWith("Sun")) { if (_sunTint == null) { _sunTint = new MaterialPropertyBlock(); } float num8 = Mathf.Clamp01(1f - num5 / 0.3f); Color val3 = Color.Lerp(new Color(1f, 0.52f, 0.26f), Color.white, Mathf.Clamp01(_sunHeight * 1.3f)); _sunTint.SetColor("_Tint", new Color(val3.r, val3.g, val3.b, num8)); val2.enabled = num8 > 0.002f; val2.SetPropertyBlock(_sunTint); } else if (name == "DuskShade" || name == "NightShade") { float num9 = ((name == "DuskShade") ? num6 : num7); val2.enabled = num9 > 0.002f; _shade.SetColor("_Tint", new Color(1f, 1f, 1f, num9)); val2.SetPropertyBlock(_shade); } else if (name.StartsWith("Storm")) { val2.enabled = true; } else { val2.enabled = num5 > 0.001f; val2.SetPropertyBlock(_tint); } } _rescan -= Time.deltaTime; if (_rescan <= 0f) { _rescan = 2f; Material[] array = Resources.FindObjectsOfTypeAll(); foreach (Material val4 in array) { if ((Object)(object)val4 == (Object)null || (Object)(object)val4.shader == (Object)null || (((Object)val4.shader).name.IndexOf("water", StringComparison.OrdinalIgnoreCase) < 0 && ((Object)val4).name.IndexOf("water", StringComparison.OrdinalIgnoreCase) < 0 && ((Object)val4).name.IndexOf("ocean", StringComparison.OrdinalIgnoreCase) < 0) || !_waterSeen.Add(val4)) { continue; } List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); List list5 = new List(); int propertyCount = val4.shader.GetPropertyCount(); for (int k = 0; k < propertyCount; k++) { if ((int)val4.shader.GetPropertyType(k) == 0) { int propertyNameId = val4.shader.GetPropertyNameId(k); string propertyName = val4.shader.GetPropertyName(k); list.Add(propertyNameId); list2.Add(val4.GetColor(propertyNameId)); list3.Add(propertyName); float item = 0.18f; if (propertyName.EndsWith("_1")) { item = 0.3f; } else if (propertyName.IndexOf("Foam", StringComparison.OrdinalIgnoreCase) >= 0 || propertyName.IndexOf("Specular", StringComparison.OrdinalIgnoreCase) >= 0) { item = 0.08f; } list4.Add(item); byte item2 = 1; if (propertyName.IndexOf("Min_Max", StringComparison.OrdinalIgnoreCase) >= 0) { item2 = 2; } else if (propertyName.IndexOf("Smoothstep", StringComparison.OrdinalIgnoreCase) >= 0 || propertyName.IndexOf("Alpha", StringComparison.OrdinalIgnoreCase) >= 0) { item2 = 0; } list5.Add(item2); } } if (_water.Count < 4) { DayNightLogTarget.LogInfo((object)("Water material '" + ((Object)val4).name + "' (" + ((Object)val4.shader).name + ") colours: " + string.Join(", ", list3.ToArray()))); List list6 = new List(); for (int l = 0; l < propertyCount; l++) { ShaderPropertyType propertyType = val4.shader.GetPropertyType(l); if ((int)propertyType == 2 || (int)propertyType == 3) { string propertyName2 = val4.shader.GetPropertyName(l); list6.Add(propertyName2 + "=" + val4.GetFloat(val4.shader.GetPropertyNameId(l)).ToString("0.###")); } } DayNightLogTarget.LogInfo((object)("Water material '" + ((Object)val4).name + "' floats: " + string.Join(", ", list6.ToArray()))); } if (list.Count > 0) { CloudPaint cloudPaint = new CloudPaint(); cloudPaint.M = val4; cloudPaint.Ids = list.ToArray(); cloudPaint.Day = list2.ToArray(); cloudPaint.Disc = new bool[list.Count]; cloudPaint.Weight = list4.ToArray(); cloudPaint.Mode = list5.ToArray(); CloudPaint cloudPaint2 = cloudPaint; if (val4.HasProperty("_Depth_Fade_Distance")) { cloudPaint2.DepthFadeId = Shader.PropertyToID("_Depth_Fade_Distance"); cloudPaint2.DepthFadeDay = val4.GetFloat(cloudPaint2.DepthFadeId); } _water.Add(cloudPaint2); } } _lights = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)0); _ours = ((Component)this).GetComponentsInChildren(true); Renderer[] array2 = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)0); foreach (Renderer val5 in array2) { if ((Object)(object)val5 == (Object)null || !val5.enabled || ((Component)val5).transform.IsChildOf(((Component)this).transform)) { continue; } string name2 = ((Object)((Component)val5).gameObject).name; bool flag = name2 == "Sun" || name2.Contains("SunAndMoon"); if ((Cycle && flag) || (num4 > 0.5f && flag)) { val5.enabled = false; _hiddenSky.Add(val5); } else { if (!name2.Contains("Cloud")) { continue; } Material[] materials = val5.materials; foreach (Material val6 in materials) { if ((Object)(object)val6 == (Object)null || (Object)(object)val6.shader == (Object)null || !_cloudSeen.Add(val6)) { continue; } List list7 = new List(); List list8 = new List(); List list9 = new List(); List list10 = new List(); int propertyCount2 = val6.shader.GetPropertyCount(); for (int num10 = 0; num10 < propertyCount2; num10++) { if ((int)val6.shader.GetPropertyType(num10) == 0) { int propertyNameId2 = val6.shader.GetPropertyNameId(num10); string propertyName3 = val6.shader.GetPropertyName(num10); list7.Add(propertyNameId2); list8.Add(val6.GetColor(propertyNameId2)); list9.Add(propertyName3.IndexOf("sun", StringComparison.OrdinalIgnoreCase) >= 0 || propertyName3.IndexOf("moon", StringComparison.OrdinalIgnoreCase) >= 0 || propertyName3.IndexOf("sss", StringComparison.OrdinalIgnoreCase) >= 0 || propertyName3.IndexOf("scatter", StringComparison.OrdinalIgnoreCase) >= 0); list10.Add(propertyName3); } } DayNightPlugin.Log.LogInfo((object)("Sky material '" + ((Object)val6).name + "' (" + ((Object)val6.shader).name + ") colours: " + string.Join(", ", list10.ToArray()))); if (list7.Count > 0) { _clouds.Add(new CloudPaint { M = val6, Ids = list7.ToArray(), Day = list8.ToArray(), Disc = list9.ToArray() }); } } } } } if (num4 <= 0.5f && _hiddenSky.Count > 0) { for (int num11 = _hiddenSky.Count - 1; num11 >= 0; num11--) { Renderer val7 = _hiddenSky[num11]; if ((Object)(object)val7 == (Object)null) { _hiddenSky.RemoveAt(num11); } else { string name3 = ((Object)((Component)val7).gameObject).name; if (!Cycle || (!(name3 == "Sun") && !name3.Contains("SunAndMoon"))) { val7.enabled = true; _hiddenSky.RemoveAt(num11); } } } } if (!_censusDone && num4 > 0.55f) { _censusDone = true; Vector3 val8 = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : ((Component)this).transform.position); Renderer[] array3 = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)0); foreach (Renderer val9 in array3) { if (!((Object)(object)val9 == (Object)null) && val9.enabled && !((Component)val9).transform.IsChildOf(((Component)this).transform)) { Bounds bounds = val9.bounds; Vector3 val10 = ((Bounds)(ref bounds)).center - val8; if (!(((Vector3)(ref val10)).magnitude < 60f) && !(((Vector3)(ref val10)).normalized.y < 0.1f)) { Material sharedMaterial = val9.sharedMaterial; ManualLogSource log = DayNightPlugin.Log; string[] obj = new string[8] { "In the sky at dusk: '", ((Object)((Component)val9).gameObject).name, "' shader ", ((Object)(object)sharedMaterial != (Object)null && (Object)(object)sharedMaterial.shader != (Object)null) ? ((Object)sharedMaterial.shader).name : "none", " material ", ((Object)(object)sharedMaterial != (Object)null) ? ((Object)sharedMaterial).name : "none", " at ", null }; bounds = val9.bounds; Vector3 center = ((Bounds)(ref bounds)).center; obj[7] = ((Vector3)(ref center)).ToString("0"); log.LogInfo((object)string.Concat(obj)); } } } } Color val12 = default(Color); Color val13 = default(Color); foreach (CloudPaint cloud in _clouds) { if ((Object)(object)cloud.M == (Object)null) { continue; } for (int num13 = 0; num13 < cloud.Ids.Length; num13++) { Color val11 = cloud.Day[num13]; if (cloud.Disc[num13]) { float num14 = Mathf.Clamp01(num4 / 0.1f); ((Color)(ref val12))..ctor(val11.r * 0.02f, val11.g * 0.02f, val11.b * 0.04f, 0f); cloud.M.SetColor(cloud.Ids[num13], Color.Lerp(val11, val12, num14)); } else { ((Color)(ref val13))..ctor(val11.r * 0.1f, val11.g * 0.12f, val11.b * 0.22f, val11.a); cloud.M.SetColor(cloud.Ids[num13], Color.Lerp(val11, val13, num4)); } } } Quaternion rotation = Quaternion.identity; float num15 = 1f; float num16 = 1f; bool cycle = Cycle; if (cycle) { Quaternion val14 = Quaternion.AngleAxis((_t - 0.75f) * 360f, PolarAxis); Vector3 val15 = val14 * SunHome; Vector3 val16 = ((val15.y >= 0f) ? val15 : (val14 * MoonHome)); _sunHeight = val15.y; num15 = Mathf.Clamp01(val15.y * 2.2f); num16 = Mathf.Clamp01(Mathf.Abs(val15.y) * 3f); rotation = Quaternion.LookRotation(-((Vector3)(ref val16)).normalized); } Camera val17 = Eye(); if ((Object)(object)val17 != (Object)null) { ((Component)this).transform.position = ((Component)val17).transform.position; } if (Cycle || num4 > 0.35f) { Color val18 = Color.Lerp(new Color(0.96f, 0.52f, 0.24f), new Color(0.42f, 0.68f, 0.96f), cycle ? num15 : 1f); Color val19 = Color.Lerp(Color.Lerp(val18, new Color(0.38f, 0.22f, 0.34f), Mathf.Clamp01(num4 / 0.35f)), NightSky, num7); Camera[] allCameras = Camera.allCameras; foreach (Camera val20 in allCameras) { if ((Object)(object)val20 == (Object)null || !((Behaviour)val20).isActiveAndEnabled || (Object)(object)val20.targetTexture != (Object)null) { continue; } if (!_wasFlagsBy.ContainsKey(val20)) { if ((int)val20.clearFlags != 1 && (int)val20.clearFlags != 2) { continue; } _wasFlagsBy[val20] = val20.clearFlags; _wasBackgroundBy[val20] = val20.backgroundColor; } val20.clearFlags = (CameraClearFlags)2; val20.backgroundColor = val19; _skyNow = val19; } if ((Object)(object)_wasSkybox == (Object)null && (Object)(object)RenderSettings.skybox != (Object)null) { _wasSkybox = RenderSettings.skybox; RenderSettings.skybox = null; } } else { GiveBackTheDay(); } float num18 = Mathf.Max(num4, cycle ? (1f - num15) : 0f); foreach (CloudPaint item4 in _water) { if ((Object)(object)item4.M == (Object)null) { continue; } for (int num19 = 0; num19 < item4.Ids.Length; num19++) { float num20 = item4.Weight[num19]; float num21 = Mathf.Clamp01((num4 - 0.15f) / 0.45f); if (item4.Mode[num19] == 0) { item4.M.SetColor(item4.Ids[num19], item4.Day[num19]); continue; } if (item4.Mode[num19] == 2) { Color val21 = item4.Day[num19]; val21.r = Mathf.Lerp(item4.Day[num19].r, 0.96f, num21); item4.M.SetColor(item4.Ids[num19], val21); continue; } if (num20 > 0.1f) { num20 = Mathf.Lerp(num20, 0.92f, num21); } Color val22 = Color.Lerp(item4.Day[num19], _skyNow, num18 * num20); val22.a = item4.Day[num19].a; item4.M.SetColor(item4.Ids[num19], val22); } } float num22 = Mathf.Clamp01((num4 - 0.15f) / 0.45f); foreach (CloudPaint item5 in _water) { if ((Object)(object)item5.M != (Object)null && item5.DepthFadeId >= 0) { item5.M.SetFloat(item5.DepthFadeId, Mathf.Lerp(item5.DepthFadeDay, item5.DepthFadeDay * 0.12f, num22)); } } if (!_tookWorld) { _dayAmbient = RenderSettings.ambientLight; _dayAmbientStrength = RenderSettings.ambientIntensity; _dayFog = RenderSettings.fogColor; _dayFogDensity = RenderSettings.fogDensity; _dayReflection = RenderSettings.reflectionIntensity; _tookWorld = true; } RenderSettings.reflectionIntensity = Mathf.Lerp(_dayReflection, _dayReflection * 0.85f, num4); _envTick -= Time.deltaTime; if (_envTick <= 0f) { _envTick = 0.25f; if (!_tookRefl) { _tookRefl = true; _dayReflMode = RenderSettings.defaultReflectionMode; _dayReflTexture = RenderSettings.customReflectionTexture; } if ((Object)(object)_envCube == (Object)null) { _envCube = new Cubemap(16, (TextureFormat)4, false); } Color skyNow = _skyNow; Color val23 = _skyNow * 0.55f; val23.a = 1f; Color val24 = _skyNow * 0.25f; val24.a = 1f; for (int num23 = 0; num23 < 6; num23++) { for (int num24 = 0; num24 < 16; num24++) { CubemapFace val25 = (CubemapFace)num23; Color val26 = (((int)val25 == 2) ? val23 : (((int)val25 != 3) ? Color.Lerp(val23, skyNow, (float)num24 / 15f) : val24)); for (int num25 = 0; num25 < 16; num25++) { _envCube.SetPixel(val25, num25, num24, val26); } } } _envCube.Apply(); RenderSettings.defaultReflectionMode = (DefaultReflectionMode)1; RenderSettings.customReflectionTexture = (Texture)(object)_envCube; ReflectionProbe[] array4 = Object.FindObjectsByType((FindObjectsInactive)0, (FindObjectsSortMode)0); foreach (ReflectionProbe val27 in array4) { if (!((Object)(object)val27 == (Object)null)) { if (_probeSeen.Add(val27)) { _probes.Add(new ProbeMemory { P = val27, Mode = val27.mode, Baked = val27.customBakedTexture }); } val27.mode = (ReflectionProbeMode)2; val27.customBakedTexture = (Texture)(object)_envCube; } } } Light[] lights = _lights; foreach (Light val28 in lights) { if ((Object)(object)val28 == (Object)null || (int)val28.type != 1) { continue; } if (!_dayColor.ContainsKey(val28)) { _dayColor[val28] = val28.color; _dayIntensity[val28] = val28.intensity; _dayAim[val28] = ((Component)val28).transform.rotation; } Color val29 = _dayColor[val28]; float num28 = _dayIntensity[val28]; if (cycle) { if (_sunHeight >= 0f) { val29 = Color.Lerp(new Color(1f, 0.62f, 0.3f), val29, num15); num28 *= 0.68f + 0.32f * num15; } else { val29 = NightLightColor; num28 *= 0.45f; } ((Component)val28).transform.rotation = rotation; } val28.color = Color.Lerp(val29, NightLightColor, num4); val28.intensity = Mathf.Lerp(num28, NightLightIntensity, num4) * (cycle ? (0.15f + 0.85f * num16) : 1f); } RenderSettings.ambientLight = Color.Lerp(_dayAmbient, new Color(0.1f, 0.12f, 0.2f), num4); RenderSettings.ambientIntensity = Mathf.Lerp(_dayAmbientStrength, 0.35f, num4); if (!((Object)(object)val17 != (Object)null) || !(((Component)val17).transform.position.y < -0.9f)) { Color val30 = Color.Lerp(_dayFog, _skyNow, cycle ? ((1f - num15) * 0.85f) : 0f); RenderSettings.fogColor = Color.Lerp(val30, NightFogColor, num4); RenderSettings.fogDensity = Mathf.Lerp(_dayFogDensity, _dayFogDensity * Mathf.Max(0.1f, NightFogDensityMul), num4); } } private static Camera Eye() { Camera val = null; Camera[] allCameras = Camera.allCameras; foreach (Camera val2 in allCameras) { if (!((Object)(object)val2 == (Object)null) && ((Behaviour)val2).isActiveAndEnabled && !((Object)(object)val2.targetTexture != (Object)null) && ((Object)(object)val == (Object)null || val2.depth > val.depth)) { val = val2; } } return ((Object)(object)val != (Object)null) ? val : Camera.main; } private void OnEnable() { RenderPipelineManager.beginCameraRendering += DaylightForPhotos; RenderPipelineManager.endCameraRendering += NightAfterPhotos; } private void OnDisable() { RenderPipelineManager.beginCameraRendering -= DaylightForPhotos; RenderPipelineManager.endCameraRendering -= NightAfterPhotos; } private void DaylightForPhotos(ScriptableRenderContext ctx, Camera cam) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0077: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0174: Invalid comparison between Unknown and I4 //IL_01a6: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cam == (Object)null || (Object)(object)cam.targetTexture == (Object)null || !_tookWorld) { return; } _photoSwap = true; _photoAmbient = RenderSettings.ambientLight; _photoAmbientStrength = RenderSettings.ambientIntensity; _photoFog = RenderSettings.fogColor; _photoReflStrength = RenderSettings.reflectionIntensity; _photoReflTexture = RenderSettings.customReflectionTexture; _photoReflMode = RenderSettings.defaultReflectionMode; RenderSettings.ambientLight = _dayAmbient; RenderSettings.ambientIntensity = _dayAmbientStrength; RenderSettings.fogColor = _dayFog; RenderSettings.reflectionIntensity = _dayReflection; RenderSettings.defaultReflectionMode = _dayReflMode; RenderSettings.customReflectionTexture = _dayReflTexture; foreach (ProbeMemory probe in _probes) { if ((Object)(object)probe.P != (Object)null) { probe.P.mode = probe.Mode; probe.P.customBakedTexture = probe.Baked; } } _photoIntensity.Clear(); _photoColor.Clear(); _photoAimWas.Clear(); Light[] lights = _lights; foreach (Light val in lights) { if (!((Object)(object)val == (Object)null) && (int)val.type == 1) { _photoIntensity[val] = val.intensity; _photoColor[val] = val.color; _photoAimWas[val] = ((Component)val).transform.rotation; if (_dayIntensity.TryGetValue(val, out var value)) { val.intensity = value; } if (_dayColor.TryGetValue(val, out var value2)) { val.color = value2; } if (_dayAim.TryGetValue(val, out var value3)) { ((Component)val).transform.rotation = value3; } } } } private void NightAfterPhotos(ScriptableRenderContext ctx, Camera cam) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (!_photoSwap || (Object)(object)cam == (Object)null || (Object)(object)cam.targetTexture == (Object)null) { return; } _photoSwap = false; RenderSettings.ambientLight = _photoAmbient; RenderSettings.ambientIntensity = _photoAmbientStrength; RenderSettings.fogColor = _photoFog; RenderSettings.reflectionIntensity = _photoReflStrength; RenderSettings.defaultReflectionMode = _photoReflMode; RenderSettings.customReflectionTexture = _photoReflTexture; foreach (KeyValuePair item in _photoIntensity) { if ((Object)(object)item.Key != (Object)null) { item.Key.intensity = item.Value; } } foreach (KeyValuePair item2 in _photoColor) { if ((Object)(object)item2.Key != (Object)null) { item2.Key.color = item2.Value; } } foreach (KeyValuePair photoAimWa in _photoAimWas) { if ((Object)(object)photoAimWa.Key != (Object)null) { ((Component)photoAimWa.Key).transform.rotation = photoAimWa.Value; } } foreach (ProbeMemory probe in _probes) { if ((Object)(object)probe.P != (Object)null && (Object)(object)_envCube != (Object)null) { probe.P.mode = (ReflectionProbeMode)2; probe.P.customBakedTexture = (Texture)(object)_envCube; } } } private void GiveBackTheDay() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair item in _wasFlagsBy) { if ((Object)(object)item.Key != (Object)null) { item.Key.clearFlags = item.Value; } } foreach (KeyValuePair item2 in _wasBackgroundBy) { if ((Object)(object)item2.Key != (Object)null) { item2.Key.backgroundColor = item2.Value; } } _wasFlagsBy.Clear(); _wasBackgroundBy.Clear(); if ((Object)(object)_wasSkybox != (Object)null) { RenderSettings.skybox = _wasSkybox; _wasSkybox = null; } } private void OnDestroy() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) foreach (Renderer item in _hiddenSky) { if ((Object)(object)item != (Object)null) { item.enabled = true; } } foreach (CloudPaint cloud in _clouds) { if ((Object)(object)cloud.M != (Object)null) { for (int i = 0; i < cloud.Ids.Length; i++) { cloud.M.SetColor(cloud.Ids[i], cloud.Day[i]); } } } foreach (CloudPaint item2 in _water) { if ((Object)(object)item2.M != (Object)null) { for (int j = 0; j < item2.Ids.Length; j++) { item2.M.SetColor(item2.Ids[j], item2.Day[j]); } if (item2.DepthFadeId >= 0) { item2.M.SetFloat(item2.DepthFadeId, item2.DepthFadeDay); } } } GiveBackTheDay(); foreach (KeyValuePair item3 in _dayColor) { if ((Object)(object)item3.Key != (Object)null) { item3.Key.color = item3.Value; } } foreach (KeyValuePair item4 in _dayIntensity) { if ((Object)(object)item4.Key != (Object)null) { item4.Key.intensity = item4.Value; } } foreach (KeyValuePair item5 in _dayAim) { if ((Object)(object)item5.Key != (Object)null) { ((Component)item5.Key).transform.rotation = item5.Value; } } if (_tookWorld) { RenderSettings.ambientLight = _dayAmbient; RenderSettings.ambientIntensity = _dayAmbientStrength; RenderSettings.fogColor = _dayFog; RenderSettings.fogDensity = _dayFogDensity; RenderSettings.reflectionIntensity = _dayReflection; } if (_tookRefl) { RenderSettings.defaultReflectionMode = _dayReflMode; RenderSettings.customReflectionTexture = _dayReflTexture; } foreach (ProbeMemory probe in _probes) { if ((Object)(object)probe.P != (Object)null) { probe.P.mode = probe.Mode; probe.P.customBakedTexture = probe.Baked; } } } }