using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RepoCommon;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RepoPrototypeLook")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+a7f99f17d93aa9d73dc2483cd9dbd4fc5f2920ab")]
[assembly: AssemblyProduct("RepoPrototypeLook")]
[assembly: AssemblyTitle("RepoPrototypeLook")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[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;
}
}
}
namespace RepoCommon
{
internal static class Modal
{
private static readonly List<InputKey> NoKeys = new List<InputKey>();
internal static void Hold()
{
InputManager instance = InputManager.instance;
if ((Object)(object)instance != (Object)null)
{
instance.DisableControlsExcept(0.1f, NoKeys);
instance.DisableMovement(0.1f);
instance.DisableAiming(0.1f);
}
if ((Object)(object)CursorManager.instance != (Object)null)
{
CursorManager.instance.Unlock(0.2f);
}
}
internal static bool InRun()
{
if (!SemiFunc.IsMainMenu())
{
return !SemiFunc.IsSplashScreen();
}
return false;
}
}
internal static class Ui
{
internal static readonly Color Accent = new Color(0.97f, 0.66f, 0.16f);
internal static readonly Color Good = new Color(0.5f, 0.88f, 0.58f);
internal static readonly Color Bad = new Color(0.96f, 0.4f, 0.36f);
internal static readonly Color TextColor = new Color(0.93f, 0.94f, 0.96f);
internal static readonly Color MutedColor = new Color(0.62f, 0.65f, 0.72f);
internal static GUIStyle Window;
internal static GUIStyle Card;
internal static GUIStyle Title;
internal static GUIStyle Heading;
internal static GUIStyle Body;
internal static GUIStyle Muted;
internal static GUIStyle Hint;
internal static GUIStyle Button;
internal static GUIStyle ButtonAccent;
internal static GUIStyle ButtonDanger;
internal static GUIStyle Tab;
internal static GUIStyle TabActive;
internal static GUIStyle Toast;
internal static GUIStyle Field;
internal static GUIStyle SliderBar;
internal static GUIStyle SliderThumb;
private static bool ready;
private static Texture2D cursorTexture;
internal static float Scale()
{
return Mathf.Max(0.75f, (float)Screen.height / 1080f);
}
internal static void Init()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: 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_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: 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_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: 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: Expected O, but got Unknown
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: 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_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Expected O, but got Unknown
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Expected O, but got Unknown
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Expected O, but got Unknown
//IL_0329: Expected O, but got Unknown
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_0380: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Expected O, but got Unknown
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Expected O, but got Unknown
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Expected O, but got Unknown
//IL_03ad: Expected O, but got Unknown
//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
if (!ready)
{
ready = true;
Window = Box(new Color(0.055f, 0.063f, 0.08f, 0.95f), 16, new RectOffset(0, 0, 0, 0));
Card = Box(new Color(0.105f, 0.118f, 0.15f, 0.98f), 9, new RectOffset(14, 14, 8, 8));
Toast = Box(new Color(0.055f, 0.063f, 0.08f, 0.92f), 9, new RectOffset(18, 12, 6, 6));
Toast.fontSize = 17;
Toast.normal.textColor = TextColor;
Toast.alignment = (TextAnchor)3;
Toast.wordWrap = false;
Title = Text(26, (FontStyle)1, Accent);
Heading = Text(19, (FontStyle)1, TextColor);
Body = Text(16, (FontStyle)0, TextColor);
Muted = Text(14, (FontStyle)0, MutedColor);
Hint = Text(13, (FontStyle)0, MutedColor);
Hint.alignment = (TextAnchor)4;
Button = Pressable(new Color(0.2f, 0.23f, 0.29f), new Color(0.27f, 0.31f, 0.39f), TextColor);
ButtonAccent = Pressable(Accent, new Color(1f, 0.78f, 0.36f), new Color(0.1f, 0.08f, 0.04f));
ButtonDanger = Pressable(new Color(0.55f, 0.18f, 0.17f), new Color(0.75f, 0.24f, 0.22f), Color.white);
Tab = Pressable(new Color(0.13f, 0.15f, 0.19f), new Color(0.2f, 0.23f, 0.29f), MutedColor);
TabActive = Pressable(Accent, Accent, new Color(0.1f, 0.08f, 0.04f));
GUIStyle tab = Tab;
int fontSize = (TabActive.fontSize = 17);
tab.fontSize = fontSize;
Field = Box(new Color(0.13f, 0.15f, 0.19f), 7, new RectOffset(10, 10, 6, 6));
Field.fontSize = 16;
Field.normal.textColor = TextColor;
Field.focused.background = Field.normal.background;
Field.focused.textColor = TextColor;
Field.alignment = (TextAnchor)3;
SliderBar = new GUIStyle(GUI.skin.horizontalSlider)
{
fixedHeight = 8f,
border = new RectOffset(4, 4, 4, 4),
margin = new RectOffset(6, 6, 9, 9),
padding = new RectOffset(0, 0, 0, 0)
};
SliderBar.normal.background = Rounded(new Color(0.22f, 0.25f, 0.32f), 4);
SliderThumb = new GUIStyle(GUI.skin.horizontalSliderThumb)
{
fixedWidth = 18f,
fixedHeight = 18f,
border = new RectOffset(9, 9, 9, 9),
margin = new RectOffset(0, 0, 0, 0),
padding = new RectOffset(0, 0, 0, 0)
};
SliderThumb.normal.background = Rounded(Accent, 9);
SliderThumb.hover.background = Rounded(new Color(1f, 0.8f, 0.4f), 9);
SliderThumb.active.background = Rounded(Color.white, 9);
}
}
internal static float Slider(string label, float value, float min, float max, string format = "0.##", float labelWidth = 230f)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(label, Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(labelWidth) });
float result = GUILayout.HorizontalSlider(value, min, max, SliderBar, SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Height(22f),
GUILayout.ExpandWidth(true)
});
GUILayout.Label(result.ToString(format), Body, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) });
GUILayout.EndHorizontal();
return result;
}
internal static bool Toggle(string label, bool value, params GUILayoutOption[] options)
{
if (!GUILayout.Button((value ? "● " : "○ ") + label, value ? ButtonAccent : Button, options))
{
return value;
}
return !value;
}
internal static void DrawCursor()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)cursorTexture == (Object)null)
{
cursorTexture = MakeCursor();
}
Matrix4x4 matrix = GUI.matrix;
GUI.matrix = Matrix4x4.identity;
float num = Mathf.Max(1f, (float)Screen.height / 1080f);
Vector3 mousePosition = Input.mousePosition;
GUI.DrawTexture(new Rect(mousePosition.x - 2f * num, (float)Screen.height - mousePosition.y - 2f * num, (float)((Texture)cursorTexture).width * num, (float)((Texture)cursorTexture).height * num), (Texture)(object)cursorTexture);
GUI.matrix = matrix;
}
private static GUIStyle Text(int size, FontStyle fontStyle, Color color)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
GUIStyle val = new GUIStyle(GUI.skin.label)
{
fontSize = size,
fontStyle = fontStyle,
wordWrap = true
};
val.normal.textColor = color;
return val;
}
private static GUIStyle Box(Color color, int radius, RectOffset padding)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
Texture2D background = Rounded(color, radius);
GUIStyle val = new GUIStyle(GUI.skin.box)
{
border = new RectOffset(radius, radius, radius, radius),
padding = padding,
margin = new RectOffset(0, 0, 0, 0)
};
val.normal.background = background;
val.hover.background = background;
val.active.background = background;
val.focused.background = background;
return val;
}
private static GUIStyle Pressable(Color normal, Color hover, Color text)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_0042: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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)
GUIStyle val = new GUIStyle(GUI.skin.button)
{
border = new RectOffset(9, 9, 9, 9),
padding = new RectOffset(14, 14, 7, 7),
margin = new RectOffset(3, 3, 3, 3),
fontSize = 16,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4
};
val.normal.background = Rounded(normal, 9);
val.hover.background = Rounded(hover, 9);
val.active.background = Rounded(Color.Lerp(hover, Color.black, 0.2f), 9);
val.focused.background = val.normal.background;
GUIStyleState normal2 = val.normal;
GUIStyleState hover2 = val.hover;
GUIStyleState active = val.active;
Color val2 = (val.focused.textColor = text);
Color val4 = (active.textColor = val2);
Color textColor = (hover2.textColor = val4);
normal2.textColor = textColor;
return val;
}
private static Texture2D Rounded(Color color, int radius)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: 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)
Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
{
filterMode = (FilterMode)1,
wrapMode = (TextureWrapMode)1,
hideFlags = (HideFlags)61
};
for (int i = 0; i < 32; i++)
{
for (int j = 0; j < 32; j++)
{
float num = (((float)j + 0.5f < (float)radius) ? ((float)radius - ((float)j + 0.5f)) : (((float)j + 0.5f > (float)(32 - radius)) ? ((float)j + 0.5f - (float)(32 - radius)) : 0f));
float num2 = (((float)i + 0.5f < (float)radius) ? ((float)radius - ((float)i + 0.5f)) : (((float)i + 0.5f > (float)(32 - radius)) ? ((float)i + 0.5f - (float)(32 - radius)) : 0f));
float num3 = Mathf.Clamp01((float)radius - Mathf.Sqrt(num * num + num2 * num2) + 0.5f);
val.SetPixel(j, i, new Color(color.r, color.g, color.b, color.a * num3));
}
}
val.Apply();
return val;
}
private static Texture2D MakeCursor()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_0110: Expected O, but got Unknown
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
Vector2[] poly = (Vector2[])(object)new Vector2[7]
{
new Vector2(2f, 2f),
new Vector2(2f, 24f),
new Vector2(7.5f, 19f),
new Vector2(11.5f, 28f),
new Vector2(15f, 26.5f),
new Vector2(11f, 18f),
new Vector2(18f, 18f)
};
bool[,] array = new bool[22, 32];
for (int i = 0; i < 32; i++)
{
for (int j = 0; j < 22; j++)
{
array[j, i] = PointInPolygon(new Vector2((float)j + 0.5f, (float)i + 0.5f), poly);
}
}
Texture2D val = new Texture2D(22, 32, (TextureFormat)4, false)
{
filterMode = (FilterMode)1,
wrapMode = (TextureWrapMode)1,
hideFlags = (HideFlags)61
};
for (int k = 0; k < 32; k++)
{
for (int l = 0; l < 22; l++)
{
Color val2 = Color.clear;
if (array[l, k])
{
val2 = Color.white;
}
else if (NeighborInside(array, l, k, 22, 32))
{
((Color)(ref val2))..ctor(0f, 0f, 0f, 0.95f);
}
val.SetPixel(l, 31 - k, val2);
}
}
val.Apply();
return val;
}
private static bool NeighborInside(bool[,] inside, int x, int y, int w, int h)
{
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
int num = x + j;
int num2 = y + i;
if (num >= 0 && num2 >= 0 && num < w && num2 < h && inside[num, num2])
{
return true;
}
}
}
return false;
}
private static bool PointInPolygon(Vector2 p, Vector2[] poly)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_0058: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
int num = 0;
int num2 = poly.Length - 1;
while (num < poly.Length)
{
if (poly[num].y > p.y != poly[num2].y > p.y && p.x < (poly[num2].x - poly[num].x) * (p.y - poly[num].y) / (poly[num2].y - poly[num].y) + poly[num].x)
{
flag = !flag;
}
num2 = num++;
}
return flag;
}
}
}
namespace RepoPrototypeLook
{
internal static class Look
{
private static PostProcessing pp;
private static bool hasBase;
private static bool diagnosticsLogged;
private static float satBase;
private static float contrastBase;
private static float tintBase;
private static float grainBase;
private static float satApplied;
private static float contrastApplied;
private static float tintApplied;
private static float grainApplied;
private static Vector4 liftBase;
private static Vector4 gainBase;
private static Vector4 liftApplied;
private static Vector4 gainApplied;
private static float tempBase;
private static float bloomIntBase;
private static float vigIntBase;
private static readonly Dictionary<int, Antialiasing> originalAa = new Dictionary<int, Antialiasing>();
private static bool qualityCaptured;
private static AnisotropicFiltering originalAniso;
private static int originalRtSamples = -1;
private static RectTransform displayRect;
private static Vector2 dispAnchorMin;
private static Vector2 dispAnchorMax;
private static Vector2 dispPivot;
private static Vector2 dispSizeDelta;
private static Vector2 dispAnchoredPosition;
private static readonly Vector3[] corners = (Vector3[])(object)new Vector3[4];
internal static void OnSetup(PostProcessing instance)
{
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)instance.colorGrading == (Object)null) && !((Object)(object)instance.bloom == (Object)null) && !((Object)(object)instance.vignette == (Object)null) && !((Object)(object)instance.grain == (Object)null))
{
bool fresh = (Object)(object)pp != (Object)(object)instance;
pp = instance;
ColorGrading colorGrading = instance.colorGrading;
satBase = Persist(fresh, ((ParameterOverride<float>)(object)colorGrading.saturation).value, satBase, satApplied);
contrastBase = Persist(fresh, ((ParameterOverride<float>)(object)colorGrading.contrast).value, contrastBase, contrastApplied);
tintBase = Persist(fresh, ((ParameterOverride<float>)(object)colorGrading.tint).value, tintBase, tintApplied);
grainBase = Persist(fresh, instance.grainIntensityDefault, grainBase, grainApplied);
liftBase = Persist(fresh, ((ParameterOverride<Vector4>)(object)colorGrading.lift).value, liftBase, liftApplied);
gainBase = Persist(fresh, ((ParameterOverride<Vector4>)(object)colorGrading.gain).value, gainBase, gainApplied);
tempBase = ((ParameterOverride<float>)(object)colorGrading.temperature).value;
bloomIntBase = instance.bloomIntensity;
vigIntBase = instance.vignetteIntensity;
hasBase = true;
if (!diagnosticsLogged)
{
diagnosticsLogged = true;
LogDiagnostics();
}
Apply();
ApplyResolution();
}
}
private static float Persist(bool fresh, float current, float oldBase, float applied)
{
if (!fresh && Mathf.Approximately(current, applied))
{
return oldBase;
}
return current;
}
private static Vector4 Persist(bool fresh, Vector4 current, Vector4 oldBase, Vector4 applied)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (!fresh)
{
Vector4 val = current - applied;
if (!(((Vector4)(ref val)).sqrMagnitude > 1E-08f))
{
return oldBase;
}
}
return current;
}
internal static void Apply()
{
//IL_011e: 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_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: 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_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
ApplyQuality();
if (!((Object)(object)pp == (Object)null) && hasBase)
{
Grade g = Presets.Get(Plugin.Style.Value);
float num = (Plugin.Enabled.Value ? Plugin.Strength.Value : 0f);
ColorGrading colorGrading = pp.colorGrading;
satApplied = satBase + (g.Saturation + Plugin.Saturation.Value) * num;
pp.colorGradingSaturation = satApplied;
((ParameterOverride<float>)(object)colorGrading.saturation).Override(satApplied);
contrastApplied = contrastBase + (g.Contrast + Plugin.Contrast.Value) * num;
pp.colorGradingContrast = contrastApplied;
((ParameterOverride<float>)(object)colorGrading.contrast).Override(contrastApplied);
tintApplied = tintBase + (g.Tint + Plugin.Tint.Value) * num;
((ParameterOverride<float>)(object)colorGrading.tint).Override(tintApplied);
((ParameterOverride<float>)(object)colorGrading.temperature).Override(tempBase + (g.Temperature + Plugin.Temperature.Value) * num);
liftApplied = Vector4.Lerp(liftBase, new Vector4(g.ShadowColor.x, g.ShadowColor.y, g.ShadowColor.z, liftBase.w), num * g.ShadowBlend);
((ParameterOverride<Vector4>)(object)colorGrading.lift).Override(liftApplied);
gainApplied = Vector4.Lerp(gainBase, new Vector4(g.HighlightColor.x, g.HighlightColor.y, g.HighlightColor.z, gainBase.w), num);
((ParameterOverride<Vector4>)(object)colorGrading.gain).Override(gainApplied);
float num2 = bloomIntBase * Mathf.Lerp(1f, g.BloomMultiplier * Plugin.BloomMultiplier.Value, num);
pp.bloomIntensity = num2;
((ParameterOverride<float>)(object)pp.bloom.intensity).Override(num2);
pp.vignetteIntensity = Mathf.Clamp01(vigIntBase + (g.VignetteBoost + Plugin.VignetteBoost.Value) * num);
grainApplied = grainBase * Mathf.Lerp(1f, g.GrainMultiplier * Plugin.GrainMultiplier.Value, num);
pp.grainIntensityDefault = grainApplied;
((ParameterOverride<float>)(object)pp.grain.intensity).Override(grainApplied);
ApplyAmbientOcclusion(g);
ApplyAntiAliasing();
}
}
private static void ApplyAmbientOcclusion(Grade g)
{
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
PostProcessProfile profile = pp.volume.profile;
bool flag = Plugin.Enabled.Value && Plugin.AmbientOcclusion.Value;
AmbientOcclusion val = default(AmbientOcclusion);
if (!profile.TryGetSettings<AmbientOcclusion>(ref val))
{
if (!flag)
{
return;
}
val = profile.AddSettings<AmbientOcclusion>();
Plugin.Log.LogInfo((object)"Затенение (AO) добавлено в профиль пост-обработки");
}
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)val).enabled).Override(flag);
if (flag)
{
((ParameterOverride<AmbientOcclusionMode>)(object)val.mode).Override((AmbientOcclusionMode)0);
((ParameterOverride<float>)(object)val.intensity).Override(g.AoIntensity * Plugin.AoStrength.Value);
((ParameterOverride<float>)(object)val.radius).Override(0.4f);
((ParameterOverride<AmbientOcclusionQuality>)(object)val.quality).Override((AmbientOcclusionQuality)2);
((ParameterOverride<Color>)(object)val.color).Override(Color.black);
}
}
private static void ApplyAntiAliasing()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
AaMode aaMode = (Plugin.Enabled.Value ? Plugin.AntiAliasing.Value : AaMode.Game);
PostProcessLayer[] array = Object.FindObjectsOfType<PostProcessLayer>();
foreach (PostProcessLayer val in array)
{
int instanceID = ((Object)val).GetInstanceID();
if (!originalAa.ContainsKey(instanceID))
{
originalAa[instanceID] = val.antialiasingMode;
}
switch (aaMode)
{
case AaMode.Off:
val.antialiasingMode = (Antialiasing)0;
break;
case AaMode.Fxaa:
val.antialiasingMode = (Antialiasing)1;
break;
case AaMode.Smaa:
val.antialiasingMode = (Antialiasing)2;
val.subpixelMorphologicalAntialiasing.quality = (Quality)2;
break;
default:
val.antialiasingMode = originalAa[instanceID];
break;
}
}
}
private static void ApplyQuality()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (!qualityCaptured)
{
qualityCaptured = true;
originalAniso = QualitySettings.anisotropicFiltering;
}
if (Plugin.Enabled.Value && Plugin.Anisotropic.Value)
{
QualitySettings.anisotropicFiltering = (AnisotropicFiltering)2;
Texture.SetGlobalAnisotropicFilteringLimits(16, 16);
}
else
{
QualitySettings.anisotropicFiltering = originalAniso;
Texture.SetGlobalAnisotropicFilteringLimits(-1, 16);
}
ApplyRenderTextureMsaa();
}
private static void ApplyRenderTextureMsaa()
{
RenderTextureMain instance = RenderTextureMain.instance;
if ((Object)(object)instance == (Object)null || (Object)(object)instance.renderTexture == (Object)null)
{
return;
}
if (originalRtSamples < 0)
{
originalRtSamples = instance.renderTexture.antiAliasing;
}
int num = originalRtSamples;
if (Plugin.Enabled.Value)
{
switch (Plugin.Msaa.Value)
{
case MsaaMode.Off:
num = 1;
break;
case MsaaMode.X2:
num = 2;
break;
case MsaaMode.X4:
num = 4;
break;
case MsaaMode.X8:
num = 8;
break;
}
}
if (instance.renderTexture.antiAliasing != num)
{
instance.renderTexture.Release();
instance.renderTexture.antiAliasing = num;
instance.ResetResolution();
Plugin.Log.LogInfo((object)$"MSAA текстуры рендера: {num}x");
}
}
internal static void ApplyResolution()
{
RenderTextureMain instance = RenderTextureMain.instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
if (Plugin.Enabled.Value && Plugin.NativeResolution.Value)
{
float value = Plugin.RenderScale.Value;
int num = Mathf.Clamp(Mathf.RoundToInt((float)Screen.width * value), 640, 7680);
int num2 = Mathf.Clamp(Mathf.RoundToInt((float)Screen.height * value), 360, 4320);
if ((int)instance.textureWidthOriginal != num || (int)instance.textureHeightOriginal != num2)
{
instance.textureWidthOriginal = num;
instance.textureHeightOriginal = num2;
instance.ResetResolution();
Plugin.Log.LogInfo((object)$"Размер рендера: {num}x{num2} (экран {Screen.width}x{Screen.height}, масштаб {value})");
}
}
ApplyDisplayFit();
}
internal static void ApplyDisplayFit()
{
//IL_009f: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: 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_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: 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_01cf: 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_01f8: 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_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
RenderTextureMain instance = RenderTextureMain.instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
RawImage component = ((Component)instance).GetComponent<RawImage>();
if ((Object)(object)component == (Object)null)
{
if ((Object)(object)displayRect == (Object)null)
{
Plugin.Log.LogWarning((object)"[диагностика] RawImage на RenderTextureMain не найден: заполнение экрана недоступно");
}
displayRect = null;
return;
}
RectTransform rectTransform = ((Graphic)component).rectTransform;
Canvas val = (((Object)(object)((Graphic)component).canvas != (Object)null) ? ((Graphic)component).canvas.rootCanvas : null);
RectTransform val2 = (RectTransform)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null);
if ((Object)(object)val2 == (Object)null)
{
return;
}
if ((Object)(object)displayRect != (Object)(object)rectTransform)
{
displayRect = rectTransform;
dispAnchorMin = rectTransform.anchorMin;
dispAnchorMax = rectTransform.anchorMax;
dispPivot = rectTransform.pivot;
dispSizeDelta = rectTransform.sizeDelta;
dispAnchoredPosition = rectTransform.anchoredPosition;
LogDisplay(component, rectTransform, val, val2);
}
if (!Plugin.Enabled.Value || !Plugin.NativeResolution.Value || !Plugin.FillScreen.Value)
{
rectTransform.anchorMin = dispAnchorMin;
rectTransform.anchorMax = dispAnchorMax;
rectTransform.pivot = dispPivot;
rectTransform.sizeDelta = dispSizeDelta;
rectTransform.anchoredPosition = dispAnchoredPosition;
}
else if (!(instance.sizeResetTimer > 0f))
{
val2.GetWorldCorners(corners);
Vector3 position = (corners[0] + corners[2]) * 0.5f;
float num = Vector3.Distance(corners[0], corners[3]);
float num2 = Vector3.Distance(corners[0], corners[1]);
Vector3 lossyScale = ((Transform)rectTransform).lossyScale;
if (!(lossyScale.x <= 0f) && !(lossyScale.y <= 0f))
{
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(0.5f, 0.5f);
rectTransform.anchorMax = val3;
rectTransform.anchorMin = val3;
rectTransform.pivot = new Vector2(0.5f, 0.5f);
rectTransform.sizeDelta = new Vector2(num / lossyScale.x, num2 / lossyScale.y);
((Transform)rectTransform).position = position;
}
}
}
private static void LogDisplay(RawImage raw, RectTransform rect, Canvas canvas, RectTransform canvasRect)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_00af: 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_00c5: 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_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource log = Plugin.Log;
List<string> list = new List<string>();
Transform val = ((Component)rect).transform;
while ((Object)(object)val != (Object)null)
{
list.Add(((Object)val).name);
val = val.parent;
}
list.Reverse();
log.LogInfo((object)("[диагностика] изображение игры: " + string.Join(" / ", list)));
object[] obj = new object[4] { rect.anchorMin, rect.anchorMax, rect.pivot, null };
Rect rect2 = rect.rect;
obj[3] = ((Rect)(ref rect2)).size;
log.LogInfo((object)(string.Format("[диагностика] RawImage: якоря {0}..{1}, pivot {2}, размер {3}, ", obj) + $"sizeDelta {rect.sizeDelta}, позиция {rect.anchoredPosition}, масштаб {((Transform)rect).localScale}"));
object[] obj2 = new object[4]
{
((Object)canvas).name,
canvas.renderMode,
null,
null
};
rect2 = canvasRect.rect;
obj2[2] = ((Rect)(ref rect2)).size;
obj2[3] = canvas.scaleFactor;
log.LogInfo((object)string.Format("[диагностика] холст «{0}»: {1}, размер {2}, scaleFactor {3}", obj2));
CanvasScaler component = ((Component)canvas).GetComponent<CanvasScaler>();
if ((Object)(object)component != (Object)null)
{
log.LogInfo((object)$"[диагностика] CanvasScaler: {component.uiScaleMode}, опорное {component.referenceResolution}, match {component.matchWidthOrHeight}");
}
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
log.LogInfo((object)string.Format("[диагностика] Camera.main: aspect {0:0.###}, fov {1}, цель {2}", main.aspect, main.fieldOfView, ((Object)(object)main.targetTexture != (Object)null) ? (((Texture)main.targetTexture).width + "x" + ((Texture)main.targetTexture).height) : "экран"));
}
}
internal static void RefreshResolution()
{
if ((Object)(object)GraphicsManager.instance != (Object)null && (Object)(object)RenderTextureMain.instance != (Object)null)
{
GraphicsManager.instance.UpdateRenderSize();
}
}
private static void LogDiagnostics()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource log = Plugin.Log;
log.LogInfo((object)$"[диагностика] экран {Screen.width}x{Screen.height}, окно {Screen.fullScreenMode}");
RenderTextureMain instance = RenderTextureMain.instance;
if ((Object)(object)instance != (Object)null)
{
log.LogInfo((object)($"[диагностика] текстура рендера: Large {instance.textureWidthLarge}x{instance.textureHeightLarge}, " + $"Medium {instance.textureWidthMedium}x{instance.textureHeightMedium}, Small {instance.textureWidthSmall}x{instance.textureHeightSmall}, " + $"сейчас {((Texture)instance.renderTexture).width}x{((Texture)instance.renderTexture).height}, MSAA {instance.renderTexture.antiAliasing}"));
}
IEnumerable<string> values = pp.volume.profile.settings.Select((PostProcessEffectSettings s) => ((object)s).GetType().Name + (s.active ? "" : "(выкл)"));
log.LogInfo((object)("[диагностика] эффекты профиля: " + string.Join(", ", values)));
ColorGrading colorGrading = pp.colorGrading;
log.LogInfo((object)($"[диагностика] ColorGrading: режим {((ParameterOverride<GradingMode>)(object)colorGrading.gradingMode).value}, тонмаппинг {((ParameterOverride<Tonemapper>)(object)colorGrading.tonemapper).value}, " + $"насыщенность {satBase}, контраст {contrastBase}, температура {tempBase}, оттенок {tintBase}"));
log.LogInfo((object)$"[диагностика] lift {liftBase}, gain {gainBase}, bloom {bloomIntBase}, виньетка {vigIntBase}, зерно {grainBase}");
log.LogInfo((object)$"[диагностика] анизотропная фильтрация: {QualitySettings.anisotropicFiltering}, VSync {QualitySettings.vSyncCount}, FPS-лимит {Application.targetFrameRate}");
PostProcessLayer[] array = Object.FindObjectsOfType<PostProcessLayer>();
foreach (PostProcessLayer val in array)
{
log.LogInfo((object)$"[диагностика] PostProcessLayer на «{((Object)val).name}»: сглаживание {val.antialiasingMode}");
}
}
}
internal static class Patches
{
[HarmonyPatch(typeof(PostProcessing), "Setup")]
[HarmonyPostfix]
private static void SetupPostfix(PostProcessing __instance)
{
try
{
Look.OnSetup(__instance);
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Setup: {arg}");
}
}
[HarmonyPatch(typeof(GraphicsManager), "UpdateRenderSize")]
[HarmonyPostfix]
private static void RenderSizePostfix()
{
try
{
Look.ApplyResolution();
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"UpdateRenderSize: {arg}");
}
}
}
public enum AaMode
{
Game,
Off,
Fxaa,
Smaa
}
public enum MsaaMode
{
Game,
Off,
X2,
X4,
X8
}
[BepInPlugin("reporus.prototypelook", "RepoPrototypeLook", "0.4.1")]
public class Plugin : BaseUnityPlugin
{
public const string Guid = "reporus.prototypelook";
public const string Name = "RepoPrototypeLook";
public const string Version = "0.4.1";
internal static ManualLogSource Log;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<KeyboardShortcut> ToggleKey;
internal static ConfigEntry<KeyboardShortcut> PanelKey;
internal static ConfigEntry<LookStyle> Style;
internal static ConfigEntry<float> Strength;
internal static ConfigEntry<bool> NativeResolution;
internal static ConfigEntry<bool> FillScreen;
internal static ConfigEntry<float> RenderScale;
internal static ConfigEntry<AaMode> AntiAliasing;
internal static ConfigEntry<MsaaMode> Msaa;
internal static ConfigEntry<bool> Anisotropic;
internal static ConfigEntry<bool> AmbientOcclusion;
internal static ConfigEntry<float> AoStrength;
internal static ConfigEntry<float> Saturation;
internal static ConfigEntry<float> Contrast;
internal static ConfigEntry<float> Temperature;
internal static ConfigEntry<float> Tint;
internal static ConfigEntry<float> BloomMultiplier;
internal static ConfigEntry<float> VignetteBoost;
internal static ConfigEntry<float> GrainMultiplier;
private string toast;
private float toastUntil;
private GUIStyle toastStyle;
private float screenCheckTimer;
private int lastScreenW;
private int lastScreenH;
private void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
BindConfig();
new Harmony("reporus.prototypelook").PatchAll(typeof(Patches));
Log.LogInfo((object)"RepoPrototypeLook 0.4.1 загружен");
}
private void BindConfig()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Expected O, but got Unknown
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Expected O, but got Unknown
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Expected O, but got Unknown
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Expected O, but got Unknown
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Expected O, but got Unknown
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Expected O, but got Unknown
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_037c: Expected O, but got Unknown
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Expected O, but got Unknown
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Общее", "Включено", true, "Включает или выключает весь мод. Удобно для сравнения «до/после». Если картинка выглядит сломанной, выключите мод клавишей из следующей настройки.");
ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("1. Общее", "Клавиша переключения", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Включает/выключает мод прямо в игре.");
PanelKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("1. Общее", "Клавиша окна настройки", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "Открывает окно с ползунками: цвета, чёткость и стиль подбираются прямо в игре, настройки сохраняются.");
Style = ((BaseUnityPlugin)this).Config.Bind<LookStyle>("1. Общее", "Стиль", LookStyle.Gta5, "Gta5 — тёплое солнце, бирюзовые тени, насыщенные цвета, сильный контраст. Prototype — выцветшие цвета, грязно-тёплый тон.");
Strength = ((BaseUnityPlugin)this).Config.Bind<float>("1. Общее", "Сила эффекта", 1f, new ConfigDescription("Множитель цветокоррекции: 0 — как в оригинале, 1 — полный стиль.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1.5f), Array.Empty<object>()));
NativeResolution = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Чёткость", "Родное разрешение", true, "Рендерить игру в разрешении вашего экрана (вместо уменьшенного). Самая заметная прибавка к чёткости, нагружает видеокарту, а не процессор. Заодно убирает растяжение картинки на ультрашироком мониторе.");
FillScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Чёткость", "Заполнить экран", true, "Игра показывает картинку строго 16:9, на ультрашироком мониторе (21:9) по бокам остаются чёрные полосы. Включено — картинка занимает весь экран, интерфейс остаётся по центру. Работает вместе с «Родным разрешением».");
RenderScale = ((BaseUnityPlugin)this).Config.Bind<float>("2. Чёткость", "Масштаб рендера", 1f, new ConfigDescription("1 = ровно разрешение экрана. Больше 1 — сглаживание за счёт суперсэмплинга (тяжело), меньше 1 — легче для видеокарты.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
AntiAliasing = ((BaseUnityPlugin)this).Config.Bind<AaMode>("2. Чёткость", "Сглаживание", AaMode.Smaa, "Game — как в игре, Off — выключено, Fxaa — быстрое, Smaa — аккуратное (рекомендуется).");
Msaa = ((BaseUnityPlugin)this).Config.Bind<MsaaMode>("2. Чёткость", "MSAA", MsaaMode.Off, "Сглаживание краёв геометрии на видеокарте. Можно включать вместе со SMAA, X4 — хороший баланс для RTX 3070. Game — как в игре.");
Anisotropic = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Чёткость", "Анизотропная фильтрация 16x", true, "Текстуры под острым углом (пол, стены вдаль) остаются чёткими. Нагружает видеокарту совсем слабо.");
AmbientOcclusion = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Чёткость", "Затенение углов (AO)", true, "Добавляет объём: тёмные стыки, углы, пространство под предметами. Если появились артефакты — выключите.");
AoStrength = ((BaseUnityPlugin)this).Config.Bind<float>("2. Чёткость", "Сила затенения", 1f, new ConfigDescription("Множитель к силе затенения из стиля.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
Saturation = ((BaseUnityPlugin)this).Config.Bind<float>("3. Поправки к стилю", "Насыщенность", 0f, new ConfigDescription("Прибавка к насыщенности стиля. Минус — приглушённее, плюс — ярче.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
Contrast = ((BaseUnityPlugin)this).Config.Bind<float>("3. Поправки к стилю", "Контраст", 0f, new ConfigDescription("Прибавка к контрасту стиля.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
Temperature = ((BaseUnityPlugin)this).Config.Bind<float>("3. Поправки к стилю", "Температура", 0f, new ConfigDescription("Плюс — теплее (жёлто-оранжевый), минус — холоднее.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
Tint = ((BaseUnityPlugin)this).Config.Bind<float>("3. Поправки к стилю", "Оттенок", 0f, new ConfigDescription("Сдвиг между зелёным (минус) и пурпурным (плюс).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 100f), Array.Empty<object>()));
BloomMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("3. Поправки к стилю", "Свечение (bloom)", 1f, new ConfigDescription("Дополнительный множитель к свечению стиля.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4f), Array.Empty<object>()));
VignetteBoost = ((BaseUnityPlugin)this).Config.Bind<float>("3. Поправки к стилю", "Виньетка", 0f, new ConfigDescription("Прибавка к затемнению по краям кадра.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-0.5f, 0.5f), Array.Empty<object>()));
GrainMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("3. Поправки к стилю", "Зерно", 1f, new ConfigDescription("Дополнительный множитель к плёночному зерну.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
((BaseUnityPlugin)this).Config.SettingChanged += delegate(object s, SettingChangedEventArgs e)
{
ConfigEntryBase changedSetting = e.ChangedSetting;
Look.Apply();
if ((object)changedSetting == Enabled || (object)changedSetting == NativeResolution || (object)changedSetting == RenderScale || (object)changedSetting == FillScreen)
{
Look.RefreshResolution();
}
};
}
private void Update()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0067: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = ToggleKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
Enabled.Value = !Enabled.Value;
ShowToast(Enabled.Value ? $"Look: ВКЛ ({Style.Value})" : "Look: ВЫКЛ");
}
value = PanelKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
TunePanel.Toggle();
}
TunePanel.Tick();
screenCheckTimer -= Time.unscaledDeltaTime;
if (screenCheckTimer <= 0f)
{
screenCheckTimer = 1f;
if (Screen.width != lastScreenW || Screen.height != lastScreenH)
{
lastScreenW = Screen.width;
lastScreenH = Screen.height;
Look.RefreshResolution();
}
}
}
private void ShowToast(string text)
{
toast = text;
toastUntil = Time.unscaledTime + 2f;
}
private void OnGUI()
{
//IL_0077: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
TunePanel.Draw();
if (!(Time.unscaledTime >= toastUntil))
{
if (toastStyle == null)
{
toastStyle = new GUIStyle(GUI.skin.label)
{
fontSize = 22,
fontStyle = (FontStyle)1
};
toastStyle.normal.textColor = new Color(1f, 0.8f, 0.5f);
}
GUI.Label(new Rect(24f, 24f, 600f, 40f), toast, toastStyle);
}
}
}
public enum LookStyle
{
Gta5,
Prototype
}
internal struct Grade
{
public float Saturation;
public float Contrast;
public float Temperature;
public float Tint;
public float BloomMultiplier;
public float VignetteBoost;
public float GrainMultiplier;
public Vector3 ShadowColor;
public Vector3 HighlightColor;
public float ShadowBlend;
public float AoIntensity;
}
internal static class Presets
{
private static readonly Grade Gta5 = new Grade
{
Saturation = 18f,
Contrast = 26f,
Temperature = 14f,
Tint = 5f,
BloomMultiplier = 0.85f,
VignetteBoost = 0.03f,
GrainMultiplier = 0.5f,
ShadowColor = new Vector3(0f, 0.03f, 0.045f),
HighlightColor = new Vector3(1f, 0.93f, 0.8f),
ShadowBlend = 0.6f,
AoIntensity = 0.8f
};
private static readonly Grade Prototype = new Grade
{
Saturation = -22f,
Contrast = 14f,
Temperature = 10f,
Tint = 0f,
BloomMultiplier = 1.25f,
VignetteBoost = 0.08f,
GrainMultiplier = 1f,
ShadowColor = new Vector3(0f, 0f, 0f),
HighlightColor = new Vector3(1f, 0.95f, 0.85f),
ShadowBlend = 1f,
AoIntensity = 0.7f
};
internal static Grade Get(LookStyle style)
{
if (style != LookStyle.Prototype)
{
return Gta5;
}
return Prototype;
}
}
internal static class TunePanel
{
internal static bool Open;
private const float W = 820f;
private const float H = 780f;
private static Vector2 scroll;
internal static void Toggle()
{
if (Open || Modal.InRun())
{
Open = !Open;
}
}
internal static void Tick()
{
if (Open)
{
if (Input.GetKeyDown((KeyCode)27))
{
Open = false;
}
else
{
Modal.Hold();
}
}
}
internal static void Draw()
{
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
if (!Open)
{
return;
}
Ui.Init();
Matrix4x4 matrix = GUI.matrix;
float num = Ui.Scale();
GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
float num2 = (float)Screen.width / num;
float num3 = (float)Screen.height / num;
Rect val = default(Rect);
((Rect)(ref val))..ctor((num2 - 820f) / 2f, (num3 - 780f) / 2f, 820f, 780f);
GUI.Box(val, GUIContent.none, Ui.Window);
GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 22f, ((Rect)(ref val)).y + 16f, 776f, 748f));
try
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Графика · настройка", Ui.Title, Array.Empty<GUILayoutOption>());
GUILayout.FlexibleSpace();
if (GUILayout.Button("Закрыть", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }))
{
Open = false;
}
GUILayout.EndHorizontal();
GUILayout.Space(4f);
DrawStyleRow();
GUILayout.Space(6f);
scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>());
DrawColor();
GUILayout.Space(10f);
DrawSharpness();
GUILayout.EndScrollView();
GUILayout.Space(6f);
GUILayout.Label($"{Plugin.PanelKey.Value} или Esc — закрыть · {Plugin.ToggleKey.Value} — включить/выключить мод для сравнения · настройки сохраняются сами", Ui.Hint, Array.Empty<GUILayoutOption>());
}
finally
{
GUILayout.EndArea();
GUI.matrix = matrix;
}
Ui.DrawCursor();
}
private static void DrawStyleRow()
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
Choice(Plugin.Style, new(LookStyle, string)[2]
{
(LookStyle.Gta5, "GTA 5"),
(LookStyle.Prototype, "Prototype")
}, 130f);
GUILayout.FlexibleSpace();
Plugin.Enabled.Value = Ui.Toggle("Мод включён", Plugin.Enabled.Value, GUILayout.Width(190f), GUILayout.Height(34f));
GUILayout.EndHorizontal();
}
private static void DrawColor()
{
GUILayout.Label("Цвет", Ui.Heading, Array.Empty<GUILayoutOption>());
Slide(Plugin.Strength, "Сила эффекта", 0f, 1.5f);
Slide(Plugin.Saturation, "Насыщенность (поправка)", -60f, 60f, "0");
Slide(Plugin.Contrast, "Контраст (поправка)", -60f, 60f, "0");
Slide(Plugin.Temperature, "Температура (холоднее ↔ теплее)", -60f, 60f, "0");
Slide(Plugin.Tint, "Оттенок (зелёный ↔ пурпурный)", -60f, 60f, "0");
Slide(Plugin.BloomMultiplier, "Свечение ×", 0f, 2.5f);
Slide(Plugin.VignetteBoost, "Виньетка (поправка)", -0.3f, 0.3f);
Slide(Plugin.GrainMultiplier, "Зерно ×", 0f, 2f);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.FlexibleSpace();
if (GUILayout.Button("Сбросить поправки к стилю", Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }))
{
Reset<float>(Plugin.Saturation);
Reset<float>(Plugin.Contrast);
Reset<float>(Plugin.Temperature);
Reset<float>(Plugin.Tint);
Reset<float>(Plugin.BloomMultiplier);
Reset<float>(Plugin.VignetteBoost);
Reset<float>(Plugin.GrainMultiplier);
}
GUILayout.EndHorizontal();
}
private static void DrawSharpness()
{
GUILayout.Label("Чёткость и объём", Ui.Heading, Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
Plugin.NativeResolution.Value = Ui.Toggle("Родное разрешение", Plugin.NativeResolution.Value, GUILayout.Height(34f));
Plugin.FillScreen.Value = Ui.Toggle("Заполнить экран", Plugin.FillScreen.Value, GUILayout.Height(34f));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
Plugin.AmbientOcclusion.Value = Ui.Toggle("Затенение углов (AO)", Plugin.AmbientOcclusion.Value, GUILayout.Height(34f));
Plugin.Anisotropic.Value = Ui.Toggle("Анизотропная 16x", Plugin.Anisotropic.Value, GUILayout.Height(34f));
GUILayout.EndHorizontal();
Slide(Plugin.AoStrength, "Сила затенения", 0f, 2f);
GUILayout.Space(4f);
GUILayout.Label("Масштаб рендера (1 = разрешение экрана, больше — чётче и тяжелее)", Ui.Muted, Array.Empty<GUILayoutOption>());
Choice(Plugin.RenderScale, new(float, string)[5]
{
(0.75f, "0.75"),
(1f, "1.0"),
(1.25f, "1.25"),
(1.5f, "1.5"),
(2f, "2.0")
}, 90f);
GUILayout.Label("Сглаживание", Ui.Muted, Array.Empty<GUILayoutOption>());
Choice(Plugin.AntiAliasing, new(AaMode, string)[4]
{
(AaMode.Game, "Как в игре"),
(AaMode.Off, "Выкл"),
(AaMode.Fxaa, "FXAA"),
(AaMode.Smaa, "SMAA")
}, 120f);
GUILayout.Label("MSAA (края геометрии, нагружает видеокарту)", Ui.Muted, Array.Empty<GUILayoutOption>());
Choice(Plugin.Msaa, new(MsaaMode, string)[5]
{
(MsaaMode.Game, "Как в игре"),
(MsaaMode.Off, "Выкл"),
(MsaaMode.X2, "2x"),
(MsaaMode.X4, "4x"),
(MsaaMode.X8, "8x")
}, 110f);
}
private static void Choice<T>(ConfigEntry<T> entry, (T value, string text)[] options, float width)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
for (int i = 0; i < options.Length; i++)
{
(T value, string text) tuple = options[i];
T item = tuple.value;
string item2 = tuple.text;
bool flag = EqualityComparer<T>.Default.Equals(entry.Value, item);
if (GUILayout.Button(item2, flag ? Ui.ButtonAccent : Ui.Button, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(width),
GUILayout.Height(32f)
}) && !flag)
{
entry.Value = item;
}
}
GUILayout.EndHorizontal();
}
private static void Slide(ConfigEntry<float> entry, string label, float min, float max, string format = "0.##")
{
float num = Ui.Slider(label, entry.Value, min, max, format, 300f);
num = Mathf.Round(num * 100f) / 100f;
if (!Mathf.Approximately(num, entry.Value))
{
entry.Value = num;
}
}
private static void Reset<T>(ConfigEntry<T> entry)
{
entry.Value = (T)((ConfigEntryBase)entry).DefaultValue;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}