├── Editor.meta ├── Editor ├── Charts.meta ├── Charts │ ├── CobwebEditor.cs │ └── CobwebEditor.cs.meta ├── Components.meta ├── Components │ ├── RegularPolygonEditor.cs │ └── RegularPolygonEditor.cs.meta ├── Effects.meta ├── Effects │ ├── GradientEditor.cs │ ├── GradientEditor.cs.meta │ ├── MirrorEditor.cs │ ├── MirrorEditor.cs.meta │ ├── PolygonMaskEditor.cs │ ├── PolygonMaskEditor.cs.meta │ ├── RectMaskEditor.cs │ └── RectMaskEditor.cs.meta ├── Graphics.meta ├── Graphics │ ├── AnimationMeshGraphicEditor.cs │ ├── AnimationMeshGraphicEditor.cs.meta │ ├── MeshGraphicEditor.cs │ ├── MeshGraphicEditor.cs.meta │ ├── RoundRectEditor.cs │ └── RoundRectEditor.cs.meta ├── UGUIExtend.Editor.asmdef └── UGUIExtend.Editor.asmdef.meta ├── LICENSE ├── LICENSE.meta ├── Prefabs.meta ├── Prefabs ├── DatePicker.prefab ├── DatePicker.prefab.meta ├── TimePicker.prefab └── TimePicker.prefab.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── Charts.meta ├── Charts │ ├── Cobweb.cs │ └── Cobweb.cs.meta ├── Collections.meta ├── Collections │ ├── ListPool.cs │ ├── ListPool.cs.meta │ ├── Pool.cs │ └── Pool.cs.meta ├── Components.meta ├── Components │ ├── DatePicker.cs │ ├── DatePicker.cs.meta │ ├── LocateScrollRect.cs │ ├── LocateScrollRect.cs.meta │ ├── ProgressBar.cs │ ├── ProgressBar.cs.meta │ ├── RegularPolygon.cs │ ├── RegularPolygon.cs.meta │ ├── TimePicker.cs │ └── TimePicker.cs.meta ├── Core.meta ├── Core │ ├── DrawUtility.cs │ └── DrawUtility.cs.meta ├── Effects.meta ├── Effects │ ├── Gradient.cs │ ├── Gradient.cs.meta │ ├── Mirror.cs │ ├── Mirror.cs.meta │ ├── OutlineShadow.cs │ ├── OutlineShadow.cs.meta │ ├── PolygonMask.cs │ ├── PolygonMask.cs.meta │ ├── RectMask.cs │ └── RectMask.cs.meta ├── Graphics.meta ├── Graphics │ ├── AnimationMeshGraphic.cs │ ├── AnimationMeshGraphic.cs.meta │ ├── MeshGraphic.cs │ ├── MeshGraphic.cs.meta │ ├── RoundRect.cs │ └── RoundRect.cs.meta ├── UGUIExtend.asmdef └── UGUIExtend.asmdef.meta ├── UGUIEctend mind.png ├── package.json └── package.json.meta /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ab87bdcf85bbf7499030f4c09510c47 3 | folderAsset: yes 4 | timeCreated: 1484797689 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor/Charts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68410c4e39c04734c818319204d11cd1 3 | folderAsset: yes 4 | timeCreated: 1538632965 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor/Charts/CobwebEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEditor; 3 | using UnityEditor.UI; 4 | using UnityEngine; 5 | using Waiting.UGUI.Charts; 6 | 7 | /// 8 | /// 9 | /// name:CobwebEditor 10 | /// author:Lawliet 11 | /// date:2018/10/4 13:58:04 12 | /// versions: 13 | /// introduce: 14 | /// note: 15 | /// 16 | /// 17 | namespace Waiting.UGUIEditor.Charts 18 | { 19 | [CustomEditor(typeof(Cobweb), true)] 20 | [CanEditMultipleObjects] 21 | public class CobwebEditor : GraphicEditor 22 | { 23 | protected SerializedProperty m_Side; 24 | 25 | protected SerializedProperty m_MinPercent; 26 | 27 | protected SerializedProperty m_Percents; 28 | 29 | private GUIContent m_SideContent; 30 | 31 | private GUIContent m_MinPercentContent; 32 | 33 | private GUIContent m_PercentsContent; 34 | 35 | private bool _percentsFade = false; 36 | 37 | protected override void OnDisable() 38 | { 39 | base.OnDisable(); 40 | } 41 | 42 | protected override void OnEnable() 43 | { 44 | base.OnEnable(); 45 | 46 | m_SideContent = new GUIContent("Side"); 47 | 48 | m_MinPercentContent = new GUIContent("MinPercent"); 49 | 50 | m_PercentsContent = new GUIContent("Percentse"); 51 | 52 | m_Side = serializedObject.FindProperty("m_Side"); 53 | 54 | m_MinPercent = serializedObject.FindProperty("m_MinPercent"); 55 | 56 | m_Percents = serializedObject.FindProperty("m_Percents"); 57 | } 58 | 59 | public override void OnInspectorGUI() 60 | { 61 | serializedObject.Update(); 62 | 63 | EditorGUI.BeginChangeCheck(); 64 | 65 | EditorGUILayout.PropertyField(m_Side, m_SideContent); 66 | 67 | if(EditorGUI.EndChangeCheck()) 68 | { 69 | if (m_Side.intValue < 3) 70 | { 71 | m_Side.intValue = 3; 72 | } 73 | 74 | m_Percents.arraySize = m_Side.intValue; 75 | } 76 | 77 | EditorGUILayout.PropertyField(m_MinPercent, m_MinPercentContent); 78 | 79 | if (_percentsFade = EditorGUILayout.Foldout(_percentsFade, m_PercentsContent)) 80 | { 81 | EditorGUI.indentLevel++; 82 | 83 | for (int i = 0; i < m_Percents.arraySize; i++) 84 | { 85 | var element = m_Percents.GetArrayElementAtIndex(i); 86 | 87 | EditorGUILayout.PropertyField(element, new GUIContent(string.Format("percent {0}", i.ToString()))); 88 | } 89 | 90 | EditorGUI.indentLevel--; 91 | } 92 | 93 | 94 | //EditorGUILayout.PropertyField(m_Percents, true); 95 | 96 | AppearanceControlsGUI(); 97 | RaycastControlsGUI(); 98 | 99 | serializedObject.ApplyModifiedProperties(); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Editor/Charts/CobwebEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21fea396feb80fa4781a649c57615017 3 | timeCreated: 1538632965 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/Components.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51f239c3afefaf4468074b949af1f167 3 | folderAsset: yes 4 | timeCreated: 1567956606 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor/Components/RegularPolygonEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEditor; 3 | using UnityEditor.UI; 4 | using UnityEngine; 5 | using Waiting.UGUI.Components; 6 | 7 | /// 8 | /// 9 | /// name:RegularPolygonEditor 10 | /// author:Lawliet 11 | /// date:2018/10/4 13:58:04 12 | /// versions: 13 | /// introduce: 14 | /// note: 15 | /// 16 | /// 17 | namespace Waiting.UGUIEditor.Components 18 | { 19 | [CustomEditor(typeof(RegularPolygon), true)] 20 | [CanEditMultipleObjects] 21 | public class RegularPolygonEditor : GraphicEditor 22 | { 23 | protected SerializedProperty m_OverrideSprite; 24 | 25 | protected SerializedProperty m_Side; 26 | 27 | protected SerializedProperty m_InnerPercent; 28 | 29 | private GUIContent m_OverrideSpriteContent; 30 | 31 | private GUIContent m_SideContent; 32 | 33 | private GUIContent m_InnerPercentContent; 34 | 35 | private bool _percentsFade = false; 36 | 37 | protected override void OnDisable() 38 | { 39 | base.OnDisable(); 40 | } 41 | 42 | protected override void OnEnable() 43 | { 44 | base.OnEnable(); 45 | 46 | m_OverrideSpriteContent = new GUIContent("Source Sprite"); 47 | 48 | m_SideContent = new GUIContent("Side"); 49 | 50 | m_InnerPercentContent = new GUIContent("InnerPercent"); 51 | 52 | m_OverrideSprite = serializedObject.FindProperty("m_OverrideSprite"); 53 | 54 | m_Side = serializedObject.FindProperty("m_Side"); 55 | 56 | m_InnerPercent = serializedObject.FindProperty("m_InnerPercent"); 57 | } 58 | 59 | public override void OnInspectorGUI() 60 | { 61 | serializedObject.Update(); 62 | 63 | EditorGUI.BeginChangeCheck(); 64 | 65 | EditorGUILayout.PropertyField(m_Side, m_SideContent); 66 | 67 | if (EditorGUI.EndChangeCheck()) 68 | { 69 | if (m_Side.intValue < 3) 70 | { 71 | m_Side.intValue = 3; 72 | } 73 | } 74 | 75 | EditorGUILayout.PropertyField(m_InnerPercent, m_InnerPercentContent); 76 | 77 | EditorGUILayout.PropertyField(m_OverrideSprite, m_OverrideSpriteContent); 78 | 79 | AppearanceControlsGUI(); 80 | RaycastControlsGUI(); 81 | 82 | serializedObject.ApplyModifiedProperties(); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Editor/Components/RegularPolygonEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 101f7a6e98e32af4099d8d47859bb8c8 3 | timeCreated: 1567956607 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/Effects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e18df75f59f8bd347992ad8b532ca0a8 3 | folderAsset: yes 4 | timeCreated: 1486174641 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor/Effects/GradientEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEditor; 6 | using UnityEngine; 7 | 8 | /// 9 | /// 10 | /// name:MirrorEditor 11 | /// author:Lawliet 12 | /// date:2019/11/7 10:18:04 13 | /// versions: 14 | /// introduce: 15 | /// note: 16 | /// 17 | /// 18 | namespace Waiting.UGUIEditor.Effects 19 | { 20 | [CustomEditor(typeof(Gradient), true)] 21 | [CanEditMultipleObjects] 22 | public class GradientEditor : Editor 23 | { 24 | protected SerializedProperty m_StartColor; 25 | protected SerializedProperty m_EndColor; 26 | protected SerializedProperty m_Angle; 27 | protected SerializedProperty m_Percent; 28 | 29 | private GUIContent m_StartColorContent; 30 | private GUIContent m_EndColorContent; 31 | private GUIContent m_FastAngleContent; 32 | private GUIContent m_PercentContent; 33 | 34 | private readonly GUIContent[] m_FastAngleTitle = new GUIContent[] { new GUIContent("Left"), new GUIContent("Up"), new GUIContent("Right"), new GUIContent("Down")}; 35 | private readonly int[] m_FastAngleValue = new int[] { 0, 90, 180, 270 }; 36 | 37 | protected virtual void OnDisable() 38 | { 39 | 40 | } 41 | 42 | protected virtual void OnEnable() 43 | { 44 | m_StartColorContent = new GUIContent("Start Color"); 45 | m_EndColorContent = new GUIContent("End Color"); 46 | m_FastAngleContent = new GUIContent("Fast Angle"); 47 | m_PercentContent = new GUIContent("Percent"); 48 | 49 | m_StartColor = serializedObject.FindProperty("m_StartColor"); 50 | m_EndColor = serializedObject.FindProperty("m_EndColor"); 51 | m_Angle = serializedObject.FindProperty("m_Angle"); 52 | m_Percent = serializedObject.FindProperty("m_Percent"); 53 | } 54 | 55 | public override void OnInspectorGUI() 56 | { 57 | EditorGUILayout.PropertyField(m_StartColor, m_StartColorContent); 58 | EditorGUILayout.PropertyField(m_EndColor, m_EndColorContent); 59 | 60 | int angleValue = (int)m_Angle.floatValue; 61 | 62 | EditorGUI.BeginChangeCheck(); 63 | 64 | angleValue = EditorGUILayout.IntPopup(m_FastAngleContent, angleValue, m_FastAngleTitle, m_FastAngleValue); 65 | 66 | if (EditorGUI.EndChangeCheck()) 67 | { 68 | m_Angle.floatValue = angleValue; 69 | } 70 | 71 | //m_Percent.floatValue = EditorGUILayout.Slider(m_PercentContent, m_Percent.floatValue, 0, 1); 72 | 73 | serializedObject.ApplyModifiedProperties(); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Editor/Effects/GradientEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 922889e637c5cf74e85bccadbd053112 3 | timeCreated: 1573131286 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/Effects/MirrorEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEditor; 3 | using UnityEditor.AnimatedValues; 4 | using UnityEngine; 5 | using UnityEngine.UI; 6 | using Waiting.UGUI.Effects; 7 | 8 | /// 9 | /// 10 | /// name:MirrorEditor 11 | /// author:Lawliet 12 | /// date:2017/2/4 10:18:04 13 | /// versions: 14 | /// introduce: 15 | /// note: 16 | /// 17 | /// 18 | namespace Waiting.UGUIEditor.Effects 19 | { 20 | [CustomEditor(typeof(Mirror), true)] 21 | [CanEditMultipleObjects] 22 | public class MirrorEditor : Editor 23 | { 24 | protected SerializedProperty m_MirrorType; 25 | protected SerializedProperty m_IsReversed; 26 | 27 | private GUIContent m_CorrectButtonContent; 28 | private GUIContent m_MirrorTypeContent; 29 | private GUIContent m_IsReversedContent; 30 | 31 | protected virtual void OnDisable() 32 | { 33 | 34 | } 35 | 36 | protected virtual void OnEnable() 37 | { 38 | m_CorrectButtonContent = new GUIContent("Set Native Size", "Sets the size to match the content."); 39 | 40 | m_MirrorTypeContent = new GUIContent("Mirror Type"); 41 | 42 | m_IsReversedContent = new GUIContent("Is Reversed"); 43 | 44 | m_MirrorType = serializedObject.FindProperty("m_MirrorType"); 45 | m_IsReversed = serializedObject.FindProperty("m_IsReversed"); 46 | } 47 | 48 | public override void OnInspectorGUI() 49 | { 50 | EditorGUILayout.PropertyField(m_MirrorType, m_MirrorTypeContent); 51 | 52 | var canReverse = CanReverse((Mirror.MirrorType)m_MirrorType.enumValueIndex); 53 | 54 | using (new EditorGUI.DisabledGroupScope(!canReverse)) 55 | { 56 | EditorGUILayout.PropertyField(m_IsReversed, m_IsReversedContent); 57 | } 58 | 59 | if (GUILayout.Button(m_CorrectButtonContent, EditorStyles.miniButton)) 60 | { 61 | int len = targets.Length; 62 | 63 | for (int i = 0; i < len; i++) 64 | { 65 | if (targets[i] is Mirror) 66 | { 67 | Mirror mirror = targets[i] as Mirror; 68 | 69 | Undo.RecordObject(mirror.rectTransform, "Set Native Size"); 70 | mirror.SetNativeSize(); 71 | EditorUtility.SetDirty(mirror); 72 | } 73 | } 74 | } 75 | 76 | serializedObject.ApplyModifiedProperties(); 77 | } 78 | 79 | protected bool CanReverse(Mirror.MirrorType type) 80 | { 81 | return type == Mirror.MirrorType.Horizontal || type == Mirror.MirrorType.Vertical; 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Editor/Effects/MirrorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f38fce6b2a9a7a4cba217bee3a8ec37 3 | timeCreated: 1486174738 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/Effects/PolygonMaskEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEditor; 4 | using UnityEditor.AnimatedValues; 5 | using UnityEditorInternal; 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | using Waiting.UGUI.Effects; 9 | 10 | /// 11 | /// 12 | /// name:PolygonMaskEditor 13 | /// author:Lawliet 14 | /// date:2019/10/1 11:53:01 15 | /// versions: 16 | /// introduce: 17 | /// note: 18 | /// 19 | /// 20 | namespace Waiting.UGUIEditor.Effects 21 | { 22 | [CustomEditor(typeof(PolygonMask), true)] 23 | public class PolygonMaskEditor : Editor 24 | { 25 | protected SerializedProperty m_MaskType; 26 | protected SerializedProperty m_MaskRect; 27 | protected SerializedProperty m_RegularPolygon; 28 | protected SerializedProperty m_PolygonCollider2D; 29 | //protected SerializedProperty m_DrawStep; 30 | 31 | private GUIContent m_MaskTypeContent; 32 | private GUIContent m_MaskRectContent; 33 | private GUIContent m_RegularPolygonContent; 34 | private GUIContent m_PolygonCollider2DContent; 35 | //private GUIContent m_DrawStepContent; 36 | 37 | 38 | private int m_PathCount; 39 | 40 | private Vector2[] m_Points; 41 | 42 | protected virtual void OnDisable() 43 | { 44 | 45 | } 46 | 47 | protected virtual void OnEnable() 48 | { 49 | m_MaskTypeContent = new GUIContent("Mask Type"); 50 | m_MaskRectContent = new GUIContent("Mask Rect"); 51 | m_RegularPolygonContent = new GUIContent("Regular Polygon"); 52 | m_PolygonCollider2DContent = new GUIContent("Polygon Collider 2D"); 53 | //m_DrawStepContent = new GUIContent("Draw Step"); 54 | 55 | m_MaskType = serializedObject.FindProperty("m_MaskType"); 56 | m_MaskRect = serializedObject.FindProperty("m_MaskRect"); 57 | m_RegularPolygon = serializedObject.FindProperty("m_RegularPolygon"); 58 | m_PolygonCollider2D = serializedObject.FindProperty("m_PolygonCollider2D"); 59 | //m_DrawStep = serializedObject.FindProperty("m_DrawStep"); 60 | 61 | } 62 | 63 | public override void OnInspectorGUI() 64 | { 65 | EditorGUILayout.PropertyField(m_MaskType, m_MaskTypeContent); 66 | 67 | switch ((PolygonMask.MaskType)m_MaskType.enumValueIndex) 68 | { 69 | case PolygonMask.MaskType.RegularPolygon: 70 | EditorGUILayout.PropertyField(m_RegularPolygon, m_RegularPolygonContent); 71 | break; 72 | case PolygonMask.MaskType.Polygon: 73 | EditorGUILayout.PropertyField(m_PolygonCollider2D, m_PolygonCollider2DContent); 74 | 75 | if (this.target != null) 76 | { 77 | PolygonMask mask = this.target as PolygonMask; 78 | 79 | if (mask.polygonCollider2D != null) 80 | { 81 | //EditorGUILayout.LabelField("Test"); 82 | 83 | //m_DrawStep.intValue = (int)EditorGUILayout.Slider(m_DrawStep.intValue, 0, mask.polygonCollider2D.points.Length - 2); 84 | } 85 | } 86 | break; 87 | default: 88 | break; 89 | } 90 | 91 | serializedObject.ApplyModifiedProperties(); 92 | } 93 | 94 | private void OnSceneGUI() 95 | { 96 | var polygon = target as PolygonMask; 97 | 98 | if (polygon == null) 99 | { 100 | return; 101 | } 102 | 103 | if (polygon.polygonCollider2D == null) 104 | { 105 | return; 106 | } 107 | 108 | //Debug.Log(0); 109 | 110 | bool dirty = false; 111 | 112 | if (polygon.polygonCollider2D.pathCount != m_PathCount) 113 | { 114 | //Debug.Log(1); 115 | 116 | m_PathCount = polygon.polygonCollider2D.pathCount; 117 | m_Points = polygon.polygonCollider2D.points; 118 | dirty = true; 119 | } 120 | else 121 | { 122 | if(m_Points == null) 123 | { 124 | m_Points = polygon.polygonCollider2D.points; 125 | dirty = true; 126 | } 127 | else 128 | { 129 | for (int i = 0; i < m_Points.Length; i++) 130 | { 131 | if(polygon.polygonCollider2D.points[i]!= m_Points[i]) 132 | { 133 | //Debug.Log(2); 134 | 135 | m_Points = polygon.polygonCollider2D.points; 136 | dirty = true; 137 | break; 138 | } 139 | } 140 | } 141 | 142 | } 143 | 144 | if (dirty) 145 | { 146 | polygon.SetDirty(); 147 | } 148 | } 149 | } 150 | } 151 | 152 | -------------------------------------------------------------------------------- /Editor/Effects/PolygonMaskEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 217c8fa39cc79484e9bb8a23c6974622 3 | timeCreated: 1568451206 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/Effects/RectMaskEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEditor; 4 | using UnityEditor.AnimatedValues; 5 | using UnityEditorInternal; 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | using Waiting.UGUI.Effects; 9 | 10 | /// 11 | /// 12 | /// name:RectMaskEditor 13 | /// author:Lawliet 14 | /// date:2019/10/1 11:53:01 15 | /// versions: 16 | /// introduce: 17 | /// note: 18 | /// 19 | /// 20 | namespace Waiting.UGUIEditor.Effects 21 | { 22 | [CustomEditor(typeof(RectMask), true)] 23 | public class RectMaskEditor : Editor 24 | { 25 | protected SerializedProperty m_MaskRect; 26 | 27 | protected SerializedProperty m_MaskRectPosition; 28 | 29 | private GUIContent m_MaskRectContent; 30 | 31 | private Vector3 m_LastPosition; 32 | private Rect m_LastRect; 33 | 34 | protected virtual void OnEnable() 35 | { 36 | m_MaskRectContent = new GUIContent("Mask Rect"); 37 | 38 | m_MaskRect = serializedObject.FindProperty("m_MaskRect"); 39 | 40 | m_MaskRectPosition = serializedObject.FindProperty("m_MaskRect.position"); 41 | 42 | EditorApplication.update += EditorUpdate; 43 | 44 | } 45 | 46 | protected virtual void OnDisable() 47 | { 48 | EditorApplication.update -= EditorUpdate; 49 | } 50 | 51 | public override void OnInspectorGUI() 52 | { 53 | EditorGUILayout.PropertyField(m_MaskRect, m_MaskRectContent); 54 | 55 | serializedObject.ApplyModifiedProperties(); 56 | } 57 | 58 | private void EditorUpdate() 59 | { 60 | var rectMask = target as RectMask; 61 | 62 | if (rectMask == null) 63 | { 64 | return; 65 | } 66 | 67 | if (rectMask.maskRect == null) 68 | { 69 | return; 70 | } 71 | 72 | bool dirty = false; 73 | 74 | if (rectMask.rectTransform.position != m_LastPosition) 75 | { 76 | m_LastPosition = rectMask.rectTransform.position; 77 | dirty = true; 78 | } 79 | else if (rectMask.rectTransform.rect != m_LastRect) 80 | { 81 | m_LastRect = rectMask.rectTransform.rect; 82 | dirty = true; 83 | } 84 | 85 | if (dirty) 86 | { 87 | rectMask.SetDirty(); 88 | } 89 | } 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /Editor/Effects/RectMaskEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1cf5784026d2234e940b8c8684ca21a 3 | timeCreated: 1572868865 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/Graphics.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f261352b02c3e63438e429dfd064e67c 3 | folderAsset: yes 4 | timeCreated: 1508407374 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor/Graphics/AnimationMeshGraphicEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEditor.UI; 4 | using UnityEngine; 5 | using Waiting.UGUI.Graphics; 6 | 7 | /// 8 | /// 9 | /// name:MeshGraphicEditor 10 | /// author:罐子 11 | /// vindicator: 12 | /// versions: 13 | /// introduce: 14 | /// note: 15 | /// 16 | /// 17 | /// list: 18 | /// 19 | /// 20 | /// 21 | /// 22 | namespace Waiting.UGUIEditor.Graphics 23 | { 24 | [CustomEditor(typeof(AnimationMeshGraphic), true)] 25 | [CanEditMultipleObjects] 26 | public class AnimationMeshGraphicEditor : MeshGraphicEditor 27 | { 28 | protected SerializedProperty m_AnimDirtyMode; 29 | 30 | protected override void OnEnable() 31 | { 32 | base.OnEnable(); 33 | 34 | m_AnimDirtyMode = serializedObject.FindProperty("m_AnimDirtyMode"); 35 | 36 | } 37 | 38 | public override void OnInspectorGUI() 39 | { 40 | serializedObject.Update(); 41 | 42 | m_AnimDirtyMode.intValue = EditorGUILayout.MaskField(m_AnimDirtyMode.displayName, m_AnimDirtyMode.intValue, m_AnimDirtyMode.enumDisplayNames); 43 | 44 | BaseGUI(); 45 | 46 | TextureGUI(); 47 | 48 | AppearanceControlsGUI(); 49 | 50 | serializedObject.ApplyModifiedProperties(); 51 | } 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Editor/Graphics/AnimationMeshGraphicEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6872105c6df913240bba3bbad2da33f0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Graphics/MeshGraphicEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEditor.UI; 4 | using UnityEngine; 5 | using Waiting.UGUI.Graphics; 6 | 7 | /// 8 | /// 9 | /// name:MeshGraphicEditor 10 | /// author:罐子 11 | /// vindicator: 12 | /// versions: 13 | /// introduce: 14 | /// note: 15 | /// 16 | /// 17 | /// list: 18 | /// 19 | /// 20 | /// 21 | /// 22 | namespace Waiting.UGUIEditor.Graphics 23 | { 24 | [CustomEditor(typeof(MeshGraphic), true)] 25 | [CanEditMultipleObjects] 26 | public class MeshGraphicEditor : GraphicEditor 27 | { 28 | protected SerializedProperty m_Mesh; 29 | 30 | protected SerializedProperty m_Texture; 31 | 32 | protected override void OnEnable() 33 | { 34 | base.OnEnable(); 35 | 36 | m_Mesh = serializedObject.FindProperty("m_Mesh"); 37 | 38 | m_Texture = serializedObject.FindProperty("m_Texture"); 39 | } 40 | 41 | public override void OnInspectorGUI() 42 | { 43 | serializedObject.Update(); 44 | 45 | BaseGUI(); 46 | 47 | TextureGUI(); 48 | 49 | AppearanceControlsGUI(); 50 | 51 | serializedObject.ApplyModifiedProperties(); 52 | } 53 | 54 | protected void BaseGUI() 55 | { 56 | EditorGUILayout.PropertyField(m_Script); 57 | 58 | EditorGUILayout.PropertyField(m_Mesh); 59 | } 60 | 61 | protected void TextureGUI() 62 | { 63 | EditorGUILayout.PropertyField(m_Texture); 64 | } 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /Editor/Graphics/MeshGraphicEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 393c5b772b4091049bbabddeddb7742b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Graphics/RoundRectEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEditor; 3 | using UnityEditor.UI; 4 | using Waiting.UGUI.Graphics; 5 | 6 | /// 7 | /// 8 | /// name:RoundRectEditor 9 | /// author:Waiting 10 | /// date:2017/10/19 18:00:36 11 | /// versions: 12 | /// introduce: 13 | /// note: 14 | /// 15 | /// 16 | namespace Waiting.UGUIEditor.Graphics 17 | { 18 | [CustomEditor(typeof(RoundRect), true)] 19 | [CanEditMultipleObjects] 20 | public class RoundRectEditor : ImageEditor 21 | { 22 | protected SerializedProperty m_FillCenter; 23 | 24 | protected SerializedProperty m_Radius; 25 | 26 | protected override void OnEnable() 27 | { 28 | base.OnEnable(); 29 | 30 | m_FillCenter = serializedObject.FindProperty("m_FillCenter"); 31 | m_Radius = serializedObject.FindProperty("m_Radius"); 32 | } 33 | 34 | public override void OnInspectorGUI() 35 | { 36 | serializedObject.Update(); 37 | 38 | SpriteGUI(); 39 | AppearanceControlsGUI(); 40 | RaycastControlsGUI(); 41 | 42 | EditorGUILayout.PropertyField(m_FillCenter); 43 | EditorGUILayout.PropertyField(m_Radius); 44 | 45 | serializedObject.ApplyModifiedProperties(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Editor/Graphics/RoundRectEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a16e1b9ba6f75242b747ca19e9b9f18 3 | timeCreated: 1508407375 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/UGUIExtend.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UGUIExtend.Editor", 3 | "references": [ 4 | "UGUIExtend" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [] 16 | } -------------------------------------------------------------------------------- /Editor/UGUIExtend.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e935175797eaf2d4ca1fb229709fa032 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 L-Lawliet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82b9ac1112784254aae8bea0a5ebcdda 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a03c2b5134b84e42ba236c1a2e4b5c3 3 | folderAsset: yes 4 | timeCreated: 1512468837 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Prefabs/DatePicker.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/L-Lawliet/UGUIExtend/bd2ebc168aed6dddf3581eb32c83e91906f7d336/Prefabs/DatePicker.prefab -------------------------------------------------------------------------------- /Prefabs/DatePicker.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ba13c1e8a2b4f34eb9ad4f04509895b 3 | timeCreated: 1512468869 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Prefabs/TimePicker.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &130742 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 22429062} 12 | - component: {fileID: 11456492} 13 | - component: {fileID: 22248794} 14 | m_Layer: 5 15 | m_Name: MinuteScrollView 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &22429062 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 130742} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: 32 | - {fileID: 22475274} 33 | m_Father: {fileID: 22464492} 34 | m_RootOrder: 1 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | m_AnchorMin: {x: 0, y: 0} 37 | m_AnchorMax: {x: 0, y: 0} 38 | m_AnchoredPosition: {x: 0, y: 0} 39 | m_SizeDelta: {x: 0, y: 0} 40 | m_Pivot: {x: 0.5, y: 0.5} 41 | --- !u!114 &11456492 42 | MonoBehaviour: 43 | m_ObjectHideFlags: 0 44 | m_CorrespondingSourceObject: {fileID: 0} 45 | m_PrefabInstance: {fileID: 0} 46 | m_PrefabAsset: {fileID: 0} 47 | m_GameObject: {fileID: 130742} 48 | m_Enabled: 1 49 | m_EditorHideFlags: 0 50 | m_Script: {fileID: 1367256648, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 51 | m_Name: 52 | m_EditorClassIdentifier: 53 | m_Content: {fileID: 22457548} 54 | m_Horizontal: 0 55 | m_Vertical: 1 56 | m_MovementType: 1 57 | m_Elasticity: 0.1 58 | m_Inertia: 1 59 | m_DecelerationRate: 0.135 60 | m_ScrollSensitivity: 1 61 | m_Viewport: {fileID: 22475274} 62 | m_HorizontalScrollbar: {fileID: 0} 63 | m_VerticalScrollbar: {fileID: 0} 64 | m_HorizontalScrollbarVisibility: 2 65 | m_VerticalScrollbarVisibility: 2 66 | m_HorizontalScrollbarSpacing: -3 67 | m_VerticalScrollbarSpacing: -3 68 | m_OnValueChanged: 69 | m_PersistentCalls: 70 | m_Calls: [] 71 | m_TypeName: UnityEngine.UI.ScrollRect+ScrollRectEvent, UnityEngine.UI, Version=1.0.0.0, 72 | Culture=neutral, PublicKeyToken=null 73 | --- !u!222 &22248794 74 | CanvasRenderer: 75 | m_ObjectHideFlags: 0 76 | m_CorrespondingSourceObject: {fileID: 0} 77 | m_PrefabInstance: {fileID: 0} 78 | m_PrefabAsset: {fileID: 0} 79 | m_GameObject: {fileID: 130742} 80 | m_CullTransparentMesh: 0 81 | --- !u!1 &131622 82 | GameObject: 83 | m_ObjectHideFlags: 0 84 | m_CorrespondingSourceObject: {fileID: 0} 85 | m_PrefabInstance: {fileID: 0} 86 | m_PrefabAsset: {fileID: 0} 87 | serializedVersion: 6 88 | m_Component: 89 | - component: {fileID: 22432272} 90 | m_Layer: 5 91 | m_Name: TimePicker 92 | m_TagString: Untagged 93 | m_Icon: {fileID: 0} 94 | m_NavMeshLayer: 0 95 | m_StaticEditorFlags: 0 96 | m_IsActive: 1 97 | --- !u!224 &22432272 98 | RectTransform: 99 | m_ObjectHideFlags: 0 100 | m_CorrespondingSourceObject: {fileID: 0} 101 | m_PrefabInstance: {fileID: 0} 102 | m_PrefabAsset: {fileID: 0} 103 | m_GameObject: {fileID: 131622} 104 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 105 | m_LocalPosition: {x: 0, y: 0, z: 0} 106 | m_LocalScale: {x: 1, y: 1, z: 1} 107 | m_Children: 108 | - {fileID: 22447894} 109 | - {fileID: 22464492} 110 | m_Father: {fileID: 0} 111 | m_RootOrder: 0 112 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 113 | m_AnchorMin: {x: 0.5, y: 0.5} 114 | m_AnchorMax: {x: 0.5, y: 0.5} 115 | m_AnchoredPosition: {x: 0, y: 0} 116 | m_SizeDelta: {x: 300, y: 124} 117 | m_Pivot: {x: 0.5, y: 0.5} 118 | --- !u!1 &135184 119 | GameObject: 120 | m_ObjectHideFlags: 0 121 | m_CorrespondingSourceObject: {fileID: 0} 122 | m_PrefabInstance: {fileID: 0} 123 | m_PrefabAsset: {fileID: 0} 124 | serializedVersion: 6 125 | m_Component: 126 | - component: {fileID: 22410346} 127 | - component: {fileID: 11451350} 128 | - component: {fileID: 11401572} 129 | m_Layer: 5 130 | m_Name: Content 131 | m_TagString: Untagged 132 | m_Icon: {fileID: 0} 133 | m_NavMeshLayer: 0 134 | m_StaticEditorFlags: 0 135 | m_IsActive: 1 136 | --- !u!224 &22410346 137 | RectTransform: 138 | m_ObjectHideFlags: 0 139 | m_CorrespondingSourceObject: {fileID: 0} 140 | m_PrefabInstance: {fileID: 0} 141 | m_PrefabAsset: {fileID: 0} 142 | m_GameObject: {fileID: 135184} 143 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 144 | m_LocalPosition: {x: 0, y: 0, z: 0} 145 | m_LocalScale: {x: 1, y: 1, z: 1} 146 | m_Children: 147 | - {fileID: 22437896} 148 | m_Father: {fileID: 22474686} 149 | m_RootOrder: 0 150 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 151 | m_AnchorMin: {x: 0, y: 1} 152 | m_AnchorMax: {x: 1, y: 1} 153 | m_AnchoredPosition: {x: 0, y: 0} 154 | m_SizeDelta: {x: 0, y: 0} 155 | m_Pivot: {x: 0, y: 1} 156 | --- !u!114 &11451350 157 | MonoBehaviour: 158 | m_ObjectHideFlags: 0 159 | m_CorrespondingSourceObject: {fileID: 0} 160 | m_PrefabInstance: {fileID: 0} 161 | m_PrefabAsset: {fileID: 0} 162 | m_GameObject: {fileID: 135184} 163 | m_Enabled: 1 164 | m_EditorHideFlags: 0 165 | m_Script: {fileID: 1741964061, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 166 | m_Name: 167 | m_EditorClassIdentifier: 168 | m_HorizontalFit: 0 169 | m_VerticalFit: 2 170 | --- !u!114 &11401572 171 | MonoBehaviour: 172 | m_ObjectHideFlags: 0 173 | m_CorrespondingSourceObject: {fileID: 0} 174 | m_PrefabInstance: {fileID: 0} 175 | m_PrefabAsset: {fileID: 0} 176 | m_GameObject: {fileID: 135184} 177 | m_Enabled: 1 178 | m_EditorHideFlags: 0 179 | m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 180 | m_Name: 181 | m_EditorClassIdentifier: 182 | m_Padding: 183 | m_Left: 0 184 | m_Right: 0 185 | m_Top: 48 186 | m_Bottom: 48 187 | m_ChildAlignment: 0 188 | m_Spacing: 0 189 | m_ChildForceExpandWidth: 1 190 | m_ChildForceExpandHeight: 1 191 | m_ChildControlWidth: 1 192 | m_ChildControlHeight: 1 193 | --- !u!1 &148452 194 | GameObject: 195 | m_ObjectHideFlags: 0 196 | m_CorrespondingSourceObject: {fileID: 0} 197 | m_PrefabInstance: {fileID: 0} 198 | m_PrefabAsset: {fileID: 0} 199 | serializedVersion: 6 200 | m_Component: 201 | - component: {fileID: 22447894} 202 | - component: {fileID: 22250222} 203 | - component: {fileID: 11428542} 204 | m_Layer: 5 205 | m_Name: Background 206 | m_TagString: Untagged 207 | m_Icon: {fileID: 0} 208 | m_NavMeshLayer: 0 209 | m_StaticEditorFlags: 0 210 | m_IsActive: 1 211 | --- !u!224 &22447894 212 | RectTransform: 213 | m_ObjectHideFlags: 0 214 | m_CorrespondingSourceObject: {fileID: 0} 215 | m_PrefabInstance: {fileID: 0} 216 | m_PrefabAsset: {fileID: 0} 217 | m_GameObject: {fileID: 148452} 218 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 219 | m_LocalPosition: {x: 0, y: 0, z: 0} 220 | m_LocalScale: {x: 1, y: 1, z: 1} 221 | m_Children: [] 222 | m_Father: {fileID: 22432272} 223 | m_RootOrder: 0 224 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 225 | m_AnchorMin: {x: 0, y: 0} 226 | m_AnchorMax: {x: 1, y: 1} 227 | m_AnchoredPosition: {x: 0, y: 0} 228 | m_SizeDelta: {x: 0, y: 0} 229 | m_Pivot: {x: 0.5, y: 0.5} 230 | --- !u!222 &22250222 231 | CanvasRenderer: 232 | m_ObjectHideFlags: 0 233 | m_CorrespondingSourceObject: {fileID: 0} 234 | m_PrefabInstance: {fileID: 0} 235 | m_PrefabAsset: {fileID: 0} 236 | m_GameObject: {fileID: 148452} 237 | m_CullTransparentMesh: 0 238 | --- !u!114 &11428542 239 | MonoBehaviour: 240 | m_ObjectHideFlags: 0 241 | m_CorrespondingSourceObject: {fileID: 0} 242 | m_PrefabInstance: {fileID: 0} 243 | m_PrefabAsset: {fileID: 0} 244 | m_GameObject: {fileID: 148452} 245 | m_Enabled: 1 246 | m_EditorHideFlags: 0 247 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 248 | m_Name: 249 | m_EditorClassIdentifier: 250 | m_Material: {fileID: 0} 251 | m_Color: {r: 1, g: 1, b: 1, a: 1} 252 | m_RaycastTarget: 1 253 | m_OnCullStateChanged: 254 | m_PersistentCalls: 255 | m_Calls: [] 256 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 257 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 258 | m_Sprite: {fileID: 0} 259 | m_Type: 0 260 | m_PreserveAspect: 0 261 | m_FillCenter: 1 262 | m_FillMethod: 4 263 | m_FillAmount: 1 264 | m_FillClockwise: 1 265 | m_FillOrigin: 0 266 | m_UseSpriteMesh: 0 267 | --- !u!1 &155878 268 | GameObject: 269 | m_ObjectHideFlags: 0 270 | m_CorrespondingSourceObject: {fileID: 0} 271 | m_PrefabInstance: {fileID: 0} 272 | m_PrefabAsset: {fileID: 0} 273 | serializedVersion: 6 274 | m_Component: 275 | - component: {fileID: 22475274} 276 | - component: {fileID: 11440048} 277 | - component: {fileID: 22202882} 278 | - component: {fileID: 11434584} 279 | m_Layer: 5 280 | m_Name: Viewport 281 | m_TagString: Untagged 282 | m_Icon: {fileID: 0} 283 | m_NavMeshLayer: 0 284 | m_StaticEditorFlags: 0 285 | m_IsActive: 1 286 | --- !u!224 &22475274 287 | RectTransform: 288 | m_ObjectHideFlags: 0 289 | m_CorrespondingSourceObject: {fileID: 0} 290 | m_PrefabInstance: {fileID: 0} 291 | m_PrefabAsset: {fileID: 0} 292 | m_GameObject: {fileID: 155878} 293 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 294 | m_LocalPosition: {x: 0, y: 0, z: 0} 295 | m_LocalScale: {x: 1, y: 1, z: 1} 296 | m_Children: 297 | - {fileID: 22457548} 298 | m_Father: {fileID: 22429062} 299 | m_RootOrder: 0 300 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 301 | m_AnchorMin: {x: 0, y: 0} 302 | m_AnchorMax: {x: 1, y: 1} 303 | m_AnchoredPosition: {x: 0, y: 0} 304 | m_SizeDelta: {x: 0, y: 0} 305 | m_Pivot: {x: 0, y: 1} 306 | --- !u!114 &11440048 307 | MonoBehaviour: 308 | m_ObjectHideFlags: 0 309 | m_CorrespondingSourceObject: {fileID: 0} 310 | m_PrefabInstance: {fileID: 0} 311 | m_PrefabAsset: {fileID: 0} 312 | m_GameObject: {fileID: 155878} 313 | m_Enabled: 1 314 | m_EditorHideFlags: 0 315 | m_Script: {fileID: -1200242548, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 316 | m_Name: 317 | m_EditorClassIdentifier: 318 | m_ShowMaskGraphic: 0 319 | --- !u!222 &22202882 320 | CanvasRenderer: 321 | m_ObjectHideFlags: 0 322 | m_CorrespondingSourceObject: {fileID: 0} 323 | m_PrefabInstance: {fileID: 0} 324 | m_PrefabAsset: {fileID: 0} 325 | m_GameObject: {fileID: 155878} 326 | m_CullTransparentMesh: 0 327 | --- !u!114 &11434584 328 | MonoBehaviour: 329 | m_ObjectHideFlags: 0 330 | m_CorrespondingSourceObject: {fileID: 0} 331 | m_PrefabInstance: {fileID: 0} 332 | m_PrefabAsset: {fileID: 0} 333 | m_GameObject: {fileID: 155878} 334 | m_Enabled: 1 335 | m_EditorHideFlags: 0 336 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 337 | m_Name: 338 | m_EditorClassIdentifier: 339 | m_Material: {fileID: 0} 340 | m_Color: {r: 1, g: 1, b: 1, a: 1} 341 | m_RaycastTarget: 1 342 | m_OnCullStateChanged: 343 | m_PersistentCalls: 344 | m_Calls: [] 345 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 346 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 347 | m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0} 348 | m_Type: 1 349 | m_PreserveAspect: 0 350 | m_FillCenter: 1 351 | m_FillMethod: 4 352 | m_FillAmount: 1 353 | m_FillClockwise: 1 354 | m_FillOrigin: 0 355 | m_UseSpriteMesh: 0 356 | --- !u!1 &160720 357 | GameObject: 358 | m_ObjectHideFlags: 0 359 | m_CorrespondingSourceObject: {fileID: 0} 360 | m_PrefabInstance: {fileID: 0} 361 | m_PrefabAsset: {fileID: 0} 362 | serializedVersion: 6 363 | m_Component: 364 | - component: {fileID: 22407072} 365 | - component: {fileID: 11488590} 366 | - component: {fileID: 22283966} 367 | m_Layer: 5 368 | m_Name: HourScrollView 369 | m_TagString: Untagged 370 | m_Icon: {fileID: 0} 371 | m_NavMeshLayer: 0 372 | m_StaticEditorFlags: 0 373 | m_IsActive: 1 374 | --- !u!224 &22407072 375 | RectTransform: 376 | m_ObjectHideFlags: 0 377 | m_CorrespondingSourceObject: {fileID: 0} 378 | m_PrefabInstance: {fileID: 0} 379 | m_PrefabAsset: {fileID: 0} 380 | m_GameObject: {fileID: 160720} 381 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 382 | m_LocalPosition: {x: 0, y: 0, z: 0} 383 | m_LocalScale: {x: 1, y: 1, z: 1} 384 | m_Children: 385 | - {fileID: 22474686} 386 | m_Father: {fileID: 22464492} 387 | m_RootOrder: 0 388 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 389 | m_AnchorMin: {x: 0, y: 0} 390 | m_AnchorMax: {x: 0, y: 0} 391 | m_AnchoredPosition: {x: 0, y: 0} 392 | m_SizeDelta: {x: 0, y: 0} 393 | m_Pivot: {x: 0.5, y: 0.5} 394 | --- !u!114 &11488590 395 | MonoBehaviour: 396 | m_ObjectHideFlags: 0 397 | m_CorrespondingSourceObject: {fileID: 0} 398 | m_PrefabInstance: {fileID: 0} 399 | m_PrefabAsset: {fileID: 0} 400 | m_GameObject: {fileID: 160720} 401 | m_Enabled: 1 402 | m_EditorHideFlags: 0 403 | m_Script: {fileID: 1367256648, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 404 | m_Name: 405 | m_EditorClassIdentifier: 406 | m_Content: {fileID: 22410346} 407 | m_Horizontal: 0 408 | m_Vertical: 1 409 | m_MovementType: 1 410 | m_Elasticity: 0.1 411 | m_Inertia: 1 412 | m_DecelerationRate: 0.135 413 | m_ScrollSensitivity: 1 414 | m_Viewport: {fileID: 22474686} 415 | m_HorizontalScrollbar: {fileID: 0} 416 | m_VerticalScrollbar: {fileID: 0} 417 | m_HorizontalScrollbarVisibility: 2 418 | m_VerticalScrollbarVisibility: 2 419 | m_HorizontalScrollbarSpacing: -3 420 | m_VerticalScrollbarSpacing: -3 421 | m_OnValueChanged: 422 | m_PersistentCalls: 423 | m_Calls: [] 424 | m_TypeName: UnityEngine.UI.ScrollRect+ScrollRectEvent, UnityEngine.UI, Version=1.0.0.0, 425 | Culture=neutral, PublicKeyToken=null 426 | --- !u!222 &22283966 427 | CanvasRenderer: 428 | m_ObjectHideFlags: 0 429 | m_CorrespondingSourceObject: {fileID: 0} 430 | m_PrefabInstance: {fileID: 0} 431 | m_PrefabAsset: {fileID: 0} 432 | m_GameObject: {fileID: 160720} 433 | m_CullTransparentMesh: 0 434 | --- !u!1 &161786 435 | GameObject: 436 | m_ObjectHideFlags: 0 437 | m_CorrespondingSourceObject: {fileID: 0} 438 | m_PrefabInstance: {fileID: 0} 439 | m_PrefabAsset: {fileID: 0} 440 | serializedVersion: 6 441 | m_Component: 442 | - component: {fileID: 22457548} 443 | - component: {fileID: 11473856} 444 | - component: {fileID: 11433848} 445 | m_Layer: 5 446 | m_Name: Content 447 | m_TagString: Untagged 448 | m_Icon: {fileID: 0} 449 | m_NavMeshLayer: 0 450 | m_StaticEditorFlags: 0 451 | m_IsActive: 1 452 | --- !u!224 &22457548 453 | RectTransform: 454 | m_ObjectHideFlags: 0 455 | m_CorrespondingSourceObject: {fileID: 0} 456 | m_PrefabInstance: {fileID: 0} 457 | m_PrefabAsset: {fileID: 0} 458 | m_GameObject: {fileID: 161786} 459 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 460 | m_LocalPosition: {x: 0, y: 0, z: 0} 461 | m_LocalScale: {x: 1, y: 1, z: 1} 462 | m_Children: 463 | - {fileID: 22409866} 464 | m_Father: {fileID: 22475274} 465 | m_RootOrder: 0 466 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 467 | m_AnchorMin: {x: 0, y: 1} 468 | m_AnchorMax: {x: 1, y: 1} 469 | m_AnchoredPosition: {x: 0, y: 0} 470 | m_SizeDelta: {x: 0, y: 0} 471 | m_Pivot: {x: 0, y: 1} 472 | --- !u!114 &11473856 473 | MonoBehaviour: 474 | m_ObjectHideFlags: 0 475 | m_CorrespondingSourceObject: {fileID: 0} 476 | m_PrefabInstance: {fileID: 0} 477 | m_PrefabAsset: {fileID: 0} 478 | m_GameObject: {fileID: 161786} 479 | m_Enabled: 1 480 | m_EditorHideFlags: 0 481 | m_Script: {fileID: 1741964061, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 482 | m_Name: 483 | m_EditorClassIdentifier: 484 | m_HorizontalFit: 0 485 | m_VerticalFit: 2 486 | --- !u!114 &11433848 487 | MonoBehaviour: 488 | m_ObjectHideFlags: 0 489 | m_CorrespondingSourceObject: {fileID: 0} 490 | m_PrefabInstance: {fileID: 0} 491 | m_PrefabAsset: {fileID: 0} 492 | m_GameObject: {fileID: 161786} 493 | m_Enabled: 1 494 | m_EditorHideFlags: 0 495 | m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 496 | m_Name: 497 | m_EditorClassIdentifier: 498 | m_Padding: 499 | m_Left: 0 500 | m_Right: 0 501 | m_Top: 48 502 | m_Bottom: 48 503 | m_ChildAlignment: 0 504 | m_Spacing: 0 505 | m_ChildForceExpandWidth: 1 506 | m_ChildForceExpandHeight: 1 507 | m_ChildControlWidth: 1 508 | m_ChildControlHeight: 1 509 | --- !u!1 &166742 510 | GameObject: 511 | m_ObjectHideFlags: 0 512 | m_CorrespondingSourceObject: {fileID: 0} 513 | m_PrefabInstance: {fileID: 0} 514 | m_PrefabAsset: {fileID: 0} 515 | serializedVersion: 6 516 | m_Component: 517 | - component: {fileID: 22464492} 518 | - component: {fileID: 11407780} 519 | m_Layer: 5 520 | m_Name: HorizontalLayoutGroup 521 | m_TagString: Untagged 522 | m_Icon: {fileID: 0} 523 | m_NavMeshLayer: 0 524 | m_StaticEditorFlags: 0 525 | m_IsActive: 1 526 | --- !u!224 &22464492 527 | RectTransform: 528 | m_ObjectHideFlags: 0 529 | m_CorrespondingSourceObject: {fileID: 0} 530 | m_PrefabInstance: {fileID: 0} 531 | m_PrefabAsset: {fileID: 0} 532 | m_GameObject: {fileID: 166742} 533 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 534 | m_LocalPosition: {x: 0, y: 0, z: 0} 535 | m_LocalScale: {x: 1, y: 1, z: 1} 536 | m_Children: 537 | - {fileID: 22407072} 538 | - {fileID: 22429062} 539 | m_Father: {fileID: 22432272} 540 | m_RootOrder: 1 541 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 542 | m_AnchorMin: {x: 0, y: 0} 543 | m_AnchorMax: {x: 1, y: 1} 544 | m_AnchoredPosition: {x: 0, y: 0} 545 | m_SizeDelta: {x: 0, y: 0} 546 | m_Pivot: {x: 0.5, y: 0.5} 547 | --- !u!114 &11407780 548 | MonoBehaviour: 549 | m_ObjectHideFlags: 0 550 | m_CorrespondingSourceObject: {fileID: 0} 551 | m_PrefabInstance: {fileID: 0} 552 | m_PrefabAsset: {fileID: 0} 553 | m_GameObject: {fileID: 166742} 554 | m_Enabled: 1 555 | m_EditorHideFlags: 0 556 | m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 557 | m_Name: 558 | m_EditorClassIdentifier: 559 | m_Padding: 560 | m_Left: 2 561 | m_Right: 2 562 | m_Top: 2 563 | m_Bottom: 2 564 | m_ChildAlignment: 0 565 | m_Spacing: 4 566 | m_ChildForceExpandWidth: 1 567 | m_ChildForceExpandHeight: 1 568 | m_ChildControlWidth: 1 569 | m_ChildControlHeight: 1 570 | --- !u!1 &172086 571 | GameObject: 572 | m_ObjectHideFlags: 0 573 | m_CorrespondingSourceObject: {fileID: 0} 574 | m_PrefabInstance: {fileID: 0} 575 | m_PrefabAsset: {fileID: 0} 576 | serializedVersion: 6 577 | m_Component: 578 | - component: {fileID: 22437896} 579 | - component: {fileID: 22297652} 580 | - component: {fileID: 11455338} 581 | - component: {fileID: 11405634} 582 | m_Layer: 5 583 | m_Name: Label 584 | m_TagString: Untagged 585 | m_Icon: {fileID: 0} 586 | m_NavMeshLayer: 0 587 | m_StaticEditorFlags: 0 588 | m_IsActive: 1 589 | --- !u!224 &22437896 590 | RectTransform: 591 | m_ObjectHideFlags: 0 592 | m_CorrespondingSourceObject: {fileID: 0} 593 | m_PrefabInstance: {fileID: 0} 594 | m_PrefabAsset: {fileID: 0} 595 | m_GameObject: {fileID: 172086} 596 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 597 | m_LocalPosition: {x: 0, y: 0, z: 0} 598 | m_LocalScale: {x: 1, y: 1, z: 1} 599 | m_Children: [] 600 | m_Father: {fileID: 22410346} 601 | m_RootOrder: 0 602 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 603 | m_AnchorMin: {x: 0, y: 1} 604 | m_AnchorMax: {x: 0, y: 1} 605 | m_AnchoredPosition: {x: 73, y: -60} 606 | m_SizeDelta: {x: 146, y: 24} 607 | m_Pivot: {x: 0.5, y: 0.5} 608 | --- !u!222 &22297652 609 | CanvasRenderer: 610 | m_ObjectHideFlags: 0 611 | m_CorrespondingSourceObject: {fileID: 0} 612 | m_PrefabInstance: {fileID: 0} 613 | m_PrefabAsset: {fileID: 0} 614 | m_GameObject: {fileID: 172086} 615 | m_CullTransparentMesh: 0 616 | --- !u!114 &11455338 617 | MonoBehaviour: 618 | m_ObjectHideFlags: 0 619 | m_CorrespondingSourceObject: {fileID: 0} 620 | m_PrefabInstance: {fileID: 0} 621 | m_PrefabAsset: {fileID: 0} 622 | m_GameObject: {fileID: 172086} 623 | m_Enabled: 1 624 | m_EditorHideFlags: 0 625 | m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 626 | m_Name: 627 | m_EditorClassIdentifier: 628 | m_Material: {fileID: 0} 629 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 630 | m_RaycastTarget: 1 631 | m_OnCullStateChanged: 632 | m_PersistentCalls: 633 | m_Calls: [] 634 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 635 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 636 | m_FontData: 637 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 638 | m_FontSize: 18 639 | m_FontStyle: 0 640 | m_BestFit: 0 641 | m_MinSize: 1 642 | m_MaxSize: 210 643 | m_Alignment: 4 644 | m_AlignByGeometry: 0 645 | m_RichText: 1 646 | m_HorizontalOverflow: 0 647 | m_VerticalOverflow: 0 648 | m_LineSpacing: 1 649 | m_Text: 1 650 | --- !u!114 &11405634 651 | MonoBehaviour: 652 | m_ObjectHideFlags: 0 653 | m_CorrespondingSourceObject: {fileID: 0} 654 | m_PrefabInstance: {fileID: 0} 655 | m_PrefabAsset: {fileID: 0} 656 | m_GameObject: {fileID: 172086} 657 | m_Enabled: 1 658 | m_EditorHideFlags: 0 659 | m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 660 | m_Name: 661 | m_EditorClassIdentifier: 662 | m_IgnoreLayout: 0 663 | m_MinWidth: -1 664 | m_MinHeight: -1 665 | m_PreferredWidth: -1 666 | m_PreferredHeight: 24 667 | m_FlexibleWidth: -1 668 | m_FlexibleHeight: -1 669 | m_LayoutPriority: 1 670 | --- !u!1 &183202 671 | GameObject: 672 | m_ObjectHideFlags: 0 673 | m_CorrespondingSourceObject: {fileID: 0} 674 | m_PrefabInstance: {fileID: 0} 675 | m_PrefabAsset: {fileID: 0} 676 | serializedVersion: 6 677 | m_Component: 678 | - component: {fileID: 22474686} 679 | - component: {fileID: 11487936} 680 | - component: {fileID: 22250066} 681 | - component: {fileID: 11486220} 682 | m_Layer: 5 683 | m_Name: Viewport 684 | m_TagString: Untagged 685 | m_Icon: {fileID: 0} 686 | m_NavMeshLayer: 0 687 | m_StaticEditorFlags: 0 688 | m_IsActive: 1 689 | --- !u!224 &22474686 690 | RectTransform: 691 | m_ObjectHideFlags: 0 692 | m_CorrespondingSourceObject: {fileID: 0} 693 | m_PrefabInstance: {fileID: 0} 694 | m_PrefabAsset: {fileID: 0} 695 | m_GameObject: {fileID: 183202} 696 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 697 | m_LocalPosition: {x: 0, y: 0, z: 0} 698 | m_LocalScale: {x: 1, y: 1, z: 1} 699 | m_Children: 700 | - {fileID: 22410346} 701 | m_Father: {fileID: 22407072} 702 | m_RootOrder: 0 703 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 704 | m_AnchorMin: {x: 0, y: 0} 705 | m_AnchorMax: {x: 1, y: 1} 706 | m_AnchoredPosition: {x: 0, y: 0} 707 | m_SizeDelta: {x: 0, y: 0} 708 | m_Pivot: {x: 0, y: 1} 709 | --- !u!114 &11487936 710 | MonoBehaviour: 711 | m_ObjectHideFlags: 0 712 | m_CorrespondingSourceObject: {fileID: 0} 713 | m_PrefabInstance: {fileID: 0} 714 | m_PrefabAsset: {fileID: 0} 715 | m_GameObject: {fileID: 183202} 716 | m_Enabled: 1 717 | m_EditorHideFlags: 0 718 | m_Script: {fileID: -1200242548, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 719 | m_Name: 720 | m_EditorClassIdentifier: 721 | m_ShowMaskGraphic: 0 722 | --- !u!222 &22250066 723 | CanvasRenderer: 724 | m_ObjectHideFlags: 0 725 | m_CorrespondingSourceObject: {fileID: 0} 726 | m_PrefabInstance: {fileID: 0} 727 | m_PrefabAsset: {fileID: 0} 728 | m_GameObject: {fileID: 183202} 729 | m_CullTransparentMesh: 0 730 | --- !u!114 &11486220 731 | MonoBehaviour: 732 | m_ObjectHideFlags: 0 733 | m_CorrespondingSourceObject: {fileID: 0} 734 | m_PrefabInstance: {fileID: 0} 735 | m_PrefabAsset: {fileID: 0} 736 | m_GameObject: {fileID: 183202} 737 | m_Enabled: 1 738 | m_EditorHideFlags: 0 739 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 740 | m_Name: 741 | m_EditorClassIdentifier: 742 | m_Material: {fileID: 0} 743 | m_Color: {r: 1, g: 1, b: 1, a: 1} 744 | m_RaycastTarget: 1 745 | m_OnCullStateChanged: 746 | m_PersistentCalls: 747 | m_Calls: [] 748 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 749 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 750 | m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0} 751 | m_Type: 1 752 | m_PreserveAspect: 0 753 | m_FillCenter: 1 754 | m_FillMethod: 4 755 | m_FillAmount: 1 756 | m_FillClockwise: 1 757 | m_FillOrigin: 0 758 | m_UseSpriteMesh: 0 759 | --- !u!1 &183716 760 | GameObject: 761 | m_ObjectHideFlags: 0 762 | m_CorrespondingSourceObject: {fileID: 0} 763 | m_PrefabInstance: {fileID: 0} 764 | m_PrefabAsset: {fileID: 0} 765 | serializedVersion: 6 766 | m_Component: 767 | - component: {fileID: 22409866} 768 | - component: {fileID: 22253974} 769 | - component: {fileID: 11481556} 770 | - component: {fileID: 11441440} 771 | m_Layer: 5 772 | m_Name: Label 773 | m_TagString: Untagged 774 | m_Icon: {fileID: 0} 775 | m_NavMeshLayer: 0 776 | m_StaticEditorFlags: 0 777 | m_IsActive: 1 778 | --- !u!224 &22409866 779 | RectTransform: 780 | m_ObjectHideFlags: 0 781 | m_CorrespondingSourceObject: {fileID: 0} 782 | m_PrefabInstance: {fileID: 0} 783 | m_PrefabAsset: {fileID: 0} 784 | m_GameObject: {fileID: 183716} 785 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 786 | m_LocalPosition: {x: 0, y: 0, z: 0} 787 | m_LocalScale: {x: 1, y: 1, z: 1} 788 | m_Children: [] 789 | m_Father: {fileID: 22457548} 790 | m_RootOrder: 0 791 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 792 | m_AnchorMin: {x: 0, y: 0} 793 | m_AnchorMax: {x: 0, y: 0} 794 | m_AnchoredPosition: {x: 0, y: 0} 795 | m_SizeDelta: {x: 0, y: 0} 796 | m_Pivot: {x: 0.5, y: 0.5} 797 | --- !u!222 &22253974 798 | CanvasRenderer: 799 | m_ObjectHideFlags: 0 800 | m_CorrespondingSourceObject: {fileID: 0} 801 | m_PrefabInstance: {fileID: 0} 802 | m_PrefabAsset: {fileID: 0} 803 | m_GameObject: {fileID: 183716} 804 | m_CullTransparentMesh: 0 805 | --- !u!114 &11481556 806 | MonoBehaviour: 807 | m_ObjectHideFlags: 0 808 | m_CorrespondingSourceObject: {fileID: 0} 809 | m_PrefabInstance: {fileID: 0} 810 | m_PrefabAsset: {fileID: 0} 811 | m_GameObject: {fileID: 183716} 812 | m_Enabled: 1 813 | m_EditorHideFlags: 0 814 | m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 815 | m_Name: 816 | m_EditorClassIdentifier: 817 | m_Material: {fileID: 0} 818 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 819 | m_RaycastTarget: 1 820 | m_OnCullStateChanged: 821 | m_PersistentCalls: 822 | m_Calls: [] 823 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 824 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 825 | m_FontData: 826 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 827 | m_FontSize: 18 828 | m_FontStyle: 0 829 | m_BestFit: 0 830 | m_MinSize: 1 831 | m_MaxSize: 210 832 | m_Alignment: 4 833 | m_AlignByGeometry: 0 834 | m_RichText: 1 835 | m_HorizontalOverflow: 0 836 | m_VerticalOverflow: 0 837 | m_LineSpacing: 1 838 | m_Text: 1 839 | --- !u!114 &11441440 840 | MonoBehaviour: 841 | m_ObjectHideFlags: 0 842 | m_CorrespondingSourceObject: {fileID: 0} 843 | m_PrefabInstance: {fileID: 0} 844 | m_PrefabAsset: {fileID: 0} 845 | m_GameObject: {fileID: 183716} 846 | m_Enabled: 1 847 | m_EditorHideFlags: 0 848 | m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 849 | m_Name: 850 | m_EditorClassIdentifier: 851 | m_IgnoreLayout: 0 852 | m_MinWidth: -1 853 | m_MinHeight: -1 854 | m_PreferredWidth: -1 855 | m_PreferredHeight: 24 856 | m_FlexibleWidth: -1 857 | m_FlexibleHeight: -1 858 | m_LayoutPriority: 1 859 | -------------------------------------------------------------------------------- /Prefabs/TimePicker.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91cf3955496cd324ea8815e12a9acbd9 3 | timeCreated: 1512701793 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UGUIExtend 2 | ## Unity ugui 扩展 ## 3 | 4 | ### 主要是扩展UGUI的组件 ### 5 | 6 | 7 | ---------- 8 | ![v1.0.0](https://img.shields.io/badge/versions-v1.0.0-green.svg) ![v1.0.0](https://img.shields.io/badge/Unity-v5.0.0+-blue.svg) 9 | 10 | ![mind](https://raw.githubusercontent.com/L-Lawliet/UGUIExtend/master/UGUIEctend%20mind.png) 11 | 12 | 1. **Mirror** 13 | - [Unity3D UGUI优化:制作镜像图片(1)](https://zhuanlan.zhihu.com/p/25995971) 14 | - [Unity3D UGUI优化:制作镜像图片(2)](https://zhuanlan.zhihu.com/p/26382102) 15 | - [Unity3D UGUI优化:制作镜像图片(3)](https://zhuanlan.zhihu.com/p/28580768) 16 | 17 | 2. **OutlineShadow** 18 | 3. **RoundRect** 19 | 20 | > **PS:“Develop”分支内容未开发完成,请使用主分支“master”** 21 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b2aaa5f8a8cf2a429803a105d5b500d 3 | timeCreated: 1484903092 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acd74d1a5d8a331429de23450290bd22 3 | folderAsset: yes 4 | timeCreated: 1525256081 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/Charts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a20126096046994eade885959f9d94c 3 | folderAsset: yes 4 | timeCreated: 1538572043 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/Charts/Cobweb.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | using UnityEngine.UI; 5 | 6 | /// 7 | /// 8 | /// name:Cobweb 9 | /// author:Lawliet 10 | /// date:2018/10/3 21:07:32 11 | /// versions: 12 | /// introduce: 13 | /// note: 14 | /// 15 | /// 16 | namespace Waiting.UGUI.Charts 17 | { 18 | public class Cobweb : MaskableGraphic, ICanvasRaycastFilter 19 | { 20 | [SerializeField] 21 | protected uint m_Side = 3; 22 | 23 | public uint side 24 | { 25 | set 26 | { 27 | m_Side = value; 28 | 29 | ChangeSideCount(); 30 | 31 | base.SetVerticesDirty(); 32 | } 33 | get 34 | { 35 | return m_Side; 36 | } 37 | } 38 | 39 | /// 40 | /// 限制最小百分比 41 | /// 1.当percent为0时,则绘制的范围为minPercent,不至于绘制不出来 42 | /// 2.使效果更加丰满 43 | /// 44 | [SerializeField] 45 | [Range(0.01f, 0.3f)] 46 | protected float m_MinPercent = 0.01f; 47 | 48 | [SerializeField] 49 | [Range(0.0f, 1.0f)] 50 | protected float[] m_Percents; 51 | 52 | public Cobweb() 53 | { 54 | ChangeSideCount(); 55 | } 56 | 57 | protected override void OnPopulateMesh(VertexHelper vh) 58 | { 59 | var color32 = color; 60 | vh.Clear(); 61 | 62 | float size = Mathf.Min(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y); 63 | 64 | float angle = 360.0f / m_Side; 65 | 66 | Vector2[] points = new Vector2[m_Side]; 67 | 68 | for (int i = 0; i < m_Side; i++) 69 | { 70 | Vector2 point = new Vector2(); 71 | 72 | float radius = size * 0.5f * (m_MinPercent + (1 - m_MinPercent) * m_Percents[i]); 73 | 74 | point.x = Mathf.Cos((angle * i + 90) * Mathf.Deg2Rad) * radius; 75 | point.y = Mathf.Sin((angle * i + 90) * Mathf.Deg2Rad) * radius; 76 | 77 | points[i] = point; 78 | } 79 | 80 | vh.AddVert(Vector2.zero, color32, new Vector2(0, 1)); 81 | 82 | for (int i = 0; i < m_Side; i++) 83 | { 84 | Vector2 a = points[i]; 85 | 86 | vh.AddVert(a, color32, new Vector2(0, 1)); 87 | } 88 | 89 | for (int i = 0; i < m_Side; i++) 90 | { 91 | int a = i + 1; 92 | int b = i + 2; 93 | 94 | if (i == m_Side - 1) 95 | { 96 | b = 1; 97 | } 98 | 99 | vh.AddTriangle(0, b, a); 100 | } 101 | } 102 | 103 | public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) 104 | { 105 | return false; 106 | } 107 | 108 | public void SetPercent(int index, float percent) 109 | { 110 | if (index > m_Percents.Length - 1) 111 | { 112 | return; 113 | } 114 | 115 | m_Percents[index] = percent; 116 | 117 | base.SetVerticesDirty(); 118 | } 119 | 120 | public float GetPercent(int index) 121 | { 122 | if (index > m_Percents.Length - 1) 123 | { 124 | return 0; 125 | } 126 | 127 | return m_Percents[index]; 128 | } 129 | 130 | 131 | protected void ChangeSideCount() 132 | { 133 | 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /Runtime/Charts/Cobweb.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39781413966605448a1d6e6633a69eb6 3 | timeCreated: 1538573640 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Collections.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca54cf20ee9820c4f93bc4df139a8be9 3 | folderAsset: yes 4 | timeCreated: 1487670263 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/Collections/ListPool.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | 4 | /// 5 | /// 6 | /// name:ListPool 7 | /// author:Administrator 8 | /// date:2017/2/21 16:55:18 9 | /// versions: 10 | /// introduce: 11 | /// note: 12 | /// 13 | /// 14 | namespace Waiting.UGUI.Collections 15 | { 16 | internal static class ListPool 17 | { 18 | private static readonly Pool> _listPool = new Pool>(null, l => l.Clear()); 19 | 20 | public static List Get() 21 | { 22 | return _listPool.Get(); 23 | } 24 | 25 | public static void Recycle(List element) 26 | { 27 | _listPool.Recycle(element); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Runtime/Collections/ListPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e45925eea4a843246be53091a0caaaea 3 | timeCreated: 1487670266 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Collections/Pool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// 7 | /// name:Pool 8 | /// author:Administrator 9 | /// date:2016/12/22 15:34:54 10 | /// versions: 11 | /// introduce: 12 | /// note: 13 | /// 14 | /// 15 | namespace Waiting.UGUI.Collections 16 | { 17 | internal class Pool where T : new() 18 | { 19 | private readonly Stack _stack = new Stack(); 20 | 21 | private readonly Action _actionOnGet; 22 | 23 | private readonly Action _actionOnRecycle; 24 | 25 | public int count { get; private set; } 26 | public int activeCount { get { return count - inactiveCount; } } 27 | public int inactiveCount { get { return _stack.Count; } } 28 | 29 | public Pool(Action actionOnGet, Action actionOnRecycle) 30 | { 31 | _actionOnGet = actionOnGet; 32 | _actionOnRecycle = actionOnRecycle; 33 | } 34 | 35 | public T Get() 36 | { 37 | T element; 38 | if (_stack.Count == 0) 39 | { 40 | element = new T(); 41 | count++; 42 | } 43 | else 44 | { 45 | element = _stack.Pop(); 46 | } 47 | if (_actionOnGet != null) 48 | _actionOnGet(element); 49 | return element; 50 | } 51 | 52 | public void Recycle(T element) 53 | { 54 | if (_stack.Count > 0 && ReferenceEquals(_stack.Peek(), element)) 55 | { 56 | throw new Exception("Internal error. Trying to destroy object that is already released to pool."); 57 | } 58 | 59 | if (_actionOnRecycle != null) 60 | { 61 | _actionOnRecycle(element); 62 | } 63 | _stack.Push(element); 64 | } 65 | 66 | public void Clear() 67 | { 68 | _stack.Clear(); 69 | count = 0; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Runtime/Collections/Pool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bf865b41b11e2146ae2b0bf6a0f8596 3 | timeCreated: 1487670263 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Components.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a62126dae003424a909730d88b1ffab 3 | folderAsset: yes 4 | timeCreated: 1512466265 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/Components/DatePicker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityEngine.Events; 6 | using UnityEngine.EventSystems; 7 | using UnityEngine.UI; 8 | 9 | /// 10 | /// 11 | /// name:DatePicker 12 | /// author:Administrator 13 | /// date:2017/12/5 17:30:02 14 | /// versions: 15 | /// introduce: 16 | /// note: 17 | /// 18 | /// 19 | namespace Waiting.UGUI.Components 20 | { 21 | public class DatePicker : UIBehaviour 22 | { 23 | protected readonly string[] WEEK_NAMES = new string[] { "周日", "周一", "周二", "周三", "周四", "周五", "周六" }; 24 | 25 | protected readonly string[] MONTH_NAMES = new string[] { "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" }; 26 | 27 | protected class DayItem : MonoBehaviour, IPointerClickHandler 28 | { 29 | [SerializeField] 30 | private Text m_Label; 31 | 32 | [SerializeField] 33 | private Toggle m_Toggle; 34 | 35 | public Text label 36 | { 37 | get { return m_Label; } 38 | set { m_Label = value; } 39 | } 40 | 41 | public Toggle toggle 42 | { 43 | get { return m_Toggle; } 44 | set { m_Toggle = value; } 45 | } 46 | 47 | /*private int m_Day; 48 | 49 | public int day 50 | { 51 | get { return m_Day; } 52 | set 53 | { 54 | m_Day = value; 55 | label.text = m_Day.ToString(); 56 | } 57 | }*/ 58 | 59 | private DateTime m_Date; 60 | 61 | public DateTime date 62 | { 63 | get { return m_Date; } 64 | set 65 | { 66 | m_Date = value; 67 | label.text = m_Date.Day.ToString(); 68 | } 69 | } 70 | 71 | [SerializeField] 72 | private DateClickEvent m_OnClick = new DateClickEvent(); 73 | public DateClickEvent onClick { get { return m_OnClick; } set { m_OnClick = value; } } 74 | 75 | public void OnPointerClick(PointerEventData eventData) 76 | { 77 | m_OnClick.Invoke(m_Date); 78 | } 79 | } 80 | 81 | [Serializable] 82 | public class DateChangeEvent : UnityEvent { } 83 | 84 | [SerializeField] 85 | public class DateClickEvent : UnityEvent { } 86 | 87 | [SerializeField] 88 | private Button m_LeftButton; 89 | 90 | [SerializeField] 91 | private Button m_RightButton; 92 | 93 | 94 | [SerializeField] 95 | private Text m_DateText; 96 | 97 | [SerializeField] 98 | private Button m_DateButton; 99 | 100 | [Space] 101 | 102 | [SerializeField] 103 | private Text m_TemplateWeekText; 104 | 105 | [SerializeField] 106 | private RectTransform m_TemplateDayItem; 107 | 108 | [SerializeField] 109 | private Text m_TemplateDayText; 110 | 111 | [Space] 112 | 113 | [SerializeField] 114 | private Color m_TextNormalColor = Color.black; 115 | 116 | [SerializeField] 117 | private Color m_TextDisabledColor = new Color(0.4f, 0.4f, 0.4f, 1); 118 | 119 | [Space] 120 | 121 | [SerializeField] 122 | private RectTransform m_DayGridContainer; 123 | 124 | [Space] 125 | 126 | [SerializeField] 127 | private DateChangeEvent m_OnChange = new DateChangeEvent(); 128 | public DateChangeEvent onChange { get { return m_OnChange; } set { m_OnChange = value; } } 129 | 130 | [SerializeField] 131 | [HideInInspector] 132 | private List m_WeekTexts = new List(); 133 | 134 | [SerializeField] 135 | [HideInInspector] 136 | private List m_DayItems = new List(); 137 | 138 | [SerializeField] 139 | [HideInInspector] 140 | private DateTime m_SelectDate = DateTime.Now; 141 | 142 | public DateTime selectDate 143 | { 144 | get { return m_SelectDate; } 145 | set 146 | { 147 | m_SelectDate = value; 148 | 149 | m_ShowYear = m_SelectDate.Year; 150 | 151 | m_ShowMonth = m_SelectDate.Month; 152 | 153 | SetLabel(); 154 | SetDay(); 155 | } 156 | } 157 | 158 | private int m_ShowYear; 159 | 160 | private int m_ShowMonth; 161 | 162 | protected override void Awake() 163 | { 164 | m_ShowYear = m_SelectDate.Year; 165 | 166 | m_ShowMonth = m_SelectDate.Month; 167 | 168 | m_LeftButton.onClick.AddListener(LeftButtonClickHandler); 169 | m_RightButton.onClick.AddListener(RightButtonClickHandler); 170 | 171 | SetLabel(); 172 | SetupDay(); 173 | } 174 | 175 | private void LeftButtonClickHandler() 176 | { 177 | if (m_ShowMonth > 1) 178 | { 179 | m_ShowMonth--; 180 | } 181 | else 182 | { 183 | m_ShowMonth = 12; 184 | m_ShowYear--; 185 | } 186 | 187 | SetLabel(); 188 | SetDay(); 189 | } 190 | 191 | private void RightButtonClickHandler() 192 | { 193 | if (m_ShowMonth < 12) 194 | { 195 | m_ShowMonth++; 196 | } 197 | else 198 | { 199 | m_ShowMonth = 1; 200 | m_ShowYear++; 201 | } 202 | 203 | SetLabel(); 204 | SetDay(); 205 | } 206 | 207 | private void DayItemClickHandler(DateTime value) 208 | { 209 | m_SelectDate = value; 210 | 211 | m_OnChange.Invoke(value); 212 | 213 | m_ShowYear = m_SelectDate.Year; 214 | m_ShowMonth = m_SelectDate.Month; 215 | 216 | SetLabel(); 217 | SetDay(); 218 | } 219 | 220 | protected override void OnEnable() 221 | { 222 | 223 | } 224 | 225 | private void SetupDay() 226 | { 227 | m_TemplateWeekText.gameObject.SetActive(true); 228 | 229 | for (int i = 0; i < 7; i++) 230 | { 231 | Text weekText = Text.Instantiate(m_TemplateWeekText); 232 | 233 | weekText.transform.SetParent(m_TemplateWeekText.transform.parent, false); 234 | 235 | m_WeekTexts.Add(weekText); 236 | 237 | weekText.text = WEEK_NAMES[i]; 238 | } 239 | 240 | m_TemplateWeekText.gameObject.SetActive(false); 241 | 242 | m_TemplateDayItem.gameObject.SetActive(true); 243 | 244 | DayItem templateDayItem = m_TemplateDayItem.gameObject.GetComponent(); 245 | 246 | if (DayItem.Equals(templateDayItem, null)) 247 | { 248 | templateDayItem = m_TemplateDayItem.gameObject.AddComponent(); 249 | } 250 | 251 | templateDayItem.toggle = templateDayItem.GetComponent(); 252 | 253 | templateDayItem.label = m_TemplateDayText; 254 | 255 | for (int i = 0; i < 42; i++) 256 | { 257 | DayItem dayItem = DayItem.Instantiate(templateDayItem); 258 | 259 | dayItem.transform.SetParent(m_TemplateDayItem.parent, false); 260 | 261 | dayItem.onClick.AddListener(DayItemClickHandler); 262 | 263 | m_DayItems.Add(dayItem); 264 | } 265 | 266 | m_TemplateDayItem.gameObject.SetActive(false); 267 | 268 | SetDay(); 269 | } 270 | 271 | private void SetDay() 272 | { 273 | DateTime firstDay = new DateTime(m_ShowYear, m_ShowMonth, 1); 274 | 275 | int week = (int)firstDay.DayOfWeek; 276 | 277 | DateTime startDay = firstDay.AddDays(-week); 278 | 279 | m_DayItems[0].toggle.group.SetAllTogglesOff(); 280 | 281 | for (int i = 0; i < 42; i++) 282 | { 283 | DayItem dayItem = m_DayItems[i]; 284 | 285 | DateTime date; 286 | 287 | date = startDay.AddDays(i); 288 | 289 | dayItem.date = date; 290 | 291 | if (date.Month == m_ShowMonth) 292 | { 293 | dayItem.label.color = m_TextNormalColor; 294 | } 295 | else 296 | { 297 | dayItem.label.color = m_TextDisabledColor; 298 | } 299 | 300 | if (m_SelectDate.Year == date.Year && m_SelectDate.Month == date.Month && m_SelectDate.Day == date.Day) 301 | { 302 | dayItem.toggle.isOn = true; 303 | } 304 | } 305 | } 306 | 307 | private void SetLabel() 308 | { 309 | m_DateText.text = string.Format("{0} {1}", m_ShowYear, MONTH_NAMES[m_ShowMonth - 1]); 310 | } 311 | } 312 | } 313 | -------------------------------------------------------------------------------- /Runtime/Components/DatePicker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c1749855fa26bc448c66b0a931cd1e6 3 | timeCreated: 1512466268 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Components/LocateScrollRect.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | /// 6 | /// 7 | /// name:LocateScrollRect 8 | /// author:Lawliet 9 | /// date:2017/12/8 18:31:17 10 | /// versions: 11 | /// introduce: 12 | /// note: 13 | /// 14 | /// 15 | namespace Waiting.UGUI.Components 16 | { 17 | public class LocateScrollRect : ScrollRect 18 | { 19 | /// 20 | /// 列表份额 21 | /// 如果为1的时候,则为普通的ScrollRect 22 | /// 23 | [SerializeField] 24 | private int m_Share = 1; 25 | 26 | protected override void LateUpdate() 27 | { 28 | /*if (!content) 29 | return; 30 | 31 | EnsureLayoutHasRebuilt(); 32 | UpdateScrollbarVisibility(); 33 | UpdateBounds(); 34 | float deltaTime = Time.unscaledDeltaTime; 35 | Vector2 offset = CalculateOffset(Vector2.zero); 36 | if (!m_Dragging && (offset != Vector2.zero || m_Velocity != Vector2.zero)) 37 | { 38 | Vector2 position = m_Content.anchoredPosition; 39 | for (int axis = 0; axis < 2; axis++) 40 | { 41 | // Apply spring physics if movement is elastic and content has an offset from the view. 42 | if (m_MovementType == MovementType.Elastic && offset[axis] != 0) 43 | { 44 | float speed = m_Velocity[axis]; 45 | position[axis] = Mathf.SmoothDamp(m_Content.anchoredPosition[axis], m_Content.anchoredPosition[axis] + offset[axis], ref speed, m_Elasticity, Mathf.Infinity, deltaTime); 46 | m_Velocity[axis] = speed; 47 | } 48 | // Else move content according to velocity with deceleration applied. 49 | else if (m_Inertia) 50 | { 51 | m_Velocity[axis] *= Mathf.Pow(m_DecelerationRate, deltaTime); 52 | if (Mathf.Abs(m_Velocity[axis]) < 1) 53 | m_Velocity[axis] = 0; 54 | position[axis] += m_Velocity[axis] * deltaTime; 55 | } 56 | // If we have neither elaticity or friction, there shouldn't be any velocity. 57 | else 58 | { 59 | m_Velocity[axis] = 0; 60 | } 61 | } 62 | 63 | if (m_Velocity != Vector2.zero) 64 | { 65 | if (m_MovementType == MovementType.Clamped) 66 | { 67 | offset = CalculateOffset(position - m_Content.anchoredPosition); 68 | position += offset; 69 | } 70 | 71 | SetContentAnchoredPosition(position); 72 | } 73 | } 74 | 75 | if (m_Dragging && m_Inertia) 76 | { 77 | Vector3 newVelocity = (m_Content.anchoredPosition - m_PrevPosition) / deltaTime; 78 | m_Velocity = Vector3.Lerp(m_Velocity, newVelocity, deltaTime * 10); 79 | } 80 | 81 | if (m_ViewBounds != m_PrevViewBounds || m_ContentBounds != m_PrevContentBounds || m_Content.anchoredPosition != m_PrevPosition) 82 | { 83 | UpdateScrollbars(offset); 84 | m_OnValueChanged.Invoke(normalizedPosition); 85 | UpdatePrevData(); 86 | }*/ 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Runtime/Components/LocateScrollRect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92226fa4af1bd8846b5118d6c86588ce 3 | timeCreated: 1512729108 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Components/ProgressBar.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using System.Collections; 4 | using UnityEngine.EventSystems; 5 | using System; 6 | 7 | /// 8 | /// 9 | /// name:ProgressBar 10 | /// author:Administrator 11 | /// date:2016/5/30 17:04:08 12 | /// versions: 13 | /// introduce: 14 | /// note: 15 | /// 进度条 16 | /// 17 | namespace Waiting.UGUI.Components 18 | { 19 | [AddComponentMenu("UI/ProgressBar", 50)] 20 | public class ProgressBar : UIBehaviour, ICanvasElement 21 | { 22 | /// 23 | /// 进度条缩放类型 24 | /// 25 | public enum Type 26 | { 27 | fillAmount, //Image.fillAmount 28 | width, //RectTransform.Width 29 | height, //RectTransform.height 30 | } 31 | 32 | [SerializeField] 33 | protected Type _type; 34 | 35 | public Type type 36 | { 37 | get { return _type; } 38 | set 39 | { 40 | if (_type == value) 41 | { 42 | return; 43 | } 44 | 45 | _type = value; 46 | 47 | SetDirty(); 48 | } 49 | } 50 | 51 | /// 52 | /// type为fillAmount时使用 53 | /// 54 | [SerializeField] 55 | protected Image _fill; 56 | 57 | public Image fill 58 | { 59 | get { return _fill; } 60 | set 61 | { 62 | if (_fill == value) 63 | { 64 | return; 65 | } 66 | 67 | _fill = value; 68 | 69 | SetDirty(); 70 | } 71 | } 72 | 73 | /// 74 | /// type为width/height时使用 75 | /// 76 | [SerializeField] 77 | protected RectTransform _fillTransform; 78 | 79 | public RectTransform fillTransform 80 | { 81 | get { return _fillTransform; } 82 | set 83 | { 84 | if (_fillTransform == value) 85 | { 86 | return; 87 | } 88 | 89 | _fillTransform = value; 90 | 91 | SetDirty(); 92 | } 93 | } 94 | 95 | /// 96 | /// type为width/height时使用 97 | /// width/height最大值 98 | /// 99 | [SerializeField] 100 | protected float _length = 100; 101 | 102 | public float length 103 | { 104 | get { return _length; } 105 | set 106 | { 107 | if (_length == value) 108 | { 109 | return; 110 | } 111 | 112 | _length = value; 113 | 114 | SetDirty(); 115 | } 116 | } 117 | 118 | [SerializeField] 119 | protected Text _label; 120 | 121 | public Text label 122 | { 123 | get { return _label; } 124 | set 125 | { 126 | if (_label == value) 127 | { 128 | return; 129 | } 130 | 131 | _label = value; 132 | 133 | SetDirty(); 134 | } 135 | } 136 | 137 | [SerializeField] 138 | protected bool _isPercent = false; 139 | 140 | public bool isPercent 141 | { 142 | get { return _isPercent; } 143 | set 144 | { 145 | if (_isPercent == value) 146 | { 147 | return; 148 | } 149 | 150 | _isPercent = value; 151 | 152 | SetDirty(); 153 | } 154 | } 155 | 156 | /// 157 | /// 小数精确位数 158 | /// 159 | [Range(0, 5)] 160 | [SerializeField] 161 | protected int _precision = 0; 162 | 163 | public int precision 164 | { 165 | get { return _precision; } 166 | set 167 | { 168 | if (_precision == value) 169 | { 170 | return; 171 | } 172 | 173 | _precision = value; 174 | 175 | SetDirty(); 176 | } 177 | } 178 | 179 | [SerializeField] 180 | protected float _totalValue; 181 | 182 | public float totalValue 183 | { 184 | get { return _totalValue; } 185 | set 186 | { 187 | if (_totalValue == value) 188 | { 189 | return; 190 | } 191 | 192 | _totalValue = value; 193 | 194 | SetDirty(); 195 | } 196 | } 197 | 198 | [Range(0,1)] 199 | [SerializeField] 200 | protected float _percent; 201 | 202 | public float percent 203 | { 204 | get { return _percent; } 205 | set 206 | { 207 | if (_percent == value) 208 | { 209 | return; 210 | } 211 | 212 | value = Mathf.Max(Mathf.Min(value, 1), 0); 213 | 214 | _percent = value; 215 | 216 | SetDirty(); 217 | } 218 | } 219 | 220 | public void UpdateFill() 221 | { 222 | switch (type) 223 | { 224 | case Type.fillAmount: 225 | if (fill != null) 226 | { 227 | fill.fillAmount = _percent; 228 | } 229 | break; 230 | case Type.width: 231 | if (fillTransform == null) 232 | { 233 | break; 234 | } 235 | 236 | if (_percent == 0) 237 | { 238 | fillTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0.001f); 239 | } 240 | else 241 | { 242 | fillTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, length * _percent); 243 | } 244 | break; 245 | case Type.height: 246 | if (fillTransform == null) 247 | { 248 | break; 249 | } 250 | 251 | if (_percent == 0) 252 | { 253 | fillTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0.001f); 254 | } 255 | else 256 | { 257 | fillTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, length * _percent); 258 | } 259 | break; 260 | } 261 | 262 | if (label != null) 263 | { 264 | float multiple = Mathf.Pow(10, precision); 265 | 266 | if (isPercent) 267 | { 268 | label.text = (_percent * 100).ToString("f" + precision) + "%"; 269 | } 270 | else 271 | { 272 | label.text = (_percent * totalValue).ToString("f" + precision) + "/" + totalValue; 273 | } 274 | } 275 | } 276 | 277 | #if UNITY_EDITOR 278 | protected override void OnValidate() 279 | { 280 | base.OnValidate(); 281 | SetDirty(); 282 | } 283 | 284 | #endif 285 | 286 | public void GraphicUpdateComplete() 287 | { 288 | 289 | } 290 | 291 | public void LayoutComplete() 292 | { 293 | 294 | } 295 | 296 | public void Rebuild(CanvasUpdate executing) 297 | { 298 | UpdateFill(); 299 | } 300 | 301 | protected void SetDirty() 302 | { 303 | if (!IsActive()) 304 | return; 305 | 306 | CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); 307 | } 308 | 309 | void OnDestroy() 310 | { 311 | fill = null; 312 | 313 | label = null; 314 | } 315 | } 316 | } 317 | -------------------------------------------------------------------------------- /Runtime/Components/ProgressBar.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bab0bd6920bace34fa159ad6bf2d7894 3 | timeCreated: 1520303341 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Components/RegularPolygon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Sprites; 4 | using UnityEngine.UI; 5 | 6 | /// 7 | /// 8 | /// name:RegularPolygon 9 | /// author:Lawliet 10 | /// date:2018/10/3 21:07:32 11 | /// versions: 12 | /// introduce: 13 | /// note: 14 | /// 15 | /// 16 | namespace Waiting.UGUI.Components 17 | { 18 | public class RegularPolygon : MaskableGraphic, ICanvasRaycastFilter 19 | { 20 | [SerializeField] 21 | protected Sprite m_OverrideSprite; 22 | 23 | public Sprite overrideSprite 24 | { 25 | get 26 | { 27 | return m_OverrideSprite; 28 | } 29 | set 30 | { 31 | m_OverrideSprite = value; 32 | 33 | this.SetAllDirty(); 34 | } 35 | } 36 | 37 | [SerializeField] 38 | protected uint m_Side = 3; 39 | 40 | public uint side 41 | { 42 | set 43 | { 44 | m_Side = value; 45 | 46 | ChangeSideCount(); 47 | 48 | base.SetVerticesDirty(); 49 | } 50 | get 51 | { 52 | return m_Side; 53 | } 54 | } 55 | 56 | [SerializeField] 57 | [Range(0.0f, 0.999f)] 58 | protected float m_InnerPercent = 0.0f; 59 | 60 | public float innerPercent 61 | { 62 | set 63 | { 64 | m_InnerPercent = value; 65 | base.SetVerticesDirty(); 66 | } 67 | get 68 | { 69 | return m_InnerPercent; 70 | } 71 | } 72 | 73 | public override Texture mainTexture 74 | { 75 | get 76 | { 77 | if (overrideSprite == null) 78 | { 79 | if (material != null && material.mainTexture != null) 80 | { 81 | return material.mainTexture; 82 | } 83 | return s_WhiteTexture; 84 | } 85 | 86 | return overrideSprite.texture; 87 | } 88 | } 89 | 90 | public RegularPolygon() 91 | { 92 | ChangeSideCount(); 93 | } 94 | 95 | protected override void OnPopulateMesh(VertexHelper vh) 96 | { 97 | if (m_InnerPercent == 0) 98 | { 99 | DrawPolygon(vh); 100 | } 101 | else 102 | { 103 | DrawRing(vh); 104 | } 105 | } 106 | 107 | private void DrawPolygon(VertexHelper vh) 108 | { 109 | Rect rect = this.GetPixelAdjustedRect(); 110 | 111 | Vector4 outer = new Vector4(); 112 | 113 | if (overrideSprite != null) 114 | { 115 | outer = DataUtility.GetOuterUV(overrideSprite); 116 | } 117 | 118 | 119 | vh.Clear(); 120 | 121 | float size = Mathf.Min(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y); 122 | 123 | float angle = 360.0f / m_Side; 124 | 125 | Vector2[] points = new Vector2[m_Side]; 126 | 127 | for (int i = 0; i < m_Side; i++) 128 | { 129 | Vector2 point = new Vector2(); 130 | 131 | float radius = size * 0.5f; 132 | 133 | point.x = Mathf.Cos((angle * i + 90) * Mathf.Deg2Rad) * radius; 134 | point.y = Mathf.Sin((angle * i + 90) * Mathf.Deg2Rad) * radius; 135 | 136 | points[i] = point; 137 | } 138 | 139 | UIVertex center = GetVertex(Vector2.zero, rect, outer); 140 | 141 | vh.AddVert(center); 142 | 143 | for (int i = 0; i < m_Side; i++) 144 | { 145 | UIVertex a = GetVertex(points[i], rect, outer); 146 | 147 | vh.AddVert(a); 148 | } 149 | 150 | for (int i = 0; i < m_Side; i++) 151 | { 152 | int a = i + 1; 153 | int b = i + 2; 154 | 155 | if (i == m_Side - 1) 156 | { 157 | b = 1; 158 | } 159 | 160 | vh.AddTriangle(0, b, a); 161 | } 162 | } 163 | 164 | private void DrawRing(VertexHelper vh) 165 | { 166 | Rect rect = this.GetPixelAdjustedRect(); 167 | 168 | Vector4 outer = new Vector4(); 169 | 170 | if (overrideSprite != null) 171 | { 172 | outer = DataUtility.GetOuterUV(overrideSprite); 173 | } 174 | 175 | vh.Clear(); 176 | 177 | float size = Mathf.Min(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y); 178 | 179 | float angle = 360.0f / m_Side; 180 | 181 | uint len = m_Side * 2; 182 | 183 | int sideCount = (int)m_Side; 184 | 185 | Vector2[] points = new Vector2[len]; 186 | 187 | for (int i = 0; i < sideCount; i++) 188 | { 189 | Vector2 point = new Vector2(); 190 | 191 | float outerRadius = size * 0.5f; 192 | float innerRadius = size * 0.5f * m_InnerPercent; 193 | 194 | ///添加外点 195 | point.x = Mathf.Cos((angle * i + 90) * Mathf.Deg2Rad) * outerRadius; 196 | point.y = Mathf.Sin((angle * i + 90) * Mathf.Deg2Rad) * outerRadius; 197 | 198 | points[i] = point; 199 | 200 | ///添加内点 201 | point.x = Mathf.Cos((angle * i + 90) * Mathf.Deg2Rad) * innerRadius; 202 | point.y = Mathf.Sin((angle * i + 90) * Mathf.Deg2Rad) * innerRadius; 203 | 204 | points[i + sideCount] = point; 205 | } 206 | 207 | for (int i = 0; i < len; i++) 208 | { 209 | UIVertex a = GetVertex(points[i], rect, outer); 210 | 211 | vh.AddVert(a); 212 | } 213 | 214 | for (int i = 0; i < sideCount; i++) 215 | { 216 | int a = i + 0; 217 | int b = i + 1; 218 | int c = i + 0 + sideCount; 219 | int d = i + 1 + sideCount; 220 | 221 | if (i == sideCount - 1) 222 | { 223 | b = 0; 224 | d = sideCount; 225 | } 226 | 227 | vh.AddTriangle(c, b, a); 228 | vh.AddTriangle(b, d, c); 229 | } 230 | } 231 | 232 | public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) 233 | { 234 | return false; 235 | } 236 | 237 | private UIVertex GetVertex(Vector2 vector, Rect rect, Vector4 inner) 238 | { 239 | UIVertex vertex = new UIVertex(); 240 | vertex.position = vector; 241 | vertex.color = color; 242 | vertex.normal = new Vector3(0, 0, -1); 243 | 244 | float u = (vertex.position.x - rect.x) / rect.width * (inner.z - inner.x) + inner.x; 245 | float v = (vertex.position.y - rect.y) / rect.height * (inner.w - inner.y) + inner.y; 246 | 247 | vertex.uv0 = new Vector2(u, v); 248 | 249 | return vertex; 250 | } 251 | 252 | protected void ChangeSideCount() 253 | { 254 | 255 | } 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /Runtime/Components/RegularPolygon.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5014c8d68015394082ebd33fa55676b 3 | timeCreated: 1567916904 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Components/TimePicker.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | using UnityEngine.EventSystems; 4 | using UnityEngine.UI; 5 | 6 | /// 7 | /// 8 | /// name:TimePicker 9 | /// author:Administrator 10 | /// date:2017/12/8 11:40:22 11 | /// versions: 12 | /// introduce: 13 | /// note: 14 | /// 15 | /// 16 | namespace Waiting.UGUI.Components 17 | { 18 | public class TimePicker : UIBehaviour 19 | { 20 | [SerializeField] 21 | private ScrollRect m_HourScrollRect; 22 | 23 | [SerializeField] 24 | private HorizontalLayoutGroup m_HourLayoutGroup; 25 | 26 | [SerializeField] 27 | private ScrollRect m_MinuteScrollRect; 28 | 29 | [SerializeField] 30 | private float m_Velocity = 0; 31 | 32 | private float m_ItemHeight; 33 | 34 | private bool m_Dragging = false; 35 | 36 | private bool m_Dirty = false; 37 | 38 | protected override void Awake() 39 | { 40 | m_HourScrollRect.onValueChanged.AddListener(HourScrollChangeHandler); 41 | } 42 | 43 | private void HourScrollChangeHandler(Vector2 value) 44 | { 45 | m_Dirty = true; 46 | 47 | m_Dragging = true; 48 | } 49 | 50 | private void UpdateScrollRect() 51 | { 52 | Rect viewport = m_HourScrollRect.viewport.rect; 53 | 54 | m_ItemHeight = viewport.height / 5; 55 | 56 | //m_HourScrollRect.preferredHeight = (m_HourScrollRect.transform as RectTransform).rect.height 57 | } 58 | 59 | protected virtual void LateUpdate() 60 | { 61 | if (!m_Dirty) 62 | { 63 | return; 64 | } 65 | 66 | if (m_Dragging) 67 | { 68 | m_Dragging = false; 69 | 70 | return; 71 | } 72 | 73 | Debug.Log(m_Dragging); 74 | 75 | /*float deltaTime = Time.unscaledDeltaTime; 76 | 77 | RectTransform contentTransform = m_HourScrollRect.content; 78 | 79 | //m_HourScrollRect 80 | 81 | float targetPosition = Mathf.Round(m_HourScrollRect.verticalNormalizedPosition * (12 + 4))/(12+4); 82 | 83 | float speed = m_Velocity; 84 | 85 | m_HourScrollRect.verticalNormalizedPosition = Mathf.SmoothDamp(m_HourScrollRect.verticalNormalizedPosition, targetPosition, ref speed, Mathf.Infinity, deltaTime); 86 | 87 | m_Velocity = speed;*/ 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Runtime/Components/TimePicker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90b1dd6cac13e2040adea649f916f88d 3 | timeCreated: 1512704458 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6bfd90d221d8be4e89e8bbfd1478399 3 | folderAsset: yes 4 | timeCreated: 1545813419 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/Core/DrawUtility.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Assertions; 5 | using UnityEngine.UI; 6 | 7 | /// 8 | /// 9 | /// name:DrawUtility 10 | /// author:Administrator 11 | /// date:2018/12/26 16:33:57 12 | /// versions: 13 | /// introduce: 14 | /// note: 15 | /// 16 | /// 17 | namespace Waiting.UGUI.Core 18 | { 19 | public class DrawUtility 20 | { 21 | public static void DrawLine(VertexHelper vertexHelper, Vector2 startPoint, Vector2 endPoint, Color32 color, float width = 1) 22 | { 23 | DrawLine(vertexHelper, startPoint, endPoint, color, color, width); 24 | } 25 | 26 | public static void DrawLine(VertexHelper vertexHelper, Vector2 startPoint, Vector2 endPoint, Color32 startColor, Color32 endColor, float width = 1) 27 | { 28 | Assert.IsNotNull(vertexHelper, "Argument 'vertexHelper' cannot be null!"); 29 | Assert.IsTrue((startPoint.x != endPoint.x && startPoint.y != endPoint.y), "'startPoint' can't be equal as 'endPoint'!"); 30 | 31 | int startIndex = vertexHelper.currentVertCount; 32 | 33 | float angle = Mathf.Atan2(-endPoint.y + startPoint.y, endPoint.x - startPoint.x); 34 | 35 | float sw = Mathf.Sin(angle) * width * 0.5f; 36 | float sh = Mathf.Cos(angle) * width * 0.5f; 37 | 38 | float ew = Mathf.Sin(angle) * width * 0.5f; 39 | float eh = Mathf.Cos(angle) * width * 0.5f; 40 | 41 | vertexHelper.AddVert(new Vector3(startPoint.x - sw, startPoint.y - sh), startColor, new Vector2(0f, 0f)); 42 | vertexHelper.AddVert(new Vector3(startPoint.x + sw, startPoint.y + sh), startColor, new Vector2(0f, 1f)); 43 | vertexHelper.AddVert(new Vector3(endPoint.x + ew, endPoint.y + sh), endColor, new Vector2(1f, 1f)); 44 | vertexHelper.AddVert(new Vector3(endPoint.x - ew, endPoint.y - sh), endColor, new Vector2(1f, 0f)); 45 | 46 | vertexHelper.AddTriangle(startIndex + 0, startIndex + 1, startIndex + 2); 47 | vertexHelper.AddTriangle(startIndex + 2, startIndex + 3, startIndex + 0); 48 | } 49 | 50 | public static void DrawLine(VertexHelper vertexHelper, Vector2[] pointList, Color32 color, float width = 1) 51 | { 52 | Assert.IsNotNull(vertexHelper, "Argument 'vertexHelper' cannot be null!"); 53 | Assert.IsNotNull(pointList, "Argument 'pointList' cannot be null!"); 54 | Assert.IsTrue(pointList.Length > 1, "pointList's count must be more than one!"); 55 | 56 | DrawLine(vertexHelper, pointList as IEnumerable, color, width); 57 | } 58 | 59 | public static void DrawLine(VertexHelper vertexHelper, List pointList, Color32 color, float width = 1) 60 | { 61 | Assert.IsNotNull(vertexHelper, "Argument 'vertexHelper' cannot be null!"); 62 | Assert.IsNotNull>(pointList, "Argument 'pointList' cannot be null!"); 63 | Assert.IsTrue(pointList.Count > 1, "pointList's count must be more than one!"); 64 | 65 | DrawLine(vertexHelper, pointList as IEnumerable, color, width); 66 | } 67 | 68 | private static void DrawLine(VertexHelper vertexHelper, IEnumerable pointList, Color32 color, float width = 1) 69 | { 70 | var enumerator = pointList.GetEnumerator(); 71 | 72 | Vector2 lastPoint = Vector2.zero; 73 | 74 | int i = 0; 75 | 76 | while (enumerator.MoveNext()) 77 | { 78 | Vector3 current = enumerator.Current; 79 | 80 | if (i > 0) 81 | { 82 | //TODO:直接绘制会产生接缝处开口,以后改成平滑接缝处 83 | DrawLine(vertexHelper, lastPoint, current, color, width); 84 | } 85 | 86 | lastPoint = current; 87 | 88 | i++; 89 | } 90 | } 91 | 92 | private static void Draw() 93 | { 94 | 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Runtime/Core/DrawUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a986c6a9fd7869749ab9fce1bff10614 3 | timeCreated: 1545813422 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Effects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 272862d1d59313e42a0c27d255b0a9d5 3 | folderAsset: yes 4 | timeCreated: 1484797635 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/Effects/Gradient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | /// 7 | /// 8 | /// name:Gradient 9 | /// author:Lawliet 10 | /// date:2019/11/7 10:18:04 11 | /// versions: 12 | /// introduce: 13 | /// note: 14 | /// 15 | /// 16 | namespace Waiting.UGUIEditor 17 | { 18 | [AddComponentMenu("UI/Effects/Gradient")] 19 | [RequireComponent(typeof(Graphic))] 20 | public class Gradient : BaseMeshEffect 21 | { 22 | [SerializeField] 23 | private Color32 m_StartColor = Color.white; 24 | 25 | public Color32 startColor 26 | { 27 | get { return m_StartColor; } 28 | set 29 | { 30 | m_StartColor = value; 31 | } 32 | } 33 | 34 | [SerializeField] 35 | private Color32 m_EndColor = Color.black; 36 | 37 | public Color32 endColor 38 | { 39 | get { return m_EndColor; } 40 | set 41 | { 42 | m_EndColor = value; 43 | } 44 | } 45 | 46 | [SerializeField] 47 | private float m_Angle = 0; 48 | 49 | public float angle 50 | { 51 | get { return m_Angle; } 52 | set 53 | { 54 | m_Angle = value; 55 | } 56 | } 57 | 58 | [SerializeField] 59 | private float m_Percent = 0; 60 | 61 | public float percent 62 | { 63 | get { return m_Percent; } 64 | set 65 | { 66 | m_Percent = value; 67 | } 68 | } 69 | 70 | public override void ModifyMesh(VertexHelper vh) 71 | { 72 | if (!IsActive()) 73 | { 74 | return; 75 | } 76 | 77 | var count = vh.currentVertCount; 78 | if (count == 0) 79 | { 80 | return; 81 | } 82 | 83 | List vertexs = new List(); 84 | 85 | vh.GetUIVertexStream(vertexs); 86 | 87 | Rect rect = graphic.GetPixelAdjustedRect(); 88 | 89 | count = vertexs.Count; 90 | 91 | angle = angle % 360.0f; 92 | 93 | for (var i = 0; i < count; i++) 94 | { 95 | var vertex = vertexs[i]; 96 | 97 | byte alpha = vertex.color.a; 98 | 99 | Color32 color; 100 | 101 | if (angle >= 0 && angle < 90) 102 | { 103 | color = Color32.Lerp(m_StartColor, m_EndColor, (vertexs[i].position.x - rect.xMin) / rect.width); 104 | } 105 | else if (angle >= 90 && angle < 180) 106 | { 107 | color = Color32.Lerp(m_EndColor, m_StartColor, (vertexs[i].position.y - rect.yMin) / rect.height); 108 | } 109 | else if (angle >= 180 && angle < 270) 110 | { 111 | color = Color32.Lerp(m_EndColor, m_StartColor, (vertexs[i].position.x - rect.xMin) / rect.width); 112 | } 113 | else 114 | { 115 | color = Color32.Lerp(m_StartColor, m_EndColor, (vertexs[i].position.y - rect.yMin) / rect.height); 116 | } 117 | 118 | color.a = (byte)(color.a * alpha / byte.MaxValue); 119 | 120 | vertex.color = color; 121 | 122 | vertexs[i] = vertex; 123 | } 124 | 125 | vh.Clear(); 126 | vh.AddUIVertexTriangleStream(vertexs); 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /Runtime/Effects/Gradient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5d2d703c4abe7944a6dc231eaefca41 3 | timeCreated: 1553658394 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Effects/Mirror.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityEngine.Sprites; 6 | using UnityEngine.UI; 7 | using Waiting.UGUI.Collections; 8 | 9 | /// 10 | /// 11 | /// name:Mirror 12 | /// author:Lawliet 13 | /// date:2017/1/19 11:53:01 14 | /// versions: 15 | /// introduce: 16 | /// note: 17 | /// 18 | /// 19 | namespace Waiting.UGUI.Effects 20 | { 21 | [AddComponentMenu("UI/Effects/Mirror", 20)] 22 | [RequireComponent(typeof(Graphic))] 23 | public class Mirror : BaseMeshEffect 24 | { 25 | public enum MirrorType 26 | { 27 | /// 28 | /// 水平 29 | /// 30 | Horizontal, 31 | 32 | /// 33 | /// 垂直 34 | /// 35 | Vertical, 36 | 37 | /// 38 | /// 四分之一 39 | /// 相当于水平,然后再垂直 40 | /// 41 | Quarter, 42 | } 43 | 44 | /// 45 | /// 镜像类型 46 | /// 47 | [SerializeField] 48 | private MirrorType m_MirrorType = MirrorType.Horizontal; 49 | 50 | public MirrorType mirrorType 51 | { 52 | get { return m_MirrorType; } 53 | set 54 | { 55 | if (m_MirrorType != value) 56 | { 57 | m_MirrorType = value; 58 | if(graphic != null){ 59 | graphic.SetVerticesDirty(); 60 | } 61 | } 62 | } 63 | } 64 | 65 | /// 66 | /// 颠倒元素 67 | /// 68 | [SerializeField] 69 | private bool m_IsReversed = false; 70 | 71 | public bool isReversed 72 | { 73 | get { return m_IsReversed; } 74 | set 75 | { 76 | if (m_IsReversed != value) 77 | { 78 | m_IsReversed = value; 79 | if (graphic != null) 80 | { 81 | graphic.SetVerticesDirty(); 82 | } 83 | } 84 | } 85 | } 86 | 87 | [NonSerialized] 88 | private RectTransform m_RectTransform; 89 | 90 | public RectTransform rectTransform 91 | { 92 | get { return m_RectTransform ?? (m_RectTransform = GetComponent()); } 93 | } 94 | 95 | /// 96 | /// 设置原始尺寸 97 | /// 98 | public void SetNativeSize() 99 | { 100 | if (graphic != null && graphic is Image) 101 | { 102 | Sprite overrideSprite = (graphic as Image).overrideSprite; 103 | 104 | if(overrideSprite != null){ 105 | float w = overrideSprite.rect.width / (graphic as Image).pixelsPerUnit; 106 | float h = overrideSprite.rect.height / (graphic as Image).pixelsPerUnit; 107 | rectTransform.anchorMax = rectTransform.anchorMin; 108 | 109 | switch (m_MirrorType) 110 | { 111 | case MirrorType.Horizontal: 112 | rectTransform.sizeDelta = new Vector2(w * 2, h); 113 | break; 114 | case MirrorType.Vertical: 115 | rectTransform.sizeDelta = new Vector2(w, h * 2); 116 | break; 117 | case MirrorType.Quarter: 118 | rectTransform.sizeDelta = new Vector2(w * 2, h * 2); 119 | break; 120 | } 121 | 122 | graphic.SetVerticesDirty(); 123 | } 124 | } 125 | } 126 | 127 | public override void ModifyMesh(VertexHelper vh) 128 | { 129 | if (!IsActive()) 130 | { 131 | return; 132 | } 133 | 134 | var output = ListPool.Get(); 135 | vh.GetUIVertexStream(output); 136 | 137 | int count = output.Count; 138 | 139 | if (graphic is Image) 140 | { 141 | Image.Type type = (graphic as Image).type; 142 | 143 | switch (type) 144 | { 145 | case Image.Type.Simple: 146 | DrawSimple(output, count); 147 | break; 148 | case Image.Type.Sliced: 149 | DrawSliced(output, count); 150 | break; 151 | case Image.Type.Tiled: 152 | DrawTiled(output, count); 153 | break; 154 | case Image.Type.Filled: 155 | break; 156 | } 157 | } 158 | else 159 | { 160 | DrawSimple(output, count); 161 | } 162 | 163 | vh.Clear(); 164 | vh.AddUIVertexTriangleStream(output); 165 | 166 | ListPool.Recycle(output); 167 | } 168 | 169 | /// 170 | /// 绘制Simple版 171 | /// 172 | /// 173 | /// 174 | protected void DrawSimple(List output, int count) 175 | { 176 | Rect rect = graphic.GetPixelAdjustedRect(); 177 | 178 | SimpleScale(rect, output, count); 179 | 180 | switch (m_MirrorType) 181 | { 182 | case MirrorType.Horizontal: 183 | ExtendCapacity(output, count); 184 | MirrorVerts(rect, output, count, true, true); 185 | break; 186 | case MirrorType.Vertical: 187 | ExtendCapacity(output, count); 188 | MirrorVerts(rect, output, count, false, true); 189 | break; 190 | case MirrorType.Quarter: 191 | ExtendCapacity(output, count * 3); 192 | MirrorVerts(rect, output, count, true, false); 193 | MirrorVerts(rect, output, count * 2, false, false); 194 | break; 195 | } 196 | } 197 | 198 | /// 199 | /// 绘制Sliced版 200 | /// 201 | /// 202 | /// 203 | protected void DrawSliced(List output, int count) 204 | { 205 | if (!(graphic as Image).hasBorder) 206 | { 207 | DrawSimple(output, count); 208 | 209 | return; 210 | } 211 | 212 | Rect rect = graphic.GetPixelAdjustedRect(); 213 | 214 | SlicedScale(rect, output, count); 215 | 216 | count = SliceExcludeVerts(output, count); 217 | 218 | switch (m_MirrorType) 219 | { 220 | case MirrorType.Horizontal: 221 | ExtendCapacity(output, count); 222 | MirrorVerts(rect, output, count, true, true); 223 | break; 224 | case MirrorType.Vertical: 225 | ExtendCapacity(output, count); 226 | MirrorVerts(rect, output, count, false, true); 227 | break; 228 | case MirrorType.Quarter: 229 | ExtendCapacity(output, count * 3); 230 | MirrorVerts(rect, output, count, true, false); 231 | MirrorVerts(rect, output, count * 2, false, false); 232 | break; 233 | } 234 | } 235 | 236 | /// 237 | /// 绘制Tiled版 238 | /// 239 | /// 240 | /// 241 | protected void DrawTiled(List verts, int count) 242 | { 243 | Sprite overrideSprite = (graphic as Image).overrideSprite; 244 | 245 | if (overrideSprite == null) 246 | { 247 | return; 248 | } 249 | 250 | Rect rect = graphic.GetPixelAdjustedRect(); 251 | 252 | //此处使用inner是因为Image绘制Tiled时,会把透明区域也绘制了。 253 | 254 | Vector4 inner = DataUtility.GetInnerUV(overrideSprite); 255 | 256 | float w = overrideSprite.rect.width / (graphic as Image).pixelsPerUnit; 257 | float h = overrideSprite.rect.height / (graphic as Image).pixelsPerUnit; 258 | 259 | int len = count / 3; 260 | 261 | for (int i = 0; i < len; i++) 262 | { 263 | UIVertex v1 = verts[i * 3]; 264 | UIVertex v2 = verts[i * 3 + 1]; 265 | UIVertex v3 = verts[i * 3 + 2]; 266 | 267 | float centerX = GetCenter(v1.position.x, v2.position.x, v3.position.x); 268 | 269 | float centerY = GetCenter(v1.position.y, v2.position.y, v3.position.y); 270 | 271 | if (m_MirrorType == MirrorType.Horizontal || m_MirrorType == MirrorType.Quarter) 272 | { 273 | //判断三个点的水平位置是否在偶数矩形内,如果是,则把UV坐标水平翻转 274 | if (Mathf.FloorToInt((centerX - rect.xMin) / w) % 2 == 1) 275 | { 276 | v1.uv0 = GetOverturnUV(v1.uv0, inner.x, inner.z, true); 277 | v2.uv0 = GetOverturnUV(v2.uv0, inner.x, inner.z, true); 278 | v3.uv0 = GetOverturnUV(v3.uv0, inner.x, inner.z, true); 279 | } 280 | } 281 | 282 | if (m_MirrorType == MirrorType.Vertical || m_MirrorType == MirrorType.Quarter) 283 | { 284 | //判断三个点的垂直位置是否在偶数矩形内,如果是,则把UV坐标垂直翻转 285 | if (Mathf.FloorToInt((centerY - rect.yMin) / h) % 2 == 1) 286 | { 287 | v1.uv0 = GetOverturnUV(v1.uv0, inner.y, inner.w, false); 288 | v2.uv0 = GetOverturnUV(v2.uv0, inner.y, inner.w, false); 289 | v3.uv0 = GetOverturnUV(v3.uv0, inner.y, inner.w, false); 290 | } 291 | } 292 | 293 | verts[i * 3] = v1; 294 | verts[i * 3 + 1] = v2; 295 | verts[i * 3 + 2] = v3; 296 | } 297 | } 298 | 299 | /// 300 | /// 扩展容量 301 | /// 302 | /// 303 | /// 304 | protected void ExtendCapacity(List verts, int addCount) 305 | { 306 | var neededCapacity = verts.Count + addCount; 307 | if (verts.Capacity < neededCapacity) 308 | { 309 | verts.Capacity = neededCapacity; 310 | } 311 | } 312 | 313 | /// 314 | /// Simple缩放位移顶点(减半) 315 | /// 316 | /// 317 | /// 318 | /// 319 | protected void SimpleScale(Rect rect, List verts, int count) 320 | { 321 | for (int i = 0; i < count; i++) 322 | { 323 | UIVertex vertex = verts[i]; 324 | 325 | Vector3 position = vertex.position; 326 | 327 | if (m_MirrorType == MirrorType.Horizontal || m_MirrorType == MirrorType.Quarter) 328 | { 329 | position.x = (position.x + rect.x) * 0.5f; 330 | } 331 | 332 | if (m_MirrorType == MirrorType.Vertical || m_MirrorType == MirrorType.Quarter) 333 | { 334 | position.y = (position.y + rect.y) * 0.5f; 335 | } 336 | 337 | vertex.position = position; 338 | 339 | verts[i] = vertex; 340 | } 341 | } 342 | 343 | /// 344 | /// Sliced缩放位移顶点(减半) 345 | /// 346 | /// 347 | /// 348 | /// 349 | protected void SlicedScale(Rect rect, List verts, int count) 350 | { 351 | Vector4 border = GetAdjustedBorders(rect); 352 | 353 | float halfWidth = rect.width * 0.5f; 354 | 355 | float halfHeight = rect.height * 0.5f; 356 | 357 | for (int i = 0; i < count; i++) 358 | { 359 | UIVertex vertex = verts[i]; 360 | 361 | Vector3 position = vertex.position; 362 | 363 | if (m_MirrorType == MirrorType.Horizontal || m_MirrorType == MirrorType.Quarter) 364 | { 365 | if (halfWidth < border.x && position.x >= rect.center.x) 366 | { 367 | position.x = rect.center.x; 368 | } 369 | else if (position.x >= border.x) 370 | { 371 | position.x = (position.x + rect.x) * 0.5f; 372 | } 373 | } 374 | 375 | if (m_MirrorType == MirrorType.Vertical || m_MirrorType == MirrorType.Quarter) 376 | { 377 | if (halfHeight < border.y && position.y >= rect.center.y) 378 | { 379 | position.y = rect.center.y; 380 | } 381 | else if (position.y >= border.y) 382 | { 383 | position.y = (position.y + rect.y) * 0.5f; 384 | } 385 | } 386 | 387 | vertex.position = position; 388 | 389 | verts[i] = vertex; 390 | } 391 | } 392 | 393 | /// 394 | /// 镜像顶点 395 | /// 396 | /// 397 | /// 398 | /// 399 | /// 400 | /// 401 | protected void MirrorVerts(Rect rect, List verts, int count, bool isHorizontal = true, bool canReverse = false) 402 | { 403 | bool isReversedResult = canReverse && isReversed; 404 | 405 | for (int i = 0; i < count; i++) 406 | { 407 | int index; 408 | 409 | if (isReversedResult) 410 | { 411 | index = i; 412 | } 413 | else 414 | { 415 | index = (count - 1) - i; 416 | } 417 | 418 | UIVertex vertex = verts[index]; 419 | 420 | Vector3 position = vertex.position; 421 | 422 | if (isHorizontal) 423 | { 424 | position.x = rect.center.x * 2 - position.x; 425 | 426 | if (isReversedResult) 427 | { 428 | position.y = rect.center.y * 2 - position.y; 429 | } 430 | } 431 | else 432 | { 433 | position.y = rect.center.y * 2 - position.y; 434 | 435 | if (isReversedResult) 436 | { 437 | position.x = rect.center.x * 2 - position.x; 438 | } 439 | } 440 | 441 | vertex.position = position; 442 | 443 | verts.Add(vertex); 444 | } 445 | } 446 | 447 | /// 448 | /// 清理掉不能成三角面的顶点 449 | /// 450 | /// 451 | /// 452 | /// 453 | protected int SliceExcludeVerts(List verts, int count) 454 | { 455 | int realCount = count; 456 | 457 | int i = 0; 458 | 459 | while (i < realCount) 460 | { 461 | UIVertex v1 = verts[i]; 462 | UIVertex v2 = verts[i + 1]; 463 | UIVertex v3 = verts[i + 2]; 464 | 465 | if (v1.position == v2.position || v2.position == v3.position || v3.position == v1.position) 466 | { 467 | verts[i] = verts[realCount - 3]; 468 | verts[i + 1] = verts[realCount - 2]; 469 | verts[i + 2] = verts[realCount - 1]; 470 | 471 | realCount -= 3; 472 | continue; 473 | } 474 | 475 | i += 3; 476 | } 477 | 478 | if (realCount < count) 479 | { 480 | verts.RemoveRange(realCount, count - realCount); 481 | } 482 | 483 | return realCount; 484 | } 485 | 486 | /// 487 | /// 返回矫正过的范围 488 | /// 489 | /// 490 | /// 491 | protected Vector4 GetAdjustedBorders(Rect rect) 492 | { 493 | Sprite overrideSprite = (graphic as Image).overrideSprite; 494 | 495 | Vector4 border = overrideSprite.border; 496 | 497 | border = border / (graphic as Image).pixelsPerUnit; 498 | 499 | for (int axis = 0; axis <= 1; axis++) 500 | { 501 | float combinedBorders = border[axis] + border[axis + 2]; 502 | if (rect.size[axis] < combinedBorders && combinedBorders != 0) 503 | { 504 | float borderScaleRatio = rect.size[axis] / combinedBorders; 505 | border[axis] *= borderScaleRatio; 506 | border[axis + 2] *= borderScaleRatio; 507 | } 508 | } 509 | 510 | return border; 511 | } 512 | 513 | /// 514 | /// 返回三个点的中心点 515 | /// 516 | /// 517 | /// 518 | /// 519 | /// 520 | protected float GetCenter(float p1, float p2, float p3) 521 | { 522 | float max = Mathf.Max(Mathf.Max(p1, p2), p3); 523 | 524 | float min = Mathf.Min(Mathf.Min(p1, p2), p3); 525 | 526 | return (max + min) / 2; 527 | } 528 | 529 | /// 530 | /// 返回翻转UV坐标 531 | /// 532 | /// 533 | /// 534 | /// 535 | /// 536 | /// 537 | protected Vector2 GetOverturnUV(Vector2 uv, float start, float end, bool isHorizontal = true) 538 | { 539 | if (isHorizontal) 540 | { 541 | uv.x = end - uv.x + start; 542 | } 543 | else 544 | { 545 | uv.y = end - uv.y + start; 546 | } 547 | 548 | return uv; 549 | } 550 | 551 | } 552 | } 553 | -------------------------------------------------------------------------------- /Runtime/Effects/Mirror.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 645d624fb0bb6a342ae3b4cbe052b595 3 | timeCreated: 1484798005 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Effects/OutlineShadow.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using Waiting.UGUI.Collections; 6 | 7 | /// 8 | /// 9 | /// name:OutlineShadow 10 | /// author:Administrator 11 | /// date:2017/10/16 15:19:41 12 | /// versions: 13 | /// introduce: 14 | /// note: 15 | /// 16 | /// 17 | namespace Waiting.UGUI.Effects 18 | { 19 | public class OutlineShadow : BaseMeshEffect 20 | { 21 | [SerializeField] 22 | private Color m_OutlineEffectColor = new Color(0f, 0f, 0f, 0.5f); 23 | 24 | [SerializeField] 25 | private Vector2 m_OutlineEffectDistance = new Vector2(1f, -1f); 26 | 27 | [SerializeField] 28 | private bool m_OutlineUseGraphicAlpha = true; 29 | 30 | [SerializeField] 31 | private Color m_ShadowEffectColor = new Color(0f, 0f, 0f, 0.5f); 32 | 33 | [SerializeField] 34 | private Vector2 m_ShadowEffectDistance = new Vector2(1f, -1f); 35 | 36 | [SerializeField] 37 | private bool m_ShadowUseGraphicAlpha = true; 38 | 39 | private const float kMaxEffectDistance = 600f; 40 | 41 | #if UNITY_EDITOR 42 | protected override void OnValidate() 43 | { 44 | outlineEffectDistance = m_OutlineEffectDistance; 45 | shadowEffectDistance = m_ShadowEffectDistance; 46 | base.OnValidate(); 47 | } 48 | 49 | #endif 50 | 51 | public Color outlineEffectColor 52 | { 53 | get { return m_OutlineEffectColor; } 54 | set 55 | { 56 | m_OutlineEffectColor = value; 57 | if (graphic != null) 58 | graphic.SetVerticesDirty(); 59 | } 60 | } 61 | 62 | public Vector2 outlineEffectDistance 63 | { 64 | get { return m_OutlineEffectDistance; } 65 | set 66 | { 67 | value = DistanceLimit(value); 68 | 69 | if (m_OutlineEffectDistance == value) 70 | return; 71 | 72 | m_OutlineEffectDistance = value; 73 | 74 | if (graphic != null) 75 | graphic.SetVerticesDirty(); 76 | } 77 | } 78 | 79 | public bool outlineUseGraphicAlpha 80 | { 81 | get { return m_OutlineUseGraphicAlpha; } 82 | set 83 | { 84 | m_OutlineUseGraphicAlpha = value; 85 | if (graphic != null) 86 | graphic.SetVerticesDirty(); 87 | } 88 | } 89 | 90 | public Color shadowEffectColor 91 | { 92 | get { return m_ShadowEffectColor; } 93 | set 94 | { 95 | m_ShadowEffectColor = value; 96 | if (graphic != null) 97 | graphic.SetVerticesDirty(); 98 | } 99 | } 100 | 101 | public Vector2 shadowEffectDistance 102 | { 103 | get { return m_ShadowEffectDistance; } 104 | set 105 | { 106 | value = DistanceLimit(value); 107 | 108 | if (m_ShadowEffectDistance == value) 109 | return; 110 | 111 | m_ShadowEffectDistance = value; 112 | 113 | if (graphic != null) 114 | graphic.SetVerticesDirty(); 115 | } 116 | } 117 | 118 | public bool shadowUseGraphicAlpha 119 | { 120 | get { return m_ShadowUseGraphicAlpha; } 121 | set 122 | { 123 | m_ShadowUseGraphicAlpha = value; 124 | if (graphic != null) 125 | graphic.SetVerticesDirty(); 126 | } 127 | } 128 | 129 | /// 130 | /// 限定距离最大最小尺寸 131 | /// 132 | /// 133 | /// 134 | protected Vector2 DistanceLimit(Vector2 value) 135 | { 136 | if (value.x > kMaxEffectDistance) 137 | value.x = kMaxEffectDistance; 138 | if (value.x < -kMaxEffectDistance) 139 | value.x = -kMaxEffectDistance; 140 | 141 | if (value.y > kMaxEffectDistance) 142 | value.y = kMaxEffectDistance; 143 | if (value.y < -kMaxEffectDistance) 144 | value.y = -kMaxEffectDistance; 145 | 146 | return value; 147 | } 148 | 149 | /// 150 | /// 绘制单个Shadow 151 | /// 152 | /// 153 | /// 154 | /// 155 | /// 156 | /// 157 | /// 158 | /// 159 | protected void ApplyShadowZeroAlloc(List verts, Color32 color, int start, int end, float x, float y, bool useGraphicAlpha) 160 | { 161 | UIVertex vt; 162 | 163 | var neededCapacity = verts.Count + end - start; 164 | if (verts.Capacity < neededCapacity) 165 | verts.Capacity = neededCapacity; 166 | 167 | for (int i = start; i < end; ++i) 168 | { 169 | vt = verts[i]; 170 | verts.Add(vt); 171 | 172 | Vector3 v = vt.position; 173 | v.x += x; 174 | v.y += y; 175 | vt.position = v; 176 | var newColor = color; 177 | if (useGraphicAlpha) 178 | newColor.a = (byte)((newColor.a * verts[i].color.a) / 255); 179 | vt.color = newColor; 180 | verts[i] = vt; 181 | } 182 | } 183 | 184 | public override void ModifyMesh(VertexHelper vh) 185 | { 186 | if (!IsActive()) 187 | return; 188 | 189 | var output = ListPool.Get(); 190 | vh.GetUIVertexStream(output); 191 | 192 | int len = output.Count; 193 | 194 | var neededCpacity = output.Count * 6; 195 | if (output.Capacity < neededCpacity) 196 | output.Capacity = neededCpacity; 197 | 198 | //Shadow 199 | 200 | ApplyShadowZeroAlloc(output, shadowEffectColor, 0, output.Count, shadowEffectDistance.x, shadowEffectDistance.y, m_ShadowUseGraphicAlpha); 201 | 202 | //Outline 203 | 204 | var start = len; 205 | var end = output.Count; 206 | ApplyShadowZeroAlloc(output, outlineEffectColor, start, output.Count, outlineEffectDistance.x, outlineEffectDistance.y, m_OutlineUseGraphicAlpha); 207 | 208 | start = end; 209 | end = output.Count; 210 | ApplyShadowZeroAlloc(output, outlineEffectColor, start, output.Count, outlineEffectDistance.x, -outlineEffectDistance.y, m_OutlineUseGraphicAlpha); 211 | 212 | start = end; 213 | end = output.Count; 214 | ApplyShadowZeroAlloc(output, outlineEffectColor, start, output.Count, -outlineEffectDistance.x, outlineEffectDistance.y, m_OutlineUseGraphicAlpha); 215 | 216 | start = end; 217 | end = output.Count; 218 | ApplyShadowZeroAlloc(output, outlineEffectColor, start, output.Count, -outlineEffectDistance.x, -outlineEffectDistance.y, m_OutlineUseGraphicAlpha); 219 | 220 | vh.Clear(); 221 | vh.AddUIVertexTriangleStream(output); 222 | ListPool.Recycle(output); 223 | } 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /Runtime/Effects/OutlineShadow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b641e470dd713248a1a2b70798e5871 3 | timeCreated: 1508138522 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Effects/PolygonMask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityEngine.Sprites; 6 | using UnityEngine.UI; 7 | using Waiting.UGUI.Collections; 8 | using Waiting.UGUI.Components; 9 | 10 | /// 11 | /// 12 | /// name:PolygonMask 13 | /// author:Lawliet 14 | /// date:2019/10/1 11:53:01 15 | /// versions: 16 | /// introduce: 17 | /// note: 18 | /// 19 | /// 20 | namespace Waiting.UGUI.Effects 21 | { 22 | [AddComponentMenu("UI/Effects/PolygonMask", 21)] 23 | [RequireComponent(typeof(Graphic))] 24 | public class PolygonMask : BaseMeshEffect 25 | { 26 | public enum MaskType 27 | { 28 | /// 29 | /// RectTransform 30 | /// 31 | //Rect, 32 | /// 33 | /// 正多边形 34 | /// 35 | RegularPolygon, 36 | /// 37 | /// 不规则多边形 38 | /// 39 | Polygon, 40 | } 41 | 42 | /// 43 | /// 镜像类型 44 | /// 45 | [SerializeField] 46 | private MaskType m_MaskType = MaskType.Polygon; 47 | 48 | public MaskType maskType 49 | { 50 | get { return m_MaskType; } 51 | set 52 | { 53 | if (m_MaskType != value) 54 | { 55 | m_MaskType = value; 56 | 57 | if (graphic != null) 58 | { 59 | graphic.SetVerticesDirty(); 60 | } 61 | } 62 | } 63 | } 64 | 65 | [SerializeField] 66 | private RectTransform m_MaskRect; 67 | 68 | public RectTransform maskRect 69 | { 70 | get { return m_MaskRect == null ? this.transform.parent as RectTransform : m_MaskRect; } 71 | set 72 | { 73 | if (m_MaskRect != value) 74 | { 75 | m_MaskRect = value; 76 | 77 | if (graphic != null) 78 | { 79 | graphic.SetVerticesDirty(); 80 | } 81 | } 82 | } 83 | } 84 | 85 | [SerializeField] 86 | private RegularPolygon m_RegularPolygon; 87 | 88 | public RegularPolygon regularPolygon 89 | { 90 | get { return m_RegularPolygon; } 91 | set 92 | { 93 | if (m_RegularPolygon != value) 94 | { 95 | m_RegularPolygon = value; 96 | 97 | if (graphic != null) 98 | { 99 | graphic.SetVerticesDirty(); 100 | } 101 | } 102 | } 103 | } 104 | 105 | [SerializeField] 106 | private PolygonCollider2D m_PolygonCollider2D; 107 | 108 | public PolygonCollider2D polygonCollider2D 109 | { 110 | get { return m_PolygonCollider2D; } 111 | set 112 | { 113 | if (m_PolygonCollider2D != value) 114 | { 115 | m_PolygonCollider2D = value; 116 | 117 | if (graphic != null) 118 | { 119 | graphic.SetVerticesDirty(); 120 | } 121 | } 122 | } 123 | } 124 | 125 | /// 126 | /// 采用局部坐标 127 | /// 不采用的话,会根据Mask的RectTransform做偏移 128 | /// 129 | [SerializeField] 130 | private bool m_IsLocal; 131 | 132 | public bool isLocal 133 | { 134 | get { return m_IsLocal; } 135 | set 136 | { 137 | if(m_IsLocal != value) 138 | { 139 | m_IsLocal = value; 140 | 141 | if(graphic != null) 142 | { 143 | graphic.SetVerticesDirty(); 144 | } 145 | } 146 | } 147 | } 148 | 149 | [NonSerialized] 150 | private RectTransform m_RectTransform; 151 | 152 | public RectTransform rectTransform 153 | { 154 | get { return m_RectTransform ?? (m_RectTransform = GetComponent()); } 155 | } 156 | 157 | /*[SerializeField] 158 | private int m_DrawStep;*/ 159 | 160 | #if UNITY_EDITOR 161 | public void SetDirty() 162 | { 163 | if (graphic != null) 164 | { 165 | graphic.SetVerticesDirty(); 166 | } 167 | } 168 | #endif 169 | 170 | public override void ModifyMesh(VertexHelper vh) 171 | { 172 | if (!IsActive()) 173 | { 174 | return; 175 | } 176 | 177 | 178 | 179 | var original = ListPool.Get(); 180 | var output = ListPool.Get(); 181 | vh.GetUIVertexStream(original); 182 | 183 | int count = original.Count; 184 | 185 | switch (m_MaskType) 186 | { 187 | case MaskType.RegularPolygon: 188 | if (regularPolygon != null) 189 | { 190 | DrawRegularPolygon(original, output, count); 191 | } 192 | else 193 | { 194 | return; 195 | } 196 | 197 | break; 198 | case MaskType.Polygon: 199 | if (m_PolygonCollider2D == null) 200 | { 201 | return; 202 | } 203 | DrawPolygon(original, output, count); 204 | break; 205 | default: 206 | break; 207 | } 208 | 209 | vh.Clear(); 210 | vh.AddUIVertexTriangleStream(output); 211 | 212 | ListPool.Recycle(original); 213 | ListPool.Recycle(output); 214 | } 215 | 216 | private void DrawRect(List original, List output, int count) 217 | { 218 | Sprite overrideSprite = null; 219 | 220 | Rect rect = graphic.GetPixelAdjustedRect(); 221 | 222 | Vector4 outer = new Vector4(); 223 | 224 | if (graphic is Image) 225 | { 226 | overrideSprite = (graphic as Image).overrideSprite; 227 | 228 | if (overrideSprite != null) 229 | { 230 | outer = DataUtility.GetOuterUV(overrideSprite); 231 | } 232 | } 233 | 234 | Vector2 offset = GetRectTransformOffset(rectTransform, maskRect); 235 | 236 | Vector2 v0 = new Vector2(maskRect.rect.xMin, maskRect.rect.yMin) - offset; 237 | Vector2 v1 = new Vector2(maskRect.rect.xMax, maskRect.rect.yMin) - offset; 238 | Vector2 v2 = new Vector2(maskRect.rect.xMax, maskRect.rect.yMax) - offset; 239 | Vector2 v3 = new Vector2(maskRect.rect.xMin, maskRect.rect.yMax) - offset; 240 | 241 | output.Add(GetVertex(v0, rect, overrideSprite, outer)); 242 | output.Add(GetVertex(v1, rect, overrideSprite, outer)); 243 | output.Add(GetVertex(v2, rect, overrideSprite, outer)); 244 | 245 | output.Add(GetVertex(v0, rect, overrideSprite, outer)); 246 | output.Add(GetVertex(v2, rect, overrideSprite, outer)); 247 | output.Add(GetVertex(v3, rect, overrideSprite, outer)); 248 | } 249 | 250 | private void DrawRegularPolygon(List original, List output, int count) 251 | { 252 | Sprite overrideSprite = null; 253 | 254 | Rect rect = graphic.GetPixelAdjustedRect(); 255 | 256 | Vector4 inner = new Vector4(); 257 | 258 | if (graphic is Image) 259 | { 260 | overrideSprite = (graphic as Image).overrideSprite; 261 | 262 | if (overrideSprite != null) 263 | { 264 | inner = DataUtility.GetInnerUV(overrideSprite); 265 | } 266 | } 267 | 268 | uint side = regularPolygon.side; 269 | float innerPercent = regularPolygon.innerPercent; 270 | 271 | Vector2 offset = new Vector2(); 272 | 273 | if (!m_IsLocal) 274 | { 275 | offset = GetRectTransformOffset(rectTransform, regularPolygon.rectTransform); 276 | } 277 | 278 | float size = Mathf.Min(regularPolygon.rectTransform.sizeDelta.x, regularPolygon.rectTransform.sizeDelta.y); 279 | 280 | float angle = 360.0f / side; 281 | 282 | uint len = side * 2; 283 | 284 | int sideCount = (int)side; 285 | 286 | Vector2[] points = new Vector2[len]; 287 | 288 | for (int i = 0; i < sideCount; i++) 289 | { 290 | Vector2 point = new Vector2(); 291 | 292 | float outerRadius = size * 0.5f; 293 | float innerRadius = size * 0.5f * innerPercent; 294 | 295 | ///添加外点 296 | point.x = Mathf.Cos((angle * i + 90) * Mathf.Deg2Rad) * outerRadius; 297 | point.y = Mathf.Sin((angle * i + 90) * Mathf.Deg2Rad) * outerRadius; 298 | 299 | points[i] = point; 300 | 301 | ///添加内点 302 | point.x = Mathf.Cos((angle * i + 90) * Mathf.Deg2Rad) * innerRadius; 303 | point.y = Mathf.Sin((angle * i + 90) * Mathf.Deg2Rad) * innerRadius; 304 | 305 | points[i + sideCount] = point; 306 | } 307 | 308 | for (int i = 0; i < sideCount; i++) 309 | { 310 | int a = i + 0; 311 | int b = i + 1; 312 | int c = i + 0 + sideCount; 313 | int d = i + 1 + sideCount; 314 | 315 | if (i == sideCount - 1) 316 | { 317 | b = 0; 318 | d = sideCount; 319 | } 320 | 321 | output.Add(GetVertex(points, c, offset, rect, overrideSprite, inner)); 322 | output.Add(GetVertex(points, b, offset, rect, overrideSprite, inner)); 323 | output.Add(GetVertex(points, a, offset, rect, overrideSprite, inner)); 324 | 325 | output.Add(GetVertex(points, b, offset, rect, overrideSprite, inner)); 326 | output.Add(GetVertex(points, d, offset, rect, overrideSprite, inner)); 327 | output.Add(GetVertex(points, c, offset, rect, overrideSprite, inner)); 328 | } 329 | } 330 | 331 | /// 332 | /// 333 | /// 334 | /// 335 | /// 336 | /// 337 | private void DrawPolygon(List original, List output, int count) 338 | { 339 | Vector2[] points = m_PolygonCollider2D.points; 340 | 341 | Sprite overrideSprite = null ; 342 | 343 | Rect rect = graphic.GetPixelAdjustedRect(); 344 | 345 | Vector4 inner = new Vector4(); 346 | 347 | if (graphic is Image) 348 | { 349 | overrideSprite = (graphic as Image).overrideSprite; 350 | 351 | if(overrideSprite != null) 352 | { 353 | inner = DataUtility.GetInnerUV(overrideSprite); 354 | } 355 | } 356 | 357 | Vector2 offset = new Vector2(); 358 | 359 | if (!m_IsLocal) 360 | { 361 | offset = GetRectTransformOffset(rectTransform, m_PolygonCollider2D.transform as RectTransform); 362 | } 363 | 364 | var len = points.Length; 365 | 366 | List indexList = new List(len); 367 | 368 | #if UNITY_5 369 | for (int i = len - 1; i >= 0; i--) 370 | #else //Unity5 之后修改了PolygonCollider2D的绘制顺序 371 | for (int i = 0; i < len; i++) 372 | #endif 373 | { 374 | indexList.Add(i); 375 | 376 | } 377 | 378 | while (indexList.Count > 2) //indexList.Count > points.Length - m_DrawStep 379 | { 380 | int i; 381 | 382 | len = indexList.Count; 383 | 384 | bool isLeft = false; 385 | 386 | for (i = 0; i < len; i++) 387 | { 388 | int p = indexList[(i + 0) % len]; 389 | int s = indexList[(i + 1) % len]; 390 | int q = indexList[(i + 2) % len]; 391 | 392 | if (len == 3) //只剩下三个点了,直接绘制 393 | { 394 | output.Add(GetVertex(points, p, offset, rect, overrideSprite, inner)); 395 | output.Add(GetVertex(points, s, offset, rect, overrideSprite, inner)); 396 | output.Add(GetVertex(points, q, offset, rect, overrideSprite, inner)); 397 | 398 | indexList.RemoveAt(i + 1); 399 | 400 | isLeft = true; 401 | 402 | break; 403 | } 404 | 405 | isLeft = ToLeftTest(m_PolygonCollider2D.points, p, q, s); 406 | 407 | if (isLeft) // s在左边,表示为嘴巴,对上一个三角形切耳 408 | { 409 | p = indexList[(i + len - 1) % len]; 410 | s = indexList[(i + 0) % len]; 411 | q = indexList[(i + 1) % len]; 412 | 413 | output.Add(GetVertex(points, p, offset, rect, overrideSprite, inner)); 414 | output.Add(GetVertex(points, s, offset, rect, overrideSprite, inner)); 415 | output.Add(GetVertex(points, q, offset, rect, overrideSprite, inner)); 416 | 417 | indexList.RemoveAt(i); 418 | 419 | break; 420 | } 421 | } 422 | 423 | if (!isLeft) //没有嘴巴,直接绘制 424 | { 425 | for (i = 0; i < len - 2; i++) 426 | { 427 | int p = indexList[0]; 428 | int s = indexList[(i + 1) % len]; 429 | int q = indexList[(i + 2) % len]; 430 | 431 | output.Add(GetVertex(points, p, offset, rect, overrideSprite, inner)); 432 | output.Add(GetVertex(points, s, offset, rect, overrideSprite, inner)); 433 | output.Add(GetVertex(points, q, offset, rect, overrideSprite, inner)); 434 | 435 | } 436 | 437 | break; 438 | } 439 | } 440 | 441 | } 442 | 443 | private UIVertex GetVertex(Vector2[] list, int index, Vector2 offset, Rect rect, Sprite overrideSprite, Vector4 inner) 444 | { 445 | return GetVertex(list[index] - offset, rect, overrideSprite, inner); 446 | } 447 | 448 | private UIVertex GetVertex(Vector2 vector, Rect rect, Sprite overrideSprite, Vector4 inner) 449 | { 450 | UIVertex vertex = new UIVertex(); 451 | vertex.position = vector; 452 | vertex.color = graphic.color; 453 | vertex.normal = new Vector3(0, 0, -1); 454 | 455 | float u = (vertex.position.x - rect.x) / rect.width * (inner.z - inner.x) + inner.x; 456 | float v = (vertex.position.y - rect.y) / rect.height * (inner.w - inner.y) + inner.y; 457 | 458 | vertex.uv0 = new Vector2(u, v); 459 | 460 | return vertex; 461 | } 462 | 463 | private bool ToLeftTest(Vector2[] points, int pIndex, int qIndex, int sIndex) 464 | { 465 | return ToLeftTest(points[pIndex], points[qIndex], points[sIndex]); 466 | } 467 | 468 | private bool ToLeftTest(Vector2 p, Vector2 q, Vector2 s) 469 | { 470 | return Area2(p, q, s) > 0; 471 | } 472 | 473 | private float Area2(Vector2 p, Vector2 q, Vector2 s) 474 | { 475 | return p.x * q.y - p.y * q.x + q.x * s.y - q.y * s.x + s.x * p.y - s.y * p.x; 476 | } 477 | 478 | /// 479 | /// 返回两个RectTransform的偏移值,相对rect1来说。 480 | /// 只对同一个Canvas下的两个RectTransform有效 481 | /// 482 | /// 483 | /// 484 | /// 485 | private Vector2 GetRectTransformOffset(RectTransform rect1, RectTransform rect2) 486 | { 487 | Vector2 offset1 = Vector2.zero; 488 | Vector2 offset2 = Vector2.zero; 489 | 490 | RectTransform temp = rect1; 491 | 492 | while (temp != null) 493 | { 494 | if(temp == rect2) 495 | { 496 | return offset1; 497 | } 498 | 499 | offset1 += temp.anchoredPosition; 500 | 501 | temp = temp.parent as RectTransform; 502 | } 503 | 504 | temp = rect2; 505 | 506 | while (temp != null) 507 | { 508 | if (temp == rect1) 509 | { 510 | return -offset2; 511 | } 512 | 513 | offset2 += temp.anchoredPosition; 514 | 515 | temp = temp.parent as RectTransform; 516 | } 517 | 518 | return offset1 - offset2; 519 | } 520 | } 521 | } 522 | -------------------------------------------------------------------------------- /Runtime/Effects/PolygonMask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 549a2eac1ae86ca40b43a8558d9e8feb 3 | timeCreated: 1568451206 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Effects/RectMask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityEngine.Sprites; 6 | using UnityEngine.UI; 7 | using Waiting.UGUI.Collections; 8 | using Waiting.UGUI.Components; 9 | 10 | /// 11 | /// 12 | /// name:RectMask 13 | /// author:Lawliet 14 | /// date:2019/11/1 11:53:01 15 | /// versions: 16 | /// introduce: 17 | /// note: 18 | /// 19 | /// 20 | namespace Waiting.UGUI.Effects 21 | { 22 | [AddComponentMenu("UI/Effects/RectMask", 22)] 23 | [RequireComponent(typeof(Graphic))] 24 | public class RectMask : BaseMeshEffect 25 | { 26 | [SerializeField] 27 | private RectTransform m_MaskRect; 28 | 29 | /// 30 | /// 作为蒙版的矩形框 31 | /// 32 | public RectTransform maskRect 33 | { 34 | get { return m_MaskRect == null ? this.transform.parent as RectTransform : m_MaskRect; } 35 | set 36 | { 37 | if (m_MaskRect != value) 38 | { 39 | m_MaskRect = value; 40 | 41 | if (graphic != null) 42 | { 43 | graphic.SetVerticesDirty(); 44 | } 45 | } 46 | } 47 | } 48 | 49 | [NonSerialized] 50 | private RectTransform m_RectTransform; 51 | 52 | /// 53 | /// 54 | /// 55 | public RectTransform rectTransform 56 | { 57 | get 58 | { 59 | if (m_RectTransform == null) 60 | { 61 | m_RectTransform = GetComponent(); 62 | } 63 | 64 | return m_RectTransform; 65 | } 66 | } 67 | 68 | #if UNITY_EDITOR 69 | public void SetDirty() 70 | { 71 | if (graphic != null) 72 | { 73 | graphic.SetVerticesDirty(); 74 | } 75 | } 76 | #endif 77 | 78 | /// 79 | /// 绘制网格 80 | /// 81 | /// 82 | public override void ModifyMesh(VertexHelper vh) 83 | { 84 | if (!IsActive()) 85 | { 86 | return; 87 | } 88 | 89 | if (m_MaskRect == null) 90 | { 91 | return; 92 | } 93 | 94 | var original = ListPool.Get(); 95 | var output = ListPool.Get(); 96 | vh.GetUIVertexStream(original); 97 | 98 | int count = original.Count; 99 | 100 | DrawRect(original, output, count); 101 | 102 | vh.Clear(); 103 | vh.AddUIVertexTriangleStream(output); 104 | 105 | ListPool.Recycle(original); 106 | ListPool.Recycle(output); 107 | } 108 | 109 | /// 110 | /// 绘制矩形区域 111 | /// 112 | /// 113 | /// 114 | /// 115 | private void DrawRect(List original, List output, int count) 116 | { 117 | Sprite overrideSprite = null; 118 | 119 | Rect rect = graphic.GetPixelAdjustedRect(); 120 | 121 | Vector4 outer = new Vector4(); 122 | 123 | if (graphic is Image) 124 | { 125 | overrideSprite = (graphic as Image).overrideSprite; 126 | 127 | if (overrideSprite != null) 128 | { 129 | outer = DataUtility.GetOuterUV(overrideSprite); 130 | } 131 | } 132 | 133 | Vector2 offset = GetRectTransformOffset(rectTransform, maskRect); 134 | 135 | Vector2 v0 = new Vector2(maskRect.rect.xMin, maskRect.rect.yMin) - offset; 136 | Vector2 v1 = new Vector2(maskRect.rect.xMax, maskRect.rect.yMin) - offset; 137 | Vector2 v2 = new Vector2(maskRect.rect.xMax, maskRect.rect.yMax) - offset; 138 | Vector2 v3 = new Vector2(maskRect.rect.xMin, maskRect.rect.yMax) - offset; 139 | 140 | output.Add(GetVertex(v0, rect, overrideSprite, outer)); 141 | output.Add(GetVertex(v1, rect, overrideSprite, outer)); 142 | output.Add(GetVertex(v2, rect, overrideSprite, outer)); 143 | 144 | output.Add(GetVertex(v0, rect, overrideSprite, outer)); 145 | output.Add(GetVertex(v2, rect, overrideSprite, outer)); 146 | output.Add(GetVertex(v3, rect, overrideSprite, outer)); 147 | } 148 | 149 | private UIVertex GetVertex(Vector2[] list, int index, Rect rect, Sprite overrideSprite, Vector4 inner) 150 | { 151 | return GetVertex(list[index], rect, overrideSprite, inner); 152 | } 153 | 154 | /// 155 | /// 返回顶点位置 156 | /// 157 | /// 158 | /// 159 | /// 160 | /// 161 | /// 162 | private UIVertex GetVertex(Vector2 vector, Rect rect, Sprite overrideSprite, Vector4 inner) 163 | { 164 | UIVertex vertex = new UIVertex(); 165 | vertex.position = vector; 166 | vertex.color = graphic.color; 167 | vertex.normal = new Vector3(0, 0, -1); 168 | 169 | float u = (vertex.position.x - rect.x) / rect.width * inner.z + inner.x; 170 | float v = (vertex.position.y - rect.y) / rect.height * inner.w + inner.y; 171 | 172 | vertex.uv0 = new Vector2(u, v); 173 | 174 | return vertex; 175 | } 176 | 177 | 178 | /// 179 | /// 返回两个RectTransform的偏移值,相对rect1来说。 180 | /// 只对同一个Canvas下的两个RectTransform有效 181 | /// 182 | /// 183 | /// 184 | /// 185 | private Vector2 GetRectTransformOffset(RectTransform rect1, RectTransform rect2) 186 | { 187 | Vector2 offset1 = Vector2.zero; 188 | Vector2 offset2 = Vector2.zero; 189 | 190 | RectTransform temp = rect1; 191 | 192 | while (temp != null) 193 | { 194 | if(temp == rect2) 195 | { 196 | return offset1; 197 | } 198 | 199 | offset1 += temp.anchoredPosition; 200 | 201 | temp = temp.parent as RectTransform; 202 | } 203 | 204 | temp = rect2; 205 | 206 | while (temp != null) 207 | { 208 | if (temp == rect1) 209 | { 210 | return -offset2; 211 | } 212 | 213 | offset2 += temp.anchoredPosition; 214 | 215 | temp = temp.parent as RectTransform; 216 | } 217 | 218 | return offset1 - offset2; 219 | } 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /Runtime/Effects/RectMask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe9b61d3502db5746ba0d60ea793487b 3 | timeCreated: 1572868866 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/Graphics.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56fb9831511708542b43b288718d35e6 3 | folderAsset: yes 4 | timeCreated: 1508407374 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/Graphics/AnimationMeshGraphic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Serialization; 4 | using UnityEngine.UI; 5 | 6 | /// 7 | /// 8 | /// name:MeshImage 9 | /// author:Lawliet 10 | /// vindicator: 11 | /// versions: 12 | /// introduce: 13 | /// note: 14 | /// 15 | /// 16 | /// list: 17 | /// 18 | /// 19 | /// 20 | /// 21 | namespace Waiting.UGUI.Graphics 22 | { 23 | [AddComponentMenu("UI/AnimationMeshGraphic", 52)] 24 | public class AnimationMeshGraphic : MeshGraphic 25 | { 26 | [Flags] 27 | public enum AnimDirtyMode 28 | { 29 | Layout = 1, 30 | Vertices = 2, 31 | Materal = 4, 32 | MateralParameter = 8, 33 | } 34 | 35 | [SerializeField] 36 | protected AnimDirtyMode m_AnimDirtyMode = 0; 37 | 38 | public AnimDirtyMode animDirtyMode 39 | { 40 | get 41 | { 42 | return m_AnimDirtyMode; 43 | } 44 | set 45 | { 46 | m_AnimDirtyMode = value; 47 | } 48 | } 49 | 50 | [SerializeField] 51 | protected Vector4 m_MainTexST = new Vector4(1, 1, 0, 0); 52 | 53 | public Vector4 mainTexST 54 | { 55 | get 56 | { 57 | return m_MainTexST; 58 | } 59 | set 60 | { 61 | m_MainTexST = value; 62 | } 63 | } 64 | 65 | protected override void OnDidApplyAnimationProperties() 66 | { 67 | if (m_AnimDirtyMode.HasFlag(AnimDirtyMode.Layout)) 68 | { 69 | SetLayoutDirty(); 70 | } 71 | 72 | if (m_AnimDirtyMode.HasFlag(AnimDirtyMode.Vertices)) 73 | { 74 | SetVerticesDirty(); 75 | } 76 | 77 | if (m_AnimDirtyMode.HasFlag(AnimDirtyMode.Materal)) 78 | { 79 | UpdateMaterial(); 80 | } 81 | 82 | if (m_AnimDirtyMode.HasFlag(AnimDirtyMode.MateralParameter)) 83 | { 84 | UpdateMaterialParameter(); 85 | } 86 | } 87 | 88 | protected void UpdateMaterialParameter() 89 | { 90 | UnityEngine.Profiling.Profiler.BeginSample("#UpdateMaterial()"); 91 | material.SetVector("_MainTex_ST", mainTexST); 92 | 93 | UnityEngine.Profiling.Profiler.EndSample(); 94 | } 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /Runtime/Graphics/AnimationMeshGraphic.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2158805d91c241941baa7a43a5cd9ceb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Graphics/MeshGraphic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Serialization; 4 | using UnityEngine.UI; 5 | 6 | /// 7 | /// 8 | /// name:MeshImage 9 | /// author:Lawliet 10 | /// vindicator: 11 | /// versions: 12 | /// introduce: 13 | /// note: 14 | /// 15 | /// 16 | /// list: 17 | /// 18 | /// 19 | /// 20 | /// 21 | namespace Waiting.UGUI.Graphics 22 | { 23 | [AddComponentMenu("UI/MeshGraphic", 51)] 24 | public class MeshGraphic : MaskableGraphic, ICanvasRaycastFilter 25 | { 26 | [SerializeField] 27 | protected Mesh m_Mesh; 28 | 29 | public Mesh mesh 30 | { 31 | get 32 | { 33 | return m_Mesh; 34 | } 35 | set 36 | { 37 | if(m_Mesh != value) 38 | { 39 | m_Mesh = value; 40 | 41 | SetVerticesDirty(); 42 | } 43 | } 44 | } 45 | 46 | [SerializeField] 47 | private Texture m_Texture; 48 | 49 | public override Texture mainTexture 50 | { 51 | get 52 | { 53 | return texture; 54 | } 55 | } 56 | 57 | public Texture texture 58 | { 59 | get 60 | { 61 | if (m_Texture == null) 62 | { 63 | if (material != null && material.mainTexture != null) 64 | { 65 | return material.mainTexture; 66 | } 67 | return s_WhiteTexture; 68 | } 69 | 70 | return m_Texture; 71 | } 72 | set 73 | { 74 | if(m_Texture != value) 75 | { 76 | m_Texture = value; 77 | 78 | SetMaterialDirty(); 79 | } 80 | } 81 | } 82 | 83 | protected override void OnPopulateMesh(VertexHelper vh) 84 | { 85 | if (m_Mesh == null) 86 | { 87 | return; 88 | } 89 | 90 | Vector2 sizeDelta = rectTransform.sizeDelta; 91 | 92 | float width = sizeDelta.x; 93 | float height = sizeDelta.y; 94 | 95 | vh.Clear(); 96 | 97 | for (int i = 0; i < m_Mesh.vertexCount; i++) 98 | { 99 | Vector3 v = m_Mesh.vertices[i]; 100 | 101 | v = new Vector2(v.x * width, v.y * height); 102 | 103 | Color32 c = Color.white; 104 | 105 | if (i < m_Mesh.colors32.Length) 106 | { 107 | c = m_Mesh.colors32[i] * color; 108 | } 109 | else 110 | { 111 | c = color; 112 | } 113 | 114 | Vector2 uv = m_Mesh.uv[i]; 115 | 116 | vh.AddVert(v, c, uv); 117 | } 118 | 119 | for (int i = 0; i < m_Mesh.triangles.Length / 3; i++) 120 | { 121 | int idx0 = m_Mesh.triangles[i * 3]; 122 | int idx1 = m_Mesh.triangles[i * 3 + 1]; 123 | int idx2 = m_Mesh.triangles[i * 3 + 2]; 124 | 125 | vh.AddTriangle(idx0, idx1, idx2); 126 | } 127 | } 128 | 129 | public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) 130 | { 131 | return false; 132 | } 133 | } 134 | } 135 | 136 | -------------------------------------------------------------------------------- /Runtime/Graphics/MeshGraphic.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9897d2bd09dde8349b30cd2ce721c15a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Graphics/RoundRect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | using UnityEngine.Serialization; 5 | using UnityEngine.Sprites; 6 | using UnityEngine.UI; 7 | 8 | /// 9 | /// 10 | /// name:RoundRect 11 | /// author:Waiting 12 | /// date:2017/10/17 14:45:36 13 | /// versions: 14 | /// introduce: 15 | /// note: 16 | /// 圆角矩形 17 | /// 18 | namespace Waiting.UGUI.Graphics 19 | { 20 | public class RoundRect : Image 21 | { 22 | /// 23 | /// 圆角半径 24 | /// 25 | [SerializeField] 26 | private float m_Radius = 4; 27 | 28 | public float radius 29 | { 30 | get { return m_Radius; } 31 | set 32 | { 33 | if (m_Radius != value) 34 | { 35 | m_Radius = value; 36 | 37 | this.SetVerticesDirty(); 38 | } 39 | } 40 | } 41 | 42 | public override void SetVerticesDirty() 43 | { 44 | if (type != Type.Sliced) 45 | { 46 | type = Type.Sliced; 47 | } 48 | 49 | base.SetVerticesDirty(); 50 | } 51 | 52 | #if UNITY_EDITOR 53 | protected override void OnValidate() 54 | { 55 | if (type != Type.Sliced) 56 | { 57 | type = Type.Sliced; 58 | } 59 | 60 | base.OnValidate(); 61 | } 62 | 63 | #endif 64 | 65 | protected override void OnPopulateMesh(VertexHelper toFill) 66 | { 67 | if (overrideSprite == null) 68 | { 69 | base.OnPopulateMesh(toFill); 70 | return; 71 | } 72 | 73 | if (!hasBorder) 74 | { 75 | GenerateSimpleSprite(toFill, false); 76 | } 77 | else 78 | { 79 | GenerateSlicedSprite(toFill); 80 | } 81 | } 82 | 83 | /// 84 | /// Generate vertices for a simple Image. 85 | /// 86 | protected void GenerateSimpleSprite(VertexHelper vh, bool lPreserveAspect) 87 | { 88 | Vector4 v = GetDrawingDimensions(lPreserveAspect); 89 | var uv = (overrideSprite != null) ? DataUtility.GetOuterUV(overrideSprite) : Vector4.zero; 90 | 91 | var color32 = color; 92 | vh.Clear(); 93 | vh.AddVert(new Vector3(v.x, v.y), color32, new Vector2(uv.x, uv.y)); 94 | vh.AddVert(new Vector3(v.x, v.w), color32, new Vector2(uv.x, uv.w)); 95 | vh.AddVert(new Vector3(v.z, v.w), color32, new Vector2(uv.z, uv.w)); 96 | vh.AddVert(new Vector3(v.z, v.y), color32, new Vector2(uv.z, uv.y)); 97 | 98 | vh.AddTriangle(0, 1, 2); 99 | vh.AddTriangle(2, 3, 0); 100 | } 101 | 102 | static readonly Vector2[] s_VertScratch = new Vector2[4]; 103 | static readonly Vector2[] s_UVScratch = new Vector2[4]; 104 | 105 | protected void GenerateSlicedSprite(VertexHelper toFill) 106 | { 107 | Vector4 outer, inner, padding, border; 108 | 109 | if (overrideSprite != null) 110 | { 111 | outer = DataUtility.GetOuterUV(overrideSprite); 112 | inner = DataUtility.GetInnerUV(overrideSprite); 113 | padding = DataUtility.GetPadding(overrideSprite); 114 | border = overrideSprite.border; 115 | } 116 | else 117 | { 118 | outer = Vector4.zero; 119 | inner = Vector4.zero; 120 | padding = Vector4.zero; 121 | border = Vector4.zero; 122 | } 123 | 124 | Rect rect = GetPixelAdjustedRect(); 125 | 126 | border = GetAdjustedBorders(border / pixelsPerUnit, rect); 127 | 128 | padding = padding / pixelsPerUnit; 129 | 130 | s_VertScratch[0] = new Vector2(padding.x, padding.y); 131 | s_VertScratch[3] = new Vector2(rect.width - padding.z, rect.height - padding.w); 132 | 133 | s_VertScratch[1].x = border.x; 134 | s_VertScratch[1].y = border.y; 135 | s_VertScratch[2].x = rect.width - border.z; 136 | s_VertScratch[2].y = rect.height - border.w; 137 | 138 | for (int i = 0; i < 4; ++i) 139 | { 140 | s_VertScratch[i].x = s_VertScratch[i].x * 0.5f + rect.x; 141 | s_VertScratch[i].y = s_VertScratch[i].y * 0.5f + rect.y; 142 | } 143 | 144 | s_UVScratch[0] = new Vector2(outer.x, outer.y); 145 | s_UVScratch[1] = new Vector2(inner.x, inner.y); 146 | s_UVScratch[2] = new Vector2(inner.z, inner.w); 147 | s_UVScratch[3] = new Vector2(outer.z, outer.w); 148 | 149 | toFill.Clear(); 150 | 151 | for (int x = 0; x < 2; x++) 152 | { 153 | int x2 = x + 1; 154 | 155 | for (int y = 0; y < 2; y++) 156 | { 157 | if (!fillCenter && x == 1 && y == 1) 158 | { 159 | continue; 160 | } 161 | 162 | int y2 = y + 1; 163 | 164 | AddQuad(toFill, 165 | new Vector2(s_VertScratch[x].x, s_VertScratch[y].y), 166 | new Vector2(s_VertScratch[x2].x, s_VertScratch[y2].y), 167 | color, 168 | new Vector2(s_UVScratch[x].x, s_UVScratch[y].y), 169 | new Vector2(s_UVScratch[x2].x, s_UVScratch[y2].y)); 170 | 171 | AddQuad(toFill, 172 | new Vector2(-s_VertScratch[x2].x, s_VertScratch[y].y), 173 | new Vector2(-s_VertScratch[x].x, s_VertScratch[y2].y), 174 | color, 175 | new Vector2(s_UVScratch[x2].x, s_UVScratch[y].y), 176 | new Vector2(s_UVScratch[x].x, s_UVScratch[y2].y)); 177 | 178 | AddQuad(toFill, 179 | new Vector2(s_VertScratch[x].x, -s_VertScratch[y2].y), 180 | new Vector2(s_VertScratch[x2].x, -s_VertScratch[y].y), 181 | color, 182 | new Vector2(s_UVScratch[x].x, s_UVScratch[y2].y), 183 | new Vector2(s_UVScratch[x2].x, s_UVScratch[y].y)); 184 | 185 | AddQuad(toFill, 186 | new Vector2(-s_VertScratch[x].x, -s_VertScratch[y].y), 187 | new Vector2(-s_VertScratch[x2].x, -s_VertScratch[y2].y), 188 | color, 189 | new Vector2(s_UVScratch[x].x, s_UVScratch[y].y), 190 | new Vector2(s_UVScratch[x2].x, s_UVScratch[y2].y)); 191 | } 192 | } 193 | } 194 | 195 | protected Vector4 GetDrawingDimensions(bool shouldPreserveAspect) 196 | { 197 | var padding = overrideSprite == null ? Vector4.zero : DataUtility.GetPadding(overrideSprite); 198 | var size = overrideSprite == null ? Vector2.zero : new Vector2(overrideSprite.rect.width, overrideSprite.rect.height); 199 | 200 | Rect r = GetPixelAdjustedRect(); 201 | // Debug.Log(string.Format("r:{2}, size:{0}, padding:{1}", size, padding, r)); 202 | 203 | int spriteW = Mathf.RoundToInt(size.x); 204 | int spriteH = Mathf.RoundToInt(size.y); 205 | 206 | var v = new Vector4( 207 | padding.x / spriteW, 208 | padding.y / spriteH, 209 | (spriteW - padding.z) / spriteW, 210 | (spriteH - padding.w) / spriteH); 211 | 212 | if (shouldPreserveAspect && size.sqrMagnitude > 0.0f) 213 | { 214 | var spriteRatio = size.x / size.y; 215 | var rectRatio = r.width / r.height; 216 | 217 | if (spriteRatio > rectRatio) 218 | { 219 | var oldHeight = r.height; 220 | r.height = r.width * (1.0f / spriteRatio); 221 | r.y += (oldHeight - r.height) * rectTransform.pivot.y; 222 | } 223 | else 224 | { 225 | var oldWidth = r.width; 226 | r.width = r.height * spriteRatio; 227 | r.x += (oldWidth - r.width) * rectTransform.pivot.x; 228 | } 229 | } 230 | 231 | v = new Vector4( 232 | r.x + r.width * v.x, 233 | r.y + r.height * v.y, 234 | r.x + r.width * v.z, 235 | r.y + r.height * v.w 236 | ); 237 | 238 | return v; 239 | } 240 | 241 | protected Vector4 GetAdjustedBorders(Vector4 border, Rect rect) 242 | { 243 | border.x = m_Radius; 244 | border.y = m_Radius; 245 | border.z = 0; 246 | border.w = 0; 247 | 248 | for (int axis = 0; axis <= 1; axis++) 249 | { 250 | // If the rect is smaller than the combined borders, then there's not room for the borders at their normal size. 251 | // In order to avoid artefacts with overlapping borders, we scale the borders down to fit. 252 | float combinedBorders = border[axis] + border[axis + 2]; 253 | if (rect.size[axis] < combinedBorders && combinedBorders != 0) 254 | { 255 | float borderScaleRatio = rect.size[axis] / combinedBorders; 256 | border[axis] *= borderScaleRatio; 257 | border[axis + 2] *= borderScaleRatio; 258 | } 259 | } 260 | return border; 261 | } 262 | 263 | /// 264 | /// 绘制四边形 265 | /// 266 | /// 267 | /// 268 | /// 269 | /// 270 | /// 271 | /// 272 | protected static void AddQuad(VertexHelper vertexHelper, Vector2 posMin, Vector2 posMax, Color32 color, Vector2 uvMin, Vector2 uvMax) 273 | { 274 | //剔除无效的四边形 275 | if (posMin.x == posMax.x || posMin.y == posMax.y) 276 | { 277 | return; 278 | } 279 | 280 | int startIndex = vertexHelper.currentVertCount; 281 | 282 | vertexHelper.AddVert(new Vector3(posMin.x, posMin.y, 0), color, new Vector2(uvMin.x, uvMin.y)); 283 | vertexHelper.AddVert(new Vector3(posMin.x, posMax.y, 0), color, new Vector2(uvMin.x, uvMax.y)); 284 | vertexHelper.AddVert(new Vector3(posMax.x, posMax.y, 0), color, new Vector2(uvMax.x, uvMax.y)); 285 | vertexHelper.AddVert(new Vector3(posMax.x, posMin.y, 0), color, new Vector2(uvMax.x, uvMin.y)); 286 | 287 | vertexHelper.AddTriangle(startIndex, startIndex + 1, startIndex + 2); 288 | vertexHelper.AddTriangle(startIndex + 2, startIndex + 3, startIndex); 289 | } 290 | } 291 | } 292 | -------------------------------------------------------------------------------- /Runtime/Graphics/RoundRect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8f6364f979726444a9f46aee9df3ce4 3 | timeCreated: 1508232193 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/UGUIExtend.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UGUIExtend", 3 | "references": [], 4 | "optionalUnityReferences": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [] 12 | } -------------------------------------------------------------------------------- /Runtime/UGUIExtend.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c40a6b95869a8c43a5b4ecb9be68656 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UGUIEctend mind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/L-Lawliet/UGUIExtend/bd2ebc168aed6dddf3581eb32c83e91906f7d336/UGUIEctend mind.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uguiextend", 3 | "displayName": "UGUIExtend", 4 | "version": "0.0.1", 5 | "unity": "2017.1", 6 | "description": "", 7 | "keywords": [ 8 | "UGUI", 9 | "Extend" 10 | ], 11 | "category": "UGUI", 12 | "dependencies": {} 13 | } 14 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf8d7aad3dbb13d4fb5723c7e6acdd80 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------