Decompiled source of ItemDisplayPlacementHelper v1.7.1
plugins/ItemDisplayPlacementHelper/ItemDisplayPlacementHelper.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
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.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Generics.Dynamics; using ItemDisplayPlacementHelper.AnimatorEditing; using ItemDisplayPlacementHelper.AxisEditing; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using RoR2; using RoR2.ContentManagement; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] public class InvariatCultureDecimalValidator : MonoBehaviour { private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown ((Component)this).GetComponent<TMP_InputField>().onValidateInput = new OnValidateInput(Validate); } private char Validate(string text, int pos, char ch) { if ((pos != 0 || text.Length <= 0 || text[0] != '-') && ((ch >= '0' && ch <= '9') || (ch == '-' && pos == 0) || (ch == '.' && !text.Contains(".")))) { return ch; } return '\0'; } } namespace ItemDisplayPlacementHelper { public class AnimatorParametersController : MonoBehaviour { private CharacterModel currentModel; private Animator currentAnimator; public Transform container; private readonly List<AnimatorParameterField> rows = new List<AnimatorParameterField>(); [Space] public GameObject boolRowPrefab; public GameObject intRowPrefab; public GameObject floatRowPrefab; private void Awake() { ModelPicker.OnModelChanged += OnModelChanged; } private void OnDestroy() { ModelPicker.OnModelChanged -= OnModelChanged; } private void OnModelChanged(CharacterModel model) { //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_00a1: 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_00ba: Expected I4, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 foreach (AnimatorParameterField row in rows) { Object.Destroy((Object)(object)((Component)row).gameObject); } rows.Clear(); currentAnimator = null; currentModel = model; if (Object.op_Implicit((Object)(object)currentModel)) { currentAnimator = ((Component)currentModel).GetComponent<Animator>(); } if (!Object.op_Implicit((Object)(object)currentAnimator)) { return; } AnimatorControllerParameter[] parameters = currentAnimator.parameters; foreach (AnimatorControllerParameter val in parameters) { GameObject val2 = null; AnimatorControllerParameterType type = val.type; switch (type - 1) { default: if ((int)type == 9) { continue; } break; case 0: val2 = Object.Instantiate<GameObject>(floatRowPrefab, container); break; case 2: val2 = Object.Instantiate<GameObject>(intRowPrefab, container); break; case 3: val2 = Object.Instantiate<GameObject>(boolRowPrefab, container); break; case 1: break; } AnimatorParameterField component = val2.GetComponent<AnimatorParameterField>(); component.animator = currentAnimator; component.parameter = val; rows.Add(component); val2.SetActive(true); } } } internal static class AssetsHelper { public static AssetBundle SceneBundle { get; private set; } public static void LoadAssetBundle() { SceneBundle = AssetBundle.LoadFromFile(GetBundlePath("kingenderbrine_idrs_editor")); } private static string GetBundlePath(string bundleName) { return Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)ItemDisplayPlacementHelperPlugin.Instance).Info.Location), bundleName); } } public class BepInExConfigController : MonoBehaviour { public SensitivityController sensitivityController; public ParentedPrefabDisplayController parentedPrefabDisplayController; private void Start() { sensitivityController.fastCoefficientInput.Value = ConfigHelper.FastCoefficient.Value; sensitivityController.slowCoefficientInput.Value = ConfigHelper.SlowCoefficient.Value; parentedPrefabDisplayController.CopyFormat = ConfigHelper.CopyFormat.Value; parentedPrefabDisplayController.customFormatInput.text = FromConfigFriendly(ConfigHelper.CustomFormat.Value); ((MonoBehaviour)this).StartCoroutine(SaveCurrentValues()); } private void OnDestroy() { ((MonoBehaviour)this).StopAllCoroutines(); } private IEnumerator SaveCurrentValues() { while (true) { yield return (object)new WaitForSeconds(10f); ConfigHelper.FastCoefficient.Value = sensitivityController.fastCoefficientInput.Value; ConfigHelper.SlowCoefficient.Value = sensitivityController.slowCoefficientInput.Value; ConfigHelper.CopyFormat.Value = parentedPrefabDisplayController.CopyFormat; ConfigHelper.CustomFormat.Value = ToConfigFriendly(parentedPrefabDisplayController.customFormatInput.text); } } private static string ToConfigFriendly(string str) { return Convert.ToBase64String(Encoding.UTF8.GetBytes(str)).Replace('=', '-'); } private static string FromConfigFriendly(string str) { return Encoding.UTF8.GetString(Convert.FromBase64String(str.Replace('-', '='))); } } public class CameraPostprocessEventHandler : MonoBehaviour { public static EventHandler onPostRender; private void OnPostRender() { onPostRender?.Invoke(this, null); } } public static class ConfigHelper { public static ConfigEntry<float> FastCoefficient { get; private set; } public static ConfigEntry<float> SlowCoefficient { get; private set; } public static ConfigEntry<CopyFormat> CopyFormat { get; private set; } public static ConfigEntry<string> CustomFormat { get; private set; } internal static void InitConfigs(ConfigFile config) { FastCoefficient = config.Bind<float>("EditorInputs", "FastCoefficient", 2.5f, (ConfigDescription)null); SlowCoefficient = config.Bind<float>("EditorInputs", "SlowCoefficient", 0.1f, (ConfigDescription)null); CopyFormat = config.Bind<CopyFormat>("EditorInputs", "CopyFormat", ItemDisplayPlacementHelper.CopyFormat.Block, (ConfigDescription)null); CustomFormat = config.Bind<string>("EditorInputs", "CustomFormat", "", (ConfigDescription)null); } } public class DialogController : MonoBehaviour { public TMP_Text textComponent; public GameObject container; private static DialogController Instance { get; set; } private void Awake() { Instance = this; } private void OnDestroy() { Instance = null; } public static void ShowError(string text) { if (Object.op_Implicit((Object)(object)Instance)) { Instance.textComponent.text = text; Instance.container.SetActive(true); } } public void Ok() { container.SetActive(false); } } public class DisplayRuleGroupEditingController : MonoBehaviour { public delegate void OnDisplayRuleGroupChangedHadler(DisplayRuleGroup displayRuleGroup); public GameObject rowPrefab; public Transform container; public Button reapplyButton; private CharacterModel characterModel; public static OnDisplayRuleGroupChangedHadler OnDisplayRuleGroupChanged; private readonly List<ParentedPrefabDisplay> parentedPrefabDisplays = new List<ParentedPrefabDisplay>(); private readonly List<GameObject> rows = new List<GameObject>(); private ItemDisplayRuleSet TempRuleSet; public static DisplayRuleGroupEditingController Instance { get; private set; } public DisplayRuleGroup DisplayRuleGroup { get; private set; } public ItemDisplayRuleSetController.Catalog Catalog { get; private set; } public int Index { get; private set; } = -1; private void Awake() { Instance = this; ModelPicker.OnModelChanged += OnModelChanged; TempRuleSet = ScriptableObject.CreateInstance<ItemDisplayRuleSet>(); TempRuleSet.GenerateRuntimeValues(); } private void OnDestroy() { ModelPicker.OnModelChanged -= OnModelChanged; Instance = null; Object.Destroy((Object)(object)TempRuleSet); } private void Update() { ((Selectable)reapplyButton).interactable = Index != -1; } private void OnModelChanged(CharacterModel characterModel) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) this.characterModel = characterModel; SetDisplayRuleGroup(default(DisplayRuleGroup), ItemDisplayRuleSetController.Catalog.Item, -1); } public void SetDisplayRuleGroup(DisplayRuleGroup displayRuleGroup, ItemDisplayRuleSetController.Catalog catalog, int index) { //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_0110: 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_0128: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) DisplayRuleGroup displayRuleGroup2 = DisplayRuleGroup; if (((DisplayRuleGroup)(ref displayRuleGroup2)).Equals(displayRuleGroup) && Catalog == catalog && Index == index) { return; } DisplayRuleGroup = displayRuleGroup; Catalog = catalog; Index = index; parentedPrefabDisplays.Clear(); rows.ForEach((Action<GameObject>)Object.Destroy); rows.Clear(); if (index == -1 || !Object.op_Implicit((Object)(object)characterModel)) { OnDisplayRuleGroupChanged(displayRuleGroup); return; } switch (catalog) { case ItemDisplayRuleSetController.Catalog.Item: { ItemIndex itemIndex = (ItemIndex)index; parentedPrefabDisplays.AddRange(characterModel.parentedPrefabDisplays.Where((ParentedPrefabDisplay el) => el.itemIndex == itemIndex)); break; } case ItemDisplayRuleSetController.Catalog.Equipment: { EquipmentIndex equipmentIndex = (EquipmentIndex)index; parentedPrefabDisplays.AddRange(characterModel.parentedPrefabDisplays.Where((ParentedPrefabDisplay el) => el.equipmentIndex == equipmentIndex)); break; } } for (int i = 0; i < parentedPrefabDisplays.Count; i++) { GameObject val = Object.Instantiate<GameObject>(rowPrefab, container); ItemDisplayRulePreviewController component = val.GetComponent<ItemDisplayRulePreviewController>(); component.itemDisplayRule = displayRuleGroup.rules[i]; component.parentedPrefabDisplay = parentedPrefabDisplays[i]; ParentedPrefabDisplay val2 = parentedPrefabDisplays[i]; ItemFollower component2 = ((ParentedPrefabDisplay)(ref val2)).instance.GetComponent<ItemFollower>(); if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.followerPrefab)) { ((MonoBehaviour)component2).StartCoroutine(AddComponentToFollowerInstanceCoroutine(component2)); } val.SetActive(true); rows.Add(val); } OnDisplayRuleGroupChanged(displayRuleGroup); } public void ReapplyCurrentDisplayGroup() { //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_0012: 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_0040: 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_0066: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) DisplayRuleGroup displayRuleGroup = DisplayRuleGroup; int num = Array.IndexOf(displayRuleGroup.rules, ParentedPrefabDisplayController.Instance.ItemDisplayRule); ItemDisplayRule[] array = displayRuleGroup.rules.ToArray(); for (int i = 0; i < parentedPrefabDisplays.Count; i++) { ParentedPrefabDisplay val = parentedPrefabDisplays[i]; GameObject instance = ((ParentedPrefabDisplay)(ref val)).instance; Transform parent = instance.transform.parent; ItemDisplayRule val2 = array[i]; val2.localPos = instance.transform.localPosition; val2.localScale = instance.transform.localScale; val2.localAngles = instance.transform.localEulerAngles; val2.childName = ((IEnumerable<NameTransformPair>)characterModel.childLocator.transformPairs).FirstOrDefault((Func<NameTransformPair, bool>)((NameTransformPair p) => (Object)(object)p.transform == (Object)(object)parent)).name; array[i] = val2; } displayRuleGroup.rules = array; DisplayRuleGroupPreviewController displayRuleGroupPreviewController; if (Catalog == ItemDisplayRuleSetController.Catalog.Item) { displayRuleGroupPreviewController = ItemDisplayRuleSetController.Instance.ItemRows[Index]; TempRuleSet.runtimeItemRuleGroups[Index] = displayRuleGroup; } else { displayRuleGroupPreviewController = ItemDisplayRuleSetController.Instance.EquipmentRows[Index]; TempRuleSet.runtimeEquipmentRuleGroups[Index] = displayRuleGroup; } displayRuleGroupPreviewController.ToggleDisplay(display: false); ItemDisplayRuleSet itemDisplayRuleSet = characterModel.itemDisplayRuleSet; characterModel.itemDisplayRuleSet = TempRuleSet; displayRuleGroupPreviewController.EditDisplayRuleGroup(); characterModel.itemDisplayRuleSet = itemDisplayRuleSet; ParentedPrefabDisplayController.Instance.SetItemDisplayRule(DisplayRuleGroup.rules[num], parentedPrefabDisplays[num]); } private IEnumerator AddComponentToFollowerInstanceCoroutine(ItemFollower itemFollower) { yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)itemFollower.followerInstance))); itemFollower.followerInstance.AddComponent<MatchLocalScale>().target = ((Component)itemFollower).transform; } } public class DisplayRuleGroupPreviewController : MonoBehaviour { [HideInInspector] public Sprite icon; [HideInInspector] public string nameText; [HideInInspector] public DisplayRuleGroup displayRuleGroup; [HideInInspector] public ItemDisplayRuleSetController.Catalog catalog; [HideInInspector] public int index; private CharacterModel characterModel; [SerializeField] private Image imageComponent; [SerializeField] private TextMeshProUGUI textComponent; [SerializeField] private Toggle toggleComponent; [SerializeField] private Button buttonComponent; [SerializeField] private ToggleGroup toggleGroupComponent; [SerializeField] private Image background; private void Awake() { characterModel = ModelPicker.Instance.CharacterModel; ModelPicker.OnModelChanged += OnModelChanged; } private void OnDestroy() { ModelPicker.OnModelChanged -= OnModelChanged; } private void OnModelChanged(CharacterModel characterModel) { this.characterModel = characterModel; } private void Start() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 ((TMP_Text)textComponent).text = nameText; imageComponent.sprite = icon; switch (catalog) { case ItemDisplayRuleSetController.Catalog.Item: toggleComponent.isOn = characterModel.enabledItemDisplays.Contains((ItemIndex)index); break; case ItemDisplayRuleSetController.Catalog.Equipment: toggleComponent.group = toggleGroupComponent; toggleComponent.isOn = (int)characterModel.currentEquipmentDisplayIndex == index; break; } } public void EditDisplayRuleGroup() { //IL_004c: 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_0031: Unknown result type (might be due to invalid IL or missing references) if (DisplayRuleGroupEditingController.Instance.Catalog == catalog && DisplayRuleGroupEditingController.Instance.Index == index) { DisplayRuleGroupEditingController.Instance.SetDisplayRuleGroup(default(DisplayRuleGroup), ItemDisplayRuleSetController.Catalog.Item, -1); return; } toggleComponent.isOn = true; DisplayRuleGroupEditingController.Instance.SetDisplayRuleGroup(displayRuleGroup, catalog, index); } public void ToggleDisplay(bool display) { //IL_00ab: 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) if (toggleComponent.isOn != display) { toggleComponent.isOn = display; return; } if (display) { switch (catalog) { case ItemDisplayRuleSetController.Catalog.Item: characterModel.EnableItemDisplay((ItemIndex)index); break; case ItemDisplayRuleSetController.Catalog.Equipment: characterModel.SetEquipmentDisplay((EquipmentIndex)index); break; } return; } switch (catalog) { case ItemDisplayRuleSetController.Catalog.Item: characterModel.DisableItemDisplay((ItemIndex)index); break; case ItemDisplayRuleSetController.Catalog.Equipment: characterModel.SetEquipmentDisplay((EquipmentIndex)(-1)); break; } if (DisplayRuleGroupEditingController.Instance.Catalog == catalog && DisplayRuleGroupEditingController.Instance.Index == index) { DisplayRuleGroupEditingController.Instance.SetDisplayRuleGroup(default(DisplayRuleGroup), ItemDisplayRuleSetController.Catalog.Item, -1); } } private void Update() { ((Behaviour)background).enabled = DisplayRuleGroupEditingController.Instance.Catalog == catalog && DisplayRuleGroupEditingController.Instance.Index == index; } } public class DropdownItem : MonoBehaviour, IEventSystemHandler, ICancelHandler { public TMP_Text text; public Image image; public RectTransform rectTransform; public Button button; [HideInInspector] public object Value { get; set; } public virtual void OnCancel(BaseEventData eventData) { SearchableDropdown componentInParent = ((Component)this).GetComponentInParent<SearchableDropdown>(); if (Object.op_Implicit((Object)(object)componentInParent)) { componentInParent.Hide(); } } } public class EditorConfigPanel : MonoBehaviour { private static readonly MethodInfo dynamicBonesLateUpdateMethod = typeof(DynamicBone).GetMethod("LateUpdate", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo timeGetUnscaledDeltaTimeMethod = typeof(Time).GetProperty("unscaledDeltaTime").GetGetMethod(); public CameraRigController cameraRigController; [Space] public Toggle fadeToggle; public Toggle timeToggle; public Toggle dynamicBonesTimeToggle; [Space] public Button editorSpaceButton; public TextMeshProUGUI editorSpaceText; [Space] public Toggle editorModeMove; public Toggle editorModeRotate; public Toggle editorModeScale; private bool skipNotification; private ILHook dynamicBonesHook; private void OnDestroy() { if (dynamicBonesHook != null) { dynamicBonesHook.Undo(); } } private void Update() { skipNotification = true; if (Object.op_Implicit((Object)(object)cameraRigController)) { fadeToggle.isOn = cameraRigController.enableFading; } timeToggle.isOn = Time.timeScale > 0f; ((Selectable)editorSpaceButton).interactable = !EditorAxisController.Instance.OverrideToLocalSpace; switch (EditorAxisController.Instance.EditSpace) { case EditSpace.Global: ((TMP_Text)editorSpaceText).text = "Global"; break; case EditSpace.Local: ((TMP_Text)editorSpaceText).text = "Local"; break; } editorModeMove.isOn = EditorAxisController.Instance.EditMode == EditMode.Move; editorModeRotate.isOn = EditorAxisController.Instance.EditMode == EditMode.Rotate; editorModeScale.isOn = EditorAxisController.Instance.EditMode == EditMode.Scale; skipNotification = false; } public void ToggleTime(bool enabled) { if (!skipNotification) { Time.timeScale = (enabled ? 1 : 0); } } public void ToggleFade(bool enabled) { if (!skipNotification && Object.op_Implicit((Object)(object)cameraRigController)) { cameraRigController.enableFading = enabled; } } public void ToggleEditModeMove(bool value) { if (!skipNotification && value) { EditorAxisController.Instance.EditMode = EditMode.Move; } } public void ToggleEditModeScale(bool value) { if (!skipNotification && value) { EditorAxisController.Instance.EditMode = EditMode.Scale; } } public void ToggleEditModeRotate(bool value) { if (!skipNotification && value) { EditorAxisController.Instance.EditMode = EditMode.Rotate; } } public void ToggleEditSpace() { switch (EditorAxisController.Instance.ActualEditSpace) { case EditSpace.Global: EditorAxisController.Instance.ActualEditSpace = EditSpace.Local; break; case EditSpace.Local: EditorAxisController.Instance.ActualEditSpace = EditSpace.Global; break; } } public void ToggleDynamicBonesTimeScale(bool enabled) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (skipNotification) { return; } if (enabled) { if (dynamicBonesHook == null) { dynamicBonesHook = new ILHook((MethodBase)dynamicBonesLateUpdateMethod, new Manipulator(DynamicBonesLateUpdateIL)); } } else if (dynamicBonesHook != null) { dynamicBonesHook.Undo(); dynamicBonesHook = null; } } private void DynamicBonesLateUpdateIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Time>(x, "get_deltaTime") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Call, (MethodBase)timeGetUnscaledDeltaTimeMethod); } } public class EditorHUD : MonoBehaviour { public EditorSceneCameraController cameraController; public CameraRigController cameraRigController; private float oldTimeScale; public static EditorHUD Instance { get; private set; } private void Awake() { Instance = this; oldTimeScale = Time.timeScale; Time.timeScale = 1f; AkSoundEngine.PostEvent("Pause_All", (GameObject)null); PauseManager.onPauseEndGlobal = (Action)Delegate.Combine(PauseManager.onPauseEndGlobal, new Action(OnPauseEnd)); } private void Start() { ((Behaviour)((Component)this).GetComponent<CursorOpener>()).enabled = true; } private void OnDestroy() { Instance = null; PauseManager.onPauseEndGlobal = (Action)Delegate.Remove(PauseManager.onPauseEndGlobal, new Action(OnPauseEnd)); Time.timeScale = oldTimeScale; AkSoundEngine.PostEvent("Unpause_All", (GameObject)null); } private void Update() { if ((double)Time.timeScale < 0.01) { Physics.SyncTransforms(); } } private void OnPauseEnd() { AkSoundEngine.PostEvent("Pause_All", (GameObject)null); } } public class EditorKeysHandler : MonoBehaviour { public CameraRigController cameraRigController; private MPEventSystemLocator eventSystemLocator; private GameObject lastCheckedObject; private bool disallowKeyPress; private void Awake() { eventSystemLocator = ((Component)this).GetComponent<MPEventSystemLocator>(); } private void Update() { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)eventSystemLocator.eventSystem)) { return; } GameObject currentSelectedGameObject = ((EventSystem)eventSystemLocator.eventSystem).currentSelectedGameObject; if (!Object.op_Implicit((Object)(object)currentSelectedGameObject)) { disallowKeyPress = false; lastCheckedObject = null; } else if ((Object)(object)currentSelectedGameObject != (Object)(object)lastCheckedObject) { if (Object.op_Implicit((Object)(object)currentSelectedGameObject.GetComponent<TMP_InputField>()) || Object.op_Implicit((Object)(object)currentSelectedGameObject.GetComponent<InputField>())) { disallowKeyPress = true; } else { disallowKeyPress = false; } lastCheckedObject = currentSelectedGameObject; } if (disallowKeyPress) { return; } if (Input.GetKeyDown((KeyCode)119)) { EditorAxisController.Instance.EditMode = EditMode.Move; } else if (Input.GetKeyDown((KeyCode)101)) { EditorAxisController.Instance.EditMode = EditMode.Rotate; } else if (Input.GetKeyDown((KeyCode)114)) { EditorAxisController.Instance.EditMode = EditMode.Scale; } if (Input.GetKeyDown((KeyCode)120)) { switch (EditorAxisController.Instance.ActualEditSpace) { case EditSpace.Global: EditorAxisController.Instance.ActualEditSpace = EditSpace.Local; break; case EditSpace.Local: EditorAxisController.Instance.ActualEditSpace = EditSpace.Global; break; } } if (Input.GetKeyDown((KeyCode)116)) { Time.timeScale = ((Time.timeScale == 0f) ? 1 : 0); } if (Input.GetKeyDown((KeyCode)102) && Object.op_Implicit((Object)(object)ParentedPrefabDisplayController.Instance)) { ParentedPrefabDisplay parentedPrefabDisplay = ParentedPrefabDisplayController.Instance.ParentedPrefabDisplay; if (Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance)) { EditorSceneCameraController instance = EditorSceneCameraController.Instance; parentedPrefabDisplay = ParentedPrefabDisplayController.Instance.ParentedPrefabDisplay; instance.FocusOnPoint(((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.position); } } if (Input.GetKeyDown((KeyCode)103) && Object.op_Implicit((Object)(object)cameraRigController)) { cameraRigController.enableFading = !cameraRigController.enableFading; } } } public class EditorSceneCameraController : MonoBehaviour, ICameraStateProvider, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { private enum ActionType { None, Rotation, Movement } private const float minFocusLength = 0.1f; private float focusLength = 4f; private const float rotationMultiplier = 0.15f; private const float sidewaysMovementMultiplier = 0.01f; private const float forwardMovementMultiplier = 0.3f; public float sidewaysMovementSensitivity = 1f; public float rotationSensitivity = 1f; public float forwardMovementSensitivity = 1f; public float slowCoefficient = 0.1f; public float fastCoefficient = 3f; [Space] public Transform cameraDefaultPosition; public CameraRigController CameraRigController; public static EditorSceneCameraController Instance; private Vector3 previousMousePosition; private ActionType currentActionType; private Vector3? lerpPosition; private float lerpCameraTime; public bool PointerInside { get; private set; } private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Instance = this; CameraRigController.SetOverrideCam((ICameraStateProvider)(object)this, 0f); ((Component)CameraRigController).transform.SetPositionAndRotation(cameraDefaultPosition.position, cameraDefaultPosition.rotation); } private void OnDestroy() { Instance = null; if (Object.op_Implicit((Object)(object)CameraRigController)) { CameraRigController.SetOverrideCam((ICameraStateProvider)null, 0f); } } private void Update() { //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0408: 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_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00d6: 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_00fe: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) float num = (Input.GetKey((KeyCode)306) ? slowCoefficient : (Input.GetKey((KeyCode)304) ? fastCoefficient : 1f)); if (PointerInside) { if (currentActionType == ActionType.None) { if (Input.GetMouseButtonDown(2)) { if (Input.GetKey((KeyCode)308)) { Vector3 val = default(Vector3); foreach (KeyValuePair<SkinnedMeshRenderer, MeshCollider> cachedSkinnedMeshRenderer in ModelPicker.Instance.CachedSkinnedMeshRenderers) { Vector3 localScale = ((Component)cachedSkinnedMeshRenderer.Key).transform.localScale; Vector3 lossyScale = ((Component)cachedSkinnedMeshRenderer.Key).transform.lossyScale; ((Vector3)(ref val))..ctor(localScale.x / lossyScale.x, localScale.y / lossyScale.y, localScale.z / lossyScale.z); if (localScale != Vector3.one || val != Vector3.one) { ((Component)cachedSkinnedMeshRenderer.Key).transform.localScale = val; } cachedSkinnedMeshRenderer.Key.BakeMesh(cachedSkinnedMeshRenderer.Value.sharedMesh); cachedSkinnedMeshRenderer.Value.sharedMesh = cachedSkinnedMeshRenderer.Value.sharedMesh; if (localScale != Vector3.one || val != Vector3.one) { ((Component)cachedSkinnedMeshRenderer.Key).transform.localScale = localScale; } } RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val2, 5000f, LayerMask.GetMask(new string[1] { "World" }))) { lerpPosition = ((RaycastHit)(ref val2)).point + ((Component)CameraRigController).transform.forward * -1f * focusLength; lerpCameraTime = 0f; } } else { currentActionType = ActionType.Movement; lerpPosition = null; } } else if (Input.GetMouseButtonDown(1)) { currentActionType = ActionType.Rotation; lerpPosition = null; } } Vector3 val3 = ((Component)CameraRigController).transform.forward * Input.mouseScrollDelta.y * forwardMovementSensitivity * 0.3f * num; if (Input.GetKey((KeyCode)308)) { float num2 = Mathf.Sign(Input.mouseScrollDelta.y); if (num2 == 1f && focusLength <= 0.1f) { val3 = Vector3.zero; focusLength = 0.1f; } else { float num3 = Mathf.Max((float)Math.Log(focusLength), 0.5f); val3 *= num3; if (focusLength - num2 * ((Vector3)(ref val3)).magnitude <= 0.1f) { val3 = Vector3.zero; } focusLength -= num2 * ((Vector3)(ref val3)).magnitude; } } if (val3 != Vector3.zero) { lerpPosition = null; } Transform transform = ((Component)CameraRigController).transform; transform.position += val3; } if (lerpPosition.HasValue) { lerpCameraTime += Time.unscaledDeltaTime; ((Component)CameraRigController).transform.position = Vector3.Lerp(((Component)CameraRigController).transform.position, lerpPosition.Value, lerpCameraTime); if (lerpCameraTime >= 1f) { lerpPosition = null; } } if (EditorAxisController.Instance.SelectedAxis == Axis.None) { Vector3 val4 = Input.mousePosition - previousMousePosition; switch (currentActionType) { case ActionType.Movement: { Transform transform2 = ((Component)CameraRigController).transform; transform2.position -= ((Component)CameraRigController).transform.up * val4.y * sidewaysMovementSensitivity * 0.01f * num; Transform transform3 = ((Component)CameraRigController).transform; transform3.position -= ((Component)CameraRigController).transform.right * val4.x * sidewaysMovementSensitivity * 0.01f * num; break; } case ActionType.Rotation: if (Input.GetKey((KeyCode)308)) { Vector3 val5 = ((Component)CameraRigController).transform.position + ((Component)CameraRigController).transform.forward * focusLength; ((Component)CameraRigController).transform.RotateAround(val5, ((Component)CameraRigController).transform.right, val4.y * rotationSensitivity * 0.15f * -2f); ((Component)CameraRigController).transform.RotateAround(val5, Vector3.up, val4.x * rotationSensitivity * 0.15f * 2f); } else { ((Component)CameraRigController).transform.Rotate(Vector3.right, val4.y * rotationSensitivity * 0.15f * -1f, (Space)1); ((Component)CameraRigController).transform.Rotate(Vector3.up, val4.x * rotationSensitivity * 0.15f, (Space)0); } break; } } if (currentActionType != 0 && Input.GetMouseButtonUp((int)currentActionType)) { currentActionType = ActionType.None; } previousMousePosition = Input.mousePosition; } public void FocusOnPoint(Vector3 point) { //IL_000c: 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_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_0027: Unknown result type (might be due to invalid IL or missing references) lerpPosition = ((Component)CameraRigController).transform.forward * -1f * focusLength + point; lerpCameraTime = 0f; } public void GetCameraState(CameraRigController cameraRigController, ref CameraState cameraState) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_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) cameraState.rotation = ((Component)cameraRigController).transform.rotation; cameraState.position = ((Component)cameraRigController).transform.position; } public bool IsHudAllowed(CameraRigController cameraRigController) { return false; } public bool IsUserControlAllowed(CameraRigController cameraRigController) { return false; } public bool IsUserLookAllowed(CameraRigController cameraRigController) { return false; } public void OnPointerExit(PointerEventData eventData) { PointerInside = false; } public void OnPointerEnter(PointerEventData eventData) { PointerInside = true; } } public enum EditMode { Move, Rotate, Scale, Combined } public enum EditSpace { Global, Local } public enum Axis { None = 0, X = 1, Y = 2, Z = 4, CameraPerpendicular = 8, CameraParallel = 16, XY = 3, XZ = 5, YZ = 6, XYZ = 7 } public enum CopyFormat { Custom, Block, Inline, ForParsing } [BepInPlugin("com.KingEnderBrine.ItemDisplayPlacementHelper", "Item Display Placement Helper", "1.7.1")] public class ItemDisplayPlacementHelperPlugin : BaseUnityPlugin { internal static ItemDisplayPlacementHelperPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { ItemDisplayPlacementHelperPlugin instance = Instance; if (instance == null) { return null; } return ((BaseUnityPlugin)instance).Logger; } } private void Awake() { Instance = this; AssetsHelper.LoadAssetBundle(); ConfigHelper.InitConfigs(((BaseUnityPlugin)this).Config); } private void Destroy() { Instance = null; } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)283)) { Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "title") { ((MonoBehaviour)this).StartCoroutine(StartSceneCoroutine()); } } } private IEnumerator StartSceneCoroutine() { if (!(NetworkManager.networkSceneName == "KingEnderBrine_IDRS_Editor")) { Console.instance.SubmitCmd((NetworkUser)null, "host 0", false); yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)PreGameController.instance != (Object)null)); NetworkManager.singleton.ServerChangeScene("KingEnderBrine_IDRS_Editor"); } } } public class ItemDisplayRulePreviewController : MonoBehaviour { [HideInInspector] public ItemDisplayRule itemDisplayRule; [HideInInspector] public ParentedPrefabDisplay parentedPrefabDisplay; [SerializeField] private TMP_Text textComponent; [SerializeField] private Button buttonComponent; private void Start() { textComponent.text = ((Object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance).name; } private void Update() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Button obj = buttonComponent; ParentedPrefabDisplay val = ParentedPrefabDisplayController.Instance.ParentedPrefabDisplay; ((Selectable)obj).interactable = !((object)(ParentedPrefabDisplay)(ref val)).Equals((object?)parentedPrefabDisplay); } public void EditItemDisplayRule() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ParentedPrefabDisplayController.Instance.SetItemDisplayRule(itemDisplayRule, parentedPrefabDisplay); } } public class ItemDisplayRuleSetController : MonoBehaviour { public enum Catalog { Item, Equipment } public GameObject rowPrefab; public Transform container; [Space] public Button enableAllButton; public Button disableAllButton; public TMP_InputField searchInput; public GameObject noIDRSTextObject; public TMP_Dropdown showItemsMode; private readonly Dictionary<int, DisplayRuleGroupPreviewController> itemRows = new Dictionary<int, DisplayRuleGroupPreviewController>(); private readonly Dictionary<int, DisplayRuleGroupPreviewController> equipmentRows = new Dictionary<int, DisplayRuleGroupPreviewController>(); private CharacterModel characterModel; private string filter; public IReadOnlyDictionary<int, DisplayRuleGroupPreviewController> ItemRows => itemRows; public IReadOnlyDictionary<int, DisplayRuleGroupPreviewController> EquipmentRows => equipmentRows; public static ItemDisplayRuleSetController Instance { get; private set; } private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Instance = this; showItemsMode.AddOptions((from el in (IEnumerable<ReadOnlyContentPack>)(object)ContentManager.allLoadedContentPacks where ((IEnumerable<EquipmentDef>)(object)((ReadOnlyContentPack)(ref el)).equipmentDefs).Any() || ((IEnumerable<ItemDef>)(object)((ReadOnlyContentPack)(ref el)).itemDefs).Any() select ((ReadOnlyContentPack)(ref el)).identifier).ToList()); ModelPicker.OnModelChanged += OnModelChanged; } private void OnDestroy() { Instance = null; ModelPicker.OnModelChanged -= OnModelChanged; } private void Update() { noIDRSTextObject.SetActive(Object.op_Implicit((Object)(object)ModelPicker.Instance.ModelInstance) && (!Object.op_Implicit((Object)(object)characterModel) || !Object.op_Implicit((Object)(object)characterModel.itemDisplayRuleSet))); ((Selectable)enableAllButton).interactable = Object.op_Implicit((Object)(object)characterModel); ((Selectable)disableAllButton).interactable = Object.op_Implicit((Object)(object)characterModel); ((Selectable)searchInput).interactable = Object.op_Implicit((Object)(object)characterModel); ((Selectable)showItemsMode).interactable = Object.op_Implicit((Object)(object)characterModel); } private void OnModelChanged(CharacterModel characterModel) { ClearCurrentModel(); if (Object.op_Implicit((Object)(object)characterModel) && Object.op_Implicit((Object)(object)characterModel.itemDisplayRuleSet)) { this.characterModel = characterModel; GatherDisplayRules(this.characterModel.itemDisplayRuleSet.runtimeItemRuleGroups, itemRows, Catalog.Item); GatherDisplayRules(this.characterModel.itemDisplayRuleSet.runtimeEquipmentRuleGroups, equipmentRows, Catalog.Equipment); ApplyFilter(filter); } } private void ClearCurrentModel() { foreach (DisplayRuleGroupPreviewController value in itemRows.Values) { Object.Destroy((Object)(object)((Component)value).gameObject); } itemRows.Clear(); foreach (DisplayRuleGroupPreviewController value2 in equipmentRows.Values) { Object.Destroy((Object)(object)((Component)value2).gameObject); } equipmentRows.Clear(); characterModel = null; } private void GatherDisplayRules(DisplayRuleGroup[] displayRuleGroups, Dictionary<int, DisplayRuleGroupPreviewController> rows, Catalog catalog) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < displayRuleGroups.Length; i++) { DisplayRuleGroup displayRuleGroup = displayRuleGroups[i]; if (!((DisplayRuleGroup)(ref displayRuleGroup)).isEmpty) { GameObject obj = Object.Instantiate<GameObject>(rowPrefab, container); DisplayRuleGroupPreviewController component = obj.GetComponent<DisplayRuleGroupPreviewController>(); component.displayRuleGroup = displayRuleGroup; DisplayRuleGroupPreviewController displayRuleGroupPreviewController = component; (Sprite, string) itemInfo = GetItemInfo(catalog, i); component.icon = itemInfo.Item1; displayRuleGroupPreviewController.nameText = itemInfo.Item2; component.catalog = catalog; component.index = i; obj.SetActive(true); rows[i] = component; } } } private (Sprite, string) GetItemInfo(Catalog catalog, int index) { switch (catalog) { case Catalog.Item: { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)index); return (itemDef.pickupIconSprite, Language.GetString(itemDef.nameToken)); } case Catalog.Equipment: { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)index); return (equipmentDef.pickupIconSprite, Language.GetString(equipmentDef.nameToken)); } default: throw new ArgumentException(); } } public void ApplyFilter(string newFilter) { filter = newFilter; UpdateRowsVisibility(); } public void ChangeShowMode(int value) { UpdateRowsVisibility(); } public void EnableAll() { foreach (DisplayRuleGroupPreviewController value in itemRows.Values) { if (((Component)value).gameObject.activeSelf) { value.ToggleDisplay(display: true); } } characterModel.UpdateMaterials(); } public void DisableAll() { foreach (DisplayRuleGroupPreviewController value in itemRows.Values) { if (((Component)value).gameObject.activeSelf) { value.ToggleDisplay(display: false); } } foreach (DisplayRuleGroupPreviewController value2 in equipmentRows.Values) { if (((Component)value2).gameObject.activeSelf) { value2.ToggleDisplay(display: false); } } } private void UpdateRowsVisibility() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) bool flag = string.IsNullOrEmpty(filter); string identifier = showItemsMode.options[showItemsMode.value].text; ReadOnlyContentPack[] array = ((showItemsMode.value > 0) ? ((IEnumerable<ReadOnlyContentPack>)(object)ContentManager.allLoadedContentPacks).Where((ReadOnlyContentPack p) => ((ReadOnlyContentPack)(ref p)).identifier == identifier).ToArray() : null); foreach (DisplayRuleGroupPreviewController value in itemRows.Values) { bool flag2 = flag || value.nameText.ContainsInSequence(filter); if (flag2 && array != null) { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)value.index); flag2 = array.Any((ReadOnlyContentPack p) => ((ReadOnlyContentPack)(ref p)).itemDefs.Contains(itemDef)); } ((Component)value).gameObject.SetActive(flag2); } foreach (DisplayRuleGroupPreviewController value2 in equipmentRows.Values) { bool flag3 = flag || value2.nameText.ContainsInSequence(filter); if (flag3 && array != null) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)value2.index); flag3 = array.Any((ReadOnlyContentPack p) => ((ReadOnlyContentPack)(ref p)).equipmentDefs.Contains(equipmentDef)); } ((Component)value2).gameObject.SetActive(flag3); } } } public class MatchLocalScale : MonoBehaviour { public Transform target; private void Update() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)target)) { ((Component)this).transform.localScale = target.localScale; } } } public class ModelPicker : MonoBehaviour { public delegate void OnModelChangedHandler(CharacterModel characterModel); public SearchableDropdown dropdown; public TMP_Dropdown skinsDropdown; public Transform modelSpawnPosition; [Space] public RawImage icon; public TextMeshProUGUI bodyNameText; public TextMeshProUGUI modelNameText; private ModelPrefabInfo modelInfo; private ReverseSkin reverseSkin; private List<SearchableDropdown.OptionData> allBodyOptions; private List<SearchableDropdown.OptionData> logbookBodyOptions; public GameObject ModelInstance { get; private set; } public CharacterModel CharacterModel { get; private set; } public ModelSkinController ModelSkinController { get; private set; } public Dictionary<SkinnedMeshRenderer, MeshCollider> CachedSkinnedMeshRenderers { get; } = new Dictionary<SkinnedMeshRenderer, MeshCollider>(); public static ModelPicker Instance { get; private set; } public static event OnModelChangedHandler OnModelChanged; private void Awake() { Instance = this; logbookBodyOptions = MapBodiesToOptions(SurvivorCatalog.orderedSurvivorDefs.Select((SurvivorDef survivorDef) => BodyCatalog.GetBodyPrefabBodyComponent(SurvivorCatalog.GetBodyIndexFromSurvivorIndex(survivorDef.survivorIndex))).Union(BodyCatalog.allBodyPrefabBodyBodyComponents.Where((CharacterBody characterBody) => Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)((Component)characterBody).GetComponent<DeathRewards>()?.logUnlockableDef)))); allBodyOptions = MapBodiesToOptions(BodyCatalog.allBodyPrefabBodyBodyComponents); dropdown.Options = logbookBodyOptions; ((UnityEvent<object>)(dropdown.OnItemSelected ?? (dropdown.OnItemSelected = new SearchableDropdown.DropdownEvent()))).AddListener((UnityAction<object>)SelectModel); static List<SearchableDropdown.OptionData> MapBodiesToOptions(IEnumerable<CharacterBody> bodies) { return (from characterBody in bodies select (characterBody, ((Component)characterBody).GetComponentInChildren<CharacterModel>()) into el where Object.op_Implicit((Object)(object)el.characterModel) select el).Select<(CharacterBody, CharacterModel), SearchableDropdown.OptionData>(delegate((CharacterBody characterBody, CharacterModel characterModel) el) { ModelPrefabInfo modelPrefabInfo = new ModelPrefabInfo { modelPrefab = ((Component)el.characterModel).gameObject, bodyName = ((Object)el.characterBody).name, modelName = ((Object)el.characterModel).name, localizedBodyName = Language.GetString(el.characterBody.baseNameToken), characterBody = el.characterBody }; return new SearchableDropdown.OptionData(modelPrefabInfo, modelPrefabInfo.localizedBodyName + " || " + modelPrefabInfo.bodyName + " || " + modelPrefabInfo.modelName); }).ToList(); } } private void OnDestroy() { Instance = null; } public void SelectModel(object modelInfo) { if (modelInfo as ModelPrefabInfo != this.modelInfo) { DestroyModelInstance(); this.modelInfo = modelInfo as ModelPrefabInfo; BuildModelInstance(); ConfigureSkinVariants(); ModelPicker.OnModelChanged?.Invoke(CharacterModel); } } private void DestroyModelInstance() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) CachedSkinnedMeshRenderers.Clear(); Object.Destroy((Object)(object)ModelInstance); ModelInstance = null; ModelSkinController = null; CharacterModel = null; ((Graphic)icon).color = Color.clear; icon.texture = null; ((TMP_Text)bodyNameText).text = null; ((TMP_Text)modelNameText).text = null; reverseSkin = null; } private void BuildModelInstance() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Expected O, but got Unknown if (modelInfo == null || Object.op_Implicit((Object)(object)ModelInstance)) { return; } ((Graphic)icon).color = Color.white; icon.texture = modelInfo.characterBody.portraitIcon; ((TMP_Text)bodyNameText).text = modelInfo.localizedBodyName; ((TMP_Text)modelNameText).text = modelInfo.modelName; ModelInstance = Object.Instantiate<GameObject>(modelInfo.modelPrefab, modelSpawnPosition.position, modelSpawnPosition.rotation); CharacterModel = ModelInstance.GetComponent<CharacterModel>(); ModelSkinController = ModelInstance.GetComponent<ModelSkinController>(); if (Object.op_Implicit((Object)(object)ModelSkinController) && ModelSkinController.skins.Length != 0) { reverseSkin = new ReverseSkin(ModelInstance, ModelSkinController.skins[Mathf.Clamp(ModelSkinController.currentSkinIndex, 0, ModelSkinController.skins.Length - 1)]); } AimAnimator[] componentsInChildren = ModelInstance.GetComponentsInChildren<AimAnimator>(); foreach (AimAnimator obj in componentsInChildren) { obj.inputBank = null; obj.directionComponent = null; ((Behaviour)obj).enabled = false; } Animator[] componentsInChildren2 = ModelInstance.GetComponentsInChildren<Animator>(); foreach (Animator obj2 in componentsInChildren2) { obj2.SetBool("isGrounded", true); obj2.SetFloat("aimPitchCycle", 0.5f); obj2.SetFloat("aimYawCycle", 0.5f); obj2.Play("Idle"); obj2.Update(0f); } DitherModel[] componentsInChildren3 = ModelInstance.GetComponentsInChildren<DitherModel>(); for (int i = 0; i < componentsInChildren3.Length; i++) { ((Behaviour)componentsInChildren3[i]).enabled = false; } IKSimpleChain[] componentsInChildren4 = ModelInstance.GetComponentsInChildren<IKSimpleChain>(); for (int i = 0; i < componentsInChildren4.Length; i++) { ((Behaviour)componentsInChildren4[i]).enabled = false; } PrintController[] componentsInChildren5 = ModelInstance.GetComponentsInChildren<PrintController>(); for (int i = 0; i < componentsInChildren5.Length; i++) { ((Behaviour)componentsInChildren5[i]).enabled = false; } LightIntensityCurve[] componentsInChildren6 = ModelInstance.GetComponentsInChildren<LightIntensityCurve>(); foreach (LightIntensityCurve val in componentsInChildren6) { if (!val.loop) { ((Behaviour)val).enabled = false; } } AkEvent[] componentsInChildren7 = ModelInstance.GetComponentsInChildren<AkEvent>(); for (int i = 0; i < componentsInChildren7.Length; i++) { ((Behaviour)componentsInChildren7[i]).enabled = false; } ShakeEmitter[] componentsInChildren8 = ModelInstance.GetComponentsInChildren<ShakeEmitter>(); for (int i = 0; i < componentsInChildren8.Length; i++) { ((Behaviour)componentsInChildren8[i]).enabled = false; } Collider[] componentsInChildren9 = ModelInstance.GetComponentsInChildren<Collider>(); for (int i = 0; i < componentsInChildren9.Length; i++) { componentsInChildren9[i].enabled = false; } InverseKinematics[] componentsInChildren10 = ModelInstance.GetComponentsInChildren<InverseKinematics>(); for (int i = 0; i < componentsInChildren10.Length; i++) { ((Behaviour)componentsInChildren10[i]).enabled = false; } MeshFilter[] componentsInChildren11 = ModelInstance.GetComponentsInChildren<MeshFilter>(); foreach (MeshFilter val2 in componentsInChildren11) { MeshCollider obj3 = ((Component)val2).gameObject.AddComponent<MeshCollider>(); obj3.convex = false; obj3.sharedMesh = val2.sharedMesh; ((Component)val2).gameObject.layer = 11; } SkinnedMeshRenderer[] componentsInChildren12 = ModelInstance.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val3 in componentsInChildren12) { MeshCollider val4 = ((Component)val3).gameObject.AddComponent<MeshCollider>(); val4.convex = false; val4.sharedMesh = new Mesh(); ((Component)val3).gameObject.layer = 11; CachedSkinnedMeshRenderers[val3] = val4; } } private void ConfigureSkinVariants() { skinsDropdown.ClearOptions(); if (!Object.op_Implicit((Object)(object)ModelSkinController)) { ((Component)skinsDropdown).gameObject.SetActive(false); return; } skinsDropdown.AddOptions(((IEnumerable<SkinDef>)ModelSkinController.skins).Select((Func<SkinDef, OptionData>)delegate(SkinDef el) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown string @string = Language.GetString(el.nameToken); return new OptionData(string.IsNullOrWhiteSpace(@string) ? ((Object)el).name : @string, el.icon); }).ToList()); ((Component)skinsDropdown).gameObject.SetActive(true); } public void SelectSkin(int index) { if (Object.op_Implicit((Object)(object)ModelSkinController)) { ItemDisplayRuleSet itemDisplayRuleSet = CharacterModel.itemDisplayRuleSet; reverseSkin?.Apply(); ModelSkinController.ApplySkin(index); reverseSkin = new ReverseSkin(ModelInstance, ModelSkinController.skins[ModelSkinController.currentSkinIndex]); if ((Object)(object)itemDisplayRuleSet != (Object)(object)CharacterModel.itemDisplayRuleSet) { ItemDisplayRuleSetController.Instance.DisableAll(); ModelPicker.OnModelChanged?.Invoke(CharacterModel); } } } public void ToggleBodyOptions(bool enabled) { if (enabled) { dropdown.Options = allBodyOptions; } else { dropdown.Options = logbookBodyOptions; } } } public class ModelPrefabInfo { public GameObject modelPrefab; public string bodyName; public string localizedBodyName; public string modelName; public CharacterBody characterBody; } public class MouseEventConsumer : MonoBehaviour { private void OnMouseDrag() { } } [RequireComponent(typeof(TMP_InputField))] public class NavigateInputFieldOnTab : MonoBehaviour { private TMP_InputField inputField; public MoveDirection moveDirection; private void Awake() { inputField = ((Component)this).GetComponent<TMP_InputField>(); } private void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected I4, but got Unknown if (!((Selectable)inputField).interactable || !inputField.isFocused) { return; } Navigation navigation = ((Selectable)inputField).navigation; if ((int)((Navigation)(ref navigation)).mode != 0 && Input.GetKeyDown((KeyCode)9)) { Selectable val = null; MoveDirection val2 = moveDirection; switch ((int)val2) { case 0: val = ((Selectable)inputField).FindSelectableOnLeft(); break; case 1: val = ((Selectable)inputField).FindSelectableOnUp(); break; case 2: val = ((Selectable)inputField).FindSelectableOnRight(); break; case 3: val = ((Selectable)inputField).FindSelectableOnDown(); break; } if (Object.op_Implicit((Object)(object)val)) { val.Select(); } } } } public class ParentedPrefabDisplayController : MonoBehaviour { public TMP_Dropdown childNameDropdown; [Space] public Vector3InputField localPosInput; public Vector3InputField localAnglesInput; public Vector3InputField localScaleInput; [Space] public Button copyToClipboardButton; public Button editCopyFormatButton; [Space] public GameObject editFormatContainer; public TMP_InputField customFormatInput; public TMP_Text formatPreviewText; public TMP_Dropdown formatDropdown; private CharacterModel characterModel; private CopyFormat _copyFormat; private const string blockFormat = "childName = {childName},\r\nlocalPos = {localPos:5},\r\nlocalAngles = {localAngles:5},\r\nlocalScale = {localScale:5}\r\n"; private const string inlineFormat = "{childName}, {localPos:5}, {localAngles:5}, {localScale:5}"; private const string forParsing = "{r:childName},{r:localPos.x:5},{r:localPos.y:5},{r:localPos.z:5},{r:localAngles.x:5},{r:localAngles.y:5},{r:localAngles.z:5},{r:localScale.x:5},{r:localScale.y:5},{r:localScale.z:5}"; public ParentedPrefabDisplay ParentedPrefabDisplay { get; private set; } public ItemDisplayRule ItemDisplayRule { get; private set; } public static ParentedPrefabDisplayController Instance { get; private set; } public CopyFormat CopyFormat { get { return _copyFormat; } set { if (formatDropdown.value == (int)value) { SelectFormat((int)value); } else { formatDropdown.value = (int)value; } } } private void Awake() { Instance = this; Vector3InputField vector3InputField = localPosInput; vector3InputField.onValueChanged = (Vector3InputField.OnChangeEvent)Delegate.Combine(vector3InputField.onValueChanged, new Vector3InputField.OnChangeEvent(OnLocalPosChanged)); Vector3InputField vector3InputField2 = localAnglesInput; vector3InputField2.onValueChanged = (Vector3InputField.OnChangeEvent)Delegate.Combine(vector3InputField2.onValueChanged, new Vector3InputField.OnChangeEvent(OnLocalAnglesChanged)); Vector3InputField vector3InputField3 = localScaleInput; vector3InputField3.onValueChanged = (Vector3InputField.OnChangeEvent)Delegate.Combine(vector3InputField3.onValueChanged, new Vector3InputField.OnChangeEvent(OnLocalScaleChanged)); ModelPicker.OnModelChanged += OnModelChanged; DisplayRuleGroupEditingController.OnDisplayRuleGroupChanged = (DisplayRuleGroupEditingController.OnDisplayRuleGroupChangedHadler)Delegate.Combine(DisplayRuleGroupEditingController.OnDisplayRuleGroupChanged, new DisplayRuleGroupEditingController.OnDisplayRuleGroupChangedHadler(OnDisplayRuleGroupChanged)); formatDropdown.AddOptions(((IEnumerable<string>)Enum.GetNames(typeof(CopyFormat))).Select((Func<string, OptionData>)((string name) => new OptionData(name))).ToList()); } private void OnDestroy() { ModelPicker.OnModelChanged -= OnModelChanged; DisplayRuleGroupEditingController.OnDisplayRuleGroupChanged = (DisplayRuleGroupEditingController.OnDisplayRuleGroupChangedHadler)Delegate.Remove(DisplayRuleGroupEditingController.OnDisplayRuleGroupChanged, new DisplayRuleGroupEditingController.OnDisplayRuleGroupChangedHadler(OnDisplayRuleGroupChanged)); Instance = null; } private void OnModelChanged(CharacterModel characterModel) { this.characterModel = characterModel; ClearValues(); childNameDropdown.ClearOptions(); if (Object.op_Implicit((Object)(object)characterModel)) { childNameDropdown.options.AddRange(((IEnumerable<NameTransformPair>)characterModel.childLocator.transformPairs).Select((Func<NameTransformPair, OptionData>)((NameTransformPair el) => new OptionData(el.name))).ToList()); } } private void OnDisplayRuleGroupChanged(DisplayRuleGroup displayRuleGroup) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) SetItemDisplayRule(default(ItemDisplayRule), default(ParentedPrefabDisplay)); } private void Update() { //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_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_0088: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) //IL_00be: 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_00e2: Unknown result type (might be due to invalid IL or missing references) ParentedPrefabDisplay parentedPrefabDisplay = ParentedPrefabDisplay; bool flag = Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance); ((Selectable)childNameDropdown).interactable = flag; localPosInput.interactable = flag; localAnglesInput.interactable = flag; localScaleInput.interactable = flag; ((Selectable)copyToClipboardButton).interactable = flag; ((Selectable)editCopyFormatButton).interactable = flag; if (!flag) { editFormatContainer.SetActive(false); } parentedPrefabDisplay = ParentedPrefabDisplay; if (Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance)) { Vector3InputField vector3InputField = localPosInput; parentedPrefabDisplay = ParentedPrefabDisplay; vector3InputField.SetValueWithoutNotify(((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.localPosition); Vector3InputField vector3InputField2 = localAnglesInput; parentedPrefabDisplay = ParentedPrefabDisplay; vector3InputField2.SetValueWithoutNotify(((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.localEulerAngles); Vector3InputField vector3InputField3 = localScaleInput; parentedPrefabDisplay = ParentedPrefabDisplay; vector3InputField3.SetValueWithoutNotify(((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.localScale); } } private void ClearValues() { childNameDropdown.captionText.text = ""; localPosInput.ClearValues(); localAnglesInput.ClearValues(); localScaleInput.ClearValues(); } public void SetItemDisplayRule(ItemDisplayRule itemDisplayRule, ParentedPrefabDisplay parentedPrefabDisplay) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0049: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_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) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRule itemDisplayRule2 = ItemDisplayRule; ParentedPrefabDisplay parentedPrefabDisplay2; if (((ItemDisplayRule)(ref itemDisplayRule2)).Equals(itemDisplayRule)) { parentedPrefabDisplay2 = ParentedPrefabDisplay; if (((object)(ParentedPrefabDisplay)(ref parentedPrefabDisplay2)).Equals((object?)parentedPrefabDisplay)) { return; } } ClearValues(); ParentedPrefabDisplay = parentedPrefabDisplay; ItemDisplayRule = itemDisplayRule; EditorAxisController instance = EditorAxisController.Instance; parentedPrefabDisplay2 = ParentedPrefabDisplay; object selectedObject; if (!Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay2)).instance)) { selectedObject = null; } else { parentedPrefabDisplay2 = ParentedPrefabDisplay; selectedObject = ((ParentedPrefabDisplay)(ref parentedPrefabDisplay2)).instance.transform; } instance.SetSelectedObject((Transform)selectedObject); parentedPrefabDisplay2 = ParentedPrefabDisplay; if (Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay2)).instance)) { Transform displayTransform = ((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform; childNameDropdown.captionText.text = ((IEnumerable<NameTransformPair>)characterModel.childLocator.transformPairs).FirstOrDefault((Func<NameTransformPair, bool>)((NameTransformPair el) => (Object)(object)el.transform == (Object)(object)displayTransform.parent)).name; childNameDropdown.SetValueWithoutNotify(childNameDropdown.options.FindIndex((OptionData el) => el.text == childNameDropdown.captionText.text)); localPosInput.SetValueWithoutNotify(displayTransform.localPosition, forceUpdate: true); localAnglesInput.SetValueWithoutNotify(displayTransform.localEulerAngles, forceUpdate: true); localScaleInput.SetValueWithoutNotify(displayTransform.localScale, forceUpdate: true); } } public void OnLocalPosChanged(Vector3 value) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) ParentedPrefabDisplay parentedPrefabDisplay = ParentedPrefabDisplay; if (Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance)) { parentedPrefabDisplay = ParentedPrefabDisplay; ((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.localPosition = value; } } public void OnLocalAnglesChanged(Vector3 value) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) ParentedPrefabDisplay parentedPrefabDisplay = ParentedPrefabDisplay; if (Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance)) { parentedPrefabDisplay = ParentedPrefabDisplay; ((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.localEulerAngles = value; } } public void OnLocalScaleChanged(Vector3 value) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) ParentedPrefabDisplay parentedPrefabDisplay = ParentedPrefabDisplay; if (Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance)) { parentedPrefabDisplay = ParentedPrefabDisplay; ((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.localScale = value; } } public void SelectChild(int index) { //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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ParentedPrefabDisplay parentedPrefabDisplay = ParentedPrefabDisplay; if (Object.op_Implicit((Object)(object)((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance)) { Transform transform = characterModel.childLocator.transformPairs[index].transform; parentedPrefabDisplay = ParentedPrefabDisplay; ((ParentedPrefabDisplay)(ref parentedPrefabDisplay)).instance.transform.SetParent(transform, false); } } public void SelectFormat(int format) { _copyFormat = (CopyFormat)format; ((Component)customFormatInput).gameObject.SetActive(CopyFormat == CopyFormat.Custom); ((Component)formatPreviewText.transform.parent.parent).gameObject.SetActive(CopyFormat != CopyFormat.Custom); formatPreviewText.text = GetText(); } public void CopyValuesToClipboard() { try { string text = GetText(); GUIUtility.systemCopyBuffer = ReplacePlaceHolders(text); } catch (Exception ex) { DialogController.ShowError(ex.Message); } } public void ToogleEditFormatContainerVisibility() { editFormatContainer.SetActive(!editFormatContainer.activeSelf); } private string ReplacePlaceHolders(string text) { MatchCollection matchCollection = Regex.Matches(text, "(?<!\\{)\\{((?<modificator>.??):)?(?<field>[^\\{\\}:]*?)(\\.(?<subfield>.*?))?(:(?<precision>.*?))?\\}(?!\\})"); if (matchCollection.Count == 0) { return text; } StringBuilder stringBuilder = new StringBuilder(); int num = 0; for (int i = 0; i < matchCollection.Count; i++) { Match match = matchCollection[i]; stringBuilder.Append(text.Substring(num, match.Index - num)); num = match.Index + match.Length; stringBuilder.Append(ParsePlaceHolder(match)); } return stringBuilder.ToString(); } private string ParsePlaceHolder(Match match) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) string modificator = match.Groups["modificator"].Value?.ToLower(); string value = match.Groups["field"].Value; string value2 = match.Groups["subfield"].Value; int result = 5; if (match.Groups["precision"].Success && !int.TryParse(match.Groups["precision"].Value, out result)) { throw new ArgumentException("Failed to parse placeholder " + match.Value); } return value switch { "childName" => StringText(childNameDropdown.captionText.text, modificator), "localPos" => Vector3Text(localPosInput.CurrentValue, result, modificator, value2), "localAngles" => Vector3Text(localAnglesInput.CurrentValue, result, modificator, value2), "localScale" => Vector3Text(localScaleInput.CurrentValue, result, modificator, value2), _ => throw new ArgumentException("Failed to parse placeholder " + match.Value), }; } private string GetText() { return CopyFormat switch { CopyFormat.Custom => customFormatInput.text, CopyFormat.Block => "childName = {childName},\r\nlocalPos = {localPos:5},\r\nlocalAngles = {localAngles:5},\r\nlocalScale = {localScale:5}\r\n", CopyFormat.Inline => "{childName}, {localPos:5}, {localAngles:5}, {localScale:5}", CopyFormat.ForParsing => "{r:childName},{r:localPos.x:5},{r:localPos.y:5},{r:localPos.z:5},{r:localAngles.x:5},{r:localAngles.y:5},{r:localAngles.z:5},{r:localScale.x:5},{r:localScale.y:5},{r:localScale.z:5}", _ => throw new IndexOutOfRangeException(), }; } private string StringText(string str, string modificator) { if (modificator == "r") { return str; } return "\"" + str + "\""; } private string Vector3Text(Vector3 vector, int precision, string modificator, string subField) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) bool flag = modificator == "r"; return subField switch { "x" => FloatInvariant(vector.x, precision) + (flag ? "" : "F"), "y" => FloatInvariant(vector.y, precision) + (flag ? "" : "F"), "z" => FloatInvariant(vector.z, precision) + (flag ? "" : "F"), _ => "new Vector3(" + FloatInvariant(vector.x, precision) + "F, " + FloatInvariant(vector.y, precision) + "F, " + FloatInvariant(vector.z, precision) + "F)", }; } private string FloatInvariant(float num, int precision) { return num.ToString("0." + "".PadLeft(precision, '#'), CultureInfo.InvariantCulture); } } public class ReverseSkin { private readonly List<RendererInfo> baseRendererInfos = new List<RendererInfo>(); private readonly List<GameObjectActivationTemplate> gameObjectActivationTemplates = new List<GameObjectActivationTemplate>(); private readonly List<MeshReplacementTemplate> meshReplacementTemplates = new List<MeshReplacementTemplate>(); private readonly GameObject modelObject; public ReverseSkin(GameObject modelObject, SkinDef skinDef) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00b2: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) this.modelObject = modelObject; skinDef.Bake(); RuntimeSkin runtimeSkin = skinDef.runtimeSkin; baseRendererInfos.AddRange(modelObject.GetComponent<CharacterModel>().baseRendererInfos); GameObjectActivationTemplate[] array = runtimeSkin.gameObjectActivationTemplates; foreach (GameObjectActivationTemplate val in array) { gameObjectActivationTemplates.Add(new GameObjectActivationTemplate { path = val.path, shouldActivate = !val.shouldActivate }); } MeshReplacementTemplate[] array2 = runtimeSkin.meshReplacementTemplates; foreach (MeshReplacementTemplate val2 in array2) { Renderer component = ((Component)modelObject.transform.Find(val2.path)).GetComponent<Renderer>(); Mesh mesh = null; if (!(component is MeshRenderer)) { SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((component is SkinnedMeshRenderer) ? component : null); if (val3 != null) { mesh = val3.sharedMesh; } } else { mesh = ((Component)component).GetComponent<MeshFilter>().sharedMesh; } meshReplacementTemplates.Add(new MeshReplacementTemplate { path = val2.path, mesh = mesh }); } } public void Apply() { //IL_0045: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)modelObject)) { return; } Transform transform = modelObject.transform; modelObject.GetComponent<CharacterModel>().baseRendererInfos = baseRendererInfos.ToArray(); foreach (GameObjectActivationTemplate gameObjectActivationTemplate in gameObjectActivationTemplates) { ((Component)transform.Find(gameObjectActivationTemplate.path)).gameObject.SetActive(gameObjectActivationTemplate.shouldActivate); } foreach (MeshReplacementTemplate meshReplacementTemplate in meshReplacementTemplates) { Renderer component = ((Component)transform.Find(meshReplacementTemplate.path)).GetComponent<Renderer>(); if (!(component is MeshRenderer)) { SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((component is SkinnedMeshRenderer) ? component : null); if (val != null) { val.sharedMesh = meshReplacementTemplate.mesh; } } else { ((Component)component).GetComponent<MeshFilter>().sharedMesh = meshReplacementTemplate.mesh; } } } } public class RotateWithObject : MonoBehaviour { public Transform objectTransform; private void LateUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)objectTransform)) { ((Component)this).transform.rotation = objectTransform.rotation; } } } [AddComponentMenu("UI/Searchable Dropdown", 35)] [RequireComponent(typeof(RectTransform))] public class SearchableDropdown : TMP_InputField, IEventSystemHandler, ICancelHandler { public class OptionData { public object Value { get; set; } public string Text { get; set; } public Sprite Image { get; set; } public OptionData() { } public OptionData(object value, string text) { Value = value; Text = text; } public OptionData(object value, Sprite image) { Value = value; Image = image; } public OptionData(object value, string text, Sprite image) { Value = value; Text = text; Image = image; } } [Serializable] public class DropdownEvent : UnityEvent<object> { } internal class FloatTweenRunner { protected MonoBehaviour m_CoroutineContainer; protected IEnumerator m_Tween; private static IEnumerator Start(FloatTween tweenInfo) { if (tweenInfo.ValidTarget()) { float elapsedTime = 0f; while ((double)elapsedTime < (double)tweenInfo.duration) { elapsedTime += (tweenInfo.ignoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime); tweenInfo.TweenValue(Mathf.Clamp01(elapsedTime / tweenInfo.duration)); yield return null; } tweenInfo.TweenValue(1f); } } public void Init(MonoBehaviour coroutineContainer) { m_CoroutineContainer = coroutineContainer; } public void StartTween(FloatTween info) { if ((Object)(object)m_CoroutineContainer == (Object)null) { Debug.LogWarning((object)"Coroutine container not configured... did you forget to call Init?"); return; } StopTween(); if (!((Component)m_CoroutineContainer).gameObject.activeInHierarchy) { info.TweenValue(1f); return; } m_Tween = Start(info); m_CoroutineContainer.StartCoroutine(m_Tween); } public void StopTween() { if (m_Tween != null) { m_CoroutineContainer.StopCoroutine(m_Tween); m_Tween = null; } } } internal struct FloatTween { public class FloatTweenCallback : UnityEvent<float> { } private FloatTweenCallback m_Target; private float m_StartValue; private float m_TargetValue; private float m_Duration; private bool m_IgnoreTimeScale; public float startValue { get { return m_StartValue; } set { m_StartValue = value; } } public float targetValue { get { return m_TargetValue; } set { m_TargetValue = value; } } public float duration { get { return m_Duration; } set { m_Duration = value; } } public bool ignoreTimeScale { get { return m_IgnoreTimeScale; } set { m_IgnoreTimeScale = value; } } public void TweenValue(float floatPercentage) { if (ValidTarget()) { ((UnityEvent<float>)m_Target).Invoke(Mathf.Lerp(m_StartValue, m_TargetValue, floatPercentage)); } } public void AddOnChangedCallback(UnityAction<float> callback) { if (m_Target == null) { m_Target = new FloatTweenCallback(); } ((UnityEvent<float>)m_Target).AddListener(callback); } public bool GetIgnoreTimescale() { return m_IgnoreTimeScale; } public float GetDuration() { return m_Duration; } public bool ValidTarget() { return m_Target != null; } } [SerializeField] private RectTransform m_Template; [Space] [SerializeField] private TMP_Text m_ItemText; [SerializeField] private Image m_ItemImage; [SerializeField] private TMP_Text m_SelectText; [Space] private GameObject m_Dropdown; private GameObject m_Blocker; private List<DropdownItem> m_Items = new List<DropdownItem>(); private FloatTweenRunner m_AlphaTweenRunner; private bool validTemplate; private Canvas rootCanvas; private Vector2 initialContentSizeDelta; private Vector2 initialDropdownSizeDelta; [SerializeField] private DropdownEvent m_OnItemSelected; public RectTransform template { get { return m_Template; } set { m_Template = value; } } public TMP_Text itemText { get { return m_ItemText; } set { m_ItemText = value; } } public Image itemImage { get { return m_ItemImage; } set { m_ItemImage = value; } } public List<OptionData> Options { get; set; } = new List<OptionData>(); public DropdownEvent OnItemSelected { get { return m_OnItemSelected; } set { m_OnItemSelected = value; } } public bool IsExpanded => (Object)(object)m_Dropdown != (Object)null; protected SearchableDropdown() { } protected override void Awake() { ((Selectable)this).Awake(); m_AlphaTweenRunner = new FloatTweenRunner(); m_AlphaTweenRunner.Init((MonoBehaviour)(object)this); if (Object.op_Implicit((Object)(object)m_Template)) { ((Component)m_Template).gameObject.SetActive(false); ((UnityEvent<string>)(object)((TMP_InputField)this).onValueChanged).AddListener((UnityAction<string>)ApplyOptionsFilter); } } protected override void Start() { ((UIBehaviour)this).Start(); } protected override void OnDisable() { ((TMP_InputField)this).OnDisable(); ImmediateDestroyDropdownList(); if (!Object.op_Implicit((Object)(object)m_Blocker)) { DestroyBlocker(m_Blocker); } m_Blocker = null; } public void AddOptions(List<OptionData> options) { Options.AddRange(options); } public void AddOptions(Dictionary<object, string> options) { foreach (KeyValuePair<object, string> option in options) { Options.Add(new OptionData(option.Key, option.Value)); } } public void AddOptions(Dictionary<object, Sprite> options) { foreach (KeyValuePair<object, Sprite> option in options) { Options.Add(new OptionData(option.Key, option.Value)); } } public void ClearOptions() { Options.Clear(); } private void SetupTemplate() { validTemplate = false; if (!Object.op_Implicit((Object)(object)m_Template)) { Debug.LogError((object)"The dropdown template is not assigned. The template needs to be assigned and must have a child GameObject with a Toggle component serving as the item.", (Object)(object)this); return; } GameObject gameObject = ((Component)m_Template).gameObject; gameObject.SetActive(true); validTemplate = true; Button componentInChildren = gameObject.GetComponentInChildren<Button>(); if (!Object.op_Implicit((Object)(object)componentInChildren) || (Object)(object)((Component)componentInChildren).transform == (Object)(object)template) { validTemplate = false; Debug.LogError((object)"The dropdown template is not valid. The template must have a child GameObject with a Button component serving as the item.", (Object)(object)template); } else if (!(((Component)componentInChildren).transform.parent is RectTransform)) { validTemplate = false; Debug.LogError((object)"The dropdown template is not valid. The child GameObject with a Button component (the item) must have a RectTransform on its parent.", (Object)(object)template); } else if ((Object)(object)itemText != (Object)null && !itemText.transform.IsChildOf(((Component)componentInChildren).transform)) { validTemplate = false; Debug.LogError((object)"The dropdown template is not valid. The Item Text must be on the item GameObject or children of it.", (Object)(object)template); } else if ((Object)(object)itemImage != (Object)null && !((Component)itemImage).transform.IsChildOf(((Component)componentInChildren).transform)) { validTemplate = false; Debug.LogError((object)"The dropdown template is not valid. The Item Image must be on the item GameObject or children of it.", (Object)(object)template); } if (!validTemplate) { gameObject.SetActive(false); return; } Canvas orAddComponent = GetOrAddComponent<Canvas>(gameObject); orAddComponent.overrideSorting = true; orAddComponent.sortingOrder = 30000; GetOrAddComponent<GraphicRaycaster>(gameObject); GetOrAddComponent<CanvasGroup>(gameObject); gameObject.SetActive(false); validTemplate = true; } private static T GetOrAddComponent<T>(GameObject go) where T : Component { T val = go.GetComponent<T>(); if (!Object.op_Implicit((Object)(object)val)) { val = go.AddComponent<T>(); } return val; } public override void OnPointerClick(PointerEventData eventData) { Show(); ((Component)((TMP_InputField)this).textViewport).gameObject.SetActive(true); ((Component)m_SelectText).gameObject.SetActive(false); ((TMP_InputField)this).OnPointerClick(eventData); } public virtual void OnCancel(BaseEventData eventData) { Hide(); } public void Show() { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown if (!((UIBehaviour)this).IsActive() || !((Selectable)this).IsInteractable() || Object.op_Implicit((Object)(object)m_Dropdown)) { return; } Canvas[] componentsInParent = ((Component)this).gameObject.GetComponentsInParent<Canvas>(false); if (componentsInParent.Length == 0) { return; } rootCanvas = componentsInParent[^1]; for (int i = 0; i < componentsInParent.Length; i++) { if (componentsInParent[i].isRootCanvas) { rootCanvas = componentsInParent[i]; break; } } componentsInParent = null; if (!validTemplate) { SetupTemplate(); if (!validTemplate) { return; } } ((Component)m_Template).gameObject.SetActive(true); ((Component)m_Template).GetComponent<Canvas>().sortingLayerID = rootCanvas.sortingLayerID; m_Dropdown = CreateDropdownList(((Component)m_Template).gameObject); ((Object)m_Dropdown).name = "Dropdown List"; m_Dropdown.SetActive(true); Transform transform = m_Dropdown.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); ((Transform)val).SetParent(((Component)m_Template).transform.parent, false); DropdownItem componentInChildren = m_Dropdown.GetComponentInChildren<DropdownItem>(); Transform transform2 = ((Component)((Transform)componentInChildren.rectTransform).parent).gameObject.transform; RectTransform val2 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); initialContentSizeDelta = val2.sizeDelta; initialDropdownSizeDelta = val.sizeDelta; ((Component)componentInChildren.rectTransform).gameObject.SetActive(true); m_Items.Clear(); for (int j = 0; j < Options.Count; j++) {