using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using GBGraphicsPlus;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(GraphicsMod), "GBGraphicsPlus", "2.3.0", "Author", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GBGraphicsPlus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Graphics Enhancer for Gang Beasts")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GBGraphicsPlus")]
[assembly: AssemblyTitle("GBGraphicsPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
namespace GBGraphicsPlus
{
public class GraphicsMod : MelonMod
{
private enum MenuState
{
Main,
Presets,
MapSelect,
LightList,
LightEdit
}
private MenuState currentMenu;
private bool showMenu;
private Rect windowRect = new Rect(20f, 20f, 500f, 720f);
private bool isDragging;
private Vector2 dragOffset;
private Vector2 scrollPosition = Vector2.zero;
private GUIStyle labelStyle;
private GUIStyle valueStyle;
private GUIStyle headerStyle;
private GUIStyle boxStyle;
private GUIStyle buttonStyle;
private GUIStyle activeButtonStyle;
private GUIStyle titleStyle;
private float bloomIntensity = 1.71f;
private float bloomThreshold = 0.69f;
private float dofFocusDistance = 9.69f;
private float dofAperture = 1.46f;
private float dofFocalLength = 63.77f;
private float caIntensity = 0.17f;
private float gamma = 1.17f;
private float contrast = 5.26f;
private float vignetteIntensity = 0.25f;
private bool softShadows = true;
private float fogDensity = 0.01f;
private float fogR = 0.5f;
private float fogG = 0.5f;
private float fogB = 0.5f;
private int sunPos;
private float sunR = 1f;
private float sunG = 0.95f;
private float sunB = 0.9f;
private List<VolumeProfile> activeProfiles = new List<VolumeProfile>();
private float drawY;
private bool settingsChanged;
private bool applyQueued;
private string presetFolder;
private string mapOverridesFolder;
private List<string> knownScenes = new List<string>();
private string currentActiveScene = "GLOBAL";
private string editingScene = "GLOBAL";
private bool isFreeCam;
private bool freezeFreeCam;
private Camera originalCam;
private Camera freeCam;
private float fcPitch;
private float fcYaw;
private Light[] sceneLights;
private Light editingLight;
private bool isPlacingLight;
private Light tempLight;
private GameObject lightGizmo;
private float scrollHeight = 1700f;
public override void OnInitializeMelon()
{
try
{
presetFolder = Path.Combine(MelonEnvironment.UserDataDirectory, "GBGraphicsPlus");
mapOverridesFolder = Path.Combine(presetFolder, "MapOverrides");
if (!Directory.Exists(presetFolder))
{
Directory.CreateDirectory(presetFolder);
}
if (!Directory.Exists(mapOverridesFolder))
{
Directory.CreateDirectory(mapOverridesFolder);
}
}
catch (Exception)
{
}
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
try
{
activeProfiles.Clear();
if (!string.IsNullOrEmpty(sceneName) && !knownScenes.Contains(sceneName))
{
knownScenes.Add(sceneName);
}
LoadKnownScenesFromFiles();
currentActiveScene = sceneName;
editingScene = sceneName;
if (isFreeCam)
{
ToggleFreeCam();
}
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
UniversalAdditionalCameraData component = ((Component)main).GetComponent<UniversalAdditionalCameraData>();
if ((Object)(object)component != (Object)null)
{
component.requiresDepthTexture = true;
component.renderPostProcessing = true;
}
}
Volume[] array = Il2CppArrayBase<Volume>.op_Implicit(Object.FindObjectsOfType<Volume>());
if (array != null)
{
Volume[] array2 = array;
foreach (Volume val in array2)
{
if ((Object)(object)val.profile != (Object)null)
{
val.isGlobal = true;
activeProfiles.Add(val.profile);
}
}
}
LoadSettingsForScene(currentActiveScene);
applyQueued = true;
}
catch (Exception)
{
}
}
private void LoadKnownScenesFromFiles()
{
if (Directory.Exists(mapOverridesFolder))
{
string[] files = Directory.GetFiles(mapOverridesFolder, "*.txt");
for (int i = 0; i < files.Length; i++)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(files[i]);
if (!knownScenes.Contains(fileNameWithoutExtension))
{
knownScenes.Add(fileNameWithoutExtension);
}
}
}
knownScenes.Sort();
}
public override void OnUpdate()
{
//IL_023f: 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_024e: 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_029c: 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_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: 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_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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: 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_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_0175: 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_0184: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: 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_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//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)
try
{
if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f9Key).wasPressedThisFrame)
{
showMenu = !showMenu;
}
if (isPlacingLight || showMenu)
{
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
}
else if (isFreeCam && !freezeFreeCam)
{
Cursor.lockState = (CursorLockMode)1;
Cursor.visible = false;
}
if (isFreeCam && (Object)(object)freeCam != (Object)null && !showMenu && !freezeFreeCam && !isPlacingLight)
{
float num = (((ButtonControl)Keyboard.current.leftShiftKey).isPressed ? 35f : 10f);
Vector3 val = Vector3.zero;
if (((ButtonControl)Keyboard.current.wKey).isPressed)
{
val += ((Component)freeCam).transform.forward;
}
if (((ButtonControl)Keyboard.current.sKey).isPressed)
{
val -= ((Component)freeCam).transform.forward;
}
if (((ButtonControl)Keyboard.current.aKey).isPressed)
{
val -= ((Component)freeCam).transform.right;
}
if (((ButtonControl)Keyboard.current.dKey).isPressed)
{
val += ((Component)freeCam).transform.right;
}
Transform transform = ((Component)freeCam).transform;
transform.position += val * num * Time.deltaTime;
Vector2 val2 = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).delta).ReadValue();
fcYaw += val2.x * 0.1f;
fcPitch -= val2.y * 0.1f;
((Component)freeCam).transform.rotation = Quaternion.Euler(fcPitch, fcYaw, 0f);
}
if (isPlacingLight && (Object)(object)tempLight != (Object)null)
{
Camera val3 = (isFreeCam ? freeCam : Camera.main);
if ((Object)(object)val3 != (Object)null)
{
Ray val4 = val3.ScreenPointToRay(Vector2.op_Implicit(((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue()));
RaycastHit val5 = default(RaycastHit);
if (Physics.Raycast(val4, ref val5))
{
((Component)tempLight).transform.position = ((RaycastHit)(ref val5)).point + ((RaycastHit)(ref val5)).normal * 0.5f;
}
else
{
((Component)tempLight).transform.position = ((Ray)(ref val4)).GetPoint(5f);
}
if (Mouse.current.leftButton.wasPressedThisFrame)
{
isPlacingLight = false;
showMenu = true;
editingLight = tempLight;
currentMenu = MenuState.LightEdit;
}
}
}
UpdateLightGizmo();
if (applyQueued)
{
applyQueued = false;
ApplyRealTimeSettings();
}
}
catch (Exception)
{
}
}
public override void OnGUI()
{
//IL_0102: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: 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)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Invalid comparison between Unknown and I4
//IL_005c: 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_008c: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Invalid comparison between Unknown and I4
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if (!showMenu)
{
return;
}
try
{
if (boxStyle == null)
{
InitializeStyles();
}
Event current = Event.current;
if (current != null)
{
Rect val = default(Rect);
((Rect)(ref val))..ctor(((Rect)(ref windowRect)).x, ((Rect)(ref windowRect)).y, ((Rect)(ref windowRect)).width, 40f);
if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition))
{
isDragging = true;
dragOffset = current.mousePosition - new Vector2(((Rect)(ref windowRect)).x, ((Rect)(ref windowRect)).y);
}
else if ((int)current.type == 1)
{
isDragging = false;
}
if (isDragging && (int)current.type == 3)
{
((Rect)(ref windowRect)).x = current.mousePosition.x - dragOffset.x;
((Rect)(ref windowRect)).y = current.mousePosition.y - dragOffset.y;
}
}
GUI.backgroundColor = Color.white;
GUI.Box(windowRect, "", boxStyle);
GUI.Label(new Rect(((Rect)(ref windowRect)).x, ((Rect)(ref windowRect)).y + 10f, ((Rect)(ref windowRect)).width, 30f), "GB Graphics+ Menu (F9)", titleStyle);
scrollPosition = GUI.BeginScrollView(new Rect(((Rect)(ref windowRect)).x + 15f, ((Rect)(ref windowRect)).y + 50f, ((Rect)(ref windowRect)).width - 30f, ((Rect)(ref windowRect)).height - 60f), scrollPosition, new Rect(0f, 0f, ((Rect)(ref windowRect)).width - 50f, scrollHeight));
if (currentMenu == MenuState.Presets)
{
DrawPresetsMenu();
}
else if (currentMenu == MenuState.MapSelect)
{
DrawMapSelectMenu();
}
else if (currentMenu == MenuState.LightList)
{
DrawLightListMenu();
}
else if (currentMenu == MenuState.LightEdit)
{
DrawLightEditMenu();
}
else
{
DrawMainGUI();
}
GUI.EndScrollView();
}
catch (Exception)
{
}
}
private void InitializeStyles()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00c9: Expected O, but got Unknown
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: 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_0109: Expected O, but got Unknown
//IL_010a: 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_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: 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_0142: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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_0158: 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_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Expected O, but got Unknown
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: 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_0198: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Expected O, but got Unknown
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Expected O, but got Unknown
Texture2D background = MakeTex(2, 2, new Color(0.08f, 0.08f, 0.09f, 0.98f));
Texture2D background2 = MakeTex(2, 2, new Color(0.18f, 0.18f, 0.2f, 1f));
Texture2D background3 = MakeTex(2, 2, new Color(0f, 0.45f, 0.7f, 1f));
Texture2D background4 = MakeTex(2, 2, new Color(0f, 0.65f, 0.3f, 1f));
GUIStyle val = new GUIStyle(GUI.skin.box);
val.normal.background = background;
val.normal.textColor = Color.white;
val.padding = new RectOffset(0, 0, 15, 0);
boxStyle = val;
GUIStyle val2 = new GUIStyle();
val2.normal.textColor = new Color(0f, 0.8f, 1f);
val2.fontSize = 22;
val2.fontStyle = (FontStyle)1;
val2.alignment = (TextAnchor)1;
titleStyle = val2;
GUIStyle val3 = new GUIStyle();
val3.normal.textColor = new Color(0.9f, 0.9f, 0.9f);
val3.fontSize = 15;
val3.fontStyle = (FontStyle)1;
labelStyle = val3;
GUIStyle val4 = new GUIStyle();
val4.normal.textColor = Color.cyan;
val4.fontSize = 15;
val4.fontStyle = (FontStyle)1;
val4.alignment = (TextAnchor)2;
valueStyle = val4;
GUIStyle val5 = new GUIStyle();
val5.normal.textColor = new Color(1f, 0.8f, 0.2f);
val5.fontSize = 18;
val5.fontStyle = (FontStyle)1;
val5.alignment = (TextAnchor)4;
headerStyle = val5;
GUIStyle val6 = new GUIStyle(GUI.skin.button);
val6.normal.background = background2;
val6.normal.textColor = Color.white;
val6.hover.background = background3;
val6.hover.textColor = Color.white;
val6.fontSize = 15;
val6.fontStyle = (FontStyle)1;
val6.alignment = (TextAnchor)4;
buttonStyle = val6;
GUIStyle val7 = new GUIStyle(buttonStyle);
val7.normal.background = background4;
val7.hover.background = background4;
activeButtonStyle = val7;
}
private Texture2D MakeTex(int w, int h, Color c)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
Color[] array = (Color[])(object)new Color[w * h];
for (int i = 0; i < array.Length; i++)
{
array[i] = c;
}
Texture2D val = new Texture2D(w, h);
val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
val.Apply();
return val;
}
private void SetPlayerInputs(bool state)
{
foreach (PlayerInput item in Object.FindObjectsOfType<PlayerInput>())
{
((Behaviour)item).enabled = state;
}
}
private void ToggleFreeCam()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
isFreeCam = !isFreeCam;
if (isFreeCam)
{
SetPlayerInputs(state: false);
originalCam = Camera.main;
if ((Object)(object)originalCam != (Object)null)
{
((Behaviour)originalCam).enabled = false;
GameObject val = new GameObject("ModFreeCam");
freeCam = val.AddComponent<Camera>();
freeCam.CopyFrom(originalCam);
val.AddComponent<UniversalAdditionalCameraData>().renderPostProcessing = true;
((Component)freeCam).transform.position = ((Component)originalCam).transform.position;
((Component)freeCam).transform.rotation = ((Component)originalCam).transform.rotation;
Vector3 eulerAngles = ((Component)originalCam).transform.eulerAngles;
fcPitch = eulerAngles.x;
fcYaw = eulerAngles.y;
}
}
else
{
freezeFreeCam = false;
SetPlayerInputs(state: true);
if ((Object)(object)freeCam != (Object)null)
{
Object.Destroy((Object)(object)((Component)freeCam).gameObject);
}
if ((Object)(object)originalCam != (Object)null)
{
((Behaviour)originalCam).enabled = true;
}
}
}
private void BuildLightGizmo()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_0142: 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)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)lightGizmo != (Object)null))
{
lightGizmo = new GameObject("GBLightGizmo");
GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
obj.transform.SetParent(lightGizmo.transform);
obj.transform.localScale = new Vector3(0.05f, 1.5f, 0.05f);
obj.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
obj.GetComponent<Renderer>().material.color = Color.red;
Object.Destroy((Object)(object)obj.GetComponent<Collider>());
GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)2);
obj2.transform.SetParent(lightGizmo.transform);
obj2.transform.localScale = new Vector3(0.05f, 1.5f, 0.05f);
obj2.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
obj2.GetComponent<Renderer>().material.color = Color.green;
Object.Destroy((Object)(object)obj2.GetComponent<Collider>());
GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)2);
obj3.transform.SetParent(lightGizmo.transform);
obj3.transform.localScale = new Vector3(0.05f, 1.5f, 0.05f);
obj3.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
obj3.GetComponent<Renderer>().material.color = Color.blue;
Object.Destroy((Object)(object)obj3.GetComponent<Collider>());
lightGizmo.SetActive(false);
}
}
private void UpdateLightGizmo()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
if (currentMenu == MenuState.LightEdit && (Object)(object)editingLight != (Object)null && showMenu)
{
if ((Object)(object)lightGizmo == (Object)null)
{
BuildLightGizmo();
}
lightGizmo.SetActive(true);
lightGizmo.transform.position = ((Component)editingLight).transform.position;
lightGizmo.transform.rotation = ((Component)editingLight).transform.rotation;
}
else if ((Object)(object)lightGizmo != (Object)null)
{
lightGizmo.SetActive(false);
}
}
private void DrawMainGUI()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_033e: 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_0404: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Unknown result type (might be due to invalid IL or missing references)
//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
//IL_060f: Unknown result type (might be due to invalid IL or missing references)
drawY = 0f;
settingsChanged = false;
float num = (((Rect)(ref windowRect)).width - 40f) / 2f;
if (GUI.Button(new Rect(0f, drawY, num - 5f, 40f), "Global Presets", buttonStyle))
{
currentMenu = MenuState.Presets;
}
if (GUI.Button(new Rect(num + 5f, drawY, num - 5f, 40f), "Specific Scene", buttonStyle))
{
LoadKnownScenesFromFiles();
currentMenu = MenuState.MapSelect;
}
drawY += 50f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), isFreeCam ? "DISABLE FREECAM" : "ENABLE FREECAM", isFreeCam ? activeButtonStyle : buttonStyle))
{
ToggleFreeCam();
}
drawY += 45f;
if (isFreeCam)
{
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 35f), freezeFreeCam ? "Camera is Frozen" : "Freeze Freecam (For Cinematics)", freezeFreeCam ? activeButtonStyle : buttonStyle))
{
freezeFreeCam = !freezeFreeCam;
}
drawY += 45f;
}
GUI.Label(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 30f), "EDITING MAP: " + ((editingScene == "GLOBAL") ? "GLOBAL DEFAULT" : editingScene.ToUpper()), titleStyle);
drawY += 40f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Force Save Map Settings Now", activeButtonStyle))
{
SaveSettingsForScene(editingScene);
}
drawY += 55f;
DrawHeader("ADVANCED LIGHTING");
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Open Lights Menu / Spawn Lights", buttonStyle))
{
RefreshLightList();
currentMenu = MenuState.LightList;
}
drawY += 55f;
DrawHeader("GLOBAL SUN SETTINGS");
if (GUI.Button(new Rect(0f, drawY, num - 5f, 35f), "Hard Shadows", (!softShadows) ? activeButtonStyle : buttonStyle) && softShadows)
{
softShadows = false;
settingsChanged = true;
}
if (GUI.Button(new Rect(num + 5f, drawY, num - 5f, 35f), "Soft Shadows", softShadows ? activeButtonStyle : buttonStyle) && !softShadows)
{
softShadows = true;
settingsChanged = true;
}
drawY += 45f;
float num2 = (((Rect)(ref windowRect)).width - 50f) / 4f;
if (GUI.Button(new Rect(0f, drawY, num2 - 2f, 35f), "North", (sunPos == 0) ? activeButtonStyle : buttonStyle))
{
sunPos = 0;
settingsChanged = true;
}
if (GUI.Button(new Rect(num2, drawY, num2 - 2f, 35f), "East", (sunPos == 1) ? activeButtonStyle : buttonStyle))
{
sunPos = 1;
settingsChanged = true;
}
if (GUI.Button(new Rect(num2 * 2f, drawY, num2 - 2f, 35f), "South", (sunPos == 2) ? activeButtonStyle : buttonStyle))
{
sunPos = 2;
settingsChanged = true;
}
if (GUI.Button(new Rect(num2 * 3f, drawY, num2 - 2f, 35f), "West", (sunPos == 3) ? activeButtonStyle : buttonStyle))
{
sunPos = 3;
settingsChanged = true;
}
drawY += 45f;
sunR = DrawSlider("Sun Color (Red)", sunR, 0f, 2f);
sunG = DrawSlider("Sun Color (Green)", sunG, 0f, 2f);
sunB = DrawSlider("Sun Color (Blue)", sunB, 0f, 2f);
drawY += 10f;
DrawHeader("FOG ENGINE");
fogDensity = DrawSlider("Density", fogDensity, 0f, 0.1f);
fogR = DrawSlider("Fog Color (Red)", fogR, 0f, 1f);
fogG = DrawSlider("Fog Color (Green)", fogG, 0f, 1f);
fogB = DrawSlider("Fog Color (Blue)", fogB, 0f, 1f);
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 35f), "Force Apply Fog Settings", activeButtonStyle))
{
settingsChanged = true;
}
drawY += 50f;
DrawHeader("BLOOM");
bloomIntensity = DrawSlider("Intensity", bloomIntensity, 0f, 30f);
bloomThreshold = DrawSlider("Threshold", bloomThreshold, 0f, 2f);
drawY += 10f;
DrawHeader("DEPTH OF FIELD");
dofFocusDistance = DrawSlider("Focus Distance", dofFocusDistance, 0.1f, 50f);
dofAperture = DrawSlider("Aperture (Lower = Blur)", dofAperture, 1f, 32f);
dofFocalLength = DrawSlider("Focal Length", dofFocalLength, 1f, 300f);
drawY += 10f;
DrawHeader("CHROMATIC ABERRATION");
caIntensity = DrawSlider("Intensity", caIntensity, 0f, 1f);
drawY += 10f;
DrawHeader("VIGNETTE");
vignetteIntensity = DrawSlider("Intensity", vignetteIntensity, 0f, 1f);
drawY += 10f;
DrawHeader("COLOR ADJUSTMENTS");
gamma = DrawSlider("Gamma", gamma, -5f, 5f);
contrast = DrawSlider("Contrast", contrast, -100f, 100f);
scrollHeight = drawY + 100f;
if (settingsChanged)
{
SaveSettingsForScene(editingScene);
if (editingScene == currentActiveScene || editingScene == "GLOBAL")
{
applyQueued = true;
}
}
}
private void RefreshLightList()
{
sceneLights = Il2CppArrayBase<Light>.op_Implicit(Object.FindObjectsOfType<Light>());
}
private void DrawLightListMenu()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
drawY = 0f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Back to Main Menu", buttonStyle))
{
currentMenu = MenuState.Main;
}
drawY += 50f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Aim & Spawn Light", activeButtonStyle))
{
GameObject val = new GameObject("Spawned Custom Light");
tempLight = val.AddComponent<Light>();
tempLight.type = (LightType)2;
tempLight.intensity = 5f;
tempLight.range = 15f;
isPlacingLight = true;
showMenu = false;
return;
}
drawY += 50f;
float num = (((Rect)(ref windowRect)).width - 60f) / 2f;
if (GUI.Button(new Rect(0f, drawY, num, 35f), "ENABLE ALL", buttonStyle))
{
Light[] array = sceneLights;
foreach (Light val2 in array)
{
if ((Object)(object)val2 != (Object)null)
{
((Behaviour)val2).enabled = true;
}
}
}
if (GUI.Button(new Rect(num + 10f, drawY, num, 35f), "DISABLE ALL", buttonStyle))
{
Light[] array = sceneLights;
foreach (Light val3 in array)
{
if ((Object)(object)val3 != (Object)null)
{
((Behaviour)val3).enabled = false;
}
}
}
drawY += 45f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Refresh Light List", buttonStyle))
{
RefreshLightList();
}
drawY += 60f;
DrawHeader("SCENE LIGHTS");
if (sceneLights != null)
{
Light[] array = sceneLights;
foreach (Light val4 in array)
{
if (!((Object)(object)val4 == (Object)null))
{
string text = $"{((Object)val4).name} [{val4.type}]";
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 35f), text, ((Behaviour)val4).enabled ? buttonStyle : activeButtonStyle))
{
editingLight = val4;
currentMenu = MenuState.LightEdit;
}
drawY += 40f;
}
}
}
scrollHeight = drawY + 100f;
}
private void DrawLightEditMenu()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_0151: Invalid comparison between Unknown and I4
//IL_0159: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Invalid comparison between Unknown and I4
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: 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_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
drawY = 0f;
if ((Object)(object)editingLight == (Object)null)
{
currentMenu = MenuState.LightList;
return;
}
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Back to Light List", buttonStyle))
{
currentMenu = MenuState.LightList;
return;
}
drawY += 60f;
DrawHeader("EDITING: " + ((Object)editingLight).name);
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), ((Behaviour)editingLight).enabled ? "Light is ON (Click to Disable)" : "Light is OFF (Click to Enable)", ((Behaviour)editingLight).enabled ? activeButtonStyle : buttonStyle))
{
((Behaviour)editingLight).enabled = !((Behaviour)editingLight).enabled;
}
drawY += 55f;
editingLight.intensity = DrawSlider("Intensity", editingLight.intensity, 0f, 50f);
if ((int)editingLight.type == 2 || (int)editingLight.type == 0)
{
editingLight.range = DrawSlider("Range", editingLight.range, 0f, 200f);
}
drawY += 10f;
DrawHeader("TRANSFORM (Position)");
Vector3 position = ((Component)editingLight).transform.position;
position.x = DrawSlider("X (Red Axis)", position.x, -200f, 200f);
position.y = DrawSlider("Y (Green Axis)", position.y, -50f, 200f);
position.z = DrawSlider("Z (Blue Axis)", position.z, -200f, 200f);
((Component)editingLight).transform.position = position;
drawY += 10f;
if ((int)editingLight.type == 1 || (int)editingLight.type == 0)
{
DrawHeader("TRANSFORM (Rotation)");
Vector3 eulerAngles = ((Component)editingLight).transform.eulerAngles;
eulerAngles.x = DrawSlider("Pitch X", eulerAngles.x, 0f, 360f);
eulerAngles.y = DrawSlider("Yaw Y", eulerAngles.y, 0f, 360f);
eulerAngles.z = DrawSlider("Roll Z", eulerAngles.z, 0f, 360f);
((Component)editingLight).transform.rotation = Quaternion.Euler(eulerAngles);
drawY += 10f;
}
DrawHeader("COLOR");
float r = editingLight.color.r;
float g = editingLight.color.g;
float b = editingLight.color.b;
r = DrawSlider("Color (Red)", r, 0f, 2f);
g = DrawSlider("Color (Green)", g, 0f, 2f);
b = DrawSlider("Color (Blue)", b, 0f, 2f);
editingLight.color = new Color(r, g, b);
scrollHeight = drawY + 100f;
}
private void DrawPresetsMenu()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_013d: Unknown result type (might be due to invalid IL or missing references)
drawY = 0f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Back to Settings", buttonStyle))
{
currentMenu = MenuState.Main;
}
drawY += 50f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Save Current As New Global Preset", buttonStyle))
{
SaveGlobalPreset();
}
drawY += 60f;
DrawHeader("SAVED GLOBAL PRESETS");
string[] files = Directory.GetFiles(presetFolder, "*.txt");
if (files.Length == 0)
{
GUI.Label(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 30f), "No presets saved yet.", labelStyle);
}
else
{
string[] array = files;
foreach (string text in array)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), fileNameWithoutExtension, buttonStyle))
{
LoadSettingsFromFile(text);
SaveSettingsForScene(editingScene);
if (editingScene == currentActiveScene || editingScene == "GLOBAL")
{
applyQueued = true;
}
currentMenu = MenuState.Main;
return;
}
drawY += 50f;
}
}
scrollHeight = drawY + 100f;
}
private void DrawMapSelectMenu()
{
//IL_002c: 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)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
drawY = 0f;
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "Back to Settings", buttonStyle))
{
currentMenu = MenuState.Main;
}
drawY += 60f;
DrawHeader("MAP SPECIFIC OVERRIDES");
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), "EDIT GLOBAL SETTINGS", buttonStyle))
{
editingScene = "GLOBAL";
LoadSettingsForScene(editingScene);
currentMenu = MenuState.Main;
return;
}
drawY += 60f;
if (knownScenes.Count == 0)
{
GUI.Label(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 30f), "Load into a map first to see it here!", labelStyle);
}
else
{
foreach (string knownScene in knownScenes)
{
if (GUI.Button(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 40f), knownScene, buttonStyle))
{
editingScene = knownScene;
LoadSettingsForScene(editingScene);
currentMenu = MenuState.Main;
return;
}
drawY += 50f;
}
}
scrollHeight = drawY + 100f;
}
private void DrawHeader(string text)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
GUI.Label(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 30f), text, headerStyle);
drawY += 35f;
}
private float DrawSlider(string label, float value, float min, float max)
{
//IL_0021: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
GUI.Label(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 200f, 25f), label, labelStyle);
GUI.Label(new Rect(((Rect)(ref windowRect)).width - 150f, drawY, 100f, 25f), value.ToString("F2", CultureInfo.InvariantCulture), valueStyle);
drawY += 25f;
float num = GUI.HorizontalSlider(new Rect(0f, drawY, ((Rect)(ref windowRect)).width - 50f, 25f), value, min, max);
drawY += 35f;
if (Mathf.Abs(num - value) > 0.0001f)
{
settingsChanged = true;
}
return num;
}
private void ApplyRealTimeSettings()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Invalid comparison between Unknown and I4
//IL_014d: 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_008a: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
try
{
Light[] array = Il2CppArrayBase<Light>.op_Implicit(Object.FindObjectsOfType<Light>());
foreach (Light val in array)
{
if ((int)val.type == 1 && ((Object)val).name.ToLower().Contains("sun"))
{
val.shadows = (LightShadows)((!softShadows) ? 1 : 2);
val.color = new Color(sunR, sunG, sunB);
float num = 50f;
if (sunPos == 0)
{
((Component)val).transform.rotation = Quaternion.Euler(num, 0f, 0f);
}
else if (sunPos == 1)
{
((Component)val).transform.rotation = Quaternion.Euler(num, 90f, 0f);
}
else if (sunPos == 2)
{
((Component)val).transform.rotation = Quaternion.Euler(num, 180f, 0f);
}
else if (sunPos == 3)
{
((Component)val).transform.rotation = Quaternion.Euler(num, -90f, 0f);
}
}
}
QualitySettings.shadows = (ShadowQuality)((!softShadows) ? 1 : 2);
RenderSettings.fog = true;
RenderSettings.fogMode = (FogMode)3;
RenderSettings.fogDensity = fogDensity;
RenderSettings.fogColor = new Color(fogR, fogG, fogB);
DynamicGI.UpdateEnvironment();
Bloom val2 = default(Bloom);
DepthOfField val3 = default(DepthOfField);
ChromaticAberration val4 = default(ChromaticAberration);
Vignette val5 = default(Vignette);
ColorAdjustments val6 = default(ColorAdjustments);
foreach (VolumeProfile activeProfile in activeProfiles)
{
if (!((Object)(object)activeProfile == (Object)null))
{
if (!activeProfile.TryGet<Bloom>(ref val2))
{
val2 = activeProfile.Add<Bloom>(false);
}
((VolumeComponent)val2).active = true;
((VolumeParameter<float>)(object)val2.intensity).Override(bloomIntensity);
((VolumeParameter<float>)(object)val2.threshold).Override(bloomThreshold);
if (!activeProfile.TryGet<DepthOfField>(ref val3))
{
val3 = activeProfile.Add<DepthOfField>(false);
}
((VolumeComponent)val3).active = true;
((VolumeParameter<DepthOfFieldMode>)(object)val3.mode).Override((DepthOfFieldMode)2);
((VolumeParameter<float>)(object)val3.focusDistance).Override(dofFocusDistance);
((VolumeParameter<float>)(object)val3.aperture).Override(dofAperture);
((VolumeParameter<float>)(object)val3.focalLength).Override(dofFocalLength);
if (!activeProfile.TryGet<ChromaticAberration>(ref val4))
{
val4 = activeProfile.Add<ChromaticAberration>(false);
}
((VolumeComponent)val4).active = true;
((VolumeParameter<float>)(object)val4.intensity).Override(caIntensity);
if (!activeProfile.TryGet<Vignette>(ref val5))
{
val5 = activeProfile.Add<Vignette>(false);
}
((VolumeComponent)val5).active = true;
((VolumeParameter<float>)(object)val5.intensity).Override(vignetteIntensity);
if (!activeProfile.TryGet<ColorAdjustments>(ref val6))
{
val6 = activeProfile.Add<ColorAdjustments>(false);
}
((VolumeComponent)val6).active = true;
((VolumeParameter<float>)(object)val6.postExposure).Override(gamma);
((VolumeParameter<float>)(object)val6.contrast).Override(contrast);
}
}
}
catch (Exception)
{
}
}
private void SaveSettingsForScene(string scene)
{
string filePath = ((scene == "GLOBAL") ? Path.Combine(presetFolder, "GlobalDefault.txt") : Path.Combine(mapOverridesFolder, scene + ".txt"));
SaveToFile(filePath);
}
private void LoadSettingsForScene(string scene)
{
string text = ((scene == "GLOBAL") ? Path.Combine(presetFolder, "GlobalDefault.txt") : Path.Combine(mapOverridesFolder, scene + ".txt"));
if (File.Exists(text))
{
LoadSettingsFromFile(text);
}
else if (scene != "GLOBAL")
{
string text2 = Path.Combine(presetFolder, "GlobalDefault.txt");
if (File.Exists(text2))
{
LoadSettingsFromFile(text2);
}
else
{
ResetToHardcodedDefaults();
}
}
else
{
ResetToHardcodedDefaults();
}
}
private void SaveGlobalPreset()
{
SaveToFile(Path.Combine(presetFolder, "Preset_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".txt"));
}
private void SaveToFile(string filePath)
{
try
{
string[] contents = new string[18]
{
"bloomIntensity=" + bloomIntensity.ToString(CultureInfo.InvariantCulture),
"bloomThreshold=" + bloomThreshold.ToString(CultureInfo.InvariantCulture),
"dofFocusDistance=" + dofFocusDistance.ToString(CultureInfo.InvariantCulture),
"dofAperture=" + dofAperture.ToString(CultureInfo.InvariantCulture),
"dofFocalLength=" + dofFocalLength.ToString(CultureInfo.InvariantCulture),
"caIntensity=" + caIntensity.ToString(CultureInfo.InvariantCulture),
"vignetteIntensity=" + vignetteIntensity.ToString(CultureInfo.InvariantCulture),
"gamma=" + gamma.ToString(CultureInfo.InvariantCulture),
"contrast=" + contrast.ToString(CultureInfo.InvariantCulture),
"fogDensity=" + fogDensity.ToString(CultureInfo.InvariantCulture),
"fogR=" + fogR.ToString(CultureInfo.InvariantCulture),
"fogG=" + fogG.ToString(CultureInfo.InvariantCulture),
"fogB=" + fogB.ToString(CultureInfo.InvariantCulture),
"softShadows=" + softShadows,
"sunPos=" + sunPos,
"sunR=" + sunR.ToString(CultureInfo.InvariantCulture),
"sunG=" + sunG.ToString(CultureInfo.InvariantCulture),
"sunB=" + sunB.ToString(CultureInfo.InvariantCulture)
};
File.WriteAllLines(filePath, contents);
}
catch (Exception)
{
}
}
private void LoadSettingsFromFile(string filePath)
{
try
{
if (!File.Exists(filePath))
{
return;
}
string[] array = File.ReadAllLines(filePath);
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split('=');
if (array2.Length != 2)
{
continue;
}
string text = array2[0];
float result3;
if (text == "softShadows")
{
if (bool.TryParse(array2[1], out var result))
{
softShadows = result;
}
}
else if (text == "sunPos")
{
if (int.TryParse(array2[1], out var result2))
{
sunPos = result2;
}
}
else if (float.TryParse(array2[1], NumberStyles.Float, CultureInfo.InvariantCulture, out result3))
{
switch (text)
{
case "bloomIntensity":
bloomIntensity = result3;
break;
case "bloomThreshold":
bloomThreshold = result3;
break;
case "dofFocusDistance":
dofFocusDistance = result3;
break;
case "dofAperture":
dofAperture = result3;
break;
case "dofFocalLength":
dofFocalLength = result3;
break;
case "caIntensity":
caIntensity = result3;
break;
case "vignetteIntensity":
vignetteIntensity = result3;
break;
case "gamma":
gamma = result3;
break;
case "contrast":
contrast = result3;
break;
case "fogDensity":
fogDensity = result3;
break;
case "fogR":
fogR = result3;
break;
case "fogG":
fogG = result3;
break;
case "fogB":
fogB = result3;
break;
case "sunR":
sunR = result3;
break;
case "sunG":
sunG = result3;
break;
case "sunB":
sunB = result3;
break;
}
}
}
}
catch (Exception)
{
}
}
private void ResetToHardcodedDefaults()
{
bloomIntensity = 1.71f;
bloomThreshold = 0.69f;
dofFocusDistance = 9.69f;
dofAperture = 1.46f;
dofFocalLength = 63.77f;
caIntensity = 0.17f;
gamma = 1.17f;
contrast = 5.26f;
fogDensity = 0.01f;
fogR = 0.5f;
fogG = 0.5f;
fogB = 0.5f;
vignetteIntensity = 0.25f;
softShadows = true;
sunPos = 0;
sunR = 1f;
sunG = 0.95f;
sunB = 0.9f;
}
}
}