透明小地图&列表点击切换&海拔图头像位移

This commit is contained in:
lishuo committed 2022-03-29 18:41:32 +08:00
1 parent bf48989a9c
commit 6ec4c0101b
114 files changed
+12787 -6517

No files matched your search

@@ -0,0 +1,129 @@
//MIT License
//Copyright (c) 2020 Mohammed Iqubal Hussain
//Website : Polyandcode.com
using UnityEngine.UI;
using UnityEditor.AnimatedValues;
using UnityEditor;
using UnityEngine;
namespace PolyAndCode.UI
{
[CustomEditor(typeof(RecyclableScrollRect), true)]
[CanEditMultipleObjects]
/// <summary>
/// Custom Editor for the Recyclable Scroll Rect Component which is derived from Scroll Rect.
/// </summary>
public class RecyclableScrollRectEditor : Editor
{
SerializedProperty m_Content;
SerializedProperty m_MovementType;
SerializedProperty m_Elasticity;
SerializedProperty m_Inertia;
SerializedProperty m_DecelerationRate;
SerializedProperty m_ScrollSensitivity;
SerializedProperty m_Viewport;
SerializedProperty m_OnValueChanged;
//inherited
SerializedProperty _protoTypeCell;
SerializedProperty _selfInitialize;
SerializedProperty _direction;
SerializedProperty _type;
AnimBool m_ShowElasticity;
AnimBool m_ShowDecelerationRate;
RecyclableScrollRect _script;
protected virtual void OnEnable()
{
_script = (RecyclableScrollRect)target;
m_Content = serializedObject.FindProperty("m_Content");
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_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");
//Inherited
_protoTypeCell = serializedObject.FindProperty("PrototypeCell");
_selfInitialize = serializedObject.FindProperty("SelfInitialize");
_direction = serializedObject.FindProperty("Direction");
_type = serializedObject.FindProperty("IsGrid");
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, instant);
}
void SetAnimBool(AnimBool a, bool value, bool instant)
{
if (instant)
a.value = value;
else
a.target = value;
}
public override void OnInspectorGUI()
{
SetAnimBools(false);
serializedObject.Update();
EditorGUILayout.PropertyField(_direction);
EditorGUILayout.PropertyField(_type, new GUIContent("Grid"));
if (_type.boolValue)
{
string title = _direction.enumValueIndex == (int)RecyclableScrollRect.DirectionType.Vertical ? "Coloumns" : "Rows";
_script.Segments = EditorGUILayout.IntField(title, _script.Segments);
}
EditorGUILayout.PropertyField(_selfInitialize);
EditorGUILayout.PropertyField(m_Viewport);
EditorGUILayout.PropertyField(m_Content);
EditorGUILayout.PropertyField(_protoTypeCell);
EditorGUILayout.Space();
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_OnValueChanged);
serializedObject.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 74168ba3b38714896bfecd0206751ad1
timeCreated: 1579677840
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,35 @@
using UnityEngine;
using UnityEditor;
namespace PolyAndCode.UI
{
[ExecuteInEditMode]
public static class RecyclableScrollViewEditorTool
{
const string PrefabPath = "Assets/Recyclable Scroll Rect/Main/Prefab/Recyclable Scroll View.prefab";
[MenuItem("GameObject/UI/Recyclable Scroll View")]
private static void CreateRecyclableScrollView()
{
GameObject selected = Selection.activeGameObject;
//If selected isn't a UI gameobject then find a Canvas
if (!selected || !(selected.transform is RectTransform))
{
selected = GameObject.FindObjectOfType<Canvas>().gameObject;
}
if (!selected) return;
GameObject asset = AssetDatabase.LoadAssetAtPath(PrefabPath, typeof(GameObject)) as GameObject;
GameObject item = Object.Instantiate(asset);
item.name = "Recyclable Scroll View";
item.transform.SetParent(selected.transform);
item.transform.localPosition = Vector3.zero;
Selection.activeGameObject = item;
Undo.RegisterCreatedObjectUndo(item, "Create Recycalable Scroll view");
}
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: cf7388e878b9648048580d3339aa57e6
timeCreated: 1580287998
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: