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.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Localization;
using UnityEngine.Localization.Components;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.UIElements;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Antro.Customize")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Antro.Customize")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyProduct("Antro.Customize")]
[assembly: AssemblyTitle("Antro.Customize")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CustomizeMod
{
public static class CustomColorSync
{
[CompilerGenerated]
private static class <>O
{
public static HandleNamedMessageDelegate <0>__OnColorMessage;
public static Action<ulong> <1>__OnClientConnected;
}
public static Dictionary<ulong, Dictionary<string, Color>> PlayerColors = new Dictionary<ulong, Dictionary<string, Color>>();
public static bool HandlersRegistered = false;
public static void RegisterNetworkHandlers()
{
//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_0048: Expected O, but got Unknown
NetworkManager singleton = NetworkManager.Singleton;
if (!((Object)(object)singleton == (Object)null) && singleton.CustomMessagingManager != null)
{
CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
object obj = <>O.<0>__OnColorMessage;
if (obj == null)
{
HandleNamedMessageDelegate val = OnColorMessage;
<>O.<0>__OnColorMessage = val;
obj = (object)val;
}
customMessagingManager.RegisterNamedMessageHandler("UnivColor_SetMesh", (HandleNamedMessageDelegate)obj);
if (singleton.IsServer)
{
singleton.OnClientConnectedCallback += OnClientConnected;
}
HandlersRegistered = true;
}
}
public static void ResetState()
{
NetworkManager singleton = NetworkManager.Singleton;
if ((Object)(object)singleton != (Object)null)
{
singleton.OnClientConnectedCallback -= OnClientConnected;
}
PlayerColors.Clear();
HandlersRegistered = false;
}
private static void OnClientConnected(ulong clientId)
{
if ((Object)(object)UniversalColorPlugin.Instance != (Object)null)
{
((MonoBehaviour)UniversalColorPlugin.Instance).StartCoroutine(SendAllColorsToClient(clientId));
}
}
private static IEnumerator SendAllColorsToClient(ulong clientId)
{
yield return (object)new WaitForSeconds(2f);
NetworkManager nm = NetworkManager.Singleton;
if ((Object)(object)nm == (Object)null || !nm.IsListening || nm.CustomMessagingManager == null)
{
yield break;
}
foreach (KeyValuePair<ulong, Dictionary<string, Color>> playerKvp in PlayerColors)
{
foreach (KeyValuePair<string, Color> partKvp in playerKvp.Value)
{
SendColorTo(clientId, playerKvp.Key, partKvp.Key, partKvp.Value, isDefault: false);
}
}
}
public static void BroadcastColor(ulong networkObjectId, string partName, Color color, bool isDefault)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
NetworkManager singleton = NetworkManager.Singleton;
if ((Object)(object)singleton == (Object)null || !singleton.IsListening || singleton.CustomMessagingManager == null)
{
return;
}
if (!PlayerColors.ContainsKey(networkObjectId))
{
PlayerColors[networkObjectId] = new Dictionary<string, Color>();
}
if (isDefault)
{
if (partName == "ALL")
{
PlayerColors[networkObjectId].Clear();
}
else
{
PlayerColors[networkObjectId].Remove(partName);
}
}
else
{
if (partName == "ALL")
{
PlayerColors[networkObjectId].Clear();
}
PlayerColors[networkObjectId][partName] = color;
}
if (singleton.IsServer)
{
foreach (ulong connectedClientsId in singleton.ConnectedClientsIds)
{
if (connectedClientsId != singleton.LocalClientId)
{
SendColorTo(connectedClientsId, networkObjectId, partName, color, isDefault);
}
}
return;
}
SendColorTo(0uL, networkObjectId, partName, color, isDefault);
}
private static void SendColorTo(ulong targetClientId, ulong networkObjectId, string partName, Color color, bool isDefault)
{
//IL_001b: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0072: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
NetworkManager singleton = NetworkManager.Singleton;
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(256, (Allocator)2, -1);
((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives));
((FastBufferWriter)(ref val)).WriteValueSafe(partName, false);
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isDefault, default(ForPrimitives));
if (!isDefault)
{
((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref color.r, default(ForPrimitives));
((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref color.g, default(ForPrimitives));
((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref color.b, default(ForPrimitives));
}
singleton.CustomMessagingManager.SendNamedMessage("UnivColor_SetMesh", targetClientId, val, (NetworkDelivery)3);
((FastBufferWriter)(ref val)).Dispose();
}
private static void OnColorMessage(ulong senderId, FastBufferReader reader)
{
//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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
ulong num = default(ulong);
((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref num, default(ForPrimitives));
string text = default(string);
((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false);
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
Color clear = Color.clear;
if (!flag)
{
float num2 = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num2, default(ForPrimitives));
float num3 = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num3, default(ForPrimitives));
float num4 = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num4, default(ForPrimitives));
((Color)(ref clear))..ctor(num2, num3, num4, 1f);
}
if (!PlayerColors.ContainsKey(num))
{
PlayerColors[num] = new Dictionary<string, Color>();
}
if (flag)
{
if (text == "ALL")
{
PlayerColors[num].Clear();
}
else
{
PlayerColors[num].Remove(text);
}
}
else
{
if (text == "ALL")
{
PlayerColors[num].Clear();
}
PlayerColors[num][text] = clear;
}
ApplyToNetworkObject(num, text, clear, flag);
NetworkManager singleton = NetworkManager.Singleton;
if (!((Object)(object)singleton != (Object)null) || !singleton.IsServer)
{
return;
}
foreach (ulong connectedClientsId in singleton.ConnectedClientsIds)
{
if (connectedClientsId != senderId && connectedClientsId != singleton.LocalClientId)
{
SendColorTo(connectedClientsId, num, text, clear, flag);
}
}
}
private static void ApplyToNetworkObject(ulong networkObjectId, string partName, Color color, bool isDefault)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
NetworkManager singleton = NetworkManager.Singleton;
if (!((Object)(object)singleton == (Object)null) && singleton.SpawnManager != null && singleton.SpawnManager.SpawnedObjects.TryGetValue(networkObjectId, out var value))
{
PlayerNetworking componentInChildren = ((Component)value).GetComponentInChildren<PlayerNetworking>();
if ((Object)(object)componentInChildren != (Object)null)
{
ApplyColorToPart(componentInChildren, partName, color, isDefault);
}
}
}
public static void ApplyAllSavedColors(PlayerNetworking playerNet)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
if (!PlayerColors.TryGetValue(((NetworkBehaviour)playerNet).NetworkObjectId, out var value))
{
return;
}
foreach (KeyValuePair<string, Color> item in value)
{
ApplyColorToPart(playerNet, item.Key, item.Value, isDefault: false);
}
}
public static void ApplyColorToPart(PlayerNetworking playerNet, string targetPartName, Color color, bool isDefault)
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
Renderer[] componentsInChildren = ((Component)playerNet).GetComponentsInChildren<Renderer>(true);
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
if (((Object)val).name.Contains("Outline") || ((Object)val).name.Contains("UI") || (!(targetPartName == "ALL") && !(((Object)val).name == targetPartName)))
{
continue;
}
Material[] sharedMaterials = val.sharedMaterials;
for (int j = 0; j < sharedMaterials.Length; j++)
{
if (!((Object)(object)sharedMaterials[j] != (Object)null))
{
continue;
}
if (isDefault)
{
val.SetPropertyBlock((MaterialPropertyBlock)null, j);
continue;
}
MaterialPropertyBlock val2 = new MaterialPropertyBlock();
val.GetPropertyBlock(val2, j);
string[] array2 = new string[3] { "_BaseColor", "_Color", "_TintColor" };
string[] array3 = array2;
foreach (string text in array3)
{
if (sharedMaterials[j].HasProperty(text))
{
val2.SetColor(text, color);
}
}
string[] array4 = new string[2] { "_BaseMap", "_MainTex" };
string[] array5 = array4;
foreach (string text2 in array5)
{
if (sharedMaterials[j].HasProperty(text2))
{
val2.SetTexture(text2, (Texture)(object)Texture2D.whiteTexture);
}
}
val.SetPropertyBlock(val2, j);
}
}
}
}
public class GnomeCustomizerInteractable : MonoBehaviour, IInteractable
{
public static bool IsTargeted;
public bool CanInteract => true;
public InteractOutline InteractOutline => ((Component)this).GetComponent<InteractOutline>();
public bool ShowInteractHotkey => true;
public string LocalizationTableRef => "PlayerUsageHints";
public LocalizedString LocalizedUsageHint => IInteractable.ConstructLocalizedString("Grab");
public void SetLocalizedString(LocalizedString localizedString)
{
}
public void Interact(PlayerNetworking player)
{
if (Time.time - UniversalColorPlugin.Instance.lastMenuCloseTime >= 0.5f)
{
UniversalColorPlugin.Instance.ToggleMenu(((Component)this).gameObject);
}
}
public bool GetCanSpecificPlayerInteract(PlayerNetworking player)
{
return true;
}
public LocalizedString GetLocalizedStringSpecificPlayer(PlayerNetworking player)
{
return LocalizedUsageHint;
}
private void Update()
{
if (!IsTargeted || !((Object)(object)UniversalColorPlugin.Instance != (Object)null) || !((Object)(object)UniversalColorPlugin.Instance.LocalPlayerController != (Object)null))
{
return;
}
PlayerController localPlayerController = UniversalColorPlugin.Instance.LocalPlayerController;
FieldInfo field = typeof(PlayerController).GetField("text_interact", BindingFlags.Instance | BindingFlags.NonPublic);
if (!(field != null))
{
return;
}
object? value = field.GetValue(localPlayerController);
TextMeshProUGUI val = (TextMeshProUGUI)((value is TextMeshProUGUI) ? value : null);
if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy)
{
LocalizeStringEvent component = ((Component)val).GetComponent<LocalizeStringEvent>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = false;
}
if (((TMP_Text)val).text != "[E] Customize")
{
((TMP_Text)val).text = "[E] Customize";
}
}
}
}
internal static class CustomizerInteractionHelper
{
public static bool HandleInteract(MonoBehaviour __instance)
{
if ((Object)(object)UniversalColorPlugin.Instance != (Object)null && (Object)(object)UniversalColorPlugin.Instance.customizerGnomeInstance != (Object)null && ((Object)(object)((Component)__instance).gameObject == (Object)(object)UniversalColorPlugin.Instance.customizerGnomeInstance || ((Component)__instance).transform.IsChildOf(UniversalColorPlugin.Instance.customizerGnomeInstance.transform)))
{
if (Time.time - UniversalColorPlugin.Instance.lastMenuCloseTime >= 0.5f)
{
UniversalColorPlugin.Instance.ToggleMenu(UniversalColorPlugin.Instance.customizerGnomeInstance);
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ItemInstance), "Interact")]
internal static class ItemInstanceInteractPatch
{
[HarmonyPrefix]
private static bool Prefix(ItemInstance __instance)
{
return CustomizerInteractionHelper.HandleInteract((MonoBehaviour)(object)__instance);
}
}
[HarmonyPatch(typeof(InteractableObject), "Interact")]
internal static class InteractableObjectInteractPatch
{
[HarmonyPrefix]
private static bool Prefix(InteractableObject __instance)
{
return CustomizerInteractionHelper.HandleInteract((MonoBehaviour)(object)__instance);
}
}
[HarmonyPatch(typeof(PlayerInteractListener), "Interact")]
internal static class PlayerInteractListenerInteractPatch
{
[HarmonyPrefix]
private static bool Prefix(PlayerInteractListener __instance)
{
return CustomizerInteractionHelper.HandleInteract((MonoBehaviour)(object)__instance);
}
}
[HarmonyPatch(typeof(InteractOutline), "SetOutline")]
internal static class OutlinePatch
{
[HarmonyPostfix]
private static void Postfix(InteractOutline __instance, bool enable)
{
if (!((Object)(object)((Component)__instance).GetComponent<GnomeCustomizerInteractable>() != (Object)null))
{
return;
}
GnomeCustomizerInteractable.IsTargeted = enable;
if (enable || !((Object)(object)UniversalColorPlugin.Instance != (Object)null) || !((Object)(object)UniversalColorPlugin.Instance.LocalPlayerController != (Object)null))
{
return;
}
PlayerController localPlayerController = UniversalColorPlugin.Instance.LocalPlayerController;
FieldInfo field = typeof(PlayerController).GetField("text_interact", BindingFlags.Instance | BindingFlags.NonPublic);
if (!(field != null))
{
return;
}
object? value = field.GetValue(localPlayerController);
TextMeshProUGUI val = (TextMeshProUGUI)((value is TextMeshProUGUI) ? value : null);
if ((Object)(object)val != (Object)null)
{
LocalizeStringEvent component = ((Component)val).GetComponent<LocalizeStringEvent>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = true;
}
}
}
}
[HarmonyPatch(typeof(PlayerNetworking), "OnNetworkPostSpawn")]
internal static class SpawnColorPatch
{
[HarmonyPostfix]
private static void Postfix(PlayerNetworking __instance)
{
if ((Object)(object)UniversalColorPlugin.Instance != (Object)null)
{
((MonoBehaviour)UniversalColorPlugin.Instance).StartCoroutine(WaitAndApplyColors(__instance));
}
}
private static IEnumerator WaitAndApplyColors(PlayerNetworking net)
{
yield return (object)new WaitForSeconds(0.5f);
if ((Object)(object)net != (Object)null)
{
CustomColorSync.ApplyAllSavedColors(net);
}
}
}
[HarmonyPatch(typeof(EquipmentBase), "ActivateEquipment")]
internal static class EquipmentColorPatch
{
[HarmonyPostfix]
private static void Postfix(EquipmentBase __instance)
{
if (((object)__instance).GetType().Name == "WearedEquipment")
{
PlayerNetworking componentInParent = ((Component)__instance).GetComponentInParent<PlayerNetworking>();
if ((Object)(object)componentInParent != (Object)null && (Object)(object)UniversalColorPlugin.Instance != (Object)null)
{
((MonoBehaviour)UniversalColorPlugin.Instance).StartCoroutine(ApplyEquipmentColorNextFrame(componentInParent));
}
}
}
private static IEnumerator ApplyEquipmentColorNextFrame(PlayerNetworking net)
{
yield return null;
yield return null;
if (!((Object)(object)net != (Object)null))
{
yield break;
}
CustomColorSync.ApplyAllSavedColors(net);
if ((Object)(object)UniversalColorPlugin.Instance != (Object)null && UniversalColorPlugin.Instance.isMenuOpen)
{
MethodInfo m = typeof(UniversalColorPlugin).GetMethod("RefreshAvailableBodyParts", BindingFlags.Instance | BindingFlags.NonPublic);
if (m != null)
{
m.Invoke(UniversalColorPlugin.Instance, null);
}
}
}
}
[HarmonyPatch(typeof(Debug))]
internal static class SuppressUIErrorSpamPatch
{
[HarmonyPrefix]
[HarmonyPatch("Log", new Type[] { typeof(object) })]
private static bool PrefixLog(object message)
{
if (message != null && message.ToString().Contains("enableCraftButton"))
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch("LogWarning", new Type[] { typeof(object) })]
private static bool PrefixWarn(object message)
{
if (message != null && message.ToString().Contains("enableCraftButton"))
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch("LogError", new Type[] { typeof(object) })]
private static bool PrefixError(object message)
{
if (message != null && message.ToString().Contains("enableCraftButton"))
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch("Log", new Type[]
{
typeof(object),
typeof(Object)
})]
private static bool PrefixLogCtx(object message)
{
if (message != null && message.ToString().Contains("enableCraftButton"))
{
return false;
}
return true;
}
}
[BepInPlugin("nos.Customize.mod", "Universal Gnome Customizer", "7.0.0")]
public class UniversalColorPlugin : BaseUnityPlugin
{
public static UniversalColorPlugin Instance;
public static ManualLogSource Log;
private Harmony harmony;
public bool isMenuOpen;
public float lastMenuCloseTime = 0f;
public float menuOpenTime = 0f;
public GameObject activeGnome;
public GameObject customizerGnomeInstance;
private bool wasLookingAtGnome = false;
private bool handlersRegistered = false;
private Color selectedColor = Color.white;
private float selectedHue;
private float selectedSaturation;
private float selectedValue = 1f;
private Texture2D colorWheelTexture;
private float wheelSize = 250f;
private string presetNameInput = "MyPreset";
private string presetsDirectory;
private List<string> cachedPresetFiles = new List<string>();
private VisualElement fullscreenOverlay;
private VisualElement uiRootElement;
private VisualElement uiContentContainer;
private VisualElement uiColorPreview;
private VisualElement uiWheelCursor;
private ScrollView partsScroll;
private int currentTab = 0;
private List<string> availableBodyParts = new List<string>();
private string selectedPart = "ALL";
private bool isDraggingWheel = false;
public PlayerController LocalPlayerController { get; private set; }
private void Awake()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
harmony = new Harmony("nos.Customize.mod");
harmony.PatchAll();
string path = Path.Combine(Paths.ConfigPath, "CustomizeMod_Presets");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
RefreshPresetList();
InitColorWheel();
Log.LogInfo((object)"[Universal Color Mod] Core Loaded! SCANNER ACTIVE.");
((MonoBehaviour)this).StartCoroutine(MapScannerRoutine());
}
private void OnDestroy()
{
if (harmony != null)
{
harmony.UnpatchSelf();
}
CustomColorSync.ResetState();
DestroyCustomUI();
}
private void Update()
{
//IL_04de: 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_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
if (handlersRegistered && ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsListening))
{
handlersRegistered = false;
CustomColorSync.ResetState();
}
if (!handlersRegistered && (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening && NetworkManager.Singleton.CustomMessagingManager != null)
{
handlersRegistered = true;
CustomColorSync.RegisterNetworkHandlers();
}
if ((Object)(object)LocalPlayerController == (Object)null)
{
FindLocalPlayer();
}
bool flag = false;
if ((Object)(object)LocalPlayerController != (Object)null)
{
FieldInfo field = typeof(PlayerController).GetField("interactAction", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
object? value = field.GetValue(LocalPlayerController);
InputActionReference val = (InputActionReference)((value is InputActionReference) ? value : null);
if ((Object)(object)val != (Object)null && val.action != null && val.action.WasPressedThisFrame())
{
flag = true;
}
}
}
if (Input.GetKeyDown((KeyCode)101))
{
flag = true;
}
bool flag2 = false;
if (!isMenuOpen && (Object)(object)customizerGnomeInstance != (Object)null && (Object)(object)LocalPlayerController != (Object)null)
{
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(((Component)main).transform.position, ((Component)main).transform.forward);
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val2, ref val3, 3f) && ((Object)(object)((Component)((RaycastHit)(ref val3)).collider).gameObject == (Object)(object)customizerGnomeInstance || ((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(customizerGnomeInstance.transform)))
{
flag2 = true;
}
}
}
if (flag2)
{
if (!wasLookingAtGnome && (Object)(object)customizerGnomeInstance != (Object)null)
{
try
{
InteractOutline component = customizerGnomeInstance.GetComponent<InteractOutline>();
if ((Object)(object)component != (Object)null)
{
component.SetOutline(true);
}
}
catch (Exception ex)
{
Log.LogWarning((object)("Outline error (ignored): " + ex.Message));
}
wasLookingAtGnome = true;
}
FieldInfo field2 = typeof(PlayerController).GetField("text_interact", BindingFlags.Instance | BindingFlags.NonPublic);
if (field2 != null)
{
object? value2 = field2.GetValue(LocalPlayerController);
TextMeshProUGUI val4 = (TextMeshProUGUI)((value2 is TextMeshProUGUI) ? value2 : null);
if ((Object)(object)val4 != (Object)null)
{
((Component)val4).gameObject.SetActive(true);
LocalizeStringEvent component2 = ((Component)val4).GetComponent<LocalizeStringEvent>();
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = false;
}
if (((TMP_Text)val4).text != "[E] Customize")
{
((TMP_Text)val4).text = "[E] Customize";
}
}
}
if (flag && Time.time - lastMenuCloseTime >= 0.5f)
{
if (field2 != null)
{
object? value3 = field2.GetValue(LocalPlayerController);
TextMeshProUGUI val5 = (TextMeshProUGUI)((value3 is TextMeshProUGUI) ? value3 : null);
if ((Object)(object)val5 != (Object)null)
{
((Component)val5).gameObject.SetActive(false);
}
}
ToggleMenu(customizerGnomeInstance);
}
}
else
{
if (wasLookingAtGnome && (Object)(object)customizerGnomeInstance != (Object)null)
{
try
{
InteractOutline component3 = customizerGnomeInstance.GetComponent<InteractOutline>();
if ((Object)(object)component3 != (Object)null)
{
component3.SetOutline(false);
}
}
catch (Exception ex2)
{
Log.LogWarning((object)("Outline error (ignored): " + ex2.Message));
}
wasLookingAtGnome = false;
}
if (!isMenuOpen && (Object)(object)LocalPlayerController != (Object)null)
{
FieldInfo field3 = typeof(PlayerController).GetField("text_interact", BindingFlags.Instance | BindingFlags.NonPublic);
if (field3 != null)
{
object? value4 = field3.GetValue(LocalPlayerController);
TextMeshProUGUI val6 = (TextMeshProUGUI)((value4 is TextMeshProUGUI) ? value4 : null);
if ((Object)(object)val6 != (Object)null && ((TMP_Text)val6).text == "[E] Customize")
{
LocalizeStringEvent component4 = ((Component)val6).GetComponent<LocalizeStringEvent>();
if ((Object)(object)component4 != (Object)null)
{
((Behaviour)component4).enabled = true;
}
((TMP_Text)val6).text = "";
((Component)val6).gameObject.SetActive(false);
}
}
}
}
if (isMenuOpen)
{
if ((Object)(object)activeGnome != (Object)null && (Object)(object)LocalPlayerController != (Object)null && Vector3.Distance(((Component)LocalPlayerController).transform.position, activeGnome.transform.position) > 5f)
{
CloseMenu();
}
else if (Input.GetKeyDown((KeyCode)27))
{
CloseMenu();
}
else if (flag && Time.time - menuOpenTime > 0.5f)
{
CloseMenu();
}
}
}
private IEnumerator MapScannerRoutine()
{
while (true)
{
try
{
GameObject[] allObjects = Resources.FindObjectsOfTypeAll<GameObject>();
GameObject[] array = allObjects;
Scene scene;
foreach (GameObject go in array)
{
scene = go.scene;
if (((Scene)(ref scene)).isLoaded && go.activeInHierarchy && ((Object)go).name.Contains("Mushroom_Russula_01") && (Object)(object)go.transform.parent != (Object)null && ((Object)go.transform.parent).name.Contains("Vegetation"))
{
go.SetActive(false);
}
}
if ((Object)(object)customizerGnomeInstance == (Object)null && (Object)(object)LocalPlayerController != (Object)null)
{
GameObject[] array2 = allObjects;
foreach (GameObject go2 in array2)
{
scene = go2.scene;
if (((Scene)(ref scene)).isLoaded && ((Object)go2).name == "SM_gardenGnome_E04" && (Object)(object)go2.GetComponent<InteractOutline>() == (Object)null)
{
customizerGnomeInstance = go2;
customizerGnomeInstance.SetActive(true);
Rigidbody rb = customizerGnomeInstance.GetComponent<Rigidbody>();
if ((Object)(object)rb != (Object)null)
{
rb.isKinematic = true;
}
Transform transform = customizerGnomeInstance.transform;
transform.position -= new Vector3(0f, 0.25f, 0f);
InteractOutline outline = customizerGnomeInstance.AddComponent<InteractOutline>();
FieldInfo renderersField = typeof(InteractOutline).GetField("renderers", BindingFlags.Instance | BindingFlags.NonPublic);
if (renderersField != null)
{
renderersField.SetValue(outline, customizerGnomeInstance.GetComponentsInChildren<Renderer>());
}
FieldInfo additionalObjField = typeof(InteractOutline).GetField("additionalObjectsToShow", BindingFlags.Instance | BindingFlags.NonPublic);
if (additionalObjField != null)
{
additionalObjField.SetValue(outline, new GameObject[0]);
}
Log.LogInfo((object)"[Universal Color Mod] HIJACKED GNOME! NATIVE LAYERS AND COLLIDERS PRESERVED.");
break;
}
}
}
}
catch (Exception ex)
{
Exception ex2 = ex;
Log.LogError((object)$"[Universal Color Mod] Scanner Error: {ex2}");
}
yield return (object)new WaitForSeconds(5f);
}
}
private void FindLocalPlayer()
{
PlayerController[] array = Object.FindObjectsByType<PlayerController>((FindObjectsInactive)0, (FindObjectsSortMode)0);
foreach (PlayerController val in array)
{
NetworkObject componentInParent = ((Component)val).GetComponentInParent<NetworkObject>();
if (((Behaviour)val).isActiveAndEnabled && (Object)(object)componentInParent != (Object)null && componentInParent.IsLocalPlayer)
{
LocalPlayerController = val;
break;
}
}
}
private void InitColorWheel()
{
if ((Object)(object)colorWheelTexture == (Object)null)
{
colorWheelTexture = GenerateColorWheelTexture((int)wheelSize);
}
}
private void RefreshAvailableBodyParts()
{
availableBodyParts.Clear();
availableBodyParts.Add("ALL");
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if (!((Object)(object)val != (Object)null))
{
return;
}
Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>(true);
Renderer[] array = componentsInChildren;
foreach (Renderer val2 in array)
{
if (!((Object)val2).name.Contains("Outline") && !((Object)val2).name.Contains("UI") && !((Object)val2).name.Contains("HUD") && !availableBodyParts.Contains(((Object)val2).name))
{
availableBodyParts.Add(((Object)val2).name);
}
}
}
private void UpdateColorFromNetwork()
{
//IL_0075: 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_0057: Unknown result type (might be due to invalid IL or missing references)
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if (!((Object)(object)val != (Object)null))
{
return;
}
if (CustomColorSync.PlayerColors.TryGetValue(((NetworkBehaviour)val).NetworkObjectId, out var value))
{
if (value.TryGetValue(selectedPart, out var value2))
{
SetSelectedFromColor(value2);
}
else
{
SetSelectedFromColor(Color.white);
}
}
else
{
SetSelectedFromColor(Color.white);
}
}
private void PreviewColorLocally()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if ((Object)(object)val != (Object)null)
{
CustomColorSync.ApplyColorToPart(val, selectedPart, selectedColor, isDefault: false);
}
}
private void UpdateSelectedColorFromHSV()
{
//IL_001e: 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_0042: 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)
selectedColor = Color.HSVToRGB(selectedHue, selectedSaturation, Mathf.Max(0.02f, selectedValue));
if (uiColorPreview != null)
{
uiColorPreview.style.backgroundColor = StyleColor.op_Implicit(selectedColor);
}
PreviewColorLocally();
}
private void SetSelectedFromColor(Color color)
{
//IL_0001: 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_001c: 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_0047: Unknown result type (might be due to invalid IL or missing references)
Color.RGBToHSV(color, ref selectedHue, ref selectedSaturation, ref selectedValue);
selectedColor = color;
UpdateCursorPosition();
if (uiColorPreview != null)
{
uiColorPreview.style.backgroundColor = StyleColor.op_Implicit(selectedColor);
}
}
private Texture2D GenerateColorWheelTexture(int size)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_00c8: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
{
wrapMode = (TextureWrapMode)1,
filterMode = (FilterMode)1
};
float num = (float)size * 0.5f;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(num, num);
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
Vector2 val3 = new Vector2((float)j, (float)i) - val2;
if (((Vector2)(ref val3)).magnitude <= num)
{
float num2 = Mathf.Atan2(0f - val3.y, val3.x) / ((float)Math.PI * 2f);
if (num2 < 0f)
{
num2 += 1f;
}
val.SetPixel(j, size - 1 - i, Color.HSVToRGB(num2, ((Vector2)(ref val3)).magnitude / num, 1f));
}
else
{
val.SetPixel(j, size - 1 - i, Color.clear);
}
}
}
val.Apply();
return val;
}
private void ApplyColorNetworked(string partName, Color color)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if ((Object)(object)val != (Object)null)
{
CustomColorSync.ApplyColorToPart(val, partName, color, isDefault: false);
CustomColorSync.BroadcastColor(((NetworkBehaviour)val).NetworkObjectId, partName, color, isDefault: false);
}
}
private void ResetColor(bool resetAll)
{
//IL_0002: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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)
SetSelectedFromColor(Color.white);
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if (!((Object)(object)val != (Object)null))
{
return;
}
if (resetAll)
{
CustomColorSync.PlayerColors.Remove(((NetworkBehaviour)val).NetworkObjectId);
CustomColorSync.ApplyColorToPart(val, "ALL", Color.clear, isDefault: true);
CustomColorSync.BroadcastColor(((NetworkBehaviour)val).NetworkObjectId, "ALL", Color.clear, isDefault: true);
return;
}
if (CustomColorSync.PlayerColors.TryGetValue(((NetworkBehaviour)val).NetworkObjectId, out var value))
{
value.Remove(selectedPart);
}
CustomColorSync.ApplyColorToPart(val, selectedPart, Color.clear, isDefault: true);
CustomColorSync.BroadcastColor(((NetworkBehaviour)val).NetworkObjectId, selectedPart, Color.clear, isDefault: true);
}
private void RefreshPresetList()
{
if (string.IsNullOrEmpty(presetsDirectory))
{
presetsDirectory = Path.Combine(Paths.ConfigPath, "CustomizeMod_Presets");
}
if (Directory.Exists(presetsDirectory))
{
cachedPresetFiles = Directory.GetFiles(presetsDirectory, "*.cfg").ToList();
}
}
private void SaveCurrentConfigAsPreset(string name)
{
//IL_00f6: 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 (string.IsNullOrWhiteSpace(name))
{
return;
}
char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
foreach (char c in invalidFileNameChars)
{
name = name.Replace(c.ToString(), "");
}
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if (!((Object)(object)val != (Object)null))
{
return;
}
if (!CustomColorSync.PlayerColors.TryGetValue(((NetworkBehaviour)val).NetworkObjectId, out var value))
{
value = new Dictionary<string, Color>();
}
if (string.IsNullOrEmpty(presetsDirectory))
{
presetsDirectory = Path.Combine(Paths.ConfigPath, "CustomizeMod_Presets");
}
string path = Path.Combine(presetsDirectory, name + ".cfg");
List<string> list = new List<string>();
foreach (KeyValuePair<string, Color> item2 in value)
{
Color value2 = item2.Value;
string item = item2.Key + "=" + value2.r.ToString(CultureInfo.InvariantCulture) + "," + value2.g.ToString(CultureInfo.InvariantCulture) + "," + value2.b.ToString(CultureInfo.InvariantCulture);
list.Add(item);
}
File.WriteAllLines(path, list);
Log.LogInfo((object)("[Universal Color Mod] Saved preset: " + name + ".cfg"));
presetNameInput = "";
RefreshPresetList();
}
private void LoadPreset(string filePath)
{
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
if (!File.Exists(filePath))
{
return;
}
ResetColor(resetAll: true);
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if (!((Object)(object)val != (Object)null))
{
return;
}
string[] array = File.ReadAllLines(filePath);
string[] array2 = array;
Color color = default(Color);
foreach (string text in array2)
{
if (string.IsNullOrWhiteSpace(text))
{
continue;
}
string[] array3 = text.Split(new char[1] { '=' });
if (array3.Length == 2)
{
string partName = array3[0];
string[] array4 = array3[1].Split(new char[1] { ',' });
if (array4.Length >= 3 && float.TryParse(array4[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array4[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array4[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3))
{
((Color)(ref color))..ctor(result, result2, result3, 1f);
ApplyColorNetworked(partName, color);
}
}
}
Log.LogInfo((object)("[Universal Color Mod] Loaded preset: " + Path.GetFileName(filePath)));
UpdateColorFromNetwork();
}
private void DeletePreset(string filePath)
{
if (File.Exists(filePath))
{
File.Delete(filePath);
Log.LogInfo((object)("[Universal Color Mod] Deleted preset: " + Path.GetFileName(filePath)));
RefreshPresetList();
}
}
public void ToggleMenu(GameObject gnome)
{
if (isMenuOpen)
{
CloseMenu();
}
else
{
OpenMenu(gnome);
}
}
private void SetPlayerUIOpen(bool isOpen)
{
if ((Object)(object)LocalPlayerController != (Object)null)
{
FieldInfo field = typeof(PlayerController).GetField("isUiOpen", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(LocalPlayerController, isOpen);
LocalPlayerController.RefreshMouseState();
}
}
}
private void OpenMenu(GameObject gnome)
{
if ((Object)(object)LocalPlayerController != (Object)null && !isMenuOpen)
{
isMenuOpen = true;
menuOpenTime = Time.time;
activeGnome = gnome;
SetPlayerUIOpen(isOpen: true);
RefreshAvailableBodyParts();
UpdateColorFromNetwork();
RefreshPresetList();
BuildNativeUIToolkit();
}
}
private void CloseMenu()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if (isMenuOpen)
{
isMenuOpen = false;
activeGnome = null;
lastMenuCloseTime = Time.time;
DestroyCustomUI();
SetPlayerUIOpen(isOpen: false);
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if ((Object)(object)val != (Object)null)
{
CustomColorSync.ApplyColorToPart(val, "ALL", Color.clear, isDefault: true);
CustomColorSync.ApplyAllSavedColors(val);
}
}
}
private void DestroyCustomUI()
{
if (fullscreenOverlay != null)
{
fullscreenOverlay.RemoveFromHierarchy();
fullscreenOverlay = null;
}
uiRootElement = null;
uiContentContainer = null;
uiColorPreview = null;
uiWheelCursor = null;
partsScroll = null;
}
private void BuildNativeUIToolkit()
{
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Expected O, but got Unknown
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Expected O, but got Unknown
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0380: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Expected O, but got Unknown
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Expected O, but got Unknown
//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Expected O, but got Unknown
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_047b: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
//IL_04cd: Expected O, but got Unknown
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_050a: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_0548: Expected O, but got Unknown
//IL_0578: Unknown result type (might be due to invalid IL or missing references)
//IL_057d: 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_05ab: Unknown result type (might be due to invalid IL or missing references)
//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
//IL_060e: Unknown result type (might be due to invalid IL or missing references)
//IL_0618: Expected O, but got Unknown
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_063f: Unknown result type (might be due to invalid IL or missing references)
DestroyCustomUI();
UIDocument val = null;
if ((Object)(object)LocalPlayerController != (Object)null)
{
FieldInfo field = typeof(PlayerController).GetField("uiDoc", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
object? value = field.GetValue(LocalPlayerController);
val = (UIDocument)((value is UIDocument) ? value : null);
}
}
if ((Object)(object)val == (Object)null)
{
val = Object.FindFirstObjectByType<UIDocument>((FindObjectsInactive)1);
}
if ((Object)(object)val == (Object)null)
{
return;
}
Texture2D val2 = null;
if ((Object)(object)LocalPlayerController != (Object)null)
{
FieldInfo field2 = typeof(PlayerController).GetField("ingameMenu", BindingFlags.Instance | BindingFlags.NonPublic);
if (field2 != null)
{
GameObject val3 = (GameObject)field2.GetValue(LocalPlayerController);
if ((Object)(object)val3 != (Object)null)
{
Image[] componentsInChildren = val3.GetComponentsInChildren<Image>(true);
Image[] array = componentsInChildren;
foreach (Image val4 in array)
{
if ((Object)(object)val4.sprite != (Object)null && (Object)(object)val4.sprite.texture != (Object)null)
{
val2 = val4.sprite.texture;
break;
}
}
}
}
}
fullscreenOverlay = new VisualElement();
fullscreenOverlay.style.position = StyleEnum<Position>.op_Implicit((Position)1);
fullscreenOverlay.style.left = StyleLength.op_Implicit(0f);
fullscreenOverlay.style.top = StyleLength.op_Implicit(0f);
fullscreenOverlay.style.right = StyleLength.op_Implicit(0f);
fullscreenOverlay.style.bottom = StyleLength.op_Implicit(0f);
fullscreenOverlay.style.backgroundColor = StyleColor.op_Implicit(Color.clear);
uiRootElement = new VisualElement();
uiRootElement.style.position = StyleEnum<Position>.op_Implicit((Position)1);
uiRootElement.style.width = StyleLength.op_Implicit(Length.Percent(70f));
uiRootElement.style.height = StyleLength.op_Implicit(Length.Percent(80f));
uiRootElement.style.left = StyleLength.op_Implicit(Length.Percent(15f));
uiRootElement.style.top = StyleLength.op_Implicit(Length.Percent(10f));
uiRootElement.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)0);
uiRootElement.style.color = StyleColor.op_Implicit(Color.white);
uiRootElement.style.paddingLeft = StyleLength.op_Implicit(Length.Percent(6f));
uiRootElement.style.paddingRight = StyleLength.op_Implicit(Length.Percent(6f));
uiRootElement.style.paddingTop = StyleLength.op_Implicit(Length.Percent(4f));
uiRootElement.style.paddingBottom = StyleLength.op_Implicit(Length.Percent(4f));
if ((Object)(object)val2 != (Object)null)
{
uiRootElement.style.backgroundImage = new StyleBackground(val2);
uiRootElement.style.unityBackgroundImageTintColor = StyleColor.op_Implicit(Color.white);
uiRootElement.style.unityBackgroundScaleMode = StyleEnum<ScaleMode>.op_Implicit((ScaleMode)0);
}
else
{
uiRootElement.style.backgroundColor = new StyleColor(new Color(0.15f, 0.1f, 0.05f, 1f));
}
VisualElement val5 = new VisualElement();
val5.style.height = StyleLength.op_Implicit(50f);
val5.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
val5.style.backgroundColor = StyleColor.op_Implicit(Color.clear);
val5.style.marginBottom = StyleLength.op_Implicit(15f);
Button val6 = new Button((Action)delegate
{
currentTab = 0;
RenderCurrentTab();
});
((TextElement)val6).text = "Color Picker";
((VisualElement)val6).AddToClassList("defaultButton");
((VisualElement)val6).style.flexGrow = StyleFloat.op_Implicit(1f);
((VisualElement)val6).style.height = StyleLength.op_Implicit(45f);
((VisualElement)val6).style.fontSize = StyleLength.op_Implicit(18f);
((VisualElement)val6).style.marginRight = StyleLength.op_Implicit(15f);
val5.Add((VisualElement)(object)val6);
Button val7 = new Button((Action)delegate
{
currentTab = 1;
RenderCurrentTab();
});
((TextElement)val7).text = "Presets";
((VisualElement)val7).AddToClassList("defaultButton");
((VisualElement)val7).style.flexGrow = StyleFloat.op_Implicit(1f);
((VisualElement)val7).style.height = StyleLength.op_Implicit(45f);
((VisualElement)val7).style.fontSize = StyleLength.op_Implicit(18f);
val5.Add((VisualElement)(object)val7);
Button val8 = new Button((Action)delegate
{
CloseMenu();
});
((TextElement)val8).text = "X";
((VisualElement)val8).AddToClassList("defaultButton");
((VisualElement)val8).style.backgroundColor = new StyleColor(new Color(0.8f, 0.2f, 0.2f));
((VisualElement)val8).style.width = StyleLength.op_Implicit(50f);
((VisualElement)val8).style.height = StyleLength.op_Implicit(45f);
((VisualElement)val8).style.fontSize = StyleLength.op_Implicit(20f);
((VisualElement)val8).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
((VisualElement)val8).style.marginLeft = StyleLength.op_Implicit(30f);
val5.Add((VisualElement)(object)val8);
uiRootElement.Add(val5);
uiContentContainer = new VisualElement();
uiContentContainer.style.flexGrow = StyleFloat.op_Implicit(1f);
uiContentContainer.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
uiRootElement.Add(uiContentContainer);
fullscreenOverlay.Add(uiRootElement);
val.rootVisualElement.Add(fullscreenOverlay);
RenderCurrentTab();
}
private void RenderCurrentTab()
{
if (uiContentContainer != null)
{
uiContentContainer.Clear();
if (currentTab == 0)
{
RenderColorPickerTab();
}
else
{
RenderPresetsTab();
}
}
}
private void SelectPartAndUpdateVisuals(string part)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
PlayerNetworking val = (((Object)(object)LocalPlayerController != (Object)null) ? ((Component)LocalPlayerController).GetComponent<PlayerNetworking>() : null);
if ((Object)(object)val != (Object)null)
{
CustomColorSync.ApplyColorToPart(val, "ALL", Color.clear, isDefault: true);
CustomColorSync.ApplyAllSavedColors(val);
}
selectedPart = part;
UpdateColorFromNetwork();
if (partsScroll == null)
{
return;
}
foreach (VisualElement item in ((VisualElement)partsScroll).Children())
{
Button val2 = (Button)(object)((item is Button) ? item : null);
if (val2 != null)
{
if (((VisualElement)val2).userData as string == part)
{
((VisualElement)val2).style.color = StyleColor.op_Implicit(Color.yellow);
}
else
{
((VisualElement)val2).style.color = StyleColor.op_Implicit(Color.white);
}
}
}
}
private void RenderColorPickerTab()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Expected O, but got Unknown
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Expected O, but got Unknown
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Expected O, but got Unknown
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
//IL_0383: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_0440: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Unknown result type (might be due to invalid IL or missing references)
//IL_045b: Unknown result type (might be due to invalid IL or missing references)
//IL_0471: Unknown result type (might be due to invalid IL or missing references)
//IL_0476: Unknown result type (might be due to invalid IL or missing references)
//IL_048c: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04af: Expected O, but got Unknown
//IL_04bb: 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_04e9: Unknown result type (might be due to invalid IL or missing references)
//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
//IL_04ff: Expected O, but got Unknown
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_0526: Unknown result type (might be due to invalid IL or missing references)
//IL_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_0557: Unknown result type (might be due to invalid IL or missing references)
//IL_055c: Unknown result type (might be due to invalid IL or missing references)
//IL_0577: Unknown result type (might be due to invalid IL or missing references)
//IL_0592: Unknown result type (might be due to invalid IL or missing references)
//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_062f: Unknown result type (might be due to invalid IL or missing references)
//IL_0634: Unknown result type (might be due to invalid IL or missing references)
//IL_064f: Unknown result type (might be due to invalid IL or missing references)
//IL_066a: Unknown result type (might be due to invalid IL or missing references)
//IL_0685: Unknown result type (might be due to invalid IL or missing references)
//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0711: Unknown result type (might be due to invalid IL or missing references)
//IL_0718: Expected O, but got Unknown
//IL_0732: Unknown result type (might be due to invalid IL or missing references)
//IL_0749: Unknown result type (might be due to invalid IL or missing references)
//IL_0786: Unknown result type (might be due to invalid IL or missing references)
//IL_078d: Expected O, but got Unknown
//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
//IL_080a: Unknown result type (might be due to invalid IL or missing references)
//IL_080f: Unknown result type (might be due to invalid IL or missing references)
//IL_0830: Unknown result type (might be due to invalid IL or missing references)
//IL_0835: Unknown result type (might be due to invalid IL or missing references)
//IL_0849: Unknown result type (might be due to invalid IL or missing references)
//IL_0850: Expected O, but got Unknown
//IL_0858: Unknown result type (might be due to invalid IL or missing references)
//IL_086f: Unknown result type (might be due to invalid IL or missing references)
//IL_0886: Unknown result type (might be due to invalid IL or missing references)
//IL_088d: Expected O, but got Unknown
//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
//IL_090f: Unknown result type (might be due to invalid IL or missing references)
//IL_0921: Unknown result type (might be due to invalid IL or missing references)
//IL_0926: Unknown result type (might be due to invalid IL or missing references)
//IL_0947: Unknown result type (might be due to invalid IL or missing references)
//IL_094e: Expected O, but got Unknown
//IL_0974: Unknown result type (might be due to invalid IL or missing references)
//IL_098b: Unknown result type (might be due to invalid IL or missing references)
//IL_09a2: Unknown result type (might be due to invalid IL or missing references)
//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
//IL_09da: Unknown result type (might be due to invalid IL or missing references)
//IL_09df: Unknown result type (might be due to invalid IL or missing references)
//IL_09f1: Unknown result type (might be due to invalid IL or missing references)
//IL_09f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
VisualElement val = new VisualElement();
val.style.width = StyleLength.op_Implicit(Length.Percent(30f));
val.style.height = StyleLength.op_Implicit(Length.Percent(100f));
val.style.borderRightWidth = StyleFloat.op_Implicit(4f);
val.style.borderRightColor = new StyleColor(new Color(0.2f, 0.1f, 0.05f, 1f));
val.style.paddingRight = StyleLength.op_Implicit(25f);
Label val2 = new Label("PARTS");
((VisualElement)val2).style.fontSize = StyleLength.op_Implicit(24f);
((VisualElement)val2).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
((VisualElement)val2).style.marginBottom = StyleLength.op_Implicit(15f);
((VisualElement)val2).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)4);
val.Add((VisualElement)(object)val2);
partsScroll = new ScrollView((ScrollViewMode)0);
((VisualElement)partsScroll).style.flexGrow = StyleFloat.op_Implicit(1f);
foreach (string availableBodyPart in availableBodyParts)
{
string p = availableBodyPart;
string text = p.Replace("SM_", "").Replace("prefab_", "");
Button val3 = new Button((Action)delegate
{
SelectPartAndUpdateVisuals(p);
});
((TextElement)val3).text = text;
((VisualElement)val3).userData = p;
((VisualElement)val3).AddToClassList("defaultButton");
if (selectedPart == p)
{
((VisualElement)val3).style.color = StyleColor.op_Implicit(Color.yellow);
}
else
{
((VisualElement)val3).style.color = StyleColor.op_Implicit(Color.white);
}
((VisualElement)val3).style.height = StyleLength.op_Implicit(40f);
((VisualElement)val3).style.fontSize = StyleLength.op_Implicit(16f);
((VisualElement)val3).style.marginBottom = StyleLength.op_Implicit(8f);
((VisualElement)partsScroll).Add((VisualElement)(object)val3);
}
val.Add((VisualElement)(object)partsScroll);
uiContentContainer.Add(val);
VisualElement val4 = new VisualElement();
val4.style.flexGrow = StyleFloat.op_Implicit(1f);
val4.style.paddingLeft = StyleLength.op_Implicit(50f);
val4.style.paddingRight = StyleLength.op_Implicit(20f);
val4.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2);
uiColorPreview = new VisualElement();
uiColorPreview.style.width = StyleLength.op_Implicit(250f);
uiColorPreview.style.height = StyleLength.op_Implicit(50f);
uiColorPreview.style.backgroundColor = StyleColor.op_Implicit(selectedColor);
uiColorPreview.style.marginBottom = StyleLength.op_Implicit(20f);
uiColorPreview.style.borderTopLeftRadius = StyleLength.op_Implicit(5f);
uiColorPreview.style.borderTopRightRadius = StyleLength.op_Implicit(5f);
uiColorPreview.style.borderBottomLeftRadius = StyleLength.op_Implicit(5f);
uiColorPreview.style.borderBottomRightRadius = StyleLength.op_Implicit(5f);
uiColorPreview.style.borderTopWidth = StyleFloat.op_Implicit(2f);
uiColorPreview.style.borderBottomWidth = StyleFloat.op_Implicit(2f);
uiColorPreview.style.borderLeftWidth = StyleFloat.op_Implicit(2f);
uiColorPreview.style.borderRightWidth = StyleFloat.op_Implicit(2f);
uiColorPreview.style.borderTopColor = StyleColor.op_Implicit(Color.white);
uiColorPreview.style.borderBottomColor = StyleColor.op_Implicit(Color.white);
uiColorPreview.style.borderLeftColor = StyleColor.op_Implicit(Color.white);
uiColorPreview.style.borderRightColor = StyleColor.op_Implicit(Color.white);
val4.Add(uiColorPreview);
VisualElement val5 = new VisualElement();
val5.style.width = StyleLength.op_Implicit(wheelSize);
val5.style.height = StyleLength.op_Implicit(wheelSize);
val5.style.backgroundImage = new StyleBackground(colorWheelTexture);
uiWheelCursor = new VisualElement();
uiWheelCursor.style.position = StyleEnum<Position>.op_Implicit((Position)1);
uiWheelCursor.style.width = StyleLength.op_Implicit(16f);
uiWheelCursor.style.height = StyleLength.op_Implicit(16f);
uiWheelCursor.style.backgroundColor = StyleColor.op_Implicit(Color.white);
uiWheelCursor.style.borderTopLeftRadius = StyleLength.op_Implicit(8f);
uiWheelCursor.style.borderTopRightRadius = StyleLength.op_Implicit(8f);
uiWheelCursor.style.borderBottomLeftRadius = StyleLength.op_Implicit(8f);
uiWheelCursor.style.borderBottomRightRadius = StyleLength.op_Implicit(8f);
uiWheelCursor.style.borderTopColor = StyleColor.op_Implicit(Color.black);
uiWheelCursor.style.borderBottomColor = StyleColor.op_Implicit(Color.black);
uiWheelCursor.style.borderLeftColor = StyleColor.op_Implicit(Color.black);
uiWheelCursor.style.borderRightColor = StyleColor.op_Implicit(Color.black);
uiWheelCursor.style.borderTopWidth = StyleFloat.op_Implicit(2f);
uiWheelCursor.style.borderBottomWidth = StyleFloat.op_Implicit(2f);
uiWheelCursor.style.borderLeftWidth = StyleFloat.op_Implicit(2f);
uiWheelCursor.style.borderRightWidth = StyleFloat.op_Implicit(2f);
val5.Add(uiWheelCursor);
((CallbackEventHandler)val5).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
Vector2 val11 = default(Vector2);
((Vector2)(ref val11))..ctor(wheelSize / 2f, wheelSize / 2f);
if (Vector2.Distance(Vector2.op_Implicit(((PointerEventBase<PointerDownEvent>)(object)evt).localPosition), val11) <= wheelSize / 2f)
{
isDraggingWheel = true;
UpdateColorFromPointer(Vector2.op_Implicit(((PointerEventBase<PointerDownEvent>)(object)evt).localPosition));
PointerCaptureHelper.CapturePointer((IEventHandler)(VisualElement)((EventBase)evt).target, ((PointerEventBase<PointerDownEvent>)(object)evt).pointerId);
}
}, (TrickleDown)0);
((CallbackEventHandler)val5).RegisterCallback<PointerMoveEvent>((EventCallback<PointerMoveEvent>)delegate(PointerMoveEvent evt)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if (isDraggingWheel)
{
UpdateColorFromPointer(Vector2.op_Implicit(((PointerEventBase<PointerMoveEvent>)(object)evt).localPosition));
}
}, (TrickleDown)0);
((CallbackEventHandler)val5).RegisterCallback<PointerUpEvent>((EventCallback<PointerUpEvent>)delegate(PointerUpEvent evt)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
isDraggingWheel = false;
PointerCaptureHelper.ReleasePointer((IEventHandler)(VisualElement)((EventBase)evt).target, ((PointerEventBase<PointerUpEvent>)(object)evt).pointerId);
}, (TrickleDown)0);
val4.Add(val5);
Slider val6 = new Slider("Brightness", 0f, 1f, (SliderDirection)0, 0f);
((BaseField<float>)(object)val6).value = selectedValue;
((VisualElement)val6).style.width = StyleLength.op_Implicit(300f);
((VisualElement)val6).style.marginTop = StyleLength.op_Implicit(30f);
((Focusable)val6).focusable = false;
INotifyValueChangedExtensions.RegisterValueChangedCallback<float>((INotifyValueChanged<float>)(object)val6, (EventCallback<ChangeEvent<float>>)delegate(ChangeEvent<float> evt)
{
selectedValue = evt.newValue;
UpdateSelectedColorFromHSV();
});
val4.Add((VisualElement)(object)val6);
Button val7 = new Button((Action)delegate
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
ApplyColorNetworked(selectedPart, selectedColor);
});
((TextElement)val7).text = "APPLY TO SELECTED";
((VisualElement)val7).AddToClassList("defaultButton");
((VisualElement)val7).style.marginTop = StyleLength.op_Implicit(40f);
((VisualElement)val7).style.width = StyleLength.op_Implicit(300f);
((VisualElement)val7).style.height = StyleLength.op_Implicit(55f);
((VisualElement)val7).style.fontSize = StyleLength.op_Implicit(18f);
((VisualElement)val7).style.color = StyleColor.op_Implicit(Color.white);
((VisualElement)val7).style.backgroundColor = new StyleColor(new Color(0.2f, 0.6f, 0.2f));
val4.Add((VisualElement)(object)val7);
VisualElement val8 = new VisualElement();
val8.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
val8.style.marginTop = StyleLength.op_Implicit(20f);
Button val9 = new Button((Action)delegate
{
ResetColor(resetAll: false);
});
((TextElement)val9).text = "Reset Part";
((VisualElement)val9).AddToClassList("defaultButton");
((VisualElement)val9).style.marginRight = StyleLength.op_Implicit(15f);
((VisualElement)val9).style.height = StyleLength.op_Implicit(45f);
((VisualElement)val9).style.fontSize = StyleLength.op_Implicit(16f);
((VisualElement)val9).style.paddingLeft = StyleLength.op_Implicit(20f);
((VisualElement)val9).style.paddingRight = StyleLength.op_Implicit(20f);
((VisualElement)val9).style.color = StyleColor.op_Implicit(Color.white);
val8.Add((VisualElement)(object)val9);
Button val10 = new Button((Action)delegate
{
ResetColor(resetAll: true);
});
((TextElement)val10).text = "Reset All";
((VisualElement)val10).AddToClassList("defaultButton");
((VisualElement)val10).style.height = StyleLength.op_Implicit(45f);
((VisualElement)val10).style.fontSize = StyleLength.op_Implicit(16f);
((VisualElement)val10).style.paddingLeft = StyleLength.op_Implicit(20f);
((VisualElement)val10).style.paddingRight = StyleLength.op_Implicit(20f);
((VisualElement)val10).style.backgroundColor = new StyleColor(new Color(0.8f, 0.2f, 0.2f));
((VisualElement)val10).style.color = StyleColor.op_Implicit(Color.white);
val8.Add((VisualElement)(object)val10);
val4.Add(val8);
uiContentContainer.Add(val4);
UpdateCursorPosition();
}
private void RenderPresetsTab()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Expected O, but got Unknown
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Expected O, but got Unknown
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Expected O, but got Unknown
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_0387: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_03e1: Expected O, but got Unknown
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0400: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Expected O, but got Unknown
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_0477: Unknown result type (might be due to invalid IL or missing references)
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_0495: Expected O, but got Unknown
//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Expected O, but got Unknown
//IL_051a: Unknown result type (might be due to invalid IL or missing references)
//IL_0531: Unknown result type (might be due to invalid IL or missing references)
//IL_0548: Unknown result type (might be due to invalid IL or missing references)
//IL_055f: Unknown result type (might be due to invalid IL or missing references)
//IL_0571: Unknown result type (might be due to invalid IL or missing references)
//IL_0576: Unknown result type (might be due to invalid IL or missing references)
//IL_0598: Unknown result type (might be due to invalid IL or missing references)
//IL_059f: Expected O, but got Unknown
//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_062b: Unknown result type (might be due to invalid IL or missing references)
//IL_0630: Unknown result type (might be due to invalid IL or missing references)
VisualElement val = new VisualElement();
val.style.flexGrow = StyleFloat.op_Implicit(1f);
val.style.paddingLeft = StyleLength.op_Implicit(50f);
val.style.paddingTop = StyleLength.op_Implicit(30f);
val.style.paddingRight = StyleLength.op_Implicit(50f);
VisualElement val2 = new VisualElement();
val2.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
val2.style.marginBottom = StyleLength.op_Implicit(30f);
TextField nameField = new TextField("New Preset Name:");
((BaseField<string>)(object)nameField).value = presetNameInput;
((VisualElement)nameField).style.flexGrow = StyleFloat.op_Implicit(1f);
((VisualElement)nameField).style.fontSize = StyleLength.op_Implicit(18f);
((VisualElement)nameField).style.borderTopWidth = StyleFloat.op_Implicit(0f);
((VisualElement)nameField).style.borderBottomWidth = StyleFloat.op_Implicit(0f);
((VisualElement)nameField).style.borderLeftWidth = StyleFloat.op_Implicit(0f);
((VisualElement)nameField).style.borderRightWidth = StyleFloat.op_Implicit(0f);
Label val3 = UQueryExtensions.Q<Label>((VisualElement)(object)nameField, (string)null, (string)null);
if (val3 != null)
{
((VisualElement)val3).style.color = StyleColor.op_Implicit(Color.white);
((VisualElement)val3).style.fontSize = StyleLength.op_Implicit(18f);
}
ApplyTextInputStyles();
((CallbackEventHandler)nameField).RegisterCallback<GeometryChangedEvent>((EventCallback<GeometryChangedEvent>)delegate
{
ApplyTextInputStyles();
}, (TrickleDown)0);
INotifyValueChangedExtensions.RegisterValueChangedCallback<string>((INotifyValueChanged<string>)(object)nameField, (EventCallback<ChangeEvent<string>>)delegate(ChangeEvent<string> evt)
{
presetNameInput = evt.newValue;
});
val2.Add((VisualElement)(object)nameField);
Button val4 = new Button((Action)delegate
{
SaveCurrentConfigAsPreset(presetNameInput);
RenderCurrentTab();
});
((TextElement)val4).text = "SAVE";
((VisualElement)val4).AddToClassList("defaultButton");
((VisualElement)val4).style.backgroundColor = new StyleColor(new Color(0.2f, 0.6f, 0.2f));
((VisualElement)val4).style.color = StyleColor.op_Implicit(Color.white);
((VisualElement)val4).style.marginLeft = StyleLength.op_Implicit(15f);
((VisualElement)val4).style.width = StyleLength.op_Implicit(120f);
((VisualElement)val4).style.height = StyleLength.op_Implicit(45f);
((VisualElement)val4).style.fontSize = StyleLength.op_Implicit(18f);
((VisualElement)val4).style.marginTop = StyleLength.op_Implicit(0f);
((VisualElement)val4).style.marginBottom = StyleLength.op_Implicit(0f);
val2.Add((VisualElement)(object)val4);
val.Add(val2);
Label val5 = new Label("Saved Presets:");
((VisualElement)val5).style.fontSize = StyleLength.op_Implicit(22f);
((VisualElement)val5).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
((VisualElement)val5).style.marginBottom = StyleLength.op_Implicit(15f);
val.Add((VisualElement)(object)val5);
ScrollView val6 = new ScrollView((ScrollViewMode)0);
((VisualElement)val6).style.flexGrow = StyleFloat.op_Implicit(1f);
((VisualElement)val6).style.backgroundColor = StyleColor.op_Implicit(Color.clear);
((VisualElement)val6).style.paddingLeft = StyleLength.op_Implicit(10f);
((VisualElement)val6).style.paddingTop = StyleLength.op_Implicit(10f);
((VisualElement)val6).style.paddingRight = StyleLength.op_Implicit(10f);
if (cachedPresetFiles.Count == 0)
{
Label val7 = new Label("No presets found.");
((VisualElement)val7).style.fontSize = StyleLength.op_Implicit(18f);
((VisualElement)val7).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)4);
((VisualElement)val6).Add((VisualElement)(object)val7);
}
else
{
foreach (string cachedPresetFile in cachedPresetFiles)
{
string f = cachedPresetFile;
VisualElement val8 = new VisualElement();
val8.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
val8.style.marginBottom = StyleLength.op_Implicit(8f);
Label val9 = new Label(Path.GetFileNameWithoutExtension(f));
((VisualElement)val9).style.flexGrow = StyleFloat.op_Implicit(1f);
((VisualElement)val9).style.fontSize = StyleLength.op_Implicit(18f);
((VisualElement)val9).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)3);
val8.Add((VisualElement)(object)val9);
Button val10 = new Button((Action)delegate
{
LoadPreset(f);
});
((TextElement)val10).text = "Load";
((VisualElement)val10).AddToClassList("defaultButton");
((VisualElement)val10).style.width = StyleLength.op_Implicit(100f);
((VisualElement)val10).style.height = StyleLength.op_Implicit(40f);
((VisualElement)val10).style.fontSize = StyleLength.op_Implicit(16f);
((VisualElement)val10).style.marginRight = StyleLength.op_Implicit(10f);
((VisualElement)val10).style.color = StyleColor.op_Implicit(Color.white);
val8.Add((VisualElement)(object)val10);
Button val11 = new Button((Action)delegate
{
DeletePreset(f);
RenderCurrentTab();
});
((TextElement)val11).text = "Delete";
((VisualElement)val11).AddToClassList("defaultButton");
((VisualElement)val11).style.backgroundColor = new StyleColor(new Color(0.8f, 0.2f, 0.2f));
((VisualElement)val11).style.width = StyleLength.op_Implicit(100f);
((VisualElement)val11).style.height = StyleLength.op_Implicit(40f);
((VisualElement)val11).style.fontSize = StyleLength.op_Implicit(16f);
((VisualElement)val11).style.color = StyleColor.op_Implicit(Color.white);
val8.Add((VisualElement)(object)val11);
((VisualElement)val6).Add(val8);
}
}
val.Add((VisualElement)(object)val6);
uiContentContainer.Add(val);
void ApplyTextInputStyles()
{
//IL_003f: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
VisualElement val12 = UQueryExtensions.Q((VisualElement)(object)nameField, (string)null, "unity-base-text-field__input");
if (val12 == null)
{
val12 = UQueryExtensions.Q((VisualElement)(object)nameField, (string)null, "unity-text-field__input");
}
if (val12 != null)
{
val12.style.color = StyleColor.op_Implicit(Color.black);
val12.style.backgroundColor = StyleColor.op_Implicit(Color.white);
val12.style.fontSize = StyleLength.op_Implicit(18f);
val12.style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
val12.style.borderTopWidth = StyleFloat.op_Implicit(0f);
val12.style.borderBottomWidth = StyleFloat.op_Implicit(0f);
val12.style.borderLeftWidth = StyleFloat.op_Implicit(0f);
val12.style.borderRightWidth = StyleFloat.op_Implicit(0f);
val12.style.borderTopColor = StyleColor.op_Implicit(Color.clear);
val12.style.borderBottomColor = StyleColor.op_Implicit(Color.clear);
val12.style.borderLeftColor = StyleColor.op_Implicit(Color.clear);
val12.style.borderRightColor = StyleColor.op_Implicit(Color.clear);
}
}
}
private void UpdateColorFromPointer(Vector2 localPos)
{
//IL_0020: 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_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0050: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(wheelSize / 2f, wheelSize / 2f);
Vector2 val2 = localPos - val;
float num = wheelSize / 2f;
selectedSaturation = Mathf.Clamp01(((Vector2)(ref val2)).magnitude / num);
float num2 = Mathf.Atan2(0f - val2.y, val2.x);
selectedHue = num2 / ((float)Math.PI * 2f);
if (selectedHue < 0f)
{
selectedHue += 1f;
}
UpdateSelectedColorFromHSV();
UpdateCursorPosition();
}
private void UpdateCursorPosition()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
if (uiWheelCursor != null)
{
float num = selectedHue * (float)Math.PI * 2f;
float num2 = selectedSaturation * (wheelSize / 2f);
float num3 = Mathf.Cos(num) * num2 + wheelSize / 2f;
float num4 = (0f - Mathf.Sin(num)) * num2 + wheelSize / 2f;
uiWheelCursor.style.left = StyleLength.op_Implicit(num3 - 8f);
uiWheelCursor.style.top = StyleLength.op_Implicit(num4 - 8f);
}
}
}
}