Copy Aetheria Code

Added a bunch of code from the old Aetheria project
This commit is contained in:
hyperion51 2020-02-27 18:51:07 +00:00
commit c58ba0b1da
1704 changed files with 175081 additions and 313 deletions

View file

@ -0,0 +1,24 @@
///Credit ChoMPHi
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
using UnityEditor;
using UnityEditor.UI;
namespace UnityEngine.UI.Extensions
{
[CustomEditor(typeof(AccordionElement), true)]
public class AccordionElementEditor : ToggleEditor {
public override void OnInspectorGUI()
{
this.serializedObject.Update();
EditorGUILayout.PropertyField(this.serializedObject.FindProperty("m_MinHeight"));
this.serializedObject.ApplyModifiedProperties();
base.serializedObject.Update();
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("m_IsOn"));
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("m_Interactable"));
base.serializedObject.ApplyModifiedProperties();
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8882b502b0c65b24ba4623d6a383815b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,77 @@
///Credit Jason Horsburgh
///Sourced from - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues/127/uilinerenderer-mesh-not-updating-in-editor
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
[CustomEditor(typeof(UILineRenderer))]
public class BezierLineRendererEditor : Editor
{
void OnSceneGUI()
{
UILineRenderer curveRenderer = target as UILineRenderer;
if (!curveRenderer || curveRenderer.drivenExternally || curveRenderer.Points == null || curveRenderer.Points.Length < 2)
{
return;
}
var oldMatrix = Handles.matrix;
var transform = curveRenderer.GetComponent<RectTransform>();
//Pivot must be 0,0 to edit
//transform.pivot = Vector2.zero;
Handles.matrix = transform.localToWorldMatrix;
var sizeX = curveRenderer.rectTransform.rect.width;
var sizeY = curveRenderer.rectTransform.rect.height;
var offsetX = -curveRenderer.rectTransform.pivot.x * sizeX;
var offsetY = -curveRenderer.rectTransform.pivot.y * sizeY;
Vector2[] points = new Vector2[curveRenderer.Points.Length];
for (int i = 0; i < curveRenderer.Points.Length; i++)
{
points[i] = curveRenderer.Points[i];
}
//Need to transform points to worldspace! when set to Relative
if (curveRenderer.RelativeSize)
{
for (int i = 0; i < points.Length; i++)
{
points[i] = new Vector2(points[i].x * sizeX + offsetX, points[i].y * sizeY + offsetY);
}
}
for (int i = 0; i < points.Length - 1; i += 2)
{
Handles.DrawLine(points[i], points[i + 1]);
}
for (int i = 0; i < points.Length; ++i)
{
using (var check = new EditorGUI.ChangeCheckScope())
{
var p = Handles.PositionHandle(points[i], Quaternion.identity);
if (check.changed)
{
Undo.RecordObject(curveRenderer, "Changed Curve Position");
if (curveRenderer.RelativeSize)
{
curveRenderer.Points[i] = new Vector2((p.x - offsetX) / sizeX, (p.y - offsetY) / sizeY);
}
else
{
curveRenderer.Points[i] = p;
}
curveRenderer.transform.gameObject.SetActive(false);
curveRenderer.transform.gameObject.SetActive(true);
}
}
}
Handles.matrix = oldMatrix;
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4ef6a0d3c3259384982ae3974fe7e618
timeCreated: 1492258093
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,67 @@
///Credit judah4
///Sourced from - http://forum.unity3d.com/threads/color-picker.267043/
using UnityEditor;
using UnityEditor.UI;
namespace UnityEngine.UI.Extensions
{
[CustomEditor(typeof(BoxSlider), true)]
[CanEditMultipleObjects]
public class BoxSliderEditor : SelectableEditor
{
SerializedProperty m_HandleRect;
SerializedProperty m_MinValue;
SerializedProperty m_MaxValue;
SerializedProperty m_WholeNumbers;
SerializedProperty m_ValueX;
SerializedProperty m_ValueY;
SerializedProperty m_OnValueChanged;
protected override void OnEnable()
{
base.OnEnable();
m_HandleRect = serializedObject.FindProperty("m_HandleRect");
m_MinValue = serializedObject.FindProperty("m_MinValue");
m_MaxValue = serializedObject.FindProperty("m_MaxValue");
m_WholeNumbers = serializedObject.FindProperty("m_WholeNumbers");
m_ValueX = serializedObject.FindProperty("m_ValueX");
m_ValueY = serializedObject.FindProperty("m_ValueY");
m_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.Space();
serializedObject.Update();
EditorGUILayout.PropertyField(m_HandleRect);
if (m_HandleRect.objectReferenceValue != null)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_MinValue);
EditorGUILayout.PropertyField(m_MaxValue);
EditorGUILayout.PropertyField(m_WholeNumbers);
EditorGUILayout.Slider(m_ValueX, m_MinValue.floatValue, m_MaxValue.floatValue);
EditorGUILayout.Slider(m_ValueY, m_MinValue.floatValue, m_MaxValue.floatValue);
// Draw the event notification options
EditorGUILayout.Space();
EditorGUILayout.PropertyField(m_OnValueChanged);
}
else
{
EditorGUILayout.HelpBox("Specify a RectTransform for the slider fill or the slider handle or both. Each must have a parent RectTransform that it can slide within.", MessageType.Info);
}
serializedObject.ApplyModifiedProperties();
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8701e045b26e51f4eb345f2ccb3c13f5
timeCreated: 1426804458
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,59 @@
/// Credit Titinious (https://github.com/Titinious)
/// Sourced from - https://github.com/Titinious/CurlyUI
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
[CustomEditor(typeof(CUIBezierCurve))]
[CanEditMultipleObjects]
public class CUIBezierCurveEditor : Editor
{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
}
protected void OnSceneGUI()
{
CUIBezierCurve script = (CUIBezierCurve)this.target;
if (script.ControlPoints != null)
{
Vector3[] controlPoints = script.ControlPoints;
Transform handleTransform = script.transform;
Quaternion handleRotation = script.transform.rotation;
for (int p = 0; p < CUIBezierCurve.CubicBezierCurvePtNum; p++)
{
EditorGUI.BeginChangeCheck();
Vector3 newPt = Handles.DoPositionHandle(handleTransform.TransformPoint(controlPoints[p]), handleRotation);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(script, "Move Point");
EditorUtility.SetDirty(script);
controlPoints[p] = handleTransform.InverseTransformPoint(newPt);
script.Refresh();
}
}
Handles.color = Color.gray;
Handles.DrawLine(handleTransform.TransformPoint(controlPoints[0]), handleTransform.TransformPoint(controlPoints[1]));
Handles.DrawLine(handleTransform.TransformPoint(controlPoints[1]), handleTransform.TransformPoint(controlPoints[2]));
Handles.DrawLine(handleTransform.TransformPoint(controlPoints[2]), handleTransform.TransformPoint(controlPoints[3]));
int sampleSize = 10;
Handles.color = Color.white;
for (int s = 0; s < sampleSize; s++)
{
Handles.DrawLine(handleTransform.TransformPoint(script.GetPoint((float)s / sampleSize)), handleTransform.TransformPoint(script.GetPoint((float)(s + 1) / sampleSize)));
}
script.EDITOR_ControlPoints = controlPoints;
}
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 40e01e4fb1e006b46a0f127c8a9907b3
timeCreated: 1485671367
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,187 @@
/// Credit Titinious (https://github.com/Titinious)
/// Sourced from - https://github.com/Titinious/CurlyUI
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
[CustomEditor(typeof(CUIGraphic), true)]
public class CUIGraphicEditor : Editor {
protected static bool isCurveGpFold = false;
protected Vector3[] reuse_Vector3s = new Vector3[4];
public override void OnInspectorGUI()
{
CUIGraphic script = (CUIGraphic)this.target;
EditorGUILayout.HelpBox("CurlyUI (CUI) should work with most of the Unity UI. For Image, use CUIImage; for Text, use CUIText; and for others (e.g. RawImage), use CUIGraphic", MessageType.Info);
if (script.UIGraphic == null)
{
EditorGUILayout.HelpBox("CUI is an extension to Unity's UI. You must set Ui Graphic with a Unity Graphic component (e.g. Image, Text, RawImage)", MessageType.Error);
}
else
{
if (script.UIGraphic is Image && script.GetType() != typeof(CUIImage))
{
EditorGUILayout.HelpBox("Although CUI components are generalized. It is recommended that for Image, use CUIImage", MessageType.Warning);
}
else if (script.UIGraphic is Text && script.GetType() != typeof(CUIText))
{
EditorGUILayout.HelpBox("Although CUI components are generalized. It is recommended that for Text, use CUIText", MessageType.Warning);
}
EditorGUILayout.HelpBox("Now that CUI is ready, change the control points of the top and bottom bezier curves to curve/morph the UI. Improve resolution when the UI seems to look poorly when curved/morphed should help.", MessageType.Info);
}
DrawDefaultInspector();
// draw the editor that shows the position ratio of all control points from the two bezier curves
isCurveGpFold = EditorGUILayout.Foldout(isCurveGpFold, "Curves Position Ratios");
if (isCurveGpFold)
{
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("Top Curve");
EditorGUI.indentLevel++;
Vector3[] controlPoints = script.RefCurvesControlRatioPoints[1].array;
EditorGUI.BeginChangeCheck();
for (int p = 0; p < controlPoints.Length; p++)
{
reuse_Vector3s[p] = EditorGUILayout.Vector3Field(string.Format("Control Points {0}", p + 1), controlPoints[p]);
}
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(script, "Change Ratio Points");
EditorUtility.SetDirty(script);
System.Array.Copy(reuse_Vector3s, script.RefCurvesControlRatioPoints[1].array, controlPoints.Length);
script.UpdateCurveControlPointPositions();
}
EditorGUI.indentLevel--;
EditorGUILayout.LabelField("Bottom Curve");
EditorGUI.indentLevel++;
controlPoints = script.RefCurvesControlRatioPoints[0].array;
EditorGUI.BeginChangeCheck();
for (int p = 0; p < controlPoints.Length; p++)
{
reuse_Vector3s[p] = EditorGUILayout.Vector3Field(string.Format("Control Points {0}", p + 1), controlPoints[p]);
}
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(script, "Change Ratio Points");
EditorUtility.SetDirty(script);
System.Array.Copy(reuse_Vector3s, controlPoints, controlPoints.Length);
script.UpdateCurveControlPointPositions();
}
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
EditorGUILayout.Space();
if (GUILayout.Button("Fit Bezier curves to rect transform"))
{
Undo.RecordObject(script, "Fit to Rect Transform");
Undo.RecordObject(script.RefCurves[0], "Fit to Rect Transform");
Undo.RecordObject(script.RefCurves[1], "Fit to Rect Transform");
EditorUtility.SetDirty(script);
script.FixTextToRectTrans();
script.Refresh();
}
EditorGUILayout.Space();
// disable group to prevent allowing the reference be used when there is no reference CUI
EditorGUI.BeginDisabledGroup(script.RefCUIGraphic == null);
if (GUILayout.Button("Reference CUI component for curves"))
{
Undo.RecordObject(script, "Reference Reference CUI");
Undo.RecordObject(script.RefCurves[0], "Reference Reference CUI");
Undo.RecordObject(script.RefCurves[1], "Reference Reference CUI");
EditorUtility.SetDirty(script);
script.ReferenceCUIForBCurves();
script.Refresh();
}
EditorGUILayout.HelpBox("Auto set the curves' control points by refencing another CUI. You need to set Ref CUI Graphic (e.g. CUIImage) first.", MessageType.Info);
EditorGUI.EndDisabledGroup();
}
protected virtual void OnSceneGUI()
{
// for CUITextEditor, allow using scene UI to change the control points of the bezier curves
CUIGraphic script = (CUIGraphic)this.target;
script.ReportSet();
for (int c = 0; c < script.RefCurves.Length; c++)
{
CUIBezierCurve curve = script.RefCurves[c];
if (curve.ControlPoints != null)
{
Vector3[] controlPoints = curve.ControlPoints;
Transform handleTransform = curve.transform;
Quaternion handleRotation = curve.transform.rotation;
for (int p = 0; p < CUIBezierCurve.CubicBezierCurvePtNum; p++)
{
EditorGUI.BeginChangeCheck();
Handles.Label(handleTransform.TransformPoint(controlPoints[p]), string.Format("Control Point {0}", p + 1));
Vector3 newPt = Handles.DoPositionHandle(handleTransform.TransformPoint(controlPoints[p]), handleRotation);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(curve, "Move Point");
Undo.RecordObject(script, "Move Point");
EditorUtility.SetDirty(curve);
controlPoints[p] = handleTransform.InverseTransformPoint(newPt);
}
}
Handles.color = Color.gray;
Handles.DrawLine(handleTransform.TransformPoint(controlPoints[0]), handleTransform.TransformPoint(controlPoints[1]));
Handles.DrawLine(handleTransform.TransformPoint(controlPoints[1]), handleTransform.TransformPoint(controlPoints[2]));
Handles.DrawLine(handleTransform.TransformPoint(controlPoints[2]), handleTransform.TransformPoint(controlPoints[3]));
int sampleSize = 10;
Handles.color = Color.white;
for (int s = 0; s < sampleSize; s++)
{
Handles.DrawLine(handleTransform.TransformPoint(curve.GetPoint((float)s / sampleSize)), handleTransform.TransformPoint(curve.GetPoint((float)(s + 1) / sampleSize)));
}
curve.EDITOR_ControlPoints = controlPoints;
}
}
if (script.RefCurves != null)
{
Handles.DrawLine(script.RefCurves[0].transform.TransformPoint(script.RefCurves[0].ControlPoints[0]), script.RefCurves[1].transform.TransformPoint(script.RefCurves[1].ControlPoints[0]));
Handles.DrawLine(script.RefCurves[0].transform.TransformPoint(script.RefCurves[0].ControlPoints[3]), script.RefCurves[1].transform.TransformPoint(script.RefCurves[1].ControlPoints[3]));
}
script.Refresh();
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b7b84624f1ba7bd49b6cfc63b25f4b7c
timeCreated: 1485671367
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,88 @@
/// Credit Titinious (https://github.com/Titinious)
/// Sourced from - https://github.com/Titinious/CurlyUI
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
[CustomEditor(typeof(CUIImage))]
public class CUIImageEditor : CUIGraphicEditor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
CUIImage script = (CUIImage)this.target;
EditorGUILayout.Space();
EditorGUI.BeginChangeCheck();
EditorGUI.BeginDisabledGroup(!(script.UIImage.type == Image.Type.Sliced || script.UIImage.type == Image.Type.Tiled));
Vector2 newCornerRatio = EditorGUILayout.Vector2Field("Corner Ratio", script.cornerPosRatio);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(script, "Change Corner Ratio");
EditorUtility.SetDirty(script);
script.cornerPosRatio = newCornerRatio;
}
if (GUILayout.Button("Use native corner ratio"))
{
Undo.RecordObject(script, "Change Corner Ratio");
EditorUtility.SetDirty(script);
script.cornerPosRatio = script.OriCornerPosRatio;
}
if (script.UIImage.type == Image.Type.Sliced || script.UIImage.type == Image.Type.Filled)
{
EditorGUILayout.HelpBox("With CUIImage, you can also adjust the size of the corners for filled or sliced Image. The grey sphere in the editor scene could also be moved to change the corner's size.", MessageType.Info);
}
else
{
EditorGUILayout.HelpBox("With CUIImage, you can also adjust the size of the corners for filled or sliced Image. You need to set Image to filled or sliced to use this feature.", MessageType.Info);
}
EditorGUI.EndDisabledGroup();
}
protected override void OnSceneGUI()
{
base.OnSceneGUI();
CUIImage script = (CUIImage)this.target;
if (script.UIImage.type == Image.Type.Sliced || script.UIImage.type == Image.Type.Tiled)
{
Vector3 cornerPos = Vector3.zero;//
if (script.IsCurved)
{
cornerPos = script.GetBCurveSandwichSpacePoint(script.cornerPosRatio.x, script.cornerPosRatio.y);
}
else
{
cornerPos.x = script.cornerPosRatio.x * script.RectTrans.rect.width - script.RectTrans.pivot.x * script.RectTrans.rect.width;
cornerPos.y = script.cornerPosRatio.y * script.RectTrans.rect.height - script.RectTrans.pivot.y * script.RectTrans.rect.height;
}
Handles.color = Color.gray;
EditorGUI.BeginChangeCheck();
Vector3 newCornerPos = Handles.FreeMoveHandle(script.transform.TransformPoint(cornerPos), script.transform.rotation, HandleUtility.GetHandleSize(script.transform.TransformPoint(cornerPos)) / 7, Vector3.one, Handles.SphereHandleCap);
Handles.Label(newCornerPos, string.Format("Corner Mover"));
newCornerPos = script.transform.InverseTransformPoint(newCornerPos);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(script, "Move Corner");
EditorUtility.SetDirty(script);
script.cornerPosRatio = new Vector2(newCornerPos.x, newCornerPos.y);
script.cornerPosRatio.x = (script.cornerPosRatio.x + script.RectTrans.pivot.x * script.RectTrans.rect.width) / script.RectTrans.rect.width;
script.cornerPosRatio.y = (script.cornerPosRatio.y + script.RectTrans.pivot.y * script.RectTrans.rect.height) / script.RectTrans.rect.height;
}
}
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8445204f2ee16e0408274b8400deef53
timeCreated: 1485929052
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,10 @@
/// Credit Titinious (https://github.com/Titinious)
/// Sourced from - https://github.com/Titinious/CurlyUI
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
[CustomEditor(typeof(CUIText))]
public class CUITextEditor : CUIGraphicEditor { }
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 041976c43b8439747a030b45a4712b77
timeCreated: 1485929052
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,116 @@
/// Credit dakka
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1752415
/// Notes - Mod from Yilmaz Kiymaz's editor scripts presentation at Unite 2013
/// Updated ddreaper - removed Linq use, not required.
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
public class CanvasGroupActivator : EditorWindow
{
[MenuItem("Window/UI/Extensions/Canvas Groups Activator")]
public static void InitWindow()
{
EditorWindow.GetWindow<CanvasGroupActivator>();
}
CanvasGroup[] canvasGroups;
void OnEnable()
{
ObtainCanvasGroups();
}
void OnFocus()
{
ObtainCanvasGroups();
}
void ObtainCanvasGroups()
{
canvasGroups = GameObject.FindObjectsOfType<CanvasGroup>();
}
void OnGUI()
{
if (canvasGroups == null)
{
return;
}
GUILayout.Space(10f);
GUILayout.Label("Canvas Groups");
for (int i = 0; i < canvasGroups.Length; i++)
{
if (canvasGroups[i] == null) { continue; }
bool initialActive = false;
if (canvasGroups[i].alpha == 1.0f)
initialActive = true;
bool active = EditorGUILayout.Toggle(canvasGroups[i].name, initialActive);
if (active != initialActive)
{
//If deactivated and initially active
if (!active && initialActive)
{
//Deactivate this
canvasGroups[i].alpha = 0f;
canvasGroups[i].interactable = false;
canvasGroups[i].blocksRaycasts = false;
}
//If activated and initially deactive
else if (active && !initialActive)
{
//Deactivate all others and activate this
HideAllGroups();
canvasGroups[i].alpha = 1.0f;
canvasGroups[i].interactable = true;
canvasGroups[i].blocksRaycasts = true;
}
}
}
GUILayout.Space(5f);
if (GUILayout.Button("Show All"))
{
ShowAllGroups();
}
if (GUILayout.Button("Hide All"))
{
HideAllGroups();
}
}
void ShowAllGroups()
{
foreach (var group in canvasGroups)
{
if (group != null)
{
group.alpha = 1.0f;
group.interactable = true;
group.blocksRaycasts = true;
}
}
}
void HideAllGroups()
{
foreach (var group in canvasGroups)
{
if (group != null)
{
group.alpha = 0;
group.interactable = false;
group.blocksRaycasts = false;
}
}
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f60a419e63d329f43ba1bf57e98b34bf
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,21 @@
/// Credit Slipp Douglas Thompson
/// Sourced from - https://gist.github.com/capnslipp/349c18283f2fea316369
///
using UnityEditor;
using UnityEditor.UI;
namespace UnityEngine.UI.Extensions
{
[CanEditMultipleObjects, CustomEditor(typeof(NonDrawingGraphic), false)]
public class NonDrawingGraphicEditor : GraphicEditor
{
public override void OnInspectorGUI()
{
base.serializedObject.Update();
EditorGUILayout.PropertyField(base.m_Script, new GUILayoutOption[0]);
// skipping AppearanceControlsGUI
base.RaycastControlsGUI();
base.serializedObject.ApplyModifiedProperties();
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ee2802949feca4c4c934331b6a0dc379
timeCreated: 1483566748
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,19 @@
/// Credit tanoshimi
/// Sourced from - https://forum.unity3d.com/threads/read-only-fields.68976/
///
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
GUI.enabled = false;
EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = true;
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 33c90f5149877a242981372f6cde9a35
timeCreated: 1498392707
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,38 @@
/// Credit drobina, w34edrtfg, playemgames
/// Sourced from - http://forum.unity3d.com/threads/sprite-icons-with-text-e-g-emoticons.265927/
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
[CanEditMultipleObjects]
[CustomEditor(typeof(TextPic))]
public class TextPicEditor : UnityEditor.UI.TextEditor
{
private SerializedProperty ImageScalingFactorProp;
private SerializedProperty hyperlinkColorProp;
private SerializedProperty imageOffsetProp;
private SerializedProperty iconList;
protected override void OnEnable()
{
base.OnEnable();
ImageScalingFactorProp = serializedObject.FindProperty("ImageScalingFactor");
hyperlinkColorProp = serializedObject.FindProperty("hyperlinkColor");
imageOffsetProp = serializedObject.FindProperty("imageOffset");
iconList = serializedObject.FindProperty("inspectorIconList");
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();
EditorGUILayout.PropertyField(imageOffsetProp, new GUIContent("Image Offset"));
EditorGUILayout.PropertyField(ImageScalingFactorProp, new GUIContent("Image Scaling Factor"));
EditorGUILayout.PropertyField(hyperlinkColorProp, new GUIContent("Hyperlink Color"));
EditorGUILayout.PropertyField(iconList, new GUIContent("Icon List"), true);
serializedObject.ApplyModifiedProperties();
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5fe8e67609bbee14d8ad0805aac72799
timeCreated: 1468515486
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3cac6d35505037446b512aea22d40688
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View file

@ -0,0 +1,115 @@
/// Credit Senshi
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/ (uGUITools link)
using UnityEditor;
namespace UnityEngine.UI.Extensions
{
public static class uGUITools
{
[MenuItem("uGUI/Anchors to Corners %[")]
static void AnchorsToCorners()
{
foreach (Transform transform in Selection.transforms)
{
RectTransform t = transform as RectTransform;
RectTransform pt = Selection.activeTransform.parent as RectTransform;
if (t == null || pt == null) return;
Vector2 newAnchorsMin = new Vector2(t.anchorMin.x + t.offsetMin.x / pt.rect.width,
t.anchorMin.y + t.offsetMin.y / pt.rect.height);
Vector2 newAnchorsMax = new Vector2(t.anchorMax.x + t.offsetMax.x / pt.rect.width,
t.anchorMax.y + t.offsetMax.y / pt.rect.height);
t.anchorMin = newAnchorsMin;
t.anchorMax = newAnchorsMax;
t.offsetMin = t.offsetMax = new Vector2(0, 0);
}
}
[MenuItem("uGUI/Corners to Anchors %]")]
static void CornersToAnchors()
{
foreach (Transform transform in Selection.transforms)
{
RectTransform t = transform as RectTransform;
if (t == null) return;
t.offsetMin = t.offsetMax = new Vector2(0, 0);
}
}
[MenuItem("uGUI/Mirror Horizontally Around Anchors %;")]
static void MirrorHorizontallyAnchors()
{
MirrorHorizontally(false);
}
[MenuItem("uGUI/Mirror Horizontally Around Parent Center %:")]
static void MirrorHorizontallyParent()
{
MirrorHorizontally(true);
}
static void MirrorHorizontally(bool mirrorAnchors)
{
foreach (Transform transform in Selection.transforms)
{
RectTransform t = transform as RectTransform;
RectTransform pt = Selection.activeTransform.parent as RectTransform;
if (t == null || pt == null) return;
if (mirrorAnchors)
{
Vector2 oldAnchorMin = t.anchorMin;
t.anchorMin = new Vector2(1 - t.anchorMax.x, t.anchorMin.y);
t.anchorMax = new Vector2(1 - oldAnchorMin.x, t.anchorMax.y);
}
Vector2 oldOffsetMin = t.offsetMin;
t.offsetMin = new Vector2(-t.offsetMax.x, t.offsetMin.y);
t.offsetMax = new Vector2(-oldOffsetMin.x, t.offsetMax.y);
t.localScale = new Vector3(-t.localScale.x, t.localScale.y, t.localScale.z);
}
}
[MenuItem("uGUI/Mirror Vertically Around Anchors %'")]
static void MirrorVerticallyAnchors()
{
MirrorVertically(false);
}
[MenuItem("uGUI/Mirror Vertically Around Parent Center %\"")]
static void MirrorVerticallyParent()
{
MirrorVertically(true);
}
static void MirrorVertically(bool mirrorAnchors)
{
foreach (Transform transform in Selection.transforms)
{
RectTransform t = transform as RectTransform;
RectTransform pt = Selection.activeTransform.parent as RectTransform;
if (t == null || pt == null) return;
if (mirrorAnchors)
{
Vector2 oldAnchorMin = t.anchorMin;
t.anchorMin = new Vector2(t.anchorMin.x, 1 - t.anchorMax.y);
t.anchorMax = new Vector2(t.anchorMax.x, 1 - oldAnchorMin.y);
}
Vector2 oldOffsetMin = t.offsetMin;
t.offsetMin = new Vector2(t.offsetMin.x, -t.offsetMax.y);
t.offsetMax = new Vector2(t.offsetMax.x, -oldOffsetMin.y);
t.localScale = new Vector3(t.localScale.x, -t.localScale.y, t.localScale.z);
}
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b896154a8dbdc524092e78923478d27a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: