PO/Library/Artifacts/e7/e7d0a399af1ca57c3ff1d2f0cc6...

182 lines
12 KiB
Plaintext
Raw Normal View History

2022-01-12 10:06:03 +03:00
<0F>22019.4.19f1<00><><EFBFBD><EFBFBD> <00><>f<EFBFBD><66>!<21>5<>9<EFBFBD>4Q<0E><>B<00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00> E<00> <00><00>#<00>.<00>,<00>5a<00> <00><00>#<00>.<00>,<00><00><00>r<00> <00><00># <00>.<00>,
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00><00><00>J<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><00>\<00><00><><EFBFBD><EFBFBD><EFBFBD><00>H<00>r<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00>w<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00>#!<00>.<00>,"<00><00><><00><><EFBFBD><EFBFBD>#@1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>$<00><00><00>%.<00>j<00>&<00><00><><00><><EFBFBD><EFBFBD>'<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>(<00><00><00><00>)<00>j<00><><EFBFBD><EFBFBD><EFBFBD>*<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD>+<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>,@<00><00><00>-Q<00>j<00>.y<00>
<00> /<00><00>#0<00>.<00>,1<00> <00><>2@<00><00><> 3@<00><00>#4<00>.<00>,5<00>H<00><><00><><EFBFBD><EFBFBD>6<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>7@<00><00><00>8Q<00>j<00>9H<00><><00><><EFBFBD><EFBFBD>:<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>;@<00><00><00><Q<00>j<00>=H<00><><00><><EFBFBD><EFBFBD>><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>?@<00><00><00>@Q<00>j<00>AMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariants<00><><EFBFBD>G<EFBFBD><47>܏Z56<35>:!@i<>J*<00><00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00>E<00> <00><00><00>.<00><00>(a<00> <00><00><00>.<00><00><00><00>r<00> <00><00> <00>.<00>
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00><00><00>=<00><><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><01><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><01>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00><00>.<00><00>y<00>Q <00><00><00>.<00> <00><00><00>X!H<00>i<00><><EFBFBD><EFBFBD>"<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>#@<00><00><00>$Q<00>j<00>%H<00>u<00><><EFBFBD><EFBFBD>&<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>'@<00><00><00>(Q<00>j<00>)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespace\<00>y<EFBFBD>`<00>!<00>y<EFBFBD>ScrollRectEditor,!using UnityEngine;
using UnityEngine.UI;
using UnityEditor.AnimatedValues;
namespace UnityEditor.UI
{
[CustomEditor(typeof(ScrollRect), true)]
[CanEditMultipleObjects]
/// <summary>
/// Custom Editor for the ScrollRect Component.
/// Extend this class to write a custom editor for a component derived from ScrollRect.
/// </summary>
public class ScrollRectEditor : Editor
{
SerializedProperty m_Content;
SerializedProperty m_Horizontal;
SerializedProperty m_Vertical;
SerializedProperty m_MovementType;
SerializedProperty m_Elasticity;
SerializedProperty m_Inertia;
SerializedProperty m_DecelerationRate;
SerializedProperty m_ScrollSensitivity;
SerializedProperty m_Viewport;
SerializedProperty m_HorizontalScrollbar;
SerializedProperty m_VerticalScrollbar;
SerializedProperty m_HorizontalScrollbarVisibility;
SerializedProperty m_VerticalScrollbarVisibility;
SerializedProperty m_HorizontalScrollbarSpacing;
SerializedProperty m_VerticalScrollbarSpacing;
SerializedProperty m_OnValueChanged;
AnimBool m_ShowElasticity;
AnimBool m_ShowDecelerationRate;
bool m_ViewportIsNotChild, m_HScrollbarIsNotChild, m_VScrollbarIsNotChild;
static string s_HError = "For this visibility mode, the Viewport property and the Horizontal Scrollbar property both needs to be set to a Rect Transform that is a child to the Scroll Rect.";
static string s_VError = "For this visibility mode, the Viewport property and the Vertical Scrollbar property both needs to be set to a Rect Transform that is a child to the Scroll Rect.";
protected virtual void OnEnable()
{
m_Content = serializedObject.FindProperty("m_Content");
m_Horizontal = serializedObject.FindProperty("m_Horizontal");
m_Vertical = serializedObject.FindProperty("m_Vertical");
m_MovementType = serializedObject.FindProperty("m_MovementType");
m_Elasticity = serializedObject.FindProperty("m_Elasticity");
m_Inertia = serializedObject.FindProperty("m_Inertia");
m_DecelerationRate = serializedObject.FindProperty("m_DecelerationRate");
m_ScrollSensitivity = serializedObject.FindProperty("m_ScrollSensitivity");
m_Viewport = serializedObject.FindProperty("m_Viewport");
m_HorizontalScrollbar = serializedObject.FindProperty("m_HorizontalScrollbar");
m_VerticalScrollbar = serializedObject.FindProperty("m_VerticalScrollbar");
m_HorizontalScrollbarVisibility = serializedObject.FindProperty("m_HorizontalScrollbarVisibility");
m_VerticalScrollbarVisibility = serializedObject.FindProperty("m_VerticalScrollbarVisibility");
m_HorizontalScrollbarSpacing = serializedObject.FindProperty("m_HorizontalScrollbarSpacing");
m_VerticalScrollbarSpacing = serializedObject.FindProperty("m_VerticalScrollbarSpacing");
m_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");
m_ShowElasticity = new AnimBool(Repaint);
m_ShowDecelerationRate = new AnimBool(Repaint);
SetAnimBools(true);
}
protected virtual void OnDisable()
{
m_ShowElasticity.valueChanged.RemoveListener(Repaint);
m_ShowDecelerationRate.valueChanged.RemoveListener(Repaint);
}
void SetAnimBools(bool instant)
{
SetAnimBool(m_ShowElasticity, !m_MovementType.hasMultipleDifferentValues && m_MovementType.enumValueIndex == (int)ScrollRect.MovementType.Elastic, instant);
SetAnimBool(m_ShowDecelerationRate, !m_Inertia.hasMultipleDifferentValues && m_Inertia.boolValue == true, instant);
}
void SetAnimBool(AnimBool a, bool value, bool instant)
{
if (instant)
a.value = value;
else
a.target = value;
}
void CalculateCachedValues()
{
m_ViewportIsNotChild = false;
m_HScrollbarIsNotChild = false;
m_VScrollbarIsNotChild = false;
if (targets.Length == 1)
{
Transform transform = ((ScrollRect)target).transform;
if (m_Viewport.objectReferenceValue == null || ((RectTransform)m_Viewport.objectReferenceValue).transform.parent != transform)
m_ViewportIsNotChild = true;
if (m_HorizontalScrollbar.objectReferenceValue == null || ((Scrollbar)m_HorizontalScrollbar.objectReferenceValue).transform.parent != transform)
m_HScrollbarIsNotChild = true;
if (m_VerticalScrollbar.objectReferenceValue == null || ((Scrollbar)m_VerticalScrollbar.objectReferenceValue).transform.parent != transform)
m_VScrollbarIsNotChild = true;
}
}
public override void OnInspectorGUI()
{
SetAnimBools(false);
serializedObject.Update();
// Once we have a reliable way to know if the object changed, only re-cache in that case.
CalculateCachedValues();
EditorGUILayout.PropertyField(m_Content);
EditorGUILayout.PropertyField(m_Horizontal);
EditorGUILayout.PropertyField(m_Vertical);
EditorGUILayout.PropertyField(m_MovementType);
if (EditorGUILayout.BeginFadeGroup(m_ShowElasticity.faded))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_Elasticity);
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFadeGroup();
EditorGUILayout.PropertyField(m_Inertia);
if (EditorGUILayout.BeginFadeGroup(m_ShowDecelerationRate.faded))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_DecelerationRate);
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFadeGroup();
EditorGUILayout.PropertyField(m_ScrollSensitivity);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(m_Viewport);
EditorGUILayout.PropertyField(m_HorizontalScrollbar);
if (m_HorizontalScrollbar.objectReferenceValue && !m_HorizontalScrollbar.hasMultipleDifferentValues)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_HorizontalScrollbarVisibility, EditorGUIUtility.TrTextContent("Visibility"));
if ((ScrollRect.ScrollbarVisibility)m_HorizontalScrollbarVisibility.enumValueIndex == ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport
&& !m_HorizontalScrollbarVisibility.hasMultipleDifferentValues)
{
if (m_ViewportIsNotChild || m_HScrollbarIsNotChild)
EditorGUILayout.HelpBox(s_HError, MessageType.Error);
EditorGUILayout.PropertyField(m_HorizontalScrollbarSpacing, EditorGUIUtility.TrTextContent("Spacing"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(m_VerticalScrollbar);
if (m_VerticalScrollbar.objectReferenceValue && !m_VerticalScrollbar.hasMultipleDifferentValues)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_VerticalScrollbarVisibility, EditorGUIUtility.TrTextContent("Visibility"));
if ((ScrollRect.ScrollbarVisibility)m_VerticalScrollbarVisibility.enumValueIndex == ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport
&& !m_VerticalScrollbarVisibility.hasMultipleDifferentValues)
{
if (m_ViewportIsNotChild || m_VScrollbarIsNotChild)
EditorGUILayout.HelpBox(s_VError, MessageType.Error);
EditorGUILayout.PropertyField(m_VerticalScrollbarSpacing, EditorGUIUtility.TrTextContent("Spacing"));
}
EditorGUI.indentLevel--;
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(m_OnValueChanged);
serializedObject.ApplyModifiedProperties();
}
}
}
ScrollRectEditorUnityEditor.UI