using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using plog;
using plog.Models;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SSNC")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4d91e29024e4cd5f2ef99ab636acc2a4663caecb")]
[assembly: AssemblyProduct("SSNC")]
[assembly: AssemblyTitle("SSNC")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 SSNC
{
public class Logger
{
public enum Level
{
Off,
Debug,
Info,
Fine,
Warning,
Error,
Exception,
Extreme,
CommandLine,
Config
}
public struct Stylizer
{
public Hex Basic;
public Hex Primitive;
public Hex Class;
public Hex Interface;
public Hex Enum;
public Hex Struct;
public Hex Delegate;
public Hex Method;
public Hex Parameter;
public Hex Namespace;
public Hex FallBack;
public Stylizer(Hex? Basic = null, Hex? Primitive = null, Hex? Class = null, Hex? Interface = null, Hex? Enum = null, Hex? Struct = null, Hex? Delegate = null, Hex? Parameter = null, Hex? Method = null, Hex? Namespace = null, Hex? FallBack = null)
{
this.Basic = Basic ?? ((Hex)"47D");
this.Primitive = Primitive ?? ((Hex)"8BF");
this.Class = Class ?? ((Hex)"5CB");
this.Interface = Interface ?? ((Hex)"BDA");
this.Enum = Enum ?? ((Hex)"9DC");
this.Struct = Struct ?? ((Hex)"8C9");
this.Delegate = Delegate ?? ((Hex)"4BC");
this.Method = Method ?? ((Hex)"DDA");
this.Parameter = Parameter ?? ((Hex)"9DF");
this.Namespace = Namespace ?? ((Hex)"FFF");
this.FallBack = FallBack ?? ((Hex)"FFF");
}
public string GetColorOfType(Type type)
{
return "<color=#" + (type.IsPrimitive ? Primitive : (type.IsClass ? Class : (type.IsInterface ? Interface : (type.IsEnum ? Enum : (type.IsValueType ? Struct : ((type.IsSubclassOf(typeof(Delegate)) || type == typeof(Delegate)) ? Delegate : FallBack)))))).ToString() + ">";
}
public static string GetColorOfType(Type type, Stylizer style)
{
return style.GetColorOfType(type);
}
}
public struct Hex
{
public static bool fuckoffupieceofshit = false;
public byte Red;
public byte Green;
public byte Blue;
public byte Alpha;
public static readonly Hex red = "#FF0000";
public static readonly Hex green = "#00FF00";
public static readonly Hex brightTeal = "#01F9C6";
public static readonly Hex blue = "#0000FF";
public static readonly Hex white = "#FFFFFF";
public static readonly Hex black = "#000000";
public static readonly Hex yellow = "#FFFF00";
public static readonly Hex cyan = "#00FFFF";
public static readonly Hex magent = "#FF00FF";
public static readonly Hex gray = "#7F7F7F";
public static readonly Hex grey = gray;
public static readonly Hex clear = "#00";
public static readonly Hex transparent = clear;
public byte r
{
readonly get
{
return Red;
}
set
{
Red = value;
}
}
public byte g
{
readonly get
{
return Green;
}
set
{
Green = value;
}
}
public byte b
{
readonly get
{
return Blue;
}
set
{
Blue = value;
}
}
public byte a
{
readonly get
{
return Alpha;
}
set
{
Alpha = value;
}
}
public Hex(byte r, byte g, byte b, byte a)
{
Red = r;
Green = g;
Blue = b;
Alpha = a;
}
public Hex(int r, int g, int b)
: this(r, g, b, 255)
{
}
public Hex(int r, int g, int b, int a)
: this((byte)r, (byte)g, (byte)b, (byte)a)
{
}
public Hex(byte r, byte g, byte b)
: this(r, g, b, byte.MaxValue)
{
}
public Hex(byte? r = null, byte? g = null, byte? b = null, byte? a = null)
: this(r.GetValueOrDefault(), g.GetValueOrDefault(), b.GetValueOrDefault(), a.GetValueOrDefault(byte.MaxValue))
{
}
public Hex(int? r = null, int? g = null, int? b = null, int? a = null)
: this(r.GetValueOrDefault(), g.GetValueOrDefault(), b.GetValueOrDefault(), a.GetValueOrDefault(255))
{
}
public static Hex operator +(Hex a, Hex b)
{
return new Hex(a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a);
}
public static Hex operator +(Hex a, byte b)
{
return new Hex(a.r + b, a.g + b, a.b + b, a.a + b);
}
public static Hex operator -(Hex a, Hex b)
{
return new Hex(a.r - b.r, a.g - b.g, a.b - b.b, a.a - b.a);
}
public static Hex operator -(Hex a, byte b)
{
return new Hex(a.r - b, a.g - b, a.b - b, a.a - b);
}
public static Hex operator *(Hex a, Hex b)
{
return new Hex(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a);
}
public static Hex operator *(Hex a, byte b)
{
return new Hex(a.r * b, a.g * b, a.b * b, a.a * b);
}
public static Hex operator /(Hex a, Hex b)
{
return new Hex(a.r / b.r, a.g / b.g, a.b / b.b, a.a / b.a);
}
public static Hex operator /(Hex a, byte b)
{
return new Hex(a.r / b, a.g / b, a.b / b, a.a / b);
}
public static float[]operator /(Hex a, float b)
{
return new float[4]
{
(float)(int)a.r / b,
(float)(int)a.g / b,
(float)(int)a.b / b,
(float)(int)a.a / b
};
}
public static bool operator ==(Hex left, Hex right)
{
return left.Equals(right);
}
public static bool operator !=(Hex left, Hex right)
{
return !left.Equals(right);
}
public static bool operator >(Hex left, Hex right)
{
return Compare(left, right) >= 3;
}
public static bool operator <(Hex left, Hex right)
{
return Compare(left, right) <= 2;
}
public static int Compare(Hex left, Hex right)
{
int num = 0;
if (left.Red > right.Red)
{
num++;
}
if (left.Green > right.Green)
{
num++;
}
if (left.Blue > right.Blue)
{
num++;
}
if (left.Alpha > right.Alpha)
{
num++;
}
return num;
}
public static byte DarkenBasedOnAlpha(byte? colorByte, byte? Alpha)
{
return (byte)((float)(int)colorByte.GetValueOrDefault(byte.MaxValue) * ((float)(int)Alpha.GetValueOrDefault(byte.MaxValue) / 255f));
}
public byte DarkenBasedOnAlpha(byte? colorByte)
{
return DarkenBasedOnAlpha(colorByte.GetValueOrDefault(byte.MaxValue), Alpha);
}
public static Hex ToRGB(Hex h)
{
return new Hex(h.DarkenBasedOnAlpha(h.Red), h.DarkenBasedOnAlpha(h.Green), h.DarkenBasedOnAlpha(h.Blue));
}
public readonly Hex ToRGB()
{
return ToRGB(this);
}
public static float[] ToCMYK(Hex h)
{
h = ToRGB(h);
float num = (float)(int)h.r / 255f;
float num2 = (float)(int)h.g / 255f;
float num3 = (float)(int)h.b / 255f;
float num4 = Mathf.Min(new float[3]
{
1f - num,
1f - num2,
1f - num3
});
float num5 = (1f - num - num4) / (1f - num4);
float num6 = (1f - num2 - num4) / (1f - num4);
float num7 = (1f - num3 - num4) / (1f - num4);
return new float[4] { num5, num6, num7, num4 };
}
public readonly float[] ToCMYK()
{
return ToCMYK(this);
}
public static float[] ToHSV(Hex h)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV((Color)ToRGB(h), ref num, ref num2, ref num3);
return new float[3] { num, num2, num3 };
}
public readonly float[] ToHSV()
{
return ToHSV(this);
}
public override readonly bool Equals(object A)
{
if (!(A is Hex hex) || 1 == 0)
{
return false;
}
return hex.r == r && hex.g == g && hex.b == b && hex.a == Alpha;
}
public override readonly int GetHashCode()
{
return HashCode.Combine(Red, Green, Blue, Alpha);
}
public readonly string ToString(string format = "X2")
{
Plugin.Log.Debug("active tostring(format) " + format);
if (format[0] != 'x' || format != "rgb" || format != "rgba")
{
format = format.ToUpper();
}
string point = ((format.Length == 1) ? "" : format.Substring(1));
if (1 == 0)
{
}
string result = format switch
{
"HEX" => $"{Red:X2}{Green:X2}{Blue:X2}{Alpha:X2}",
"A" => $"{Alpha:D3}",
"rgb" => $"{Red:D} {Green:D} {Blue:D}",
"RGB" => $"{Red:D3}{Green:D3}{Blue:D3}",
"rgba" => $"{Red:D} {Green:D} {Blue:D} {Alpha:D}",
"RGBA" => $"{Red:D3}{Green:D3}{Blue:D3}{Alpha:D3}",
"#AA" => $"{Alpha:X2}",
"#RGB" => string.Format("{0}{1}{2}", Red.ToString("X2")[0], Green.ToString("X2")[0], Blue.ToString("X2")[0]),
"#RGBA" => string.Format("{0}{1}{2}{3}", Red.ToString("X2")[0], Green.ToString("X2")[0], Blue.ToString("X2")[0], Alpha.ToString("X2")[0]),
"#RRGGBB" => $"{Red:X2}{Green:X2}{Blue:X2}",
"#RRGGBBAA" => $"{Red:X2}{Green:X2}{Blue:X2}{Alpha:X2}",
"G" => sub(Red, "G") + sub(Green, "G") + sub(Blue, "G") + sub(Alpha, "G"),
"D" => sub(Red, "D") + " " + sub(Green, "D") + " " + sub(Blue, "D") + " " + sub(Alpha, "D"),
"X" => sub(Red, "X") + sub(Green, "X") + sub(Blue, "X") + sub(Alpha, "X"),
"x" => sub(Red, "x") + sub(Green, "x") + sub(Blue, "x") + sub(Alpha, "x"),
"N" => sub(Red, "N") + sub(Green, "N") + sub(Blue, "N") + sub(Alpha, "N"),
"F" => sub(Red, "F") + sub(Green, "F") + sub(Blue, "F") + sub(Alpha, "F"),
"E" => sub(Red, "E") + sub(Green, "E") + sub(Blue, "E") + sub(Alpha, "E"),
"P" => sub(Red, "P") + sub(Green, "P") + sub(Blue, "P") + sub(Alpha, "P"),
"C" => sub(Red, "C") + sub(Green, "C") + sub(Blue, "C") + sub(Alpha, "C"),
_ => $"{Red:X2}{Green:X2}{Blue:X2}{Alpha:X2}",
};
if (1 == 0)
{
}
return result;
string sub(byte val, string format)
{
return val.ToString($"{format[0]}{point}");
}
}
public override string ToString()
{
Plugin.Log.Debug("active tostring()");
return ToString("HEX");
}
public static implicit operator string(Hex h)
{
Plugin.Log.Debug("active implicit string opeerator");
if (!fuckoffupieceofshit)
{
return h.ToString("HEX");
}
return $"{h.Red:X2}{h.Green:X2}{h.Blue:X2}{h.Alpha:X2}";
}
public static implicit operator Hex(string s)
{
if (s.StartsWith('#'))
{
string text = s;
s = text.Substring(1, text.Length - 1);
}
if (s.Length == 2)
{
byte? b = con(s.Substring(0, 2));
return new Hex(null, null, null, b);
}
if (s.Length == 3)
{
return new Hex(con(s[0].ToString()), con(s[1].ToString()), con(s[2].ToString()));
}
if (s.Length == 4)
{
return new Hex(con(s[0].ToString()), con(s[1].ToString()), con(s[2].ToString()), con(s[3].ToString()));
}
if (s.Length == 6)
{
return new Hex(con(s.Substring(0, 2)), con(s.Substring(2, 2)), con(s.Substring(4, 2)));
}
if (s.Length == 8)
{
return new Hex(con(s.Substring(0, 2)), con(s.Substring(2, 2)), con(s.Substring(4, 2)), con(s.Substring(6, 2)));
}
return default(Hex);
static byte con(string str)
{
return Convert.ToByte(int.Parse((str.Length == 1) ? (str + "0") : str, NumberStyles.HexNumber));
}
}
public static implicit operator int(Hex h)
{
return int.Parse(h, NumberStyles.HexNumber);
}
public static implicit operator Hex(int i)
{
string hexI = i.ToString("X2");
if (!Is(new int[5] { 2, 3, 4, 6, 8 }))
{
hexI = "0" + hexI;
}
return hexI;
bool Is(int[] poss)
{
foreach (int num in poss)
{
if (hexI.Length == num)
{
return true;
}
}
return false;
}
}
public static implicit operator Color(Hex h)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
return new Color((h / 255f)[0], (h / 255f)[1], (h / 255f)[2], (h / 255f)[3]);
}
public static implicit operator Hex(Color c)
{
//IL_0004: 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_001a: 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)
return new Hex(toInt(c.r), toInt(c.g), toInt(c.b), toInt(c.a));
static int toInt(float val)
{
return (int)Math.Round(Mathf.Clamp(val * 255f, 0f, 255f));
}
}
public static implicit operator UniversalColor(Hex h)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
return new UniversalColor(h.DarkenBasedOnAlpha(h.Red), h.DarkenBasedOnAlpha(h.Green), h.DarkenBasedOnAlpha(h.Blue));
}
public static implicit operator Hex(UniversalColor c)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return new Hex(c.Red, c.Green, c.Blue);
}
}
public Logger log;
public Tag[] Tags;
public int WriteToFile = 30;
public List<string> toWrite = new List<string>();
public string logfilepath = null;
public static Dictionary<Level, Level> Translate_Level_To_Plog_Level = new Dictionary<Level, Level>
{
{
Level.Off,
(Level)0
},
{
Level.Debug,
(Level)100
},
{
Level.Info,
(Level)200
},
{
Level.Fine,
(Level)250
},
{
Level.Warning,
(Level)300
},
{
Level.Error,
(Level)400
},
{
Level.Exception,
(Level)500
},
{
Level.Extreme,
(Level)500
},
{
Level.CommandLine,
(Level)600
},
{
Level.Config,
(Level)700
}
};
public static Dictionary<Level, LogLevel> Translate_Level_To_Bep_Level = new Dictionary<Level, LogLevel>
{
{
Level.Off,
(LogLevel)0
},
{
Level.Debug,
(LogLevel)32
},
{
Level.Info,
(LogLevel)16
},
{
Level.Fine,
(LogLevel)16
},
{
Level.Warning,
(LogLevel)4
},
{
Level.Error,
(LogLevel)2
},
{
Level.Exception,
(LogLevel)2
},
{
Level.Extreme,
(LogLevel)1
},
{
Level.CommandLine,
(LogLevel)16
},
{
Level.Config,
(LogLevel)16
}
};
public Logger(Logger Log, Tag[] tags, int WriteToFile = 30, string logfilepath = null)
{
Load(Log, tags, WriteToFile, logfilepath);
}
public Logger(string name, Tag[] Tags, int WriteToFile = 30)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
Load(new Logger(name), Tags, WriteToFile);
}
public Logger(string name, int WriteToFile = 30)
: this(name, null, WriteToFile)
{
}
protected void Load(Logger Log, Tag[] tags, int WriteToFile = 30, string logfilepath = null)
{
log = Log;
Info("Logger created...");
Tags = tags;
Info("Tags set...", null, IST: false, Tags);
this.WriteToFile = WriteToFile;
this.logfilepath = logfilepath ?? Path.Combine(Path.GetDirectoryName(Plugin.Instance.Location), "logs", $"Log {DateTime.Now:MM-dd-yyyy hh-mm-ss tt}.txt");
}
public void Flush()
{
string directoryName = Path.GetDirectoryName(logfilepath);
if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
if (logfilepath == null)
{
logfilepath = Path.Combine(directoryName, $"Log {DateTime.Now:MM-dd-yyyy hh-mm-ss tt}.txt");
}
File.AppendAllLines(logfilepath, toWrite);
toWrite.Clear();
}
public void Record(Level level, string msg, string StackTrace = null, bool IncludeStackTrace = true, Tag[] extraTags = null)
{
if (IncludeStackTrace)
{
StackTrace = StackTrace + "\nOuter:\n" + StackTraceUtility.ExtractStackTrace();
}
Tag[] array = Tags ?? Array.Empty<Tag>();
if (extraTags != null)
{
CollectionExtensions.AddRangeToArray<Tag>(array, extraTags);
}
BasicRecord(msg, level, array, StackTrace);
}
public void Off(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Off, "<color=#A9A9A9>" + message + "</color>", context, IST, eT);
}
public void Debug(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Debug, "<color=#BBB>" + message + "</color>", context, IST, eT);
}
public void Info(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Info, "<size=20>[i]</size> <color=#EEF>" + message + "</color>", context, IST, eT);
}
public void Fine(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Fine, "<size=20>[i]</size> <color=#EEF>" + message + "</color>", context, IST, eT);
}
public void Warning(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Warning, "<color=#F00><size=24>[!]</color> " + message, context, IST, eT);
}
public void Error(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Error, "<color=#F00><size=24>[!!!]</color> " + message, context, IST, eT);
}
public void Exception(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Exception, message, context, IST, eT);
}
public void Exception(Exception exception, string message = null, Tag[] eT = null)
{
string msg = message ?? $"{exception}";
string stackTrace = ((message == null) ? "" : $"{exception}");
Record(Level.Exception, msg, stackTrace, IncludeStackTrace: true, eT);
}
public void CommandLine(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.CommandLine, message, context, IST, eT);
}
public void Config(string message, string context = null, bool IST = false, Tag[] eT = null)
{
Record(Level.Config, message, context, IST, eT);
}
public void BasicRecord(string message, Level level, IEnumerable<Tag> eT = null, string stackTrace = null, object context = null)
{
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
string text = string.Format("[{0}] {1}| [{2:MM/dd/yyyy hh:mm:ss tt}] | [{3}]: {4}{5}", log.Tag.Name, (eT != null) ? (string.Join(' ', eT.Select((Tag tag) => "[" + tag.Name + "]")) + " ") : string.Empty, DateTime.Now, level, Regex.Replace(message, "<.*?>", string.Empty), (stackTrace != null) ? (" stackTrace: " + stackTrace) : string.Empty);
toWrite.Add(text);
if (toWrite.Count >= WriteToFile)
{
Flush();
}
Plugin.BepLog.Log((LogLevel)(Translate_Level_To_Bep_Level[level] | 8), (object)text);
log.Record(message, Translate_Level_To_Plog_Level[level], eT, stackTrace, context);
}
public void Extreme(Exception exception, string message)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
Extra("<size=20><color=#f00>[<size=16>" + message + "</size>]</color></size>", (exception ?? new ArgumentNullException("exception")).ToString(), Level.Extreme, (Tag[])(object)new Tag[1]
{
new Tag("EXTREME")
});
}
public void Extra(string message, string extra, Level level = Level.Info, Tag[] eT = null)
{
Record(level, message, extra, IncludeStackTrace: true, eT);
}
public void Skin(string start, string OVERRIDE_LOG = null, Level level = Level.Info, params Action[] Segments)
{
string say = OVERRIDE_LOG ?? "[0]: Completed Segment [1]";
int num = 0;
foreach (Action action in Segments)
{
num++;
Record(level, Say(say, start, num.ToString()));
action();
}
}
public string Say(string say, params string[] phrases)
{
if (!say.Contains('[') || !say.Contains(']'))
{
Error("While Running SSNC.Logger.Say(string say, params string[] phrases), it failed due to no '[', or no ']' chars in string say...\nsay: " + say + "\nphrases:\n" + string.Join(" |-|-| ", phrases));
return say;
}
StringBuilder stringBuilder = new StringBuilder();
string[] array = say.Split('[', ']');
int num = 0;
string[] array2 = array;
foreach (string text in array2)
{
num++;
stringBuilder.Append((num == 1) ? text : ((!int.TryParse(text, out var result)) ? phrases[0] : ((result > 0) ? phrases[result] : phrases[0])));
if (num == 2)
{
num = 0;
}
}
return stringBuilder.ToString();
}
public string GetNameOfMethod(Type type, string Method, Stylizer? Style = null)
{
return GetNameOfMethod(type.GetMethod(Method, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), Style);
}
public string GetNameOfMethod(MethodBase method, Stylizer? Style = null)
{
if (method == null)
{
Exception(new ArgumentNullException("method"), "ARGUMENTNULLEXCEPTION WHILE TRYING TO GETNAMEOFMETHOD");
return "ARGUMENTNULLEXCEPTION WHILE TRYING TO GETNAMEOFMETHOD (stack trace: " + StackTraceUtility.ExtractStackTrace() + " )";
}
Stylizer style = Style.GetValueOrDefault();
Type type = method?.DeclaringType ?? typeof(Logger);
string text = string.Join<string>(", ", from param in method.GetParameters()
select $"{param.ParameterType?.Namespace ?? string.Empty}</color>.<color=#FFF>{style.GetColorOfType(param.ParameterType)}{((param.ParameterType.Name.IndexOf('`') != -1) ? param.ParameterType.Name.Substring(0, param.ParameterType.Name.IndexOf('`')) : param.ParameterType.Name)}</color>{parameterHasArguments(param)} <color=#{style.Parameter}>{param.Name}</color>");
return string.Format("<color=#0FC><color=#FFF>{0}</color>.<color=#{1}>{2}</color>.<color=#{3}>{4}</color><color=#FFF>({5});</color></color>", (type?.Namespace ?? "namespace").Replace(".", "</color>.<color=#FFF>"), style.Class, type?.Name ?? "class", style.Method, method?.Name ?? "method", text);
string parameterHasArguments(ParameterInfo param)
{
return (param.ParameterType.GetGenericArguments().Length == 0) ? string.Empty : ("<" + string.Join(", ", from argument in param.ParameterType.GetGenericArguments()
select $"{argument?.Namespace ?? string.Empty}</color>.<color=#FFF>{style.GetColorOfType(argument)}{((argument.Name.IndexOf('`') != -1) ? argument.Name.Substring(0, argument.Name.IndexOf('`')) : argument.Name)}</color> <color=#{style.Parameter}>{argument.Name}</color>") + ">");
}
}
}
[BepInPlugin("Bryan_-000-.SSNC", "SSNC", "1.0.0")]
public class PluginLoader : BaseUnityPlugin
{
private void Awake()
{
SceneManager.sceneLoaded += delegate
{
if ((Object)(object)Plugin.Instance == (Object)null)
{
Tools.Make<Plugin>("SSNC", (Transform)null).Location = ((BaseUnityPlugin)this).Info.Location;
Plugin.BepLog = ((BaseUnityPlugin)this).Logger;
Plugin.UseDiff = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "UseDiff", true, "If true, uses regular SSNC UI. If false, does an older version of SSNC'S UI that may be buggier.").Value;
}
};
}
}
public class Plugin : MonoBehaviour
{
public static Logger Log;
public static ManualLogSource BepLog;
public static ManualLogSource UnityLog;
public static Plugin Instance;
public static bool UseDiff;
public string Location;
private bool DoneShit;
private void Awake()
{
Object.DontDestroyOnLoad((Object)(object)(Instance = this));
}
private void Start()
{
Log = new Logger("SSNC");
SceneManager.sceneLoaded += delegate
{
if (SceneHelper.CurrentScene == "Main Menu")
{
DoShit();
}
};
}
private void OnApplicationQuit()
{
Log.Flush();
}
private void DoShit()
{
if (DoneShit)
{
return;
}
UIbuilder.Load();
foreach (KeyValuePair<string, string> item in UI.supportedSlot)
{
string path = Path.Combine(GameProgressSaver.BaseSavePath, item.Value, "SlotName.txt");
if (!File.Exists(path))
{
Tools.Generate_Name_File(path, item.Key);
}
}
Log.Info("Loading UI");
UI.Load();
SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
Log.Info($"Load UI after loading into scene {((Scene)(ref scene)).name} | {mode}");
UI.Load();
};
DoneShit = true;
}
}
public static class Tools
{
public static Dictionary<string, Sprite> CacheLoadedSprite = new Dictionary<string, Sprite>();
public static Dictionary<Type, Object[]> Cache = new Dictionary<Type, Object[]>();
public static bool Generate_Name_File(string path, string slotname)
{
if (File.Exists(path))
{
return true;
}
string directoryName = Path.GetDirectoryName(path);
if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
File.AppendAllLines(path, new <>z__ReadOnlySingleElementList<string>(slotname));
if (File.Exists(path))
{
Plugin.Log.Info("Successfully generated new Save Slot Name File");
return true;
}
Plugin.Log.Error("Failed to generate new Save Slot Name File");
return false;
}
public static void Change_Slot_Name(string[] newname, string slot, string Path = null)
{
Plugin.Log.Info("Changing Save Slot(" + slot + ") Name: " + string.Join(" | ", newname));
if (Path == null)
{
Path = System.IO.Path.Combine(GameProgressSaver.BaseSavePath, slot, "SlotName.txt");
}
if (!File.Exists(Path) && !Generate_Name_File(Path, newname[0]))
{
Plugin.Log.Error("tried to change the name of a slot that doesnt have a name file..");
Plugin.Log.Error("attempted to generate a new name file and failed");
}
else
{
File.WriteAllLines(Path, newname);
}
}
public static int Get_Save_Slot_UI_Index(GameObject row)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
int num = 0;
foreach (Transform item in row.transform.parent)
{
Transform val = item;
num++;
if ((Object)(object)((Component)val).gameObject == (Object)(object)row)
{
return num;
}
}
return -1;
}
public static Sprite LoadSpriteFromDisk(string filePath)
{
//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_012e: Expected O, but got Unknown
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
if (CacheLoadedSprite.ContainsKey(filePath))
{
Plugin.Log.Fine(Plugin.Log.GetNameOfMethod(typeof(Tools), "LoadSpriteFromDisk") + " Sprite was cached, loading it from there...");
return CacheLoadedSprite[filePath];
}
if (!filePath.EndsWith(".png"))
{
Plugin.Log.Error(Plugin.Log.GetNameOfMethod(typeof(Tools), "LoadSpriteFromDisk") + " File isn't even a PNG. (filePath: " + filePath + ")");
return null;
}
if (!File.Exists(filePath))
{
Plugin.Log.Error(Plugin.Log.GetNameOfMethod(typeof(Tools), "LoadSpriteFromDisk") + " File Path doesnt exist. (filePath: " + filePath + ")");
return null;
}
byte[] array = File.ReadAllBytes(filePath);
Texture2D val = new Texture2D(1, 1, (TextureFormat)5, true)
{
filterMode = (FilterMode)0
};
if (!ImageConversion.LoadImage(val, array))
{
Plugin.Log.Error(Plugin.Log.GetNameOfMethod(typeof(Tools), "LoadSpriteFromDisk") + " Couldn't could bytes from " + filePath + " as a Texture2D.");
return null;
}
Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
CacheLoadedSprite.Add(filePath, val2);
return val2;
}
public static type SearchForA<type>(string with_the_name) where type : Object
{
Type typeFromHandle = typeof(type);
if (!Cache.TryGetValue(typeFromHandle, out var value))
{
Object[] array = (Object[])(object)Resources.FindObjectsOfTypeAll<type>();
value = array;
Cache.Add(typeFromHandle, value);
}
return (type)(object)Array.Find(value, (Object s) => s.name == with_the_name);
}
public static component Make<component>(string name, Transform parent = null) where component : Component
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
GameObject val = new GameObject(name);
Transform transform = val.transform;
object obj = parent;
if (obj == null)
{
Plugin instance = Plugin.Instance;
obj = ((instance != null) ? ((Component)instance).transform : null);
}
transform.SetParent((Transform)obj, false);
return val.AddComponent<component>();
}
public static GameObject Make(string name, Transform parent = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
GameObject val = new GameObject(name);
Transform transform = val.transform;
object obj = parent;
if (obj == null)
{
Plugin instance = Plugin.Instance;
obj = ((instance != null) ? ((Component)instance).transform : null);
}
transform.SetParent((Transform)obj, false);
return val;
}
public static GameObject ObjFindIncludeInactive(string Path, Scene? scene = null)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
Scene value = scene.GetValueOrDefault();
if (!scene.HasValue)
{
value = SceneManager.GetSceneAt(0);
scene = value;
}
string rootSearchObj = Path;
int num = Path.IndexOf('/');
if (num != -1)
{
rootSearchObj = Path.Substring(0, num);
string text = Path;
int num2 = num + 1;
Path = text.Substring(num2, text.Length - num2);
}
value = scene.Value;
GameObject val = (from gameObject in ((Scene)(ref value)).GetRootGameObjects()
where ((Object)gameObject).name == rootSearchObj
select gameObject).FirstOrDefault();
object obj2;
if (num != -1)
{
Transform obj = val.transform.Find(Path);
obj2 = ((obj != null) ? ((Component)obj).gameObject : null);
}
else
{
obj2 = val;
}
val = (GameObject)obj2;
if ((Object)(object)val != (Object)null)
{
Plugin.Log.Info("Found " + ((Object)val).name);
}
else
{
Plugin.Log.Error("Couldn't find " + rootSearchObj + " / " + Path);
}
return val;
}
public static T ObjFindIncludeInactive<T>(string Path, Scene? scene = null) where T : Component
{
GameObject val = ObjFindIncludeInactive(Path, scene);
return ((Object)(object)val == (Object)null) ? default(T) : (val.GetComponent<T>() ?? val.AddComponent<T>());
}
public static GameObject SetCompletelyActive(GameObject gameObject, bool active)
{
return ((Component)SetCompletelyActive(gameObject.transform, active)).gameObject;
}
public static Transform SetCompletelyActive(Transform transform, bool active)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
((Component)transform).gameObject.SetActive(active);
foreach (Transform item in transform)
{
Transform val = item;
((Component)val).gameObject.SetActive(active);
}
return transform;
}
public static GameObject[] GetChildren(GameObject parent)
{
GameObject[] array = (GameObject[])(GetChildren(parent.transform) ?? Array.Empty<Transform>()).Select((Transform child) => ((Component)child).gameObject);
return (array == Enumerable.Empty<GameObject>() || array == null) ? null : array;
}
public static Transform[] GetChildren(Transform parent)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
Transform[] array = null;
foreach (Transform item in parent)
{
Transform val = item;
CollectionExtensions.AddToArray<Transform>(array, val);
}
return array;
}
}
public class UI
{
public static Dictionary<string, string> supportedSlot = new Dictionary<string, string>
{
{ "Slot 1", "Slot1" },
{ "Slot 2", "Slot2" },
{ "Slot 3", "Slot3" },
{ "Slot 4", "Slot4" },
{ "Slot 5", "Slot5" },
{ "Slot M", "Slot11" }
};
public static void Load()
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_04da: Unknown result type (might be due to invalid IL or missing references)
//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_051c: Unknown result type (might be due to invalid IL or missing references)
//IL_0564: Unknown result type (might be due to invalid IL or missing references)
//IL_0569: Unknown result type (might be due to invalid IL or missing references)
//IL_056b: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_0579: Unknown result type (might be due to invalid IL or missing references)
//IL_0580: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Unknown result type (might be due to invalid IL or missing references)
//IL_059e: Unknown result type (might be due to invalid IL or missing references)
//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Tools.ObjFindIncludeInactive("Canvas/OptionsMenu");
GameObject val2 = Tools.ObjFindIncludeInactive("Canvas/OptionsMenu/Save Slots");
GameObject val3 = Tools.ObjFindIncludeInactive("Canvas/OptionsMenu/Save Slots/Grid");
val.SetActive(true);
val2.SetActive(true);
val.SetActive(false);
val2.SetActive(false);
int num = 0;
foreach (Transform item in val3.transform)
{
Transform val4 = item;
num++;
if (((Object)val4).name == "Slot Row")
{
continue;
}
Transform val5 = val4.Find("Slot Text");
bool enableWordWrapping;
if (!Plugin.UseDiff)
{
string key2 = ((TMP_Text)((Component)val5).GetComponent<TextMeshProUGUI>()).text;
string text3 = (supportedSlot.ContainsKey(key2) ? File.ReadAllText(Path.Combine(GameProgressSaver.BaseSavePath, supportedSlot[key2], "SlotName.txt")) : "ERROR");
Object.Destroy((Object)(object)((Component)val5).GetComponent<TextMeshProUGUI>());
((Component)val5).GetComponent<RectTransform>().anchoredPosition = new Vector2(120f, 0f);
TMP_InputField val6 = ((Component)val5).gameObject.AddComponent<TMP_InputField>();
Image val7 = UIbuilder.Image("Graphic", val5, new Pos(0f, 0f, 225f, 47.5f), UIbuilder.Small_Fill, (Color?)new Color(0f, 0f, 0f), fillCenter: true);
UIbuilder.Image("Graphic bg", ((Component)val7).transform, new Pos(0f, 0f, 225f, 47.5f), UIbuilder.Small_Border);
TextMeshProUGUI text2 = UIbuilder.Text("Text", "", val5, new Pos(0f, 0f, 200f, 47.5f), 27, null, (TextAlignmentOptions)514);
TextMeshProUGUI val8 = UIbuilder.Text("Placeholder", text3, val5, new Pos(0f, 0f, 200f, 47.5f), 27, null, (TextAlignmentOptions)514);
TextMeshProUGUI obj = text2;
enableWordWrapping = (((TMP_Text)val8).enableWordWrapping = true);
((TMP_Text)obj).enableWordWrapping = enableWordWrapping;
val6.textComponent = (TMP_Text)(object)text2;
val6.placeholder = (Graphic)(object)val8;
((Selectable)val6).targetGraphic = (Graphic)(object)val7;
((UnityEvent<string>)(object)val6.onSelect).AddListener((UnityAction<string>)delegate
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
((Graphic)text2).color = new Color(0.55f, 0.55f, 0.55f);
});
((UnityEvent<string>)(object)val6.onDeselect).AddListener((UnityAction<string>)delegate
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
((Graphic)text2).color = new Color(1f, 1f, 1f);
});
((UnityEvent<string>)(object)val6.onEndEdit).AddListener((UnityAction<string>)delegate(string typed)
{
if (supportedSlot.ContainsKey(key2))
{
Plugin.Log.Debug("is supported slot, " + typed);
string[] separator2 = new string[4] { "\\n", "\\r", "[n]", "[N]" };
Tools.Change_Slot_Name(((typed.Length > 60) ? typed.Substring(0, 60) : typed).Split(separator2, StringSplitOptions.None), supportedSlot[key2]);
}
else
{
Plugin.Log.Error("TRIED TO SAVE TO AN UNSUPPORTED SAVE SLOT.");
HudMessageReceiver instance2 = MonoSingleton<HudMessageReceiver>.Instance;
if (instance2 != null)
{
instance2.SendHudMessage("ERROR: THIS SAVE SLOT IS UNSUPPORTED BY SSNC, PERHAPS IT IS MODDED.\nDUE TO THIS ERROR THE NAME INPUTED WAS <color=#f00><b>NOT</b></color> SAVED.", "", "", 0, false, false, true);
}
}
});
continue;
}
TextMeshProUGUI placeholder = ((Component)val5).gameObject.GetComponent<TextMeshProUGUI>();
string key = ((TMP_Text)placeholder).text;
string text4 = (supportedSlot.ContainsKey(key) ? File.ReadAllText(Path.Combine(GameProgressSaver.BaseSavePath, supportedSlot[key], "SlotName.txt")) : "ERROR");
if (!supportedSlot.ContainsKey(key))
{
continue;
}
RectTransform val9 = Tools.Make<RectTransform>("SlotText Wrapper", val4);
TMP_InputField val10 = ((Component)val9).gameObject.AddComponent<TMP_InputField>();
TextMeshProUGUI text = UIbuilder.Text("Text", text4, (Transform)(object)val9, new Pos(0f, 0f, 200f, 47.5f), 27, null, (TextAlignmentOptions)514);
((Object)((Component)placeholder).gameObject).name = "Placeholder";
Color OGcol = ((Graphic)placeholder).color;
val5.parent = (Transform)(object)val9;
((TMP_Text)placeholder).text = text4;
TextMeshProUGUI obj2 = text;
enableWordWrapping = (((TMP_Text)placeholder).enableWordWrapping = true);
((TMP_Text)obj2).enableWordWrapping = enableWordWrapping;
TextMeshProUGUI obj3 = text;
enableWordWrapping = (((TMP_Text)placeholder).enableAutoSizing = true);
((TMP_Text)obj3).enableAutoSizing = enableWordWrapping;
TextMeshProUGUI obj4 = text;
float fontSizeMax = (((TMP_Text)placeholder).fontSizeMax = 27f);
((TMP_Text)obj4).fontSizeMax = fontSizeMax;
RectTransform component = ((Component)val5).gameObject.GetComponent<RectTransform>();
val9.anchoredPosition = new Vector2(120f, 0f);
Vector2 anchorMin = (val9.anchorMax = new Vector2(0f, 0.5f));
val9.anchorMin = anchorMin;
anchorMin = (component.anchorMax = new Vector2(0.5f, 0.5f));
component.anchorMin = anchorMin;
component.pivot = new Vector2(0.5f, 0.5f);
component.anchoredPosition = new Vector2(0f, 0f);
component.sizeDelta = new Vector2(200f, 47.5f);
val10.onFocusSelectAll = false;
val10.textComponent = (TMP_Text)(object)text;
val10.placeholder = (Graphic)(object)placeholder;
((Selectable)val10).targetGraphic = (Graphic)(object)text;
Color color = ((Graphic)placeholder).color;
Vector3 val13 = Vector3.Lerp(new Vector3(color.r, color.g, color.b), new Vector3(0.5f, 0.5f, 0.5f), 0.5f);
Color darkened = new Color(val13.x, val13.y, val13.z);
((UnityEvent<string>)(object)val10.onSelect).AddListener((UnityAction<string>)delegate
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((Graphic)placeholder).color = darkened;
((Graphic)text).color = OGcol;
});
((UnityEvent<string>)(object)val10.onDeselect).AddListener((UnityAction<string>)delegate
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
TextMeshProUGUI obj5 = placeholder;
Color color2 = (((Graphic)text).color = OGcol);
((Graphic)obj5).color = color2;
});
((UnityEvent<string>)(object)val10.onEndEdit).AddListener((UnityAction<string>)delegate(string typed)
{
if (!string.IsNullOrEmpty(typed) || typed.Length != 0 || typed != "")
{
if (supportedSlot.ContainsKey(key))
{
Plugin.Log.Debug("is supported slot,\n" + typed);
string[] separator = new string[2] { "\\n", "\\r" };
Tools.Change_Slot_Name(typed.Split(separator, StringSplitOptions.None), supportedSlot[key]);
}
else
{
Plugin.Log.Error("TRIED TO SAVE TO AN UNSUPPORTED SAVE SLOT.");
HudMessageReceiver instance = MonoSingleton<HudMessageReceiver>.Instance;
if (instance != null)
{
instance.SendHudMessage("ERROR: THIS SAVE SLOT IS UNSUPPORTED BY SSNC, PERHAPS IT IS MODDED.\nDUE TO THIS ERROR THE NAME INPUTED WAS <color=#f00><b>NOT</b></color> SAVED.", "", "", 0, false, false, true);
}
}
}
});
}
}
}
public class UIbuilder
{
public static Sprite Large_Fill;
public static Sprite Small_Fill;
public static Sprite Large_Border;
public static Sprite Small_Border;
public static Sprite Large_Border_Black;
private static ColorBlock Fill;
private static ColorBlock Border;
public static Dictionary<Sprite, (ColorBlock, float)> spriteValues = new Dictionary<Sprite, (ColorBlock, float)>();
public static TMP_FontAsset Font;
public static void Add(ColorBlock color, float PPU, params Sprite[] sprites)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
foreach (Sprite val in sprites)
{
if ((Object)(object)val == (Object)null)
{
Plugin.Log.Error("Failed to add Sprite to spriteColors, Sprite doesnt exist. (SPRITE NAME: " + ((Object)val).name + ")");
}
else
{
spriteValues.Add(val, (color, PPU));
}
}
}
public static void Load()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_00fe: 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)
Fill = (Border = ColorBlock.defaultColorBlock);
Color val = default(Color);
((Color)(ref val))..ctor(0.5f, 0.5f, 0.5f, 1f);
((ColorBlock)(ref Border)).selectedColor = val;
((ColorBlock)(ref Border)).highlightedColor = val;
((Color)(ref val))..ctor(1f, 0f, 0f, 1f);
((ColorBlock)(ref Border)).pressedColor = val;
((ColorBlock)(ref Fill)).pressedColor = val;
Large_Fill = Tools.SearchForA<Sprite>("Round_FillLarge");
Small_Fill = Tools.SearchForA<Sprite>("Round_FillSmall");
Add(Fill, 4.05f, Large_Fill);
Add(Fill, 5.4f, Small_Fill);
Large_Border = Tools.SearchForA<Sprite>("Round_BorderLarge");
Small_Border = Tools.SearchForA<Sprite>("Round_BorderSmall");
Large_Border_Black = Tools.SearchForA<Sprite>("Round_BorderLargeBlack");
Add(Border, 4.05f, Large_Border, Large_Border_Black);
Add(Border, 5.4f, Small_Border);
Font = Tools.SearchForA<TMP_FontAsset>("VCR_OSD_MONO_1");
}
public static T Create<T>(string name, Transform parent, Pos pos, Action<T> act) where T : Component
{
//IL_000b: 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_0025: 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)
RectTransform val = Tools.Make<RectTransform>(name, parent);
val.anchorMin = pos.Min;
val.anchorMax = pos.Max;
val.anchoredPosition = pos.Position;
val.sizeDelta = pos.Scale;
T val2 = ((Component)val).gameObject.AddComponent<T>();
act(val2);
return val2;
}
public static Image Image(string name, Transform parent, Pos pos, Sprite sprite = null, Color? color = null, bool fillCenter = true)
{
return UIbuilder.Create<Image>(name, parent, pos, (Action<Image>)delegate(Image image)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
image.sprite = sprite ?? Large_Fill;
image.fillCenter = fillCenter;
float item = spriteValues[sprite ?? Large_Fill].Item2;
image.pixelsPerUnitMultiplier = item;
((Graphic)image).color = (Color)(((??)color) ?? Color.white);
image.type = (Type)1;
});
}
public static Button Button(string name, Transform parent, Pos pos, Sprite sprite = null, Color? color = null, Action OnClick = null)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_005d: 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_006b: Unknown result type (might be due to invalid IL or missing references)
Image val = Image(name, parent, pos, sprite, color);
Button val2 = ((Component)val).gameObject.AddComponent<Button>();
((UnityEvent)val2.onClick).AddListener((UnityAction)delegate
{
OnClick();
});
((Selectable)val2).targetGraphic = (Graphic)(object)val;
var (colors, num) = spriteValues[sprite ?? Large_Fill];
((Selectable)val2).colors = colors;
return val2;
}
public static TextMeshProUGUI Text(string name, string Text, Transform parent, Pos pos, int size = 16, Color? color = null, TextAlignmentOptions align = 513)
{
//IL_001e: 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)
return UIbuilder.Create<TextMeshProUGUI>(name, parent, pos, (Action<TextMeshProUGUI>)delegate(TextMeshProUGUI text)
{
//IL_0042: 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_004f: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)text).text = Text;
((TMP_Text)text).font = Font;
((TMP_Text)text).fontSize = size;
((Graphic)text).color = (Color)(((??)color) ?? Color.black);
((TMP_Text)text).alignment = align;
});
}
}
public struct Pos
{
public Vector2 Position;
public Vector2 Scale;
public Vector2 Min;
public Vector2 Max;
public Pos(Vector2 Pos, Vector2 _Scale, Vector2 Minium, Vector2 Maxium)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//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_0016: 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)
Position = Pos;
Scale = _Scale;
Min = Minium;
Max = Maxium;
}
public Pos(Vector2 Pos, Vector2 Scale, Vector2 Anchor)
: this(Pos, Scale, Anchor, Anchor)
{
}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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)
public Pos(Vector2 Pos, Vector2 Scale)
: this(Pos, Scale, new Vector2(0.5f, 0.5f))
{
}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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)
public Pos(float X, float Y, float Width, float Height, Vector2 Minium, Vector2 Maxium)
: this(new Vector2(X, Y), new Vector2(Width, Height), Minium, Maxium)
{
}//IL_0003: 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_0010: 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)
public Pos(float X, float Y, float Width, float Height, Vector2 Anchor)
: this(X, Y, Width, Height, Anchor, Anchor)
{
}//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
public Pos(float X, float Y, float Width, float Height, float MinX, float MinY, float MaxX, float MaxY)
: this(new Vector2(X, Y), new Vector2(Width, Height), new Vector2(MinX, MinY), new Vector2(MaxX, MaxY))
{
}//IL_0003: 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_0014: 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)
public Pos(float X, float Y, float Width, float Height, float AnchorX, float AnchorY)
: this(X, Y, Width, Height, new Vector2(AnchorX, AnchorY))
{
}//IL_000a: Unknown result type (might be due to invalid IL or missing references)
public Pos(float X, float Y, float Width, float Height)
: this(X, Y, Width, Height, new Vector2(0.5f, 0.5f))
{
}//IL_0010: Unknown result type (might be due to invalid IL or missing references)
public static Pos operator +(Pos a, Pos b)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0018: 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)
return new Pos(a.Position + b.Position, a.Scale + b.Scale);
}
public static Pos operator -(Pos a, Pos b)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0018: 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)
return new Pos(a.Position - b.Position, a.Scale - b.Scale);
}
public static Pos operator *(Pos a, Pos b)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0018: 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)
return new Pos(a.Position * b.Position, a.Scale * b.Scale);
}
public static Pos operator /(Pos a, Pos b)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0018: 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)
return new Pos(a.Position / b.Position, a.Scale / b.Scale);
}
public static bool operator >(Pos a, Pos b)
{
return Compare(a, b);
}
public static bool operator <(Pos a, Pos b)
{
return Compare(b, a);
}
private static bool Compare(Pos a, Pos b)
{
int num = Comparison(a, b);
return num == 1 || num == 2;
}
private static int Comparison(Pos a, Pos b)
{
//IL_0004: 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_0024: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0086: 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_00a8: 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_00ca: 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_00ec: 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)
int num = 0;
if (a.Position.x > b.Position.x)
{
num++;
}
if (a.Position.y > b.Position.y)
{
num++;
}
if (a.Scale.x > b.Scale.x)
{
num++;
}
if (a.Scale.y > b.Scale.y)
{
num++;
}
if (a.Min.x > b.Min.x)
{
num++;
}
if (a.Min.y > b.Min.y)
{
num++;
}
if (a.Max.x > b.Max.x)
{
num++;
}
if (a.Max.y > b.Max.y)
{
num++;
}
return (num > 3) ? ((num < 6) ? 1 : 2) : 0;
}
public static bool operator ==(Pos a, Pos b)
{
//IL_0004: 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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
if (a.Position == b.Position)
{
num++;
}
if (a.Scale == b.Scale)
{
num++;
}
if (a.Min == b.Min)
{
num++;
}
if (a.Max == b.Max)
{
num++;
}
return num == 4;
}
public static bool operator !=(Pos a, Pos b)
{
return !(a == b);
}
public new static bool Equals(object objthis, object other)
{
if (!(objthis is Pos pos) || !(other is Pos pos2))
{
return false;
}
return pos2 == pos;
}
public override bool Equals(object other)
{
if (!(other is Pos pos) || 1 == 0)
{
return false;
}
return pos == this;
}
public static int GetHashCode(Pos p)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references)
return HashCode.Combine<Vector2, Vector2, Vector2, Vector2>(p.Position, p.Scale, p.Min, p.Max);
}
public override int GetHashCode()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references)
return HashCode.Combine<Vector2, Vector2, Vector2, Vector2>(Position, Scale, Min, Max);
}
public Pos Change(Vector2? position = null, Vector2? scale = null, Vector2? min = null, Vector2? max = null)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_006f: 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)
Position = (Vector2)(((??)position) ?? Position);
Scale = (Vector2)(((??)scale) ?? Scale);
Min = (Vector2)(((??)min) ?? Min);
Max = (Vector2)(((??)max) ?? Max);
return this;
}
public static Pos Default()
{
return new Pos(0f, 0f, 100f, 100f);
}
public static Pos LD(Vector2 pos)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return new Pos(pos.x, pos.y, 100f, 100f);
}
public static Pos LD(float x, float y)
{
return new Pos(x, y, 100f, 100f);
}
public static Pos Zero()
{
return new Pos(0f, 0f, 0f, 0f);
}
public static Pos RectTransform(RectTransform rectTransform, Vector2? OVERRIDE_ANCHOREDPOSITION = null, Vector2? OVERRIDE_SIZEDELTA = null, Vector2? OVERRIDE_ANCHORMIN = null, Vector2? OVERRIDE_ANCHORMAX = null)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
return new Pos((Vector2)(((??)OVERRIDE_ANCHOREDPOSITION) ?? rectTransform.anchoredPosition), (Vector2)(((??)OVERRIDE_SIZEDELTA) ?? rectTransform.sizeDelta), (Vector2)(((??)OVERRIDE_ANCHORMIN) ?? rectTransform.anchorMin), (Vector2)(((??)OVERRIDE_ANCHORMAX) ?? rectTransform.anchorMax));
}
public static Pos Rect(Rect rect, Vector2? OVERRIDE_POSITION = null, Vector2? OVERRIDE_SIZE = null, Vector2? OVERRIDE_MIN = null, Vector2? OVERRIDE_MAX = null)
{
//IL_0016: 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_0031: 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_004c: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
return new Pos((Vector2)(((??)OVERRIDE_POSITION) ?? ((Rect)(ref rect)).position), (Vector2)(((??)OVERRIDE_SIZE) ?? ((Rect)(ref rect)).size), (Vector2)(((??)OVERRIDE_MIN) ?? ((Rect)(ref rect)).min), (Vector2)(((??)OVERRIDE_MAX) ?? ((Rect)(ref rect)).max));
}
}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
{
object IEnumerator.Current => _item;
T IEnumerator<T>.Current => _item;
public Enumerator(T item)
{
_item = item;
}
bool IEnumerator.MoveNext()
{
return !_moveNextCalled && (_moveNextCalled = true);
}
void IEnumerator.Reset()
{
_moveNextCalled = false;
}
void IDisposable.Dispose()
{
}
}
int ICollection.Count => 1;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => 1;
T IReadOnlyList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
}
int ICollection<T>.Count => 1;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlySingleElementList(T item)
{
_item = item;
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection.CopyTo(Array array, int index)
{
array.SetValue(_item, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return EqualityComparer<T>.Default.Equals(_item, (T)value);
}
int IList.IndexOf(object value)
{
return (!EqualityComparer<T>.Default.Equals(_item, (T)value)) ? (-1) : 0;
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return EqualityComparer<T>.Default.Equals(_item, item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
array[arrayIndex] = _item;
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0;
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}