Skip to content
Permalink
Browse files

Updated formatting.

  • Loading branch information...
valyard committed Aug 1, 2017
1 parent a6713f0 commit 351487a951b6bdd9429fda6d4cc3a3eadbdd9c92
Showing with 1,544 additions and 1,589 deletions.
  1. +12 −14 Source/Assets/TouchScript/Editor/Behaviors/Cursors/CursorManagerEditor.cs
  2. +30 −31 Source/Assets/TouchScript/Editor/Behaviors/TransformerEditor.cs
  3. +1 −1 Source/Assets/TouchScript/Editor/EditorResources.cs
  4. +104 −104 Source/Assets/TouchScript/Editor/EditorUI/GUIElements.cs
  5. +18 −22 Source/Assets/TouchScript/Editor/EditorUI/GUIUtils.cs
  6. +85 −94 Source/Assets/TouchScript/Editor/EditorUI/PagedList.cs
  7. +14 −15 Source/Assets/TouchScript/Editor/Gestures/FlickGestureEditor.cs
  8. +177 −186 Source/Assets/TouchScript/Editor/Gestures/GestureEditor.cs
  9. +28 −28 Source/Assets/TouchScript/Editor/Gestures/LongPressGestureEditor.cs
  10. +14 −14 Source/Assets/TouchScript/Editor/Gestures/MetaGestureEditor.cs
  11. +16 −16 Source/Assets/TouchScript/Editor/Gestures/PressGestureEditor.cs
  12. +18 −18 Source/Assets/TouchScript/Editor/Gestures/ReleaseGestureEditor.cs
  13. +40 −41 Source/Assets/TouchScript/Editor/Gestures/TapGestureEditor.cs
  14. +34 −36 ...e/Assets/TouchScript/Editor/Gestures/TransformGestures/Base/OnePointTransformGestureBaseEditor.cs
  15. +85 −88 Source/Assets/TouchScript/Editor/Gestures/TransformGestures/Base/TransformGestureBaseEditor.cs
  16. +36 −37 ...e/Assets/TouchScript/Editor/Gestures/TransformGestures/Base/TwoPointTransformGestureBaseEditor.cs
  17. +23 −25 Source/Assets/TouchScript/Editor/Gestures/TransformGestures/PinnedTransformGestureEditor.cs
  18. +7 −9 Source/Assets/TouchScript/Editor/Gestures/TransformGestures/ScreenTransformGestureEditor.cs
  19. +16 −18 Source/Assets/TouchScript/Editor/Gestures/TransformGestures/TransformGestureEditor.cs
  20. +3 −7 Source/Assets/TouchScript/Editor/InputSources/InputSourceEditor.cs
  21. +68 −67 Source/Assets/TouchScript/Editor/InputSources/StandardInputEditor.cs
  22. +5 −6 Source/Assets/TouchScript/Editor/Layers/FullscreenLayerEditor.cs
  23. +46 −47 Source/Assets/TouchScript/Editor/Layers/StandardLayerEditor.cs
  24. +116 −113 Source/Assets/TouchScript/Editor/TouchManagerEditor.cs
  25. +142 −147 Source/Assets/TouchScript/Editor/TouchScriptSettingsWindow.cs
  26. +8 −8 Source/Assets/TouchScript/Editor/Utils/PropertyDrawers/NullToggleDrawer.cs
  27. +1 −1 Source/Assets/TouchScript/Editor/Utils/PropertyDrawers/ToggleLeftDrawer.cs
  28. +4 −4 Source/Assets/TouchScript/Examples/Camera/Scripts/CameraController.cs
  29. +2 −2 Source/Assets/TouchScript/Examples/Colors/Scripts/Circle.cs
  30. +4 −3 Source/Assets/TouchScript/Examples/Cube/Scripts/CustomPointerProxy.cs
  31. +6 −5 Source/Assets/TouchScript/Examples/Cube/Scripts/Init.cs
  32. +3 −4 Source/Assets/TouchScript/Examples/Cube/Scripts/LayerDelegate.cs
  33. +6 −9 Source/Assets/TouchScript/Examples/Cube/Scripts/RedirectInput.cs
  34. +1 −2 Source/Assets/TouchScript/Examples/Multiuser/Scripts/Logo.cs
  35. +2 −2 Source/Assets/TouchScript/Examples/Photos/Scripts/Container.cs
  36. +0 −1 Source/Assets/TouchScript/Examples/Portal/Scripts/Spawner.cs
  37. +100 −98 Source/Assets/TouchScript/Examples/Pull/Scripts/Logic.cs
  38. +160 −161 Source/Assets/TouchScript/Examples/Pull/Scripts/PullGesture.cs
  39. +3 −3 Source/Assets/TouchScript/Examples/Taps/Scripts/Break.cs
  40. +4 −4 Source/Assets/TouchScript/Examples/Taps/Scripts/Kick.cs
  41. +2 −2 Source/Assets/TouchScript/Examples/Taps/Scripts/Spawn.cs
  42. +17 −15 Source/Assets/TouchScript/Examples/_misc/Scripts/ExamplesList.cs
  43. +33 −35 Source/Assets/TouchScript/Examples/_misc/Scripts/Highlight.cs
  44. +14 −10 Source/Assets/TouchScript/Examples/_misc/Scripts/ShowMe.cs
  45. +20 −20 Source/Assets/TouchScript/Scripts/Gestures/PressGesture.cs
  46. +16 −16 Source/Assets/TouchScript/Scripts/Gestures/TapGesture.cs
@@ -9,19 +9,17 @@

namespace TouchScript.Editor.Behaviors.Visualizer
{

[CustomEditor(typeof(CursorManager))]
internal sealed class CursorManagerEditor : UnityEditor.Editor
internal sealed class CursorManagerEditor : UnityEditor.Editor
{

public static readonly GUIContent TEXT_DPI_HEADER = new GUIContent("Use DPI", "Scale touch pointer based on DPI.");
public static readonly GUIContent TEXT_CURSORS_HEADER = new GUIContent("Cursors", "Cursor prefabs used for different pointer types.");
public static readonly GUIContent TEXT_POINTER_SIZE = new GUIContent("Pointer size (cm)", "Pointer size in cm based on current DPI.");
public static readonly GUIContent TEXT_DPI_HEADER = new GUIContent("Use DPI", "Scale touch pointer based on DPI.");
public static readonly GUIContent TEXT_CURSORS_HEADER = new GUIContent("Cursors", "Cursor prefabs used for different pointer types.");
public static readonly GUIContent TEXT_POINTER_SIZE = new GUIContent("Pointer size (cm)", "Pointer size in cm based on current DPI.");
public static readonly GUIContent TEXT_POINTER_PIXEL_SIZE = new GUIContent("Pointer size (px)", "Pointer size in pixels.");

private SerializedProperty mousePointerProxy, touchPointerProxy, penPointerProxy, objectPointerProxy;
private SerializedProperty useDPI, cursorSize, cursorPixelSize;
private SerializedProperty cursorsProps;
private SerializedProperty cursorsProps;

private void OnEnable()
{
@@ -41,7 +39,7 @@ public override void OnInspectorGUI()
{
serializedObject.Update();

GUILayout.Space(5);
GUILayout.Space(5);

EditorGUILayout.PropertyField(useDPI, TEXT_DPI_HEADER);
if (useDPI.boolValue)
@@ -54,17 +52,17 @@ public override void OnInspectorGUI()
}

var display = GUIElements.Header(TEXT_CURSORS_HEADER, cursorsProps);
if (display)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(mousePointerProxy, new GUIContent("Mouse Pointer Proxy"));
if (display)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(mousePointerProxy, new GUIContent("Mouse Pointer Proxy"));
EditorGUILayout.PropertyField(touchPointerProxy, new GUIContent("Touch Pointer Proxy"));
EditorGUILayout.PropertyField(penPointerProxy, new GUIContent("Pen Pointer Proxy"));
EditorGUILayout.PropertyField(objectPointerProxy, new GUIContent("Object Pointer Proxy"));
EditorGUI.indentLevel--;
}
}

serializedObject.ApplyModifiedProperties();
}
}
}
}
@@ -13,20 +13,20 @@ namespace TouchScript.Editor.Behaviors
[CustomEditor(typeof(Transformer), true)]
internal class TransformerEditor : UnityEditor.Editor
{
public static readonly GUIContent TEXT_SMOOTHING_HEADER = new GUIContent("Smoothing", "Applies smoothing to transform actions. This allows to reduce jagged movements but adds some visual lag.");
public static readonly GUIContent TEXT_SMOOTHING_FACTOR = new GUIContent("Factor", "Indicates how much smoothing to apply. 0 - no smoothing, 100000 - maximum.");
public static readonly GUIContent TEXT_POSITION_THRESHOLD = new GUIContent("Position Threshold", "Minimum distance between target position and smoothed position when to stop automatic movement.");
public static readonly GUIContent TEXT_ROTATION_THRESHOLD = new GUIContent("Rotation Threshold", "Minimum angle between target rotation and smoothed rotation when to stop automatic movement.");
public static readonly GUIContent TEXT_SCALE_THRESHOLD = new GUIContent("Scale Threshold", "Minimum difference between target scale and smoothed scale when to stop automatic movement.");
public static readonly GUIContent TEXT_ALLOW_CHANGING = new GUIContent("Allow Changing From Outside", "Indicates if this transform can be changed from another script.");
public static readonly GUIContent TEXT_SMOOTHING_FACTOR_DESC = new GUIContent("Indicates how much smoothing to apply. \n0 - no smoothing, 100000 - maximum.");
public static readonly GUIContent TEXT_SMOOTHING_HEADER = new GUIContent("Smoothing", "Applies smoothing to transform actions. This allows to reduce jagged movements but adds some visual lag.");
public static readonly GUIContent TEXT_SMOOTHING_FACTOR = new GUIContent("Factor", "Indicates how much smoothing to apply. 0 - no smoothing, 100000 - maximum.");
public static readonly GUIContent TEXT_POSITION_THRESHOLD = new GUIContent("Position Threshold", "Minimum distance between target position and smoothed position when to stop automatic movement.");
public static readonly GUIContent TEXT_ROTATION_THRESHOLD = new GUIContent("Rotation Threshold", "Minimum angle between target rotation and smoothed rotation when to stop automatic movement.");
public static readonly GUIContent TEXT_SCALE_THRESHOLD = new GUIContent("Scale Threshold", "Minimum difference between target scale and smoothed scale when to stop automatic movement.");
public static readonly GUIContent TEXT_ALLOW_CHANGING = new GUIContent("Allow Changing From Outside", "Indicates if this transform can be changed from another script.");
public static readonly GUIContent TEXT_SMOOTHING_FACTOR_DESC = new GUIContent("Indicates how much smoothing to apply. \n0 - no smoothing, 100000 - maximum.");

public static readonly GUIContent TEXT_HELP = new GUIContent("This component receives transform data from Transform Gestures and applies changes to the GameObject.");
public static readonly GUIContent TEXT_HELP = new GUIContent("This component receives transform data from Transform Gestures and applies changes to the GameObject.");

private Transformer instance;
private Transformer instance;

private SerializedProperty enableSmoothing, allowChangingFromOutside;
private PropertyInfo enableSmoothing_prop;
private PropertyInfo enableSmoothing_prop;

protected virtual void OnEnable()
{
@@ -35,39 +35,38 @@ protected virtual void OnEnable()

instance = target as Transformer;

var type = instance.GetType();
enableSmoothing_prop = type.GetProperty("EnableSmoothing", BindingFlags.Instance | BindingFlags.Public);
var type = instance.GetType();
enableSmoothing_prop = type.GetProperty("EnableSmoothing", BindingFlags.Instance | BindingFlags.Public);
}

public override void OnInspectorGUI()
{
#if UNITY_5_6_OR_NEWER
serializedObject.UpdateIfRequiredOrScript();
serializedObject.UpdateIfRequiredOrScript();
#else
serializedObject.UpdateIfDirtyOrScript();
#endif

GUILayout.Space(5);
GUILayout.Space(5);

var display = GUIElements.Header(TEXT_SMOOTHING_HEADER, enableSmoothing, enableSmoothing, enableSmoothing_prop);
if (display)
{
EditorGUI.indentLevel++;
using (new EditorGUI.DisabledGroupScope(!enableSmoothing.boolValue))
{
instance.SmoothingFactor = EditorGUILayout.FloatField(TEXT_SMOOTHING_FACTOR, instance.SmoothingFactor);
EditorGUILayout.LabelField(TEXT_SMOOTHING_FACTOR_DESC, GUIElements.HelpBox);
instance.PositionThreshold = EditorGUILayout.FloatField(TEXT_POSITION_THRESHOLD, instance.PositionThreshold);
instance.RotationThreshold = EditorGUILayout.FloatField(TEXT_ROTATION_THRESHOLD, instance.RotationThreshold);
instance.ScaleThreshold = EditorGUILayout.FloatField(TEXT_SCALE_THRESHOLD, instance.ScaleThreshold);
EditorGUILayout.PropertyField(allowChangingFromOutside, TEXT_ALLOW_CHANGING);
}
EditorGUI.indentLevel--;
}
var display = GUIElements.Header(TEXT_SMOOTHING_HEADER, enableSmoothing, enableSmoothing, enableSmoothing_prop);
if (display)
{
EditorGUI.indentLevel++;
using (new EditorGUI.DisabledGroupScope(!enableSmoothing.boolValue))
{
instance.SmoothingFactor = EditorGUILayout.FloatField(TEXT_SMOOTHING_FACTOR, instance.SmoothingFactor);
EditorGUILayout.LabelField(TEXT_SMOOTHING_FACTOR_DESC, GUIElements.HelpBox);
instance.PositionThreshold = EditorGUILayout.FloatField(TEXT_POSITION_THRESHOLD, instance.PositionThreshold);
instance.RotationThreshold = EditorGUILayout.FloatField(TEXT_ROTATION_THRESHOLD, instance.RotationThreshold);
instance.ScaleThreshold = EditorGUILayout.FloatField(TEXT_SCALE_THRESHOLD, instance.ScaleThreshold);
EditorGUILayout.PropertyField(allowChangingFromOutside, TEXT_ALLOW_CHANGING);
}
EditorGUI.indentLevel--;
}
EditorGUILayout.LabelField(TEXT_HELP, GUIElements.HelpBox);

serializedObject.ApplyModifiedProperties();
}

}
}
}
@@ -61,4 +61,4 @@ static bool searchForEditorResourcesPath(out string path)
return true;
}
}
}
}
@@ -10,119 +10,119 @@ namespace TouchScript.Editor.EditorUI
{
internal static class GUIElements
{
public static GUIStyle Box;
public static GUIStyle BoxLabel;
public static GUIStyle Box;
public static GUIStyle BoxLabel;

public static GUIStyle HelpBox;
public static GUIStyle HelpBox;
public static GUIStyle HeaderBox;
public static GUIStyle HeaderCheckbox;
public static GUIStyle HeaderFoldout;
public static GUIStyle HeaderCheckbox;
public static GUIStyle HeaderFoldout;
public static GUIStyle SmallText;
public static GUIStyle SmallTextRight;
public static GUIStyle SmallTextRight;
public static GUIStyle SmallButton;

public static Texture2D PaneOptionsIcon;
public static Texture2D PaneOptionsIcon;

static GUIElements()
{
Box = new GUIStyle(GUI.skin.box)
{
margin = new RectOffset(0, 0, 1, 0),
padding = new RectOffset(0, 0, 0, 0),
contentOffset = new Vector2(0, 0),
alignment = TextAnchor.MiddleCenter,
};
Box.normal.textColor = GUI.skin.label.normal.textColor;

BoxLabel = new GUIStyle(GUI.skin.label)
{
fontSize = 9,
padding = new RectOffset(0, 0, 5, 0),
};

HelpBox = new GUIStyle("HelpBox")
{
wordWrap = true,
};

HeaderBox = new GUIStyle("ShurikenModuleTitle")
{
font = (new GUIStyle("Label")).font,
border = new RectOffset(15, 7, 4, 4),
fixedHeight = 22,
contentOffset = new Vector2(20f, -2f),
};

HeaderCheckbox = new GUIStyle("ShurikenCheckMark");
HeaderFoldout = new GUIStyle("Foldout");

SmallText = new GUIStyle("miniLabel")
{
alignment = TextAnchor.UpperLeft,
};

SmallTextRight = new GUIStyle("miniLabel")
{
alignment = TextAnchor.UpperRight,
};

SmallButton = new GUIStyle("Button")
{
fontSize = SmallText.fontSize,
fontStyle = SmallText.fontStyle,
font = SmallText.font,
};

if (EditorGUIUtility.isProSkin)
PaneOptionsIcon = (Texture2D)EditorGUIUtility.LoadRequired("Builtin Skins/DarkSkin/Images/pane options.png");
else
PaneOptionsIcon = (Texture2D)EditorGUIUtility.LoadRequired("Builtin Skins/LightSkin/Images/pane options.png");
Box = new GUIStyle(GUI.skin.box)
{
margin = new RectOffset(0, 0, 1, 0),
padding = new RectOffset(0, 0, 0, 0),
contentOffset = new Vector2(0, 0),
alignment = TextAnchor.MiddleCenter,
};
Box.normal.textColor = GUI.skin.label.normal.textColor;

BoxLabel = new GUIStyle(GUI.skin.label)
{
fontSize = 9,
padding = new RectOffset(0, 0, 5, 0),
};

HelpBox = new GUIStyle("HelpBox")
{
wordWrap = true,
};

HeaderBox = new GUIStyle("ShurikenModuleTitle")
{
font = (new GUIStyle("Label")).font,
border = new RectOffset(15, 7, 4, 4),
fixedHeight = 22,
contentOffset = new Vector2(20f, -2f),
};

HeaderCheckbox = new GUIStyle("ShurikenCheckMark");
HeaderFoldout = new GUIStyle("Foldout");

SmallText = new GUIStyle("miniLabel")
{
alignment = TextAnchor.UpperLeft,
};

SmallTextRight = new GUIStyle("miniLabel")
{
alignment = TextAnchor.UpperRight,
};

SmallButton = new GUIStyle("Button")
{
fontSize = SmallText.fontSize,
fontStyle = SmallText.fontStyle,
font = SmallText.font,
};

if (EditorGUIUtility.isProSkin)
PaneOptionsIcon = (Texture2D) EditorGUIUtility.LoadRequired("Builtin Skins/DarkSkin/Images/pane options.png");
else
PaneOptionsIcon = (Texture2D) EditorGUIUtility.LoadRequired("Builtin Skins/LightSkin/Images/pane options.png");
}

public static bool Header(GUIContent title, SerializedProperty expanded, SerializedProperty enabled = null, PropertyInfo enabledProp = null)
{
var rect = GUILayoutUtility.GetRect(16f, 22f, HeaderBox);
GUI.Box(rect, title, HeaderBox);

var display = expanded == null || expanded.isExpanded;

var foldoutRect = new Rect(rect.x + 4f, rect.y + 3f, 13f, 13f);
var e = Event.current;

if (e.type == EventType.Repaint)
{
if (enabled == null) HeaderFoldout.Draw(foldoutRect, false, false, display, false);
else HeaderCheckbox.Draw(foldoutRect, false, false, enabled.boolValue, false);
}

if (e.type == EventType.MouseDown)
{
if (enabled != null)
{
const float kOffset = 2f;
foldoutRect.x -= kOffset;
foldoutRect.y -= kOffset;
foldoutRect.width += kOffset * 2f;
foldoutRect.height += kOffset * 2f;

if (foldoutRect.Contains(e.mousePosition))
{
enabled.boolValue = !enabled.boolValue;
if (enabledProp != null) enabledProp.SetValue(enabled.serializedObject.targetObject, enabled.boolValue, null);
e.Use();
return display;
}
}
if (rect.Contains(e.mousePosition))
{
display = !display;
expanded.isExpanded = !expanded.isExpanded;
e.Use();
}
}

return display;
}
public static bool Header(GUIContent title, SerializedProperty expanded, SerializedProperty enabled = null, PropertyInfo enabledProp = null)
{
var rect = GUILayoutUtility.GetRect(16f, 22f, HeaderBox);
GUI.Box(rect, title, HeaderBox);

var display = expanded == null || expanded.isExpanded;

var foldoutRect = new Rect(rect.x + 4f, rect.y + 3f, 13f, 13f);
var e = Event.current;

if (e.type == EventType.Repaint)
{
if (enabled == null) HeaderFoldout.Draw(foldoutRect, false, false, display, false);
else HeaderCheckbox.Draw(foldoutRect, false, false, enabled.boolValue, false);
}

if (e.type == EventType.MouseDown)
{
if (enabled != null)
{
const float kOffset = 2f;
foldoutRect.x -= kOffset;
foldoutRect.y -= kOffset;
foldoutRect.width += kOffset * 2f;
foldoutRect.height += kOffset * 2f;

if (foldoutRect.Contains(e.mousePosition))
{
enabled.boolValue = !enabled.boolValue;
if (enabledProp != null) enabledProp.SetValue(enabled.serializedObject.targetObject, enabled.boolValue, null);
e.Use();
return display;
}
}
if (rect.Contains(e.mousePosition))
{
display = !display;
expanded.isExpanded = !expanded.isExpanded;
e.Use();
}
}

return display;
}

public static bool BasicHelpBox(GUIContent text)
{
@@ -134,4 +134,4 @@ public static bool BasicHelpBox(GUIContent text)
return GUI.Button(rect, "Switch to Advanced", SmallButton);
}
}
}
}
Oops, something went wrong.

0 comments on commit 351487a

Please sign in to comment.
You can’t perform that action at this time.