Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EyesColorCustom v4.0.1
EyesColorCustom.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; 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 HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("REPOJP")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("zabuMod")] [assembly: AssemblyTitle("zabuMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOJP.EyesColorCustom { [BepInPlugin("REPOJP.EyesColorCustom", "EyesColorCustom", "1.3.0")] public sealed class EyesColorCustomPlugin : BaseUnityPlugin { private enum EyeColorPreset { Random, Off, Red, Green, Love, CeilingEye, Inverted } private enum HudAnimState { Hidden, In, Hold, Out } [HarmonyPatch] private static class ExpressionInputSuppressPatches { [HarmonyPrefix] [HarmonyPatch(typeof(SemiFunc), "InputDown")] private static bool SemiFunc_InputDown_Prefix(InputKey key, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!IsExpressionKey(key)) { return true; } if (ShouldSuppressExpressionInputs()) { __result = false; return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(SemiFunc), "InputHold")] private static bool SemiFunc_InputHold_Prefix(InputKey key, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!IsExpressionKey(key)) { return true; } if (ShouldSuppressExpressionInputs()) { __result = false; return false; } return true; } } [HarmonyPatch] private static class PlayerCosmeticsReapplyPatches { [CompilerGenerated] private sealed class <TargetMethods>d__0 : IEnumerable<MethodBase>, IEnumerable, IEnumerator<MethodBase>, IEnumerator, IDisposable { private int <>1__state; private MethodBase <>2__current; private int <>l__initialThreadId; private Type <type>5__1; private string[] <methodNames>5__2; private string[] <>s__3; private int <>s__4; private string <methodName>5__5; private MethodInfo <method>5__6; MethodBase IEnumerator<MethodBase>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TargetMethods>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <type>5__1 = null; <methodNames>5__2 = null; <>s__3 = null; <methodName>5__5 = null; <method>5__6 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00db; } <>1__state = -1; <type>5__1 = AccessTools.TypeByName("PlayerCosmetics"); if (<type>5__1 == null) { return false; } <methodNames>5__2 = new string[3] { "PlayerMaterialSetup", "SetupColorsLogic", "SetupColorsAllLogic" }; <>s__3 = <methodNames>5__2; <>s__4 = 0; goto IL_00f8; IL_00db: <method>5__6 = null; <methodName>5__5 = null; <>s__4++; goto IL_00f8; IL_00f8: if (<>s__4 < <>s__3.Length) { <methodName>5__5 = <>s__3[<>s__4]; <method>5__6 = AccessTools.Method(<type>5__1, <methodName>5__5, (Type[])null, (Type[])null); if (<method>5__6 != null) { <>2__current = <method>5__6; <>1__state = 1; return true; } goto IL_00db; } <>s__3 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<MethodBase> IEnumerable<MethodBase>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <TargetMethods>d__0(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<MethodBase>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<TargetMethods>d__0))] private static IEnumerable<MethodBase> TargetMethods() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TargetMethods>d__0(-2); } private static void Postfix(object __instance) { if (!((Object)(object)Instance == (Object)null) && __instance != null && IsLocalPlayerCosmeticsInstance(__instance)) { Instance.MarkCosmeticReapply(); } } private static bool IsLocalPlayerCosmeticsInstance(object instance) { try { FieldInfo fieldInfo = AccessTools.Field(instance.GetType(), "playerAvatarVisuals"); if (fieldInfo == null) { return false; } object value = fieldInfo.GetValue(instance); if (value == null) { return false; } FieldInfo fieldInfo2 = AccessTools.Field(value.GetType(), "playerAvatar"); if (fieldInfo2 == null) { return false; } object value2 = fieldInfo2.GetValue(value); PlayerAvatar val = (PlayerAvatar)((value2 is PlayerAvatar) ? value2 : null); return (Object)(object)val != (Object)null && val.isLocal; } catch { return false; } } } [CompilerGenerated] private sealed class <ApplyLoop>d__58 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EyesColorCustomPlugin <>4__this; private float <interval>5__1; private float <blink>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyLoop>d__58(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (<>4__this._enabled.Value) { <>4__this.EnsureLocalCache(); if ((Object)(object)<>4__this._cachedAvatar != (Object)null && (Object)(object)<>4__this._cachedHealth != (Object)null) { <>4__this.ApplyEye(); <>4__this.ApplyPupil(); } } <interval>5__1 = Mathf.Clamp(<>4__this._applyIntervalSeconds.Value, 0.05f, 2f); if (<>4__this._enabled.Value && <>4__this._eyeBlinkList.Count >= 2) { <blink>5__2 = Mathf.Clamp(<>4__this._blinkIntervalSeconds.Value, 0.05f, 5f); <interval>5__1 = Mathf.Clamp(Mathf.Min(<interval>5__1, <blink>5__2 * 0.5f), 0.05f, 2f); } <>2__current = (object)new WaitForSeconds(<interval>5__1); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGuid = "REPOJP.EyesColorCustom"; public const string PluginName = "EyesColorCustom"; public const string PluginVersion = "1.3.0"; private static EyesColorCustomPlugin Instance; private ConfigEntry<bool> _enabled; private ConfigEntry<EyeColorPreset> _defaultEyeColor; private ConfigEntry<float> _defaultPupilMultiplier; private ConfigEntry<float> _applyIntervalSeconds; private ConfigEntry<float> _blinkIntervalSeconds; private ConfigEntry<float> _hudHoldSeconds; private ConfigEntry<float> _hudFadeInSeconds; private ConfigEntry<float> _hudFadeOutSeconds; private bool _eyeUseDefault = true; private EyeColorPreset _eyeSingle = EyeColorPreset.Off; private readonly List<EyeColorPreset> _eyeBlinkList = new List<EyeColorPreset>(); private EyeColorPreset _randomEyeForLevel = EyeColorPreset.Red; private bool _pupilUseDefault = true; private float _pupilMultiplier = 1f; private PlayerAvatar _cachedAvatar; private PlayerHealth _cachedHealth; private bool _lastAppliedEyeOverride; private EyeColorPreset _lastAppliedEyePreset; private bool _lastAppliedPupilOverride; private float _lastCosmeticReapplyRequestTime; private HudAnimState _hudState = HudAnimState.Hidden; private float _hudStateStartUnscaled; private float _hudX; private float _hudY; private float _hudAlpha; private Texture2D _whiteTex; private bool _guiInited; private GUIStyle _hudTitleStyle; private GUIStyle _hudTextStyle; private GUIStyle _hudSmallStyle; private GUIStyle _hudMonoStyle; private Harmony _harmony; private bool _pendingReapplyAfterScene; private readonly HashSet<int> _ctrlHeldDigitsPrev = new HashSet<int>(); private int _hiddenIndex; private float _hiddenDeadline; private bool _hiddenActive; private float _hiddenEndTime; private readonly EyeColorPreset[] _hiddenEyes = new EyeColorPreset[5] { EyeColorPreset.Red, EyeColorPreset.Green, EyeColorPreset.Love, EyeColorPreset.CeilingEye, EyeColorPreset.Inverted }; private readonly EyeColorPreset[] _randomPool = new EyeColorPreset[5] { EyeColorPreset.Red, EyeColorPreset.Green, EyeColorPreset.Love, EyeColorPreset.CeilingEye, EyeColorPreset.Inverted }; private void Awake() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown Instance = this; try { ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); BindConfig(); RollRandomEyeForLevel("awake"); ApplyConfigToRuntime(bumpHud: false); _harmony = new Harmony("REPOJP.EyesColorCustom"); _harmony.PatchAll(typeof(EyesColorCustomPlugin).Assembly); ((MonoBehaviour)this).StartCoroutine(ApplyLoop()); _defaultEyeColor.SettingChanged += delegate { ApplyConfigToRuntime(bumpHud: false); }; _defaultPupilMultiplier.SettingChanged += delegate { ApplyConfigToRuntime(bumpHud: false); }; SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.activeSceneChanged += OnActiveSceneChanged; ((BaseUnityPlugin)this).Logger.LogInfo((object)"EyesColorCustom loaded for REPO 0.4.0. Version=1.3.0"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failure: Awake\n" + ex)); } } private void OnDestroy() { try { SceneManager.sceneLoaded -= OnSceneLoaded; } catch { } try { SceneManager.activeSceneChanged -= OnActiveSceneChanged; } catch { } try { if (_harmony != null) { _harmony.UnpatchSelf(); } } catch { } if ((Object)(object)_whiteTex != (Object)null) { Object.Destroy((Object)(object)_whiteTex); _whiteTex = null; } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { RollRandomEyeForLevel("sceneLoaded:" + ((Scene)(ref scene)).name); MarkReapply(); } private void OnActiveSceneChanged(Scene from, Scene to) { RollRandomEyeForLevel("activeSceneChanged:" + ((Scene)(ref to)).name); MarkReapply(); } private void BindConfig() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown _enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("0_General", "Enabled", true, "Enable plugin. プラグイン有効化"); _defaultEyeColor = ((BaseUnityPlugin)this).Config.Bind<EyeColorPreset>("1_Defaults", "DefaultEyeColor", EyeColorPreset.Random, "Default eye color preset. Random selects Red, Green, Love, CeilingEye, or Inverted on each level change. デフォルト目色プリセット Randomはレベル変更ごとにOff以外から選択"); _defaultPupilMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("1_Defaults", "DefaultPupilMultiplier", 1f, new ConfigDescription("Default pupil size multiplier. デフォルト瞳孔倍率", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 3f), Array.Empty<object>())); _applyIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("2_Runtime", "ApplyIntervalSeconds", 0.2f, new ConfigDescription("Apply loop interval seconds. 適用ループ間隔秒数", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 2f), Array.Empty<object>())); _blinkIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("2_Runtime", "BlinkIntervalSeconds", 0.2f, new ConfigDescription("Blink interval seconds for multi-color selection. 複数色選択の点滅間隔秒数", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 5f), Array.Empty<object>())); _hudHoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("3_HUD", "HudHoldSeconds", 5f, new ConfigDescription("HUD hold seconds before fade out. フェードアウトまでのHUD保持秒数", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); _hudFadeInSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("3_HUD", "HudFadeInSeconds", 0.18f, new ConfigDescription("HUD fade in seconds. HUDフェードイン秒数", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); _hudFadeOutSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("3_HUD", "HudFadeOutSeconds", 0.22f, new ConfigDescription("HUD fade out seconds. HUDフェードアウト秒数", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); } private void ApplyConfigToRuntime(bool bumpHud) { _eyeUseDefault = true; _eyeBlinkList.Clear(); _eyeSingle = GetConfiguredDefaultEyeColor(); _pupilUseDefault = true; _pupilMultiplier = ClampPupil(_defaultPupilMultiplier.Value); MarkReapply(); if (bumpHud) { BumpHud(); } } private void RollRandomEyeForLevel(string reason) { try { int num = Random.Range(0, _randomPool.Length); if (num < 0 || num >= _randomPool.Length) { num = 0; } _randomEyeForLevel = _randomPool[num]; } catch { _randomEyeForLevel = EyeColorPreset.Red; } } private EyeColorPreset GetConfiguredDefaultEyeColor() { if (_defaultEyeColor.Value == EyeColorPreset.Random) { return _randomEyeForLevel; } return _defaultEyeColor.Value; } private void Update() { if (!_enabled.Value) { _ctrlHeldDigitsPrev.Clear(); ResetHiddenCommand(); return; } if (!SemiFunc.NoTextInputsActive()) { _ctrlHeldDigitsPrev.Clear(); ResetHiddenCommand(); return; } bool flag = IsCtrlPressed(); bool flag2 = IsShiftPressed(); UpdateHiddenCommand(flag2); if (flag && flag2) { _ctrlHeldDigitsPrev.Clear(); return; } if (flag) { HandleEyeInput(); return; } _ctrlHeldDigitsPrev.Clear(); if (flag2) { HandlePupilInput(); } } private void LateUpdate() { if (_enabled.Value && Time.unscaledTime - _lastCosmeticReapplyRequestTime < 1f) { _pendingReapplyAfterScene = true; } } private void HandleEyeInput() { HashSet<int> digitsHeldNow = GetDigitsHeldNow(); List<int> digitsDownThisFrame = GetDigitsDownThisFrame(); if (digitsDownThisFrame.Contains(0)) { SetEyeDefault(); _ctrlHeldDigitsPrev.Clear(); _ctrlHeldDigitsPrev.UnionWith(digitsHeldNow); return; } if (digitsDownThisFrame.Count > 0) { bool flag = _ctrlHeldDigitsPrev.Count > 0 && digitsDownThisFrame.Any((int d) => d != 0); if (digitsDownThisFrame.Count >= 2) { flag = true; } HashSet<int> hashSet = new HashSet<int>(); foreach (int item in _ctrlHeldDigitsPrev) { if (item != 0) { hashSet.Add(item); } } foreach (int item2 in digitsDownThisFrame) { if (item2 != 0) { hashSet.Add(item2); } } List<EyeColorPreset> list = MapEyePresetsFromDigits(hashSet.ToList()); if (list.Count > 0) { _eyeUseDefault = false; if (flag && list.Count >= 2) { _eyeBlinkList.Clear(); _eyeBlinkList.AddRange(list); _eyeSingle = EyeColorPreset.Off; SaveEyeColorToConfig(list[0]); } else { _eyeBlinkList.Clear(); _eyeSingle = list[0]; SaveEyeColorToConfig(list[0]); } MarkReapply(); BumpHud(); _ctrlHeldDigitsPrev.Clear(); _ctrlHeldDigitsPrev.UnionWith(digitsHeldNow); return; } } if (Input.GetKeyDown((KeyCode)280)) { CycleEyeColor(1); _ctrlHeldDigitsPrev.Clear(); _ctrlHeldDigitsPrev.UnionWith(digitsHeldNow); } else if (Input.GetKeyDown((KeyCode)281)) { CycleEyeColor(-1); _ctrlHeldDigitsPrev.Clear(); _ctrlHeldDigitsPrev.UnionWith(digitsHeldNow); } else if (Input.GetKeyDown((KeyCode)8)) { SetEyeDefault(); _ctrlHeldDigitsPrev.Clear(); _ctrlHeldDigitsPrev.UnionWith(digitsHeldNow); } else { _ctrlHeldDigitsPrev.Clear(); _ctrlHeldDigitsPrev.UnionWith(digitsHeldNow); } } private void HandlePupilInput() { List<int> digitsDownThisFrame = GetDigitsDownThisFrame(); if (digitsDownThisFrame.Count > 0) { if (digitsDownThisFrame.Contains(0)) { SetPupilDefault(); SavePupilToConfig(1f); return; } int num = digitsDownThisFrame.Where((int d) => d >= 4 && d <= 9).DefaultIfEmpty(-1).Max(); if (num >= 4) { SetPupilFromDigit(num); SavePupilToConfig(_pupilMultiplier); MarkReapply(); BumpHud(); return; } } if (Input.GetKeyDown((KeyCode)280)) { CyclePupil(1); } else if (Input.GetKeyDown((KeyCode)281)) { CyclePupil(-1); } else if (Input.GetKeyDown((KeyCode)8)) { SetPupilDefault(); SavePupilToConfig(1f); } } [IteratorStateMachine(typeof(<ApplyLoop>d__58))] private IEnumerator ApplyLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyLoop>d__58(0) { <>4__this = this }; } private void EnsureLocalCache() { PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance == (Object)null || !Object.op_Implicit((Object)(object)instance)) { _cachedAvatar = null; _cachedHealth = null; return; } PlayerHealth playerHealth = instance.playerHealth; if ((Object)(object)playerHealth == (Object)null || !Object.op_Implicit((Object)(object)playerHealth)) { _cachedAvatar = null; _cachedHealth = null; return; } if ((Object)(object)_cachedAvatar != (Object)(object)instance || (Object)(object)_cachedHealth != (Object)(object)playerHealth) { _cachedAvatar = instance; _cachedHealth = playerHealth; _lastAppliedEyeOverride = false; _lastAppliedPupilOverride = false; _pendingReapplyAfterScene = true; } if (_pendingReapplyAfterScene) { ApplyEye(); ApplyPupil(); _pendingReapplyAfterScene = false; BumpHud(); } } private void ApplyEye() { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cachedHealth == (Object)null || !Object.op_Implicit((Object)(object)_cachedHealth)) { return; } EyeColorPreset desiredEyePreset = GetDesiredEyePreset(Mathf.Clamp(_blinkIntervalSeconds.Value, 0.05f, 5f)); bool flag = desiredEyePreset != EyeColorPreset.Off && desiredEyePreset != EyeColorPreset.Random; float num = Mathf.Clamp(_applyIntervalSeconds.Value, 0.05f, 2f); float num2 = Mathf.Max(0.25f, num * 4f); if (_eyeBlinkList.Count >= 2 || _hiddenActive) { num2 = Mathf.Max(num2, Mathf.Clamp(_blinkIntervalSeconds.Value, 0.05f, 5f) * 2.5f); } try { if (flag) { EyeOverrideState val = MapPresetToState(desiredEyePreset); _cachedHealth.EyeMaterialOverride(val, num2, 9999); _lastAppliedEyeOverride = true; _lastAppliedEyePreset = desiredEyePreset; } else if (_lastAppliedEyeOverride) { _cachedHealth.EyeMaterialOverride(MapPresetToState(_lastAppliedEyePreset), 0.06f, 9999); _lastAppliedEyeOverride = false; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failure: ApplyEye\n" + ex)); _cachedHealth = null; } } private void ApplyPupil() { if ((Object)(object)_cachedAvatar == (Object)null || !Object.op_Implicit((Object)(object)_cachedAvatar)) { return; } float num = (_hiddenActive ? 3f : (_pupilUseDefault ? ClampPupil(_defaultPupilMultiplier.Value) : ClampPupil(_pupilMultiplier))); bool flag = Math.Abs(num - 1f) > 0.0001f; float num2 = Mathf.Clamp(_applyIntervalSeconds.Value, 0.05f, 2f); float num3 = Mathf.Max(0.25f, num2 * 4f); try { if (flag) { _cachedAvatar.OverridePupilSize(num, 9999, 5f, 0.5f, 5f, 0.5f, num3); _lastAppliedPupilOverride = true; } else if (_lastAppliedPupilOverride) { _cachedAvatar.OverridePupilSize(1f, 9999, 5f, 0.5f, 5f, 0.5f, 0.06f); _lastAppliedPupilOverride = false; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failure: ApplyPupil\n" + ex)); _cachedAvatar = null; } } private EyeColorPreset GetDesiredEyePreset(float blinkInterval) { if (_hiddenActive) { if (!(Time.unscaledTime >= _hiddenEndTime)) { int num = (int)(Time.unscaledTime / 0.035f) % _hiddenEyes.Length; if (num < 0) { num = 0; } return _hiddenEyes[num]; } _hiddenActive = false; MarkReapply(); } if (_eyeBlinkList.Count >= 2) { float num2 = Mathf.Clamp(blinkInterval, 0.05f, 5f); int num3 = (int)(Time.unscaledTime / num2) % _eyeBlinkList.Count; if (num3 < 0) { num3 = 0; } return _eyeBlinkList[num3]; } if (_eyeBlinkList.Count == 1) { return _eyeBlinkList[0]; } if (_eyeUseDefault) { return GetConfiguredDefaultEyeColor(); } return _eyeSingle; } private void SetEyeDefault() { _eyeUseDefault = true; _eyeBlinkList.Clear(); _eyeSingle = GetConfiguredDefaultEyeColor(); MarkReapply(); BumpHud(); } private void CycleEyeColor(int dir) { EyeColorPreset[] array = new EyeColorPreset[6] { EyeColorPreset.Off, EyeColorPreset.Red, EyeColorPreset.Green, EyeColorPreset.Love, EyeColorPreset.CeilingEye, EyeColorPreset.Inverted }; EyeColorPreset desiredEyePreset = GetDesiredEyePreset(_blinkIntervalSeconds.Value); int num = Array.IndexOf(array, desiredEyePreset); if (num < 0) { num = 0; } num = (num + dir) % array.Length; if (num < 0) { num += array.Length; } _eyeUseDefault = false; _eyeBlinkList.Clear(); _eyeSingle = array[num]; SaveEyeColorToConfig(_eyeSingle); MarkReapply(); BumpHud(); } private void SetPupilDefault() { _pupilUseDefault = true; _pupilMultiplier = ClampPupil(_defaultPupilMultiplier.Value); MarkReapply(); BumpHud(); } private void SetPupilFromDigit(int digit) { float v = Mathf.Lerp(0.25f, 3f, Mathf.InverseLerp(4f, 9f, (float)digit)); _pupilUseDefault = false; _pupilMultiplier = ClampPupil(v); } private void CyclePupil(int dir) { int num = DigitFromPupil(_pupilUseDefault ? ClampPupil(_defaultPupilMultiplier.Value) : ClampPupil(_pupilMultiplier)); int num2 = num + dir; if (num2 < 4) { num2 = 9; } if (num2 > 9) { num2 = 4; } SetPupilFromDigit(num2); SavePupilToConfig(_pupilMultiplier); MarkReapply(); BumpHud(); } private void SaveEyeColorToConfig(EyeColorPreset preset) { if (preset == EyeColorPreset.Random) { return; } try { _defaultEyeColor.Value = preset; ((BaseUnityPlugin)this).Config.Save(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failure: SaveEyeColorToConfig\n" + ex)); } } private void SavePupilToConfig(float value) { try { _defaultPupilMultiplier.Value = ClampPupil(value); ((BaseUnityPlugin)this).Config.Save(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failure: SavePupilToConfig\n" + ex)); } } private void MarkReapply() { _pendingReapplyAfterScene = true; _cachedAvatar = null; _cachedHealth = null; } private void MarkCosmeticReapply() { _lastCosmeticReapplyRequestTime = Time.unscaledTime; _pendingReapplyAfterScene = true; _lastAppliedEyeOverride = false; _lastAppliedPupilOverride = false; } private void ResetHiddenCommand() { _hiddenIndex = 0; _hiddenDeadline = 0f; } private void UpdateHiddenCommand(bool shift) { if (!shift) { ResetHiddenCommand(); } else if (_hiddenIndex > 0 && Time.unscaledTime > _hiddenDeadline) { ResetHiddenCommand(); } else if (Input.GetKeyDown((KeyCode)122)) { _hiddenIndex = 1; _hiddenDeadline = Time.unscaledTime + 2f; } else if (_hiddenIndex == 1 && Input.GetKeyDown((KeyCode)97)) { _hiddenIndex = 2; } else if (_hiddenIndex == 2 && Input.GetKeyDown((KeyCode)98)) { _hiddenIndex = 3; } else if (_hiddenIndex == 3 && Input.GetKeyDown((KeyCode)117)) { ResetHiddenCommand(); ActivateHiddenEffect(); } else if (_hiddenIndex > 0 && IsAnyNonModifierKeyDown()) { ResetHiddenCommand(); } } private void ActivateHiddenEffect() { _hiddenActive = true; _hiddenEndTime = Time.unscaledTime + 10f; SendHiddenChatMessage(); MarkReapply(); BumpHud(); } private void SendHiddenChatMessage() { try { if ((Object)(object)ChatManager.instance != (Object)null) { ChatManager.instance.ForceSendMessage("I Love REPO JP"); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failure: Hidden chat message\n" + ex)); } } private static bool IsAnyNonModifierKeyDown() { //IL_0055: 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) if (!Input.anyKeyDown) { return false; } if (Input.GetKeyDown((KeyCode)304) || Input.GetKeyDown((KeyCode)303)) { return false; } KeyCode[] array = new KeyCode[57]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); KeyCode[] array2 = (KeyCode[])(object)array; KeyCode[] array3 = array2; foreach (KeyCode val in array3) { if (Input.GetKeyDown(val)) { return true; } } return false; } private void EnsureGui() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_008f: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00b5: Expected O, but got Unknown //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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0101: Expected O, but got Unknown if ((Object)(object)_whiteTex == (Object)null) { _whiteTex = new Texture2D(1, 1, (TextureFormat)4, false); _whiteTex.SetPixel(0, 0, Color.white); _whiteTex.Apply(false, true); ((Object)_whiteTex).hideFlags = (HideFlags)61; } if (!_guiInited) { _hudTitleStyle = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)0 }; _hudTextStyle = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)0 }; _hudSmallStyle = new GUIStyle(GUI.skin.label) { fontSize = 12, alignment = (TextAnchor)0 }; _hudMonoStyle = new GUIStyle(GUI.skin.label) { fontSize = 12, alignment = (TextAnchor)0 }; _guiInited = true; } } private void OnGUI() { if (_enabled.Value) { EnsureGui(); DrawHudAnimated(); } } private void DrawHudAnimated() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) float num = 620f; float num2 = 132f; float margin = 18f; UpdateHudAnim(num, num2, margin); if (_hudState != 0 && !(_hudAlpha <= 0.001f)) { Rect r = default(Rect); ((Rect)(ref r))..ctor(_hudX, _hudY, num, num2); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, _hudAlpha); DrawRect(new Rect(((Rect)(ref r)).x + 4f, ((Rect)(ref r)).y + 6f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), new Color(0f, 0f, 0f, 0.35f * _hudAlpha)); DrawRect(r, new Color(0.05f, 0.05f, 0.06f, 0.78f * _hudAlpha)); DrawBorder(r, 1.5f, new Color(1f, 1f, 1f, 0.2f * _hudAlpha)); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref r)).x + 14f, ((Rect)(ref r)).y + 12f, ((Rect)(ref r)).width - 28f, ((Rect)(ref r)).height - 24f); EyeColorPreset desiredEyePreset = GetDesiredEyePreset(_blinkIntervalSeconds.Value); List<EyeColorPreset> list = BuildEyeShowList(); float mult = (_hiddenActive ? 3f : (_pupilUseDefault ? ClampPupil(_defaultPupilMultiplier.Value) : ClampPupil(_pupilMultiplier))); GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 20f), "Eye / Pupil", _hudTitleStyle); GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 26f, 70f, 20f), "Eye", _hudTextStyle); DrawColorSwatch(new Rect(((Rect)(ref val)).x + 44f, ((Rect)(ref val)).y + 26f, 22f, 22f), GetPresetUiColor(desiredEyePreset), active: true, 0, showIndex: true); GUI.Label(new Rect(((Rect)(ref val)).x + 76f, ((Rect)(ref val)).y + 26f, ((Rect)(ref val)).width - 76f, 20f), BuildEyeStatusText(), _hudTextStyle); DrawEyeChipRow(((Rect)(ref val)).x, ((Rect)(ref val)).y + 52f, list, desiredEyePreset); GUI.Label(new Rect(((Rect)(ref val)).x + 430f, ((Rect)(ref val)).y + 26f, 200f, 20f), "Blink " + Mathf.Clamp(_blinkIntervalSeconds.Value, 0.05f, 5f).ToString("0.00", CultureInfo.InvariantCulture) + "s", _hudSmallStyle); GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 90f, 70f, 20f), "Pupil", _hudTextStyle); GUI.Label(new Rect(((Rect)(ref val)).x + 76f, ((Rect)(ref val)).y + 90f, 180f, 20f), ((_pupilUseDefault && !_hiddenActive) ? "Default " : string.Empty) + mult.ToString("0.00", CultureInfo.InvariantCulture), _hudTextStyle); DrawPupilBar(new Rect(((Rect)(ref val)).x + 250f, ((Rect)(ref val)).y + 94f, 350f, 14f), mult); GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 112f, ((Rect)(ref val)).width, 18f), "Ctrl+4-9 Eye Ctrl+0 Default Shift+4-9 Pupil Shift+0 Default", _hudSmallStyle); GUI.color = color; } } private void UpdateHudAnim(float w, float h, float margin) { float unscaledTime = Time.unscaledTime; float num = Mathf.Clamp(_hudFadeInSeconds.Value, 0f, 2f); float num2 = Mathf.Clamp(_hudFadeOutSeconds.Value, 0f, 2f); float num3 = Mathf.Clamp(_hudHoldSeconds.Value, 0f, 10f); float num4 = ((float)Screen.width - w) * 0.5f; float num5 = (float)Screen.height - margin - h; float num6 = (float)Screen.height + h + 30f; float num7 = (float)Screen.width - margin - w; float num8 = (float)Screen.height - margin - h + 55f; if (_hudState == HudAnimState.Hidden) { _hudAlpha = 0f; } else if (_hudState == HudAnimState.In) { float num9 = ((num <= 0.0001f) ? 1f : Mathf.Clamp01((unscaledTime - _hudStateStartUnscaled) / num)); float num10 = EaseOutCubic(num9); _hudAlpha = Mathf.Lerp(0f, 1f, num10); _hudX = num4; _hudY = Mathf.Lerp(num6, num5, num10); if (num9 >= 1f) { _hudState = HudAnimState.Hold; _hudStateStartUnscaled = unscaledTime; } } else if (_hudState == HudAnimState.Hold) { _hudAlpha = 1f; _hudX = num4; _hudY = num5; if (unscaledTime - _hudStateStartUnscaled >= num3) { _hudState = HudAnimState.Out; _hudStateStartUnscaled = unscaledTime; } } else if (_hudState == HudAnimState.Out) { float num11 = ((num2 <= 0.0001f) ? 1f : Mathf.Clamp01((unscaledTime - _hudStateStartUnscaled) / num2)); float num12 = EaseInCubic(num11); _hudAlpha = Mathf.Lerp(1f, 0f, num12); _hudX = Mathf.Lerp(num4, num7, num12); _hudY = Mathf.Lerp(num5, num8, num12); if (num11 >= 1f) { _hudState = HudAnimState.Hidden; _hudAlpha = 0f; } } } private void BumpHud() { float unscaledTime = Time.unscaledTime; if (_hudState == HudAnimState.In || _hudState == HudAnimState.Hold) { _hudState = HudAnimState.Hold; _hudStateStartUnscaled = unscaledTime; } else { _hudState = HudAnimState.In; _hudStateStartUnscaled = unscaledTime; } } private List<EyeColorPreset> BuildEyeShowList() { if (_hiddenActive) { return new List<EyeColorPreset>(_hiddenEyes); } if (_eyeBlinkList.Count >= 1) { return new List<EyeColorPreset>(_eyeBlinkList); } if (_eyeUseDefault) { EyeColorPreset configuredDefaultEyeColor = GetConfiguredDefaultEyeColor(); return (configuredDefaultEyeColor == EyeColorPreset.Off) ? new List<EyeColorPreset>() : new List<EyeColorPreset> { configuredDefaultEyeColor }; } return (_eyeSingle == EyeColorPreset.Off) ? new List<EyeColorPreset>() : new List<EyeColorPreset> { _eyeSingle }; } private void DrawEyeChipRow(float x, float y, List<EyeColorPreset> list, EyeColorPreset active) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_012b: 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) if (list == null || list.Count == 0) { DrawRect(new Rect(x, y, 240f, 28f), new Color(1f, 1f, 1f, 0.06f * _hudAlpha)); DrawBorder(new Rect(x, y, 240f, 28f), 1f, new Color(1f, 1f, 1f, 0.12f * _hudAlpha)); GUI.Label(new Rect(x + 8f, y + 5f, 240f, 20f), "OFF", _hudMonoStyle); return; } float num = 44f; float num2 = 28f; float num3 = 8f; if (list.Count >= 2) { GUI.Label(new Rect(x, y - 18f, 220f, 18f), "Selected Colors", _hudSmallStyle); } for (int i = 0; i < list.Count; i++) { EyeColorPreset eyeColorPreset = list[i]; DrawColorSwatch(new Rect(x + (num + num3) * (float)i, y, num, num2), GetPresetUiColor(eyeColorPreset), eyeColorPreset == active, i + 1, list.Count >= 2); } } private void DrawPupilBar(Rect r, float mult) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_012e: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(Mathf.InverseLerp(0.25f, 3f, mult)); DrawRect(r, new Color(1f, 1f, 1f, 0.06f * _hudAlpha)); DrawBorder(r, 1f, new Color(1f, 1f, 1f, 0.14f * _hudAlpha)); DrawRect(new Rect(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + 2f, (((Rect)(ref r)).width - 4f) * num, ((Rect)(ref r)).height - 4f), new Color(0.3f, 0.85f, 0.6f, 0.7f * _hudAlpha)); GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y - 2f, 60f, 20f), "0.25", _hudSmallStyle); GUI.Label(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width - 60f, ((Rect)(ref r)).y - 2f, 60f, 20f), "3.00", _hudSmallStyle); } private void DrawColorSwatch(Rect r, Color c, bool active, int index, bool showIndex) { //IL_002a: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) DrawRect(new Rect(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + 2f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), new Color(0f, 0f, 0f, 0.3f * _hudAlpha)); Color c2 = c; c2.a *= _hudAlpha; DrawRect(r, c2); if (active) { float num = 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 10f); DrawBorder(r, 2f, new Color(1f, 1f, 1f, (0.65f + 0.25f * num) * _hudAlpha)); } else { DrawBorder(r, 1.5f, new Color(1f, 1f, 1f, 0.18f * _hudAlpha)); } if (showIndex) { GUI.Label(new Rect(((Rect)(ref r)).x + 6f, ((Rect)(ref r)).y + 5f, ((Rect)(ref r)).width - 12f, ((Rect)(ref r)).height - 10f), index.ToString(CultureInfo.InvariantCulture), _hudMonoStyle); } GUI.Label(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width - 16f, ((Rect)(ref r)).y + 5f, 16f, ((Rect)(ref r)).height - 10f), GetPresetShortNameFromColor(c), _hudMonoStyle); } private void DrawRect(Rect r, Color c) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)(((Object)(object)_whiteTex != (Object)null) ? _whiteTex : Texture2D.whiteTexture)); GUI.color = color; } private void DrawBorder(Rect r, float thickness, Color c) { //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) //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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_008a: Unknown result type (might be due to invalid IL or missing references) DrawRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, thickness), c); DrawRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - thickness, ((Rect)(ref r)).width, thickness), c); DrawRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, thickness, ((Rect)(ref r)).height), c); DrawRect(new Rect(((Rect)(ref r)).xMax - thickness, ((Rect)(ref r)).y, thickness, ((Rect)(ref r)).height), c); } private string BuildEyeStatusText() { if (_hiddenActive) { return "Blink Red,Green,Love,CeilingEye,Inverted"; } if (_eyeUseDefault) { if (_defaultEyeColor.Value == EyeColorPreset.Random) { return "Default Random -> " + _randomEyeForLevel; } return "Default " + _defaultEyeColor.Value; } if (_eyeBlinkList.Count >= 2) { return "Blink " + string.Join(",", _eyeBlinkList.Select((EyeColorPreset x) => x.ToString()).ToArray()); } return (_eyeSingle == EyeColorPreset.Off) ? "OFF" : _eyeSingle.ToString(); } internal static bool ShouldSuppressExpressionInputs() { if ((Object)(object)Instance == (Object)null || !Instance._enabled.Value) { return false; } if (!SemiFunc.NoTextInputsActive()) { return true; } return IsCtrlPressed() || IsShiftPressed(); } private static bool IsExpressionKey(InputKey key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 return (int)key == 26 || (int)key == 27 || (int)key == 28 || (int)key == 29 || (int)key == 30 || (int)key == 31; } private static bool IsCtrlPressed() { return Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305); } private static bool IsShiftPressed() { return Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303); } private static List<int> GetDigitsDownThisFrame() { List<int> list = new List<int>(); if (Input.GetKeyDown((KeyCode)52) || Input.GetKeyDown((KeyCode)260)) { list.Add(4); } if (Input.GetKeyDown((KeyCode)53) || Input.GetKeyDown((KeyCode)261)) { list.Add(5); } if (Input.GetKeyDown((KeyCode)54) || Input.GetKeyDown((KeyCode)262)) { list.Add(6); } if (Input.GetKeyDown((KeyCode)55) || Input.GetKeyDown((KeyCode)263)) { list.Add(7); } if (Input.GetKeyDown((KeyCode)56) || Input.GetKeyDown((KeyCode)264)) { list.Add(8); } if (Input.GetKeyDown((KeyCode)57) || Input.GetKeyDown((KeyCode)265)) { list.Add(9); } if (Input.GetKeyDown((KeyCode)48) || Input.GetKeyDown((KeyCode)256)) { list.Add(0); } return list.Distinct().ToList(); } private static HashSet<int> GetDigitsHeldNow() { HashSet<int> hashSet = new HashSet<int>(); if (Input.GetKey((KeyCode)52) || Input.GetKey((KeyCode)260)) { hashSet.Add(4); } if (Input.GetKey((KeyCode)53) || Input.GetKey((KeyCode)261)) { hashSet.Add(5); } if (Input.GetKey((KeyCode)54) || Input.GetKey((KeyCode)262)) { hashSet.Add(6); } if (Input.GetKey((KeyCode)55) || Input.GetKey((KeyCode)263)) { hashSet.Add(7); } if (Input.GetKey((KeyCode)56) || Input.GetKey((KeyCode)264)) { hashSet.Add(8); } if (Input.GetKey((KeyCode)57) || Input.GetKey((KeyCode)265)) { hashSet.Add(9); } if (Input.GetKey((KeyCode)48) || Input.GetKey((KeyCode)256)) { hashSet.Add(0); } return hashSet; } private static List<EyeColorPreset> MapEyePresetsFromDigits(List<int> digits) { List<Tuple<int, EyeColorPreset>> list = new List<Tuple<int, EyeColorPreset>>(); foreach (int digit in digits) { if (TryMapEyeColorDigit(digit, out var preset)) { list.Add(new Tuple<int, EyeColorPreset>(digit, preset)); } } list = list.OrderBy((Tuple<int, EyeColorPreset> x) => x.Item1).ToList(); List<EyeColorPreset> list2 = new List<EyeColorPreset>(); foreach (Tuple<int, EyeColorPreset> item in list) { if (!list2.Contains(item.Item2)) { list2.Add(item.Item2); } } return list2; } private static bool TryMapEyeColorDigit(int digit, out EyeColorPreset preset) { switch (digit) { case 4: preset = EyeColorPreset.Off; return true; case 5: preset = EyeColorPreset.Red; return true; case 6: preset = EyeColorPreset.Green; return true; case 7: preset = EyeColorPreset.Love; return true; case 8: preset = EyeColorPreset.CeilingEye; return true; case 9: preset = EyeColorPreset.Inverted; return true; default: preset = EyeColorPreset.Off; return false; } } private static EyeOverrideState MapPresetToState(EyeColorPreset preset) { //IL_000a: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_003e: Unknown result type (might be due to invalid IL or missing references) return (EyeOverrideState)(preset switch { EyeColorPreset.Red => 1, EyeColorPreset.Green => 2, EyeColorPreset.Love => 3, EyeColorPreset.CeilingEye => 4, EyeColorPreset.Inverted => 5, _ => 1, }); } private static int DigitFromPupil(float mult) { int num = Mathf.RoundToInt(Mathf.Lerp(4f, 9f, Mathf.InverseLerp(0.25f, 3f, mult))); if (num < 4) { num = 4; } if (num > 9) { num = 9; } return num; } private static float ClampPupil(float v) { if (v < 0.25f) { return 0.25f; } if (v > 3f) { return 3f; } return v; } private static Color GetPresetUiColor(EyeColorPreset p) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) return (Color)(p switch { EyeColorPreset.Red => new Color(1f, 0.22f, 0.22f, 1f), EyeColorPreset.Green => new Color(0.22f, 1f, 0.35f, 1f), EyeColorPreset.Love => new Color(1f, 0.25f, 0.95f, 1f), EyeColorPreset.CeilingEye => new Color(1f, 0.9f, 0.2f, 1f), EyeColorPreset.Inverted => new Color(0.05f, 0.05f, 0.05f, 1f), _ => new Color(0.55f, 0.55f, 0.55f, 1f), }); } private static string GetPresetShortNameFromColor(Color c) { //IL_0001: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0073: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (c.r > 0.85f && c.g > 0.8f && c.b < 0.35f) { return "C"; } if (c.r < 0.2f && c.g < 0.2f && c.b < 0.2f) { return "I"; } if (c.r > 0.8f && c.g < 0.4f && c.b < 0.4f) { return "R"; } if (c.g > 0.8f && c.r < 0.4f && c.b < 0.4f) { return "G"; } if (c.r > 0.8f && c.b > 0.8f && c.g < 0.6f) { return "L"; } return "-"; } private static float EaseOutCubic(float t) { float num = 1f - t; return 1f - num * num * num; } private static float EaseInCubic(float t) { return t * t * t; } } }