using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[BepInPlugin("emarcee.texturescript", "texturescript", "0.0.1")]
public class texturescript : BaseUnityPlugin
{
}
internal sealed class DayNightDisableOnNight : MonoBehaviour
{
[Tooltip("Object that contains Lights to toggle. Leave null to use this GameObject.")]
public GameObject target;
private Light[] _lights;
private Dictionary<Light, float> _origIntensity = new Dictionary<Light, float>();
private Dictionary<Light, bool> _origEnabled = new Dictionary<Light, bool>();
private int _dayNight;
private void Awake()
{
if ((Object)(object)target == (Object)null)
{
target = ((Component)this).gameObject;
}
_lights = target.GetComponentsInChildren<Light>(true);
Light[] lights = _lights;
foreach (Light val in lights)
{
if (!((Object)(object)val == (Object)null))
{
_origIntensity[val] = val.intensity;
_origEnabled[val] = ((Behaviour)val).enabled;
}
}
}
private void ApplyState(bool isDay)
{
if (_lights == null)
{
return;
}
Light[] lights;
if (isDay)
{
lights = _lights;
foreach (Light val in lights)
{
if (!((Object)(object)val == (Object)null))
{
((Behaviour)val).enabled = false;
}
}
return;
}
lights = _lights;
foreach (Light val2 in lights)
{
if (!((Object)(object)val2 == (Object)null))
{
if (_origEnabled.TryGetValue(val2, out var value))
{
((Behaviour)val2).enabled = value;
}
else
{
((Behaviour)val2).enabled = true;
}
if (_origIntensity.TryGetValue(val2, out var value2))
{
val2.intensity = value2;
}
}
}
}
private void Update()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected I4, but got Unknown
int num = (int)GameWorldManager._current._worldTime;
if (num != _dayNight)
{
_dayNight = num;
bool isDay = num == 0;
ApplyState(isDay);
}
}
}
[RequireComponent(typeof(MeshRenderer))]
internal sealed class DayNightChecker : MonoBehaviour
{
private MeshRenderer _renderer;
public Texture2D _dayTex;
public Texture2D _nightTex;
public Texture2D _dayEmissionTex;
public Texture2D _nightEmissionTex;
public int _materialIndex;
private int _dayNight;
private void Awake()
{
_renderer = ((Component)this).GetComponent<MeshRenderer>();
}
private void Update()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected I4, but got Unknown
//IL_00c1: 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)
int num = (int)GameWorldManager._current._worldTime;
if (num == _dayNight)
{
return;
}
_dayNight = num;
Material[] materials = ((Renderer)_renderer).materials;
Material val = materials[_materialIndex];
val.mainTexture = (Texture)(object)((_dayNight == 0) ? _dayTex : _nightTex);
Texture2D val2 = ((_dayNight == 0) ? _dayEmissionTex : _nightEmissionTex);
if (val.HasProperty("_EmissionMap") || val.HasProperty("_EmissiveMap"))
{
string text = (val.HasProperty("_EmissionMap") ? "_EmissionMap" : "_EmissiveMap");
if ((Object)(object)val2 != (Object)null)
{
val.SetTexture(text, (Texture)(object)val2);
if (val.HasProperty("_EmissionColor"))
{
val.SetColor("_EmissionColor", Color.white);
}
if (val.HasProperty("_EmissiveColor"))
{
val.SetColor("_EmissiveColor", Color.white);
}
val.EnableKeyword("_EMISSION");
try
{
val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
}
catch
{
}
}
else
{
val.SetTexture(text, (Texture)null);
val.DisableKeyword("_EMISSION");
}
}
((Renderer)_renderer).materials = materials;
}
}
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
private struct MonoScriptData
{
public byte[] FilePathsData;
public byte[] TypesData;
public int TotalTypes;
public int TotalFiles;
public bool IsEditorOnly;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static MonoScriptData Get()
{
return new MonoScriptData
{
FilePathsData = new byte[162]
{
0, 0, 0, 1, 0, 0, 0, 41, 92, 65,
115, 115, 101, 116, 115, 92, 67, 117, 115, 116,
111, 109, 67, 111, 109, 112, 111, 110, 101, 110,
116, 115, 92, 66, 101, 112, 105, 110, 69, 120,
80, 108, 117, 103, 105, 110, 46, 99, 115, 0,
0, 0, 1, 0, 0, 0, 50, 92, 65, 115,
115, 101, 116, 115, 92, 67, 117, 115, 116, 111,
109, 67, 111, 109, 112, 111, 110, 101, 110, 116,
115, 92, 68, 97, 121, 78, 105, 103, 104, 116,
68, 105, 115, 97, 98, 108, 101, 79, 110, 78,
105, 103, 104, 116, 46, 99, 115, 0, 0, 0,
1, 0, 0, 0, 47, 92, 65, 115, 115, 101,
116, 115, 92, 67, 117, 115, 116, 111, 109, 67,
111, 109, 112, 111, 110, 101, 110, 116, 115, 92,
68, 97, 121, 78, 105, 103, 104, 116, 84, 101,
120, 116, 117, 114, 101, 83, 119, 97, 112, 46,
99, 115
},
TypesData = new byte[68]
{
0, 0, 0, 0, 14, 124, 116, 101, 120, 116,
117, 114, 101, 115, 99, 114, 105, 112, 116, 0,
0, 0, 0, 23, 124, 68, 97, 121, 78, 105,
103, 104, 116, 68, 105, 115, 97, 98, 108, 101,
79, 110, 78, 105, 103, 104, 116, 0, 0, 0,
0, 16, 124, 68, 97, 121, 78, 105, 103, 104,
116, 67, 104, 101, 99, 107, 101, 114
},
TotalFiles = 3,
TotalTypes = 3,
IsEditorOnly = false
};
}
}