diff --git a/Source/Scripts/Editor/EditorToolSet.cs b/Source/Scripts/Editor/EditorToolSet.cs index acab1dc0..a285225c 100644 --- a/Source/Scripts/Editor/EditorToolSet.cs +++ b/Source/Scripts/Editor/EditorToolSet.cs @@ -42,7 +42,7 @@ static void CreatePanel() int layer = LayerMask.NameToLayer(StageCamera.LayerName); panelObject.layer = layer; } - panelObject.AddComponent(); + panelObject.AddComponent(); Selection.objects = new Object[] { panelObject }; } diff --git a/Source/Scripts/Editor/PackagesWindow.cs b/Source/Scripts/Editor/PackagesWindow.cs index b9356d96..7b5ba180 100644 --- a/Source/Scripts/Editor/PackagesWindow.cs +++ b/Source/Scripts/Editor/PackagesWindow.cs @@ -7,7 +7,6 @@ using UnityEditor.SceneManagement; #endif using FairyGUI; -using FairyGUI.Utils; namespace FairyGUIEditor { diff --git a/Source/Scripts/Editor/UIConfigEditor.cs b/Source/Scripts/Editor/UIConfigEditor.cs index 045d35fe..ea1170f7 100644 --- a/Source/Scripts/Editor/UIConfigEditor.cs +++ b/Source/Scripts/Editor/UIConfigEditor.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; using UnityEditor; using FairyGUI; diff --git a/Source/Scripts/Editor/UIPainterEditor.cs b/Source/Scripts/Editor/UIPainterEditor.cs index 36d7caf9..7e4c2049 100644 --- a/Source/Scripts/Editor/UIPainterEditor.cs +++ b/Source/Scripts/Editor/UIPainterEditor.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; #if UNITY_5_3_OR_NEWER using UnityEditor.SceneManagement; #endif diff --git a/Source/Scripts/Editor/UIPanelEditor.cs b/Source/Scripts/Editor/UIPanelEditor.cs index 189a717b..a0d1ca08 100644 --- a/Source/Scripts/Editor/UIPanelEditor.cs +++ b/Source/Scripts/Editor/UIPanelEditor.cs @@ -1,18 +1,15 @@ -using System; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; #if UNITY_5_3_OR_NEWER using UnityEditor.SceneManagement; #endif using UnityEditor; -using FairyGUI; namespace FairyGUIEditor { /// /// /// - [CustomEditor(typeof(UIPanel))] + [CustomEditor(typeof(FairyGUI.UIPanel))] public class UIPanelEditor : Editor { SerializedProperty packageName; @@ -61,7 +58,7 @@ public override void OnInspectorGUI() { serializedObject.Update(); - UIPanel panel = target as UIPanel; + FairyGUI.UIPanel panel = target as FairyGUI.UIPanel; #if UNITY_5 DrawPropertiesExcluding(serializedObject, propertyToExclude); #endif @@ -107,21 +104,21 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(scale); EditorGUILayout.Space(); - FitScreen oldFitScreen = (FitScreen)fitScreen.enumValueIndex; + FairyGUI.FitScreen oldFitScreen = (FairyGUI.FitScreen)fitScreen.enumValueIndex; EditorGUILayout.PropertyField(fitScreen); if (serializedObject.ApplyModifiedProperties()) { if (PrefabUtility.GetPrefabType(panel) != PrefabType.Prefab) { - panel.ApplyModifiedProperties(sortingOrder.intValue != oldSortingOrder, (FitScreen)fitScreen.enumValueIndex != oldFitScreen); + panel.ApplyModifiedProperties(sortingOrder.intValue != oldSortingOrder, (FairyGUI.FitScreen)fitScreen.enumValueIndex != oldFitScreen); } } } void OnSceneGUI() { - UIPanel panel = (target as UIPanel); + FairyGUI.UIPanel panel = (target as FairyGUI.UIPanel); if (panel.container == null) return; diff --git a/Source/Scripts/Gesture/LongPressGesture.cs b/Source/Scripts/Gesture/LongPressGesture.cs index 1c62864a..eed3dede 100644 --- a/Source/Scripts/Gesture/LongPressGesture.cs +++ b/Source/Scripts/Gesture/LongPressGesture.cs @@ -37,6 +37,11 @@ public class LongPressGesture : EventDispatcher /// public bool once; + /// + /// 手指按住后,移动超出此半径范围则手势停止。 + /// + public int holdRangeRadius; + GObject _host; Vector2 _startPoint; bool _started; @@ -49,6 +54,7 @@ public LongPressGesture(GObject host) _host = host; trigger = TRIGGER; interval = INTERVAL; + holdRangeRadius = 50; Enable(true); onBegin = new EventListener(this, "onLongPressBegin"); @@ -95,9 +101,8 @@ void __touchBegin(EventContext context) void __timer(object param) { - Vector2 pt = Stage.inst.touchPosition; - pt = _host.GlobalToLocal(pt) - _startPoint; - if (Mathf.Abs(pt.x) > UIConfig.touchDragSensitivity || Mathf.Abs(pt.y) > UIConfig.touchDragSensitivity) + Vector2 pt = _host.GlobalToLocal(Stage.inst.touchPosition); + if (Mathf.Pow(pt.x - _startPoint.x, 2) + Mathf.Pow(pt.y - _startPoint.y, 2) > Mathf.Pow(holdRangeRadius, 2)) { Timers.inst.Remove(__timer); return; @@ -107,7 +112,7 @@ void __timer(object param) _started = true; onBegin.Call(); - if(!once) + if (!once) Timers.inst.Add(interval, 0, __timer); } diff --git a/Source/Scripts/UI/GList.cs b/Source/Scripts/UI/GList.cs index b67c424e..932b58bf 100644 --- a/Source/Scripts/UI/GList.cs +++ b/Source/Scripts/UI/GList.cs @@ -1953,7 +1953,7 @@ void HandleScroll3(bool forceUpdate) itemRenderer(i % _numItems, ii.obj); ii.obj.SetXY((int)(i / pageSize) * viewWidth + col * (ii.size.x + _columnGap), - (i / _curLineItemCount) % _curLineItemCount2 * (ii.size.y + _lineGap)); + (int)(i / _curLineItemCount) % _curLineItemCount2 * (ii.size.y + _lineGap)); } //释放未使用的 diff --git a/Source/Scripts/UI/UIPanel.cs b/Source/Scripts/UI/UIPanel.cs index e91cbadb..3cc30ebf 100644 --- a/Source/Scripts/UI/UIPanel.cs +++ b/Source/Scripts/UI/UIPanel.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using UnityEngine; -using FairyGUI.Utils; namespace FairyGUI {