mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-09 19:25:10 +00:00
Editor stuff
This commit is contained in:
parent
ee42be75e0
commit
032777e36f
458 changed files with 37611 additions and 15 deletions
8
Assets/Plugins/com.unity.uiextensions.meta
Normal file
8
Assets/Plugins/com.unity.uiextensions.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 450fd99bb24cb1648938099cfa8efc00
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
78
Assets/Plugins/com.unity.uiextensions/CHANGELOG.md
Normal file
78
Assets/Plugins/com.unity.uiextensions/CHANGELOG.md
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
||||
|
||||
## 2019.6 - 2.5 - Bug squash - 2021/05/10
|
||||
|
||||
Its been a while since the last update and although Unity keeps changing, thankfully the parts underneath do not. THanks to some awesome work by our contributors and the test teams, we made a run on some underlying bugs and issues. If you spot anything else, please log it on the BitBucket site for resolution.
|
||||
|
||||
> Be sure to logon to the new [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project, if you have any questions, queries or suggestions
|
||||
>
|
||||
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||
>
|
||||
> ## [UIExtensions Gitter Channel](https://gitter.im/Unity-UI-Extensions/Lobby)
|
||||
|
||||
|
||||
### Added
|
||||
|
||||
Nothing new this time, bugfix release.
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated UI Line connector to use relative position instead of anchored position to verify if the Lines need updating.
|
||||
- Allow menu prefabs to not have to have canvas components. This allows you to use any type of prefab as a "menu". Adam Kapos mentions the concept on the Unite talk, https://youtu.be/wbmjturGbAQ?t=1654
|
||||
- Updated segment line drawing for Line Lists. Seems Unity no longer needs UV's to be wrapped manually.
|
||||
- Updated the AutoCompleteComboBox to display text as entered (instead of all lowercase)
|
||||
- Updated the ComboBox to display text as entered (instead of all lowercase)
|
||||
- Updated ComboBox Examples to include programmatic versions
|
||||
- Further ComboBox improvements including:
|
||||
* Upwards panel
|
||||
* Start fixes
|
||||
* Item Template resize
|
||||
* Disabled sorting on combobox as it wasn't working
|
||||
* Disabled Slider handle when not in use
|
||||
* Updated Example
|
||||
- Updated the new Input system switch and tested against 2021
|
||||
|
||||
### Deprecated
|
||||
|
||||
None
|
||||
|
||||
### Fixed
|
||||
|
||||
- Reordering issue resolved with ScrollRectOcclusion.
|
||||
- Fixed Sorting at min and max positions for ScrollRect
|
||||
- Updated ScrollToSelect script provided by zero3growlithe, tested and vastly reduces the previous jitter. Still present but barely noticeable now.
|
||||
- Fixed Issue # 363 Update Combobox control that takes multiple items programmatically, to only allow distinct items
|
||||
- Fixed the issues where dragging outside the range slider handle causes the range to update. - Resolves #369
|
||||
- Resolves an issue with Unity putting the previous controls vertex array in an uninitialised control.
|
||||
- Applied J.R. Mitchell's fix for the Accordion Controls/Accordion/AccordionElement.cs - resolves: #364
|
||||
- Resolved issue where the Content Scroll snap issue with only 1 child. Resolves #362
|
||||
- Updated the PaginationManager to override if the ScrollSnap is in motion.
|
||||
|
||||
### Removed
|
||||
|
||||
None
|
||||
|
||||
### Additional Notes
|
||||
|
||||
#### [Installation Instructions](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/GettingStarted)
|
||||
|
||||
As of Unity 2019, there are now two paths for getting access to the Unity UI Extensions project:
|
||||
|
||||
- Unity 2019 or higher
|
||||
The recommended way to add the Unity UI Extensions project to your solution is to use the Unity package Manager. Simply use the Unity Package Manager to reference the project to install it
|
||||
|
||||
Alternatively, you can also use the pre-compiled Unity packages if you wish, however, UPM offers full versioning support to allow you to switch versions as you wish.
|
||||
|
||||
- Unity 2018 or lower
|
||||
The pre-compiled Unity assets are the only solution for Unity 2018 or earlier due to the changes in the Unity UI framework in Unity made for 2019.
|
||||
Either clone / download this repository to your machine and then copy the scripts in, or use the pre-packaged .UnityPackage for your version of Unity and import it as a custom package in to your project.
|
||||
|
||||
#### Upgrade Notes
|
||||
|
||||
Due to the restructure of the package to meet Unity's new package guidelines, we recommend **Deleting the current Unity UI Extensions** folder prior to importing the new package.
|
||||
|
||||
For Unity 2019 users using the new UPM deployment, be sure to delete the existing folder in your assets folder before adding the new package to avoid conflict.
|
7
Assets/Plugins/com.unity.uiextensions/CHANGELOG.md.meta
Normal file
7
Assets/Plugins/com.unity.uiextensions/CHANGELOG.md.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 03470ebba317a0549a5582f18f4d2383
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Assets/Plugins/com.unity.uiextensions/Editor.meta
Normal file
9
Assets/Plugins/com.unity.uiextensions/Editor.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b95396d565a2a7f478b12f8b9648ed8f
|
||||
folderAsset: yes
|
||||
timeCreated: 1467468503
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8882b502b0c65b24ba4623d6a383815b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4ef6a0d3c3259384982ae3974fe7e618
|
||||
timeCreated: 1492258093
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8701e045b26e51f4eb345f2ccb3c13f5
|
||||
timeCreated: 1426804458
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 40e01e4fb1e006b46a0f127c8a9907b3
|
||||
timeCreated: 1485671367
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
187
Assets/Plugins/com.unity.uiextensions/Editor/CUIGraphicEditor.cs
Normal file
187
Assets/Plugins/com.unity.uiextensions/Editor/CUIGraphicEditor.cs
Normal 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 CUI");
|
||||
Undo.RecordObject(script.RefCurves[0], "Reference CUI");
|
||||
Undo.RecordObject(script.RefCurves[1], "Reference CUI");
|
||||
EditorUtility.SetDirty(script);
|
||||
|
||||
script.ReferenceCUIForBCurves();
|
||||
|
||||
script.Refresh();
|
||||
}
|
||||
|
||||
EditorGUILayout.HelpBox("Auto set the curves' control points by referencing 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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b7b84624f1ba7bd49b6cfc63b25f4b7c
|
||||
timeCreated: 1485671367
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8445204f2ee16e0408274b8400deef53
|
||||
timeCreated: 1485929052
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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 { }
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 041976c43b8439747a030b45a4712b77
|
||||
timeCreated: 1485929052
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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 simonDarksideJ - 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 deactivate
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f60a419e63d329f43ba1bf57e98b34bf
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,28 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityEngine.UI.Extensions.ColorPicker
|
||||
{
|
||||
[CustomEditor(typeof(ColorPickerPresets))]
|
||||
public class ColorPickerPresetsEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
var colorPickerPresets = (ColorPickerPresets)target;
|
||||
if (colorPickerPresets.saveMode != ColorPickerPresets.SaveType.JsonFile)
|
||||
return;
|
||||
|
||||
string fileLocation = colorPickerPresets.JsonFilePath;
|
||||
|
||||
if (!System.IO.File.Exists(fileLocation))
|
||||
return;
|
||||
|
||||
if (GUILayout.Button("Open JSON file."))
|
||||
{
|
||||
Application.OpenURL(fileLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0dc729b738fb01043ac4c04b78575a98
|
||||
timeCreated: 1520733906
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 77a80d348c62e93459753f8e704f474d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,158 @@
|
|||
/// Credit setchi (https://github.com/setchi)
|
||||
/// Sourced from - https://github.com/setchi/FancyScrollView
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.AnimatedValues;
|
||||
|
||||
// For maintenance, every new [SerializeField] variable in Scroller must be declared here
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[CustomEditor(typeof(Scroller))]
|
||||
[CanEditMultipleObjects]
|
||||
public class ScrollerEditor : Editor
|
||||
{
|
||||
SerializedProperty viewport;
|
||||
SerializedProperty scrollDirection;
|
||||
SerializedProperty movementType;
|
||||
SerializedProperty elasticity;
|
||||
SerializedProperty scrollSensitivity;
|
||||
SerializedProperty inertia;
|
||||
SerializedProperty decelerationRate;
|
||||
SerializedProperty snap;
|
||||
SerializedProperty snapEnable;
|
||||
SerializedProperty snapVelocityThreshold;
|
||||
SerializedProperty snapDuration;
|
||||
SerializedProperty snapEasing;
|
||||
SerializedProperty draggable;
|
||||
SerializedProperty scrollbar;
|
||||
|
||||
AnimBool showElasticity;
|
||||
AnimBool showInertiaRelatedValues;
|
||||
AnimBool showSnapEnableRelatedValues;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
viewport = serializedObject.FindProperty("viewport");
|
||||
scrollDirection = serializedObject.FindProperty("scrollDirection");
|
||||
movementType = serializedObject.FindProperty("movementType");
|
||||
elasticity = serializedObject.FindProperty("elasticity");
|
||||
scrollSensitivity = serializedObject.FindProperty("scrollSensitivity");
|
||||
inertia = serializedObject.FindProperty("inertia");
|
||||
decelerationRate = serializedObject.FindProperty("decelerationRate");
|
||||
snap = serializedObject.FindProperty("snap");
|
||||
snapEnable = serializedObject.FindProperty("snap.Enable");
|
||||
snapVelocityThreshold = serializedObject.FindProperty("snap.VelocityThreshold");
|
||||
snapDuration = serializedObject.FindProperty("snap.Duration");
|
||||
snapEasing = serializedObject.FindProperty("snap.Easing");
|
||||
draggable = serializedObject.FindProperty("draggable");
|
||||
scrollbar = serializedObject.FindProperty("scrollbar");
|
||||
|
||||
showElasticity = new AnimBool(Repaint);
|
||||
showInertiaRelatedValues = new AnimBool(Repaint);
|
||||
showSnapEnableRelatedValues = new AnimBool(Repaint);
|
||||
SetAnimBools(true);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
showElasticity.valueChanged.RemoveListener(Repaint);
|
||||
showInertiaRelatedValues.valueChanged.RemoveListener(Repaint);
|
||||
showSnapEnableRelatedValues.valueChanged.RemoveListener(Repaint);
|
||||
}
|
||||
|
||||
void SetAnimBools(bool instant)
|
||||
{
|
||||
SetAnimBool(showElasticity, !movementType.hasMultipleDifferentValues && movementType.enumValueIndex == (int)MovementType.Elastic, instant);
|
||||
SetAnimBool(showInertiaRelatedValues, !inertia.hasMultipleDifferentValues && inertia.boolValue, instant);
|
||||
SetAnimBool(showSnapEnableRelatedValues, !snapEnable.hasMultipleDifferentValues && snapEnable.boolValue, instant);
|
||||
}
|
||||
|
||||
void SetAnimBool(AnimBool a, bool value, bool instant)
|
||||
{
|
||||
if (instant)
|
||||
{
|
||||
a.value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
a.target = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
SetAnimBools(false);
|
||||
|
||||
serializedObject.Update();
|
||||
EditorGUILayout.PropertyField(viewport);
|
||||
EditorGUILayout.PropertyField(scrollDirection);
|
||||
EditorGUILayout.PropertyField(movementType);
|
||||
DrawMovementTypeRelatedValue();
|
||||
EditorGUILayout.PropertyField(scrollSensitivity);
|
||||
EditorGUILayout.PropertyField(inertia);
|
||||
DrawInertiaRelatedValues();
|
||||
EditorGUILayout.PropertyField(draggable);
|
||||
EditorGUILayout.PropertyField(scrollbar);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
void DrawMovementTypeRelatedValue()
|
||||
{
|
||||
using (var group = new EditorGUILayout.FadeGroupScope(showElasticity.faded))
|
||||
{
|
||||
if (!group.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using (new EditorGUI.IndentLevelScope())
|
||||
{
|
||||
EditorGUILayout.PropertyField(elasticity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawInertiaRelatedValues()
|
||||
{
|
||||
using (var group = new EditorGUILayout.FadeGroupScope(showInertiaRelatedValues.faded))
|
||||
{
|
||||
if (!group.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using (new EditorGUI.IndentLevelScope())
|
||||
{
|
||||
EditorGUILayout.PropertyField(decelerationRate);
|
||||
EditorGUILayout.PropertyField(snap);
|
||||
|
||||
using (new EditorGUI.IndentLevelScope())
|
||||
{
|
||||
DrawSnapRelatedValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSnapRelatedValues()
|
||||
{
|
||||
if (snap.isExpanded)
|
||||
{
|
||||
EditorGUILayout.PropertyField(snapEnable);
|
||||
|
||||
using (var group = new EditorGUILayout.FadeGroupScope(showSnapEnableRelatedValues.faded))
|
||||
{
|
||||
if (!group.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(snapVelocityThreshold);
|
||||
EditorGUILayout.PropertyField(snapDuration);
|
||||
EditorGUILayout.PropertyField(snapEasing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e82bfdd42ec254849830933cbaf350fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ee2802949feca4c4c934331b6a0dc379
|
||||
timeCreated: 1483566748
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,123 @@
|
|||
/// Credit Ben MacKinnon @Dover8
|
||||
/// Sourced from - https://github.com/Dover8/Unity-UI-Extensions/tree/range-slider
|
||||
/// Usage: Extension of the standard slider. Two handles determine a low and high value between a Min and Max.
|
||||
/// Raises a UnityEvent passing the low and high values
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[CustomEditor(typeof(RangeSlider), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class RangeSliderEditor : SelectableEditor
|
||||
{
|
||||
SerializedProperty m_LowHandleRect;
|
||||
SerializedProperty m_HighHandleRect;
|
||||
SerializedProperty m_FillRect;
|
||||
|
||||
SerializedProperty m_MinValue;
|
||||
SerializedProperty m_MaxValue;
|
||||
SerializedProperty m_WholeNumbers;
|
||||
|
||||
SerializedProperty m_LowValue;
|
||||
SerializedProperty m_HighValue;
|
||||
|
||||
//need ref values for the editor MinMaxSlider
|
||||
float low = 0;
|
||||
float high = 1;
|
||||
|
||||
SerializedProperty m_OnValueChanged;
|
||||
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_LowHandleRect = serializedObject.FindProperty("m_LowHandleRect");
|
||||
m_HighHandleRect = serializedObject.FindProperty("m_HighHandleRect");
|
||||
m_FillRect = serializedObject.FindProperty("m_FillRect");
|
||||
|
||||
m_MinValue = serializedObject.FindProperty("m_MinValue");
|
||||
m_MaxValue = serializedObject.FindProperty("m_MaxValue");
|
||||
m_WholeNumbers = serializedObject.FindProperty("m_WholeNumbers");
|
||||
|
||||
m_LowValue = serializedObject.FindProperty("m_LowValue");
|
||||
low = m_LowValue.floatValue;
|
||||
m_HighValue = serializedObject.FindProperty("m_HighValue");
|
||||
high = m_HighValue.floatValue;
|
||||
|
||||
m_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
serializedObject.Update();
|
||||
//grab the updated value affected by m_WholeNumbers
|
||||
low = m_LowValue.floatValue;
|
||||
high = m_HighValue.floatValue;
|
||||
|
||||
EditorGUILayout.PropertyField(m_LowHandleRect);
|
||||
EditorGUILayout.PropertyField(m_HighHandleRect);
|
||||
EditorGUILayout.PropertyField(m_FillRect);
|
||||
|
||||
if (m_LowHandleRect.objectReferenceValue != null && m_HighHandleRect.objectReferenceValue != null)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.PropertyField(m_MinValue);
|
||||
EditorGUILayout.PropertyField(m_MaxValue);
|
||||
EditorGUILayout.PropertyField(m_WholeNumbers);
|
||||
|
||||
//We're going to do a fair bit of layout here
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
//Low Label and value
|
||||
EditorGUILayout.BeginVertical();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("Low");
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
low = EditorGUILayout.DelayedFloatField(low, GUILayout.MaxWidth(100));
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
//Slider
|
||||
EditorGUILayout.BeginVertical();
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.MinMaxSlider(ref low, ref high, m_MinValue.floatValue, m_MaxValue.floatValue, GUILayout.ExpandWidth(true));
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
//High label and value
|
||||
EditorGUILayout.BeginVertical();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("High");
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
high = EditorGUILayout.DelayedFloatField(high, GUILayout.MaxWidth(100));
|
||||
EditorGUILayout.EndVertical();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
m_LowValue.floatValue = low;
|
||||
m_HighValue.floatValue = high;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.PropertyField(m_OnValueChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox("Specify a RectTransform for the RangeSlider fill or the RangeSlider handles or both. Each must have a parent RectTransform that it can slide within.", MessageType.Info);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ac33445ed95315743983e4b657921146
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 33c90f5149877a242981372f6cde9a35
|
||||
timeCreated: 1498392707
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,85 @@
|
|||
/// Credit setchi (https://github.com/setchi)
|
||||
/// Sourced from - https://github.com/setchi/FancyScrollView
|
||||
|
||||
// For maintenance, every new [SerializeField] variable in ScrollPositionController must be declared here
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[CustomEditor(typeof(ScrollPositionController))]
|
||||
[CanEditMultipleObjects]
|
||||
public class ScrollPositionControllerEditor : Editor
|
||||
{
|
||||
SerializedProperty viewport;
|
||||
SerializedProperty directionOfRecognize;
|
||||
SerializedProperty movementType;
|
||||
SerializedProperty elasticity;
|
||||
SerializedProperty scrollSensitivity;
|
||||
SerializedProperty inertia;
|
||||
SerializedProperty decelerationRate;
|
||||
SerializedProperty snap;
|
||||
SerializedProperty snapEnable;
|
||||
SerializedProperty snapVelocityThreshold;
|
||||
SerializedProperty snapDuration;
|
||||
SerializedProperty dataCount;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
viewport = serializedObject.FindProperty("viewport");
|
||||
directionOfRecognize = serializedObject.FindProperty("directionOfRecognize");
|
||||
movementType = serializedObject.FindProperty("movementType");
|
||||
elasticity = serializedObject.FindProperty("elasticity");
|
||||
scrollSensitivity = serializedObject.FindProperty("scrollSensitivity");
|
||||
inertia = serializedObject.FindProperty("inertia");
|
||||
decelerationRate = serializedObject.FindProperty("decelerationRate");
|
||||
snap = serializedObject.FindProperty("snap");
|
||||
snapEnable = serializedObject.FindProperty("snap.Enable");
|
||||
snapVelocityThreshold = serializedObject.FindProperty("snap.VelocityThreshold");
|
||||
snapDuration = serializedObject.FindProperty("snap.Duration");
|
||||
dataCount = serializedObject.FindProperty("dataCount");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
EditorGUILayout.PropertyField(viewport);
|
||||
EditorGUILayout.PropertyField(directionOfRecognize);
|
||||
EditorGUILayout.PropertyField(movementType);
|
||||
EditorGUILayout.PropertyField(elasticity);
|
||||
EditorGUILayout.PropertyField(scrollSensitivity);
|
||||
EditorGUILayout.PropertyField(inertia);
|
||||
DrawInertiaRelatedValues();
|
||||
EditorGUILayout.PropertyField(dataCount);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
void DrawInertiaRelatedValues()
|
||||
{
|
||||
if (inertia.boolValue)
|
||||
{
|
||||
EditorGUILayout.PropertyField(decelerationRate);
|
||||
EditorGUILayout.PropertyField(snap);
|
||||
|
||||
using (new EditorGUI.IndentLevelScope())
|
||||
{
|
||||
DrawSnapRelatedValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSnapRelatedValues()
|
||||
{
|
||||
if (snap.isExpanded)
|
||||
{
|
||||
EditorGUILayout.PropertyField(snapEnable);
|
||||
|
||||
if (snapEnable.boolValue)
|
||||
{
|
||||
EditorGUILayout.PropertyField(snapVelocityThreshold);
|
||||
EditorGUILayout.PropertyField(snapDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 986fda6476737da458576709b7f59ea3
|
||||
timeCreated: 1508699683
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5fe8e67609bbee14d8ad0805aac72799
|
||||
timeCreated: 1468515486
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Play-Em
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
|
||||
public class TextPicIconEditor : EditorWindow {
|
||||
[MenuItem("Window/UI/Extensions/TextPic Edit Icons")]
|
||||
protected static void ShowTextPicIconEditor() {
|
||||
var wnd = GetWindow<TextPicIconEditor>();
|
||||
wnd.titleContent.text = "Edit Icons in TextPic";
|
||||
wnd.Show();
|
||||
}
|
||||
|
||||
private GameObject o;
|
||||
|
||||
private static int columnWidth = 300;
|
||||
|
||||
private string iconName;
|
||||
private Sprite icon;
|
||||
|
||||
public void Swap(GameObject o) {
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log("Editing icons for " + o.name);
|
||||
|
||||
|
||||
TextPic[] children = o.GetComponentsInChildren<TextPic>(true);
|
||||
for(int i = 0; i < children.Length; i++) {
|
||||
if (children[i] != null) {
|
||||
for (int j = 0; j < children[i].inspectorIconList.Length; j++) {
|
||||
if (!string.IsNullOrEmpty(iconName)
|
||||
&& children[i].inspectorIconList[j].name == iconName) {
|
||||
children[i].inspectorIconList[j].sprite = icon;
|
||||
Debug.Log("Swapped icon for " + children[i].inspectorIconList[j].name);
|
||||
}
|
||||
}
|
||||
children[i].ResetIconList();
|
||||
|
||||
Debug.Log("Swapped icons for " + children[i].name);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OnGUI() {
|
||||
GUILayout.Label("Select a GameObject to edit TextPic icons", EditorStyles.boldLabel);
|
||||
EditorGUILayout.Separator();
|
||||
GUILayout.Label("GameObject", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
if (Selection.activeGameObject != null) {
|
||||
o = Selection.activeGameObject;
|
||||
}
|
||||
EditorGUILayout.ObjectField(o, typeof(GameObject), true);
|
||||
EditorGUI.EndChangeCheck();
|
||||
|
||||
if (o != null) {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label("Icon Name:", GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
iconName = EditorGUILayout.TextField(iconName, GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label("New Sprite:", GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
icon = (Sprite)EditorGUILayout.ObjectField(icon, typeof(Sprite), false, GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Edit Icons")) {
|
||||
#if UNITY_EDITOR
|
||||
Swap(o);
|
||||
#endif
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0fdbc2ef7cc4e73418bc4e2d9cb1ad87
|
||||
timeCreated: 1516447031
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Play-Em
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
|
||||
public class TextPicIconListCopier : EditorWindow {
|
||||
[MenuItem("Window/UI/Extensions/TextPic Copy Icon Lists")]
|
||||
protected static void ShowTextPicIconListCopier() {
|
||||
var wnd = GetWindow<TextPicIconListCopier>();
|
||||
wnd.titleContent.text = "Copy Icons in TextPic";
|
||||
wnd.Show();
|
||||
}
|
||||
|
||||
private List<TextPic> textPicList = new List<TextPic>();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void OnSelectionChange() {
|
||||
if (Selection.objects.Length > 1 )
|
||||
{
|
||||
Debug.Log ("Length? " + Selection.objects.Length);
|
||||
textPicList.Clear();
|
||||
|
||||
foreach ( Object o in Selection.objects ) {
|
||||
if ( o is GameObject ) {
|
||||
TextPic tp = ((GameObject)o).GetComponent<TextPic>();
|
||||
if (tp != null) {
|
||||
textPicList.Add(tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Selection.activeObject is GameObject) {
|
||||
textPicList.Clear();
|
||||
TextPic tp = ((GameObject)Selection.activeObject).GetComponent<TextPic>();
|
||||
if (tp != null) {
|
||||
textPicList.Add(tp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
textPicList.Clear();
|
||||
}
|
||||
|
||||
this.Repaint();
|
||||
}
|
||||
#endif
|
||||
|
||||
private static int columnWidth = 300;
|
||||
|
||||
private TextPic textPic;
|
||||
|
||||
public void Copy() {
|
||||
#if UNITY_EDITOR
|
||||
foreach(TextPic tp in textPicList) {
|
||||
if (tp != null) {
|
||||
tp.inspectorIconList = new TextPic.IconName[textPic.inspectorIconList.Length];
|
||||
textPic.inspectorIconList.CopyTo(tp.inspectorIconList, 0);
|
||||
|
||||
tp.ResetIconList();
|
||||
|
||||
Debug.Log("Copied icons to " + tp.name);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OnGUI() {
|
||||
GUILayout.Label("TextPic to copy icons", EditorStyles.boldLabel);
|
||||
EditorGUILayout.Separator();
|
||||
GUILayout.Label("TextPic", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
textPic = EditorGUILayout.ObjectField(textPic, typeof(TextPic), true) as TextPic;
|
||||
EditorGUI.EndChangeCheck();
|
||||
|
||||
if (textPicList.Count > 0) {
|
||||
if ( textPicList.Count == 1 )
|
||||
{
|
||||
textPicList[0] = ((TextPic)EditorGUILayout.ObjectField(
|
||||
textPicList[0],
|
||||
typeof(TextPic),
|
||||
true,
|
||||
GUILayout.Width(columnWidth))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("Multiple TextPic: " + textPicList.Count, GUILayout.Width(columnWidth));
|
||||
}
|
||||
|
||||
if (textPic != null) {
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Copy Icons")) {
|
||||
#if UNITY_EDITOR
|
||||
Copy();
|
||||
#endif
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
else {
|
||||
GUILayout.Label("Please select objects that have a TextPic component", EditorStyles.boldLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2f19005a68a7c044fb9390ab44d42b41
|
||||
timeCreated: 1516447031
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Play-Em
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
|
||||
public class TextPicRenameEditor : EditorWindow {
|
||||
[MenuItem("Window/UI/Extensions/TextPic Rename Icons and Text")]
|
||||
protected static void ShowTextPicRenameEditor() {
|
||||
var wnd = GetWindow<TextPicRenameEditor>();
|
||||
wnd.titleContent.text = "Rename Icon List";
|
||||
wnd.Show();
|
||||
}
|
||||
|
||||
private GameObject o;
|
||||
|
||||
private static int columnWidth = 300;
|
||||
|
||||
private string prefix;
|
||||
private string suffix;
|
||||
private string originalText;
|
||||
private string replacementText;
|
||||
|
||||
public void Rename(GameObject o) {
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log("Changing icons and text for " + o.name);
|
||||
|
||||
|
||||
TextPic[] children = o.GetComponentsInChildren<TextPic>(true);
|
||||
for(int i = 0; i < children.Length; i++) {
|
||||
if (children[i] != null) {
|
||||
for (int j = 0; j < children[i].inspectorIconList.Length; j++) {
|
||||
if (!string.IsNullOrEmpty(originalText)
|
||||
&& children[i].inspectorIconList[j].name.Contains(originalText)) {
|
||||
children[i].text.Replace(originalText, replacementText);
|
||||
children[i].inspectorIconList[j].name = children[i].inspectorIconList[j].name.Replace(originalText, replacementText);
|
||||
Debug.Log("Renamed icon for " + children[i].inspectorIconList[j].name);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(prefix)
|
||||
&& !string.IsNullOrEmpty(suffix)
|
||||
&& !children[i].inspectorIconList[j].name.StartsWith(prefix)
|
||||
&& !children[i].inspectorIconList[j].name.EndsWith(suffix)) {
|
||||
children[i].text.Replace(children[i].inspectorIconList[j].name, prefix + children[i].inspectorIconList[j].name + suffix);
|
||||
children[i].inspectorIconList[j].name = prefix + children[i].inspectorIconList[j].name + suffix;
|
||||
Debug.Log("Renamed icon for " + children[i].inspectorIconList[j].name);
|
||||
}
|
||||
}
|
||||
children[i].ResetIconList();
|
||||
|
||||
Debug.Log("Renamed icons for " + children[i].name);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OnGUI() {
|
||||
GUILayout.Label("Select a GameObject to rename TextPic icons and text", EditorStyles.boldLabel);
|
||||
EditorGUILayout.Separator();
|
||||
GUILayout.Label("GameObject", EditorStyles.boldLabel);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
if (Selection.activeGameObject != null) {
|
||||
o = Selection.activeGameObject;
|
||||
}
|
||||
EditorGUILayout.ObjectField(o, typeof(GameObject), true);
|
||||
EditorGUI.EndChangeCheck();
|
||||
|
||||
if (o != null) {
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label("Prefix:", GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
prefix = EditorGUILayout.TextField(prefix, GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label("Original Text:", GUILayout.Width(columnWidth));
|
||||
|
||||
GUILayout.Label("Replacement Text:", GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
originalText = EditorGUILayout.TextField(originalText, GUILayout.Width(columnWidth));
|
||||
|
||||
replacementText = EditorGUILayout.TextField(replacementText, GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Suffix:", GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
suffix = EditorGUILayout.TextField(suffix, GUILayout.Width(columnWidth));
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Rename Icons and Text")) {
|
||||
#if UNITY_EDITOR
|
||||
Rename(o);
|
||||
#endif
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6d2906bebe2d6024ba79f17fb908387f
|
||||
timeCreated: 1516447032
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3cac6d35505037446b512aea22d40688
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
135
Assets/Plugins/com.unity.uiextensions/Editor/uGUITools.cs
Normal file
135
Assets/Plugins/com.unity.uiextensions/Editor/uGUITools.cs
Normal file
|
@ -0,0 +1,135 @@
|
|||
/// 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()
|
||||
{
|
||||
if (Selection.transforms == null || Selection.transforms.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Undo.IncrementCurrentGroup();
|
||||
Undo.SetCurrentGroupName("AnchorsToCorners");
|
||||
var undoGroup = Undo.GetCurrentGroup();
|
||||
|
||||
foreach (Transform transform in Selection.transforms)
|
||||
{
|
||||
RectTransform t = transform as RectTransform;
|
||||
Undo.RecordObject( t, "AnchorsToCorners" );
|
||||
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);
|
||||
}
|
||||
Undo.CollapseUndoOperations(undoGroup);
|
||||
}
|
||||
|
||||
[MenuItem("uGUI/Corners to Anchors %]")]
|
||||
static void CornersToAnchors()
|
||||
{
|
||||
if (Selection.transforms == null || Selection.transforms.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Undo.IncrementCurrentGroup();
|
||||
Undo.SetCurrentGroupName("CornersToAnchors");
|
||||
var undoGroup = Undo.GetCurrentGroup();
|
||||
|
||||
foreach (Transform transform in Selection.transforms)
|
||||
{
|
||||
RectTransform t = transform as RectTransform;
|
||||
Undo.RecordObject( t, "CornersToAnchors" );
|
||||
|
||||
if (t == null) return;
|
||||
|
||||
t.offsetMin = t.offsetMax = new Vector2(0, 0);
|
||||
}
|
||||
Undo.CollapseUndoOperations(undoGroup);
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b896154a8dbdc524092e78923478d27a
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
22
Assets/Plugins/com.unity.uiextensions/LICENSE.md
Normal file
22
Assets/Plugins/com.unity.uiextensions/LICENSE.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Unity UI Extensions License (BSD3)
|
||||
|
||||
Copyright (c) 2019
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
7
Assets/Plugins/com.unity.uiextensions/LICENSE.md.meta
Normal file
7
Assets/Plugins/com.unity.uiextensions/LICENSE.md.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 85fbb9f9f8b4fa3439349b9c4c495006
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
229
Assets/Plugins/com.unity.uiextensions/README.md
Normal file
229
Assets/Plugins/com.unity.uiextensions/README.md
Normal file
|
@ -0,0 +1,229 @@
|
|||
# Unity UI Extensions README
|
||||
|
||||
This is an extension project for the new Unity UI system which can be found at: [Unity UI Source](https://bitbucket.org/Unity-Technologies/ui)
|
||||
|
||||
> [Check out the control demos on our Tumblr page](https://unityuiextensions.tumblr.com/)
|
||||
|
||||
## [Intro](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/GettingStarted)
|
||||
|
||||
For more info, here's a little introduction video for the project:
|
||||
|
||||
[![View Intro Video](http://img.youtube.com/vi/njoIeE4akq0/0.jpg)](http://www.youtube.com/watch?v=njoIeE4akq0 "Unity UI Extensions intro video")
|
||||
|
||||
You can follow the UI Extensions team for updates and news on:
|
||||
|
||||
### [Twitter](https://twitter.com/hashtag/UnityUIExtensions?src=hash) / [Facebook](https://www.facebook.com/UnityUIExtensions/) / [YouTube](https://www.youtube.com/channel/UCG3gZOkmL-2rmZat4ufv28Q)
|
||||
|
||||
> ## Chat live with the Unity UI Extensions community on Gitter here:
|
||||
>
|
||||
> ## [UI Extensions Live Chat](https://gitter.im/Unity-UI-Extensions/Lobby)
|
||||
|
||||
-----
|
||||
|
||||
## [What is this repository for?](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/About)
|
||||
|
||||
In this repository is a collection of extension scripts / effects and controls to enhance your Unity UI experience. These scripts have been gathered from many sources, combined and improved over time.
|
||||
|
||||
> The majority of the scripts came from the Scripts thread on the [Unity UI forum here](http://bit.ly/UnityUIScriptsForumPost)
|
||||
|
||||
You can either download / fork this project to access the scripts, or you can also download these pre-compiled Unity Assets, chock full of goodness for each release:
|
||||
|
||||
## [Download - 2019.5 (aka 2.3)](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Downloads)
|
||||
|
||||
We have expanded where you can download the UnityPackage asset and widened the options to contribute to the project.
|
||||
|
||||
> I will still stress however, ***contribution is optional***. **The assets / code will always remain FREE**
|
||||
|
||||
| [![Download from Itch.IO](https://bytebucket.org/UnityUIExtensions/unity-ui-extensions/wiki/SiteImages/itchio.png)](https://unityuiextensions.itch.io/uiextensions2-0 "Download from Itch.IO") | [![Download from Itch.IO](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/SiteImages/unionassets.png)](https://unionassets.com/unity-ui-extensions "Download from Union Assets") | [![Download from Itch.IO](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/SiteImages/patreon.jpg)](https://www.patreon.com/UnityUIExtensions "Support Unity UI Extensions on Patreon & download")|
|
||||
| :--- | :--- | :--- |
|
||||
| [Grab from Itchio](https://unityuiextensions.itch.io/uiextensions2-0) | [Obtain via Union Assets](https://unionassets.com/unity-ui-extensions) |[Support through Patreon](https://www.patreon.com/UnityUIExtensions) |
|
||||
|
||||
> Still available to download on the [BitBucket site](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/downloads) if you prefer
|
||||
|
||||
To view previous releases, visit the [release archive](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Downloads)
|
||||
|
||||
-----
|
||||
|
||||
## [Supporting the UI Extensions project](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=89L8T9N6BR7LJ)
|
||||
|
||||
If you wish to further support the Unity UI Extensions project itself, then you can either subsidize your downloads above, or using the links below.
|
||||
|
||||
All funds go to support the project, no matter the amount. **Donations in code are also extremely welcome**
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| [![Donate via PayPal](https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-150px.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=89L8T9N6BR7LJ "Donating via Paypal") | [![Buy us a Coffee](https://uploads-ssl.webflow.com/5c14e387dab576fe667689cf/5cbed8a4ae2b88347c06c923_BuyMeACoffee_blue-p-500.png)](https://ko-fi.com/uiextensions "Buy us a Coffee") |
|
||||
|
||||
> (PayPal account not required and you can remain anonymous if you wish)
|
||||
|
||||
-----
|
||||
|
||||
## [Getting Started](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/GettingStarted)
|
||||
|
||||
To get started with the project, here's a little guide:
|
||||
|
||||
[![View Getting Started Video](http://img.youtube.com/vi/sVLeYmsNQAI/0.jpg)](http://www.youtube.com/watch?v=sVLeYmsNQAI "Unity UI getting started video")
|
||||
|
||||
-----
|
||||
|
||||
## [Updates:](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/ReleaseNotes/RELEASENOTES)
|
||||
|
||||
## Maintenance release 2019.6 - 2.5 - Bug squash
|
||||
|
||||
Its been a while since the last update and although Unity keeps changing, thankfully the parts underneath do not. THanks to some awesome work by our contributors and the test teams, we made a run on some underlying bugs and issues. If you spot anything else, please log it on the BitBucket site for resolution.
|
||||
|
||||
Be sure to also check out the "Examples" option in the Package Manager window to import the samples to your project.
|
||||
|
||||
> Be sure to logon to the new [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project, if you have any questions, queries or suggestions
|
||||
>
|
||||
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||
>
|
||||
> ## [UIExtensions Gitter Channel](https://gitter.im/Unity-UI-Extensions/Lobby)
|
||||
|
||||
### New / updated features
|
||||
|
||||
- Updated UI Line connector to use relative position instead of anchored position to verify if the Lines need updating.
|
||||
- Allow menu prefabs to not have to have canvas components. This allows you to use any type of prefab as a "menu". Adam Kapos mentions the concept on the Unite talk, https://youtu.be/wbmjturGbAQ?t=1654
|
||||
- Updated segment line drawing for Line Lists. Seems Unity no longer needs UV's to be wrapped manually.
|
||||
- Updated the AutoCompleteComboBox to display text as entered (instead of all lowercase)
|
||||
- Updated the ComboBox to display text as entered (instead of all lowercase)
|
||||
- Updated ComboBox Examples to include programmatic versions
|
||||
- Further ComboBox improvements including:
|
||||
* Upwards panel
|
||||
* Start fixes
|
||||
* Item Template resize
|
||||
* Disabled sorting on combobox as it wasn't working
|
||||
* Disabled Slider handle when not in use
|
||||
* Updated Example
|
||||
- Updated the new Input system switch and tested against 2021
|
||||
|
||||
### Examples / Examples / Examples
|
||||
|
||||
Examples can be found either in the UPM package manager window or via the extra downloadable UnityAsset from the Bitbucket site - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Downloads
|
||||
|
||||
### Fixes
|
||||
|
||||
- Reordering issue resolved with ScrollRectOcclusion.
|
||||
- Fixed Sorting at min and max positions for ScrollRect
|
||||
- Updated ScrollToSelect script provided by zero3growlithe, tested and vastly reduces the previous jitter. Still present but barely noticeable now.
|
||||
- Fixed Issue # 363 Update Combobox control that takes multiple items programmatically, to only allow distinct items
|
||||
- Fixed the issues where dragging outside the range slider handle causes the range to update. - Resolves #369
|
||||
- Resolves an issue with Unity putting the previous controls vertex array in an uninitialised control.
|
||||
- Applied J.R. Mitchell's fix for the Accordion Controls/Accordion/AccordionElement.cs - resolves: #364
|
||||
- Resolved issue where the Content Scroll snap issue with only 1 child. Resolves #362
|
||||
- Updated the PaginationManager to override if the ScrollSnap is in motion.
|
||||
|
||||
### Known issues
|
||||
|
||||
No new issues in this release, but check the issues list for things we are currently working on:
|
||||
|
||||
* [UI Extensions Issue log](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues?status=new&status=open)
|
||||
|
||||
## Upgrade Notes
|
||||
|
||||
We recommend using the UPM delivery method. If you are using the Unity asset, there should be no issues updating but if you have a problem, just deleted the old Unity-UI-Extensions folder and import the asset new.
|
||||
|
||||
-----
|
||||
|
||||
## Release History
|
||||
|
||||
For the full release history, follow the below link to the full release notes page.
|
||||
|
||||
### [Release Notes](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/ReleaseNotes/RELEASENOTES)
|
||||
|
||||
-----
|
||||
|
||||
## [Controls and extensions listed in this project](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls)
|
||||
|
||||
There are almost 70+ extension controls / effect and other utilities in the project which are listed on the following page:
|
||||
|
||||
> ## [Check out the control demos on our Tumblr page](https://www.tumblr.com/blog/unityuiextensions)
|
||||
>
|
||||
> | [![UI Line Renderer](https://bytebucket.org/UnityUIExtensions/unity-ui-extensions/wiki/SiteImages/LineRenderer.gif)](https://www.tumblr.com/blog/unityuiextensions "UI Line Renderer") | [![UI Knob](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/SiteImages/UIKnob.gif)](https://www.tumblr.com/blog/unityuiextensions "UI Knob") | [![ScrollSnap](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/SiteImages/ScrollSnap.gif)](https://www.tumblr.com/blog/unityuiextensions "Scroll Snap")|
|
||||
> | :--- | :--- | :--- |
|
||||
> | [UI Line Renderer](https://www.tumblr.com/blog/unityuiextensions) | [UI Knob](https://www.tumblr.com/blog/unityuiextensions) |[Scroll Snap](https://www.tumblr.com/blog/unityuiextensions) |
|
||||
|
||||
## [UI Extensions controls list](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls)
|
||||
|
||||
[Controls](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls#markdown-header-controls)|||||
|
||||
------|------|------|------|------|
|
||||
Accordion|ColorPicker|Selection Box|UI Flippable|ComboBox
|
||||
AutoComplete ComboBox|DropDown List|BoundToolTip|UIWindowBase|UI Knob
|
||||
TextPic|Input Focus|Box Slider|Cooldown Button|Segmented Control
|
||||
Stepper|Range Slider|Radial Slider|MultiTouch Scroll Rect|
|
||||
||||
|
||||
|
||||
[Primitives](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls#markdown-header-primitives)|||||
|
||||
------|------|------|------|------|
|
||||
UILineRenderer|UILineTextureRenderer|UICircle|DiamondGraph|UICornerCut
|
||||
UIPolygon||||
|
||||
||||
|
||||
|
||||
[Layouts](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls#markdown-header-layouts)|||||
|
||||
------|------|------|------|------|
|
||||
Horizontal Scroll Snap|Vertical Scroll Snap|Flow Layout Group|Radial Layout|Tile Size Fitter
|
||||
Scroll Snap (alt implementation)|Reorderable List|UI Vertical Scroller|Curved Layout|Table Layout
|
||||
FancyScrollView|Card UI|Scroll Position Controller||
|
||||
||||
|
||||
|
||||
[Effects](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls#markdown-header-effect_components)|||||
|
||||
------|------|------|------|------|
|
||||
Best Fit Outline|Curved Text|Gradient|Gradient2|Letter Spacing
|
||||
NicerOutline|RaycastMask|UIFlippable|UIImageCrop|SoftAlphaMask
|
||||
CylinderText|UIParticleSystem|CurlyUI|Shine Effect|Shader Effects
|
||||
||||
|
||||
|
||||
[Additional Components](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Controls#markdown-header-additional_components)|||||
|
||||
------|------|------|------|------|
|
||||
ReturnKeyTrigger|TabNavigation|uGUITools|ScrollRectTweener|ScrollRectLinker
|
||||
ScrollRectEx|UI_InfiniteScroll|UI_ScrollRectOcclusion|UIScrollToSelection|UISelectableExtension
|
||||
switchToRectTransform|ScrollConflictManager|CLFZ2 (Encryption)|DragCorrector|PPIViewer
|
||||
UI_TweenScale|UI_MagneticInfiniteScroll|UI_ScrollRectOcclusion|NonDrawingGraphic|
|
||||
UILineConnector|UIHighlightable|Menu Manager|Pagination Manager|
|
||||
||||
|
||||
|
||||
*More to come*
|
||||
|
||||
-----
|
||||
|
||||
## [How do I get set up?](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/GettingStarted)
|
||||
|
||||
As of Unity 2019, there are now two paths for getting access to the Unity UI Extensions project:
|
||||
|
||||
- Unity 2019 or higher
|
||||
The recommended way to add the Unity UI Extensions project to your solution is to use the Unity package Manager. Simply use the [Unity Package Manager](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/UPMInstallation) to reference the project and install it.
|
||||
|
||||
Alternatively, you can also use the pre-compiled Unity packages if you wish, however, UPM offers full versioning support to allow you to switch versions as you wish.
|
||||
|
||||
- Unity 2018 or lower
|
||||
The pre-compiled Unity assets are the only solution for Unity 2018 or earlier due to the changes in the Unity UI framework in Unity made for 2019.
|
||||
Either clone / download this repository to your machine and then copy the scripts in, or use the pre-packaged .UnityPackage for your version of Unity and import it as a custom package in to your project.
|
||||
|
||||
## [Contribution guidelines](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/ContributionGuidelines)
|
||||
|
||||
Got a script you want added? Then just fork the bitbucket repository and submit a PR. All contributions accepted (including fixes)
|
||||
|
||||
Just ensure:
|
||||
|
||||
* The header of the script should match the standard used in all scripts.
|
||||
* The script uses the **Unity.UI.Extensions** namespace so they do not affect any other developments.
|
||||
* (optional) Add Component and Editor options where possible. (editor options are in the Editor\UIExtensionsMenuOptions.cs file)
|
||||
|
||||
## [License](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/License)
|
||||
|
||||
All scripts conform to the BSD3 license and are free to use / distribute. See the [LICENSE](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/License) file for more information =
|
||||
|
||||
## [Like what you see?](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/FurtherInfo)
|
||||
|
||||
All these scripts were put together for my latest book Unity3D UI Essentials
|
||||
Check out the [page on my blog](http://bit.ly/Unity3DUIEssentials) for more details and learn all about the inner workings of the new Unity UI System.
|
||||
|
||||
## [The downloads](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Downloads)
|
||||
|
||||
As this repo was created to support my new Unity UI Title ["Unity 3D UI Essentials"](http://bit.ly/Unity3DUIEssentials), in the downloads section you will find two custom assets (SpaceShip-DemoScene-Start.unitypackage and RollABallSample-Start.unitypackage). These are just here as starter scenes for doing UI tasks in the book.
|
||||
|
||||
I will add more sample scenes for the UI examples in this repository and detail them above over time.
|
||||
|
||||
## [Previous Releases](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Downloads)
|
||||
|
||||
Please see the [full downloads list](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/wiki/Downloads) for all previous releases and their corresponding download links.
|
7
Assets/Plugins/com.unity.uiextensions/README.md.meta
Normal file
7
Assets/Plugins/com.unity.uiextensions/README.md.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d3d1b86f715775647bde436195bbfaf0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Plugins/com.unity.uiextensions/Runtime.meta
Normal file
8
Assets/Plugins/com.unity.uiextensions/Runtime.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dae773db9d022de4b891928437a0c082
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
10
Assets/Plugins/com.unity.uiextensions/Runtime/Resources.meta
Normal file
10
Assets/Plugins/com.unity.uiextensions/Runtime/Resources.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a7296bad073428c4796089b44a48cab9
|
||||
folderAsset: yes
|
||||
timeCreated: 1521742084
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0873351fdb3a65f43901b3ec088375b0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -0,0 +1,150 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "UI Extensions/SoftMaskShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
|
||||
_Color("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp("Stencil Comparison", Float) = 8
|
||||
_Stencil("Stencil ID", Float) = 0
|
||||
_StencilOp("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask("Color Mask", Float) = 15
|
||||
_AlphaMask("AlphaMask - Must be Wrapped",2D) = "white"{}
|
||||
_CutOff("CutOff",Float) = 0
|
||||
[MaterialToggle]
|
||||
_HardBlend("HardBlend",Float) = 0
|
||||
_FlipAlphaMask("Flip Alpha Mask",int) = 0
|
||||
_NoOuterClip("Outer Clip",int) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent"
|
||||
"IgnoreProjector" = "True"
|
||||
"RenderType" = "Transparent"
|
||||
"PreviewType" = "Plane"
|
||||
"CanUseSpriteAtlas" = "True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref[_Stencil]
|
||||
Comp[_StencilComp]
|
||||
Pass[_StencilOp]
|
||||
ReadMask[_StencilReadMask]
|
||||
WriteMask[_StencilWriteMask]
|
||||
}
|
||||
|
||||
LOD 0
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest[unity_GUIZTestMode]
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask[_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
float2 maskTexcoord : TEXCOORD1;
|
||||
};
|
||||
|
||||
inline float UnityGet2DClipping (in float2 position, in float4 clipRect)
|
||||
{
|
||||
float2 inside = step(clipRect.xy, position.xy) * step(position.xy, clipRect.zw);
|
||||
return inside.x * inside.y;
|
||||
}
|
||||
|
||||
fixed4 _Color;
|
||||
fixed4 _TextureSampleAdd;
|
||||
sampler2D _MainTex;
|
||||
|
||||
bool _UseAlphaClip;
|
||||
int _FlipAlphaMask = 0;
|
||||
float4 _AlphaMask_ST;
|
||||
sampler2D _AlphaMask;
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
float4 wolrdPos = IN.vertex;
|
||||
OUT.maskTexcoord = TRANSFORM_TEX(wolrdPos.xy, _AlphaMask);
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw - 1.0)*float2(-1,1);
|
||||
#endif
|
||||
|
||||
OUT.color = IN.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
float _CutOff;
|
||||
bool _HardBlend = false;
|
||||
bool _NoOuterClip = false;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
|
||||
float4 inMask = float4(
|
||||
step(float2(0.0f, 0.0f), IN.maskTexcoord),
|
||||
step(IN.maskTexcoord, float2(1.0f, 1.0f)) );
|
||||
|
||||
// Do we want to clip the image to the Mask Rectangle?
|
||||
if (_NoOuterClip == false && all(inMask) == false )
|
||||
{
|
||||
color.a = 0;
|
||||
}
|
||||
else // It's in the mask rectangle, so apply the alpha of the mask provided.
|
||||
{
|
||||
|
||||
float a = tex2D(_AlphaMask, IN.maskTexcoord).a;
|
||||
|
||||
if (a <= _CutOff)
|
||||
a = 0;
|
||||
else
|
||||
{
|
||||
if(_HardBlend)
|
||||
a = 1;
|
||||
}
|
||||
|
||||
if (_FlipAlphaMask == 1)
|
||||
a = 1 - a;
|
||||
|
||||
color.a *= a;
|
||||
}
|
||||
|
||||
if (_UseAlphaClip)
|
||||
clip(color.a - 0.001);
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 947afae4d36f1274ea2e4098262ceef6
|
||||
timeCreated: 1444851202
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,105 @@
|
|||
Shader "UI Extensions/Particles/Additive" {
|
||||
Properties {
|
||||
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend SrcAlpha One
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
UNITY_TRANSFER_FOG(v,v.vertex);
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f IN) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(IN.projPos)));
|
||||
float partZ = IN.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
IN.color.a *= fade;
|
||||
#endif
|
||||
|
||||
fixed4 col = 2.0f * IN.color * _TintColor * tex2D(_MainTex, IN.texcoord);
|
||||
UNITY_APPLY_FOG_COLOR(IN.fogCoord, col, fixed4(0,0,0,0)); // fog towards black due to our blend mode
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e064104788d94b349ab13141a30b5660
|
||||
timeCreated: 1502443970
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,109 @@
|
|||
Shader "UI Extensions/Particles/~Additive-Multiply" {
|
||||
Properties {
|
||||
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend One OneMinusSrcAlpha
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
UNITY_TRANSFER_FOG(v,v.vertex);
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
|
||||
float partZ = i.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
i.color *= fade;
|
||||
#endif
|
||||
|
||||
fixed4 tex = tex2D(_MainTex, i.texcoord);
|
||||
fixed4 col;
|
||||
col.rgb = _TintColor.rgb * tex.rgb * i.color.rgb * 2.0f;
|
||||
col.a = (1 - tex.a) * (_TintColor.a * i.color.a * 2.0f);
|
||||
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0,0,0,0)); // fog towards black due to our blend mode
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 088bbfd9222ee044cb4e4699336e9ff1
|
||||
timeCreated: 1502443969
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,105 @@
|
|||
Shader "UI Extensions/Particles/Additive (Soft)" {
|
||||
Properties {
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend One OneMinusSrcColor
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
UNITY_TRANSFER_FOG(v,v.vertex);
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
|
||||
float partZ = i.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
i.color.a *= fade;
|
||||
#endif
|
||||
|
||||
half4 col = i.color * tex2D(_MainTex, i.texcoord);
|
||||
col.rgb *= col.a;
|
||||
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0,0,0,0)); // fog towards black due to our blend mode
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4c2211b120168e44db4a3a8417013615
|
||||
timeCreated: 1502443969
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,105 @@
|
|||
Shader "UI Extensions/Particles/Alpha Blended" {
|
||||
Properties {
|
||||
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
UNITY_TRANSFER_FOG(v,v.vertex);
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
|
||||
float partZ = i.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
i.color.a *= fade;
|
||||
#endif
|
||||
|
||||
fixed4 col = 2.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord);
|
||||
UNITY_APPLY_FOG(i.fogCoord, col);
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c3d7d8d71a91071469ad7019e77864d6
|
||||
timeCreated: 1502443970
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,104 @@
|
|||
Shader "UI Extensions/Particles/Blend" {
|
||||
Properties {
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend DstColor One
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
UNITY_TRANSFER_FOG(v,v.vertex);
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
|
||||
float partZ = i.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
i.color *= fade;
|
||||
#endif
|
||||
|
||||
fixed4 col = i.color * tex2D(_MainTex, i.texcoord);
|
||||
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0,0,0,0)); // fog towards black due to our blend mode
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 98fed5ba500a9a04a80325266b9911bb
|
||||
timeCreated: 1502443970
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,104 @@
|
|||
Shader "UI Extensions/Particles/Multiply" {
|
||||
Properties {
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend Zero SrcColor
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
UNITY_TRANSFER_FOG(v,v.vertex);
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
|
||||
float partZ = i.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
i.color.a *= fade;
|
||||
#endif
|
||||
|
||||
half4 prev = i.color * tex2D(_MainTex, i.texcoord);
|
||||
fixed4 col = lerp(half4(1,1,1,1), prev, prev.a);
|
||||
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(1,1,1,1)); // fog towards white due to our blend mode
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 320f6bb7bde369b4a85c9d89a9ba5268
|
||||
timeCreated: 1502443969
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,108 @@
|
|||
Shader "UI Extensions/Particles/Multiply (Double)" {
|
||||
Properties {
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend DstColor SrcColor
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD2;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
UNITY_TRANSFER_FOG(v,v.vertex);
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
|
||||
float partZ = i.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
i.color.a *= fade;
|
||||
#endif
|
||||
|
||||
fixed4 col;
|
||||
fixed4 tex = tex2D(_MainTex, i.texcoord);
|
||||
col.rgb = tex.rgb * i.color.rgb * 2;
|
||||
col.a = i.color.a * tex.a;
|
||||
col = lerp(fixed4(0.5f,0.5f,0.5f,0.5f), col, col.a);
|
||||
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0.5,0.5,0.5,0.5)); // fog towards gray due to our blend mode
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0765ecef58833c3429346a1fee45e4e0
|
||||
timeCreated: 1502443969
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,105 @@
|
|||
Shader "UI Extensions/Particles/Alpha Blended Premultiply" {
|
||||
Properties {
|
||||
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
Category {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Blend One OneMinusSrcAlpha
|
||||
ColorMask RGB
|
||||
Cull Off Lighting Off ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
SubShader {
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
#pragma multi_compile_particles
|
||||
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _TintColor;
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float4 projPos : TEXCOORD1;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata_t IN)
|
||||
{
|
||||
v2f v;
|
||||
v.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
v.projPos = ComputeScreenPos (v.vertex);
|
||||
COMPUTE_EYEDEPTH(v.projPos.z);
|
||||
#endif
|
||||
v.color = IN.color;
|
||||
v.texcoord = TRANSFORM_TEX(IN.texcoord,_MainTex);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
sampler2D_float _CameraDepthTexture;
|
||||
float _InvFade;
|
||||
|
||||
fixed4 frag (v2f IN) : SV_Target
|
||||
{
|
||||
#ifdef SOFTPARTICLES_ON
|
||||
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(IN.projPos)));
|
||||
float partZ = IN.projPos.z;
|
||||
float fade = saturate (_InvFade * (sceneZ-partZ));
|
||||
IN.color.a *= fade;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return IN.color * tex2D(_MainTex, IN.texcoord) * IN.color.a;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0596a6838d78f624397b642817cf20bc
|
||||
timeCreated: 1502443969
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,42 @@
|
|||
Shader "UI Extensions/Particles/VertexLit Blended" {
|
||||
Properties {
|
||||
_EmisColor ("Emissive Color", Color) = (.2,.2,.2,0)
|
||||
_MainTex ("Particle Texture", 2D) = "white" {}
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
||||
Tags { "LightMode" = "Vertex" }
|
||||
Cull Off
|
||||
Lighting On
|
||||
Material { Emission [_EmisColor] }
|
||||
ColorMaterial AmbientAndDiffuse
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Pass {
|
||||
|
||||
SetTexture [_MainTex] { combine primary * texture }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 65bbb789ada58ab44aaedbe09687f089
|
||||
timeCreated: 1502443969
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,94 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "UI Extensions/UIAdditive"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend One One
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
|
||||
#endif
|
||||
OUT.color = IN.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
|
||||
color.rgb *= color.a;
|
||||
clip (color.a - 0.01);
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 20fb5fa09d4675a4e94314a228763c23
|
||||
timeCreated: 1464629199
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,69 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
/// Credit 00christian00
|
||||
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
|
||||
|
||||
Shader "UI Extensions/UI Image Crop" {
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||
|
||||
_XCrop ("X Crop", Range(0.0,1.0)) = 1
|
||||
_YCrop ("Y Crop", Range(0.0,1.0)) = 1
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
ZWrite Off
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent"
|
||||
"RenderType" = "Transparent"
|
||||
"IgnoreProjector" = "True"
|
||||
}
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Pass {
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 uv : TEXCOORD0; //UV1 coord
|
||||
};
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
uniform float _XCrop;
|
||||
uniform float _YCrop;
|
||||
|
||||
v2f vert (v2f v)
|
||||
{
|
||||
|
||||
v2f o;
|
||||
o.color=v.color;
|
||||
o.color.a=0.1;
|
||||
o.pos = UnityObjectToClipPos (v.pos);
|
||||
|
||||
o.uv=TRANSFORM_TEX(v.uv, _MainTex);
|
||||
|
||||
return o;
|
||||
}
|
||||
fixed4 frag (v2f i) : COLOR
|
||||
{
|
||||
|
||||
//return fixed4(0.25,0,0,1);
|
||||
i.color.a=step(i.uv.x,_XCrop);
|
||||
//I don't like the bottom up ordering,so I reverse it
|
||||
i.color.a=i.color.a*step(1-i.uv.y,_YCrop);
|
||||
return i.color * tex2D (_MainTex, i.uv);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ccf5a0c8f87d3c547aff3daecb3164a4
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
|
@ -0,0 +1,95 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "UI Extensions/UILinearDodge"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
BlendOp Add
|
||||
Blend SrcAlpha One, One Zero
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
|
||||
#endif
|
||||
OUT.color = IN.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
|
||||
color.rgb *= color.a;
|
||||
clip (color.a - 0.01);
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c3c3af59790cf3749ba49fe1c838c94e
|
||||
timeCreated: 1464629199
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,93 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "UI Extensions/UIMultiply"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend DstColor Zero
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
|
||||
#endif
|
||||
OUT.color = IN.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
|
||||
clip (color.a - 0.01);
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d287872ca8fd776418c28d332df585c3
|
||||
timeCreated: 1464629200
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,38 @@
|
|||
Shader "UI/Particles/Hidden"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Geometry" "RenderType"="Opaque" }
|
||||
Cull Off Lighting Off ZWrite Off Fog { Mode Off }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert ()
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = fixed4(0, 0, 0, 0);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
discard;
|
||||
return fixed4(0, 0, 0, 0);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cf73a0a4b5ea8994f916cd18a97c564b
|
||||
timeCreated: 1464476220
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,95 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "UI Extensions/UIScreen"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
BlendOp Add
|
||||
Blend OneMinusDstColor One, One Zero
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
|
||||
#endif
|
||||
OUT.color = IN.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
|
||||
color.rgb *= color.a;
|
||||
clip (color.a - 0.01);
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 227ac21f7763c00489cc458e3938e326
|
||||
timeCreated: 1464629199
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,94 @@
|
|||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "UI Extensions/UISoftAdditive"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend OneMinusDstColor One
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
|
||||
#endif
|
||||
OUT.color = IN.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
sampler2D _MainTex;
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
|
||||
color.rgb *= color.a;
|
||||
clip (color.a - 0.01);
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fb2e16a3d1280334a9e05394e1890f09
|
||||
timeCreated: 1464629200
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9d40233b1c5add641bb2f4f7f12af05e
|
||||
folderAsset: yes
|
||||
timeCreated: 1438724032
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fab8c1b6e538fad489513f03e0418451
|
||||
folderAsset: yes
|
||||
timeCreated: 1468775610
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 82ea50ac9a6ea8940a71f86ea8d13bf0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -0,0 +1,61 @@
|
|||
///Credit ChoMPHi
|
||||
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[RequireComponent(typeof(HorizontalOrVerticalLayoutGroup), typeof(ContentSizeFitter), typeof(ToggleGroup))]
|
||||
[AddComponentMenu("UI/Extensions/Accordion/Accordion Group")]
|
||||
public class Accordion : MonoBehaviour
|
||||
{
|
||||
private bool m_expandVertical = true;
|
||||
[HideInInspector]
|
||||
public bool ExpandVerticval => m_expandVertical;
|
||||
|
||||
public enum Transition
|
||||
{
|
||||
Instant,
|
||||
Tween
|
||||
}
|
||||
|
||||
[SerializeField] private Transition m_Transition = Transition.Instant;
|
||||
[SerializeField] private float m_TransitionDuration = 0.3f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the transition.
|
||||
/// </summary>
|
||||
/// <value>The transition.</value>
|
||||
public Transition transition
|
||||
{
|
||||
get { return this.m_Transition; }
|
||||
set { this.m_Transition = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the duration of the transition.
|
||||
/// </summary>
|
||||
/// <value>The duration of the transition.</value>
|
||||
public float transitionDuration
|
||||
{
|
||||
get { return this.m_TransitionDuration; }
|
||||
set { this.m_TransitionDuration = value; }
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_expandVertical = GetComponent<HorizontalLayoutGroup>() ? false : true;
|
||||
var group = GetComponent<ToggleGroup>();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (!GetComponent<HorizontalLayoutGroup>() && !GetComponent<VerticalLayoutGroup>())
|
||||
{
|
||||
Debug.LogError("Accordion requires either a Horizontal or Vertical Layout group to place children");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4387cc9950f37044c92f9d144a2b1002
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,218 @@
|
|||
///Credit ChoMPHi
|
||||
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
||||
|
||||
using System;
|
||||
using UnityEngine.UI.Extensions.Tweens;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[RequireComponent(typeof(RectTransform), typeof(LayoutElement))]
|
||||
[AddComponentMenu("UI/Extensions/Accordion/Accordion Element")]
|
||||
public class AccordionElement : Toggle
|
||||
{
|
||||
|
||||
[SerializeField] private float m_MinHeight = 18f;
|
||||
|
||||
public float MinHeight => m_MinHeight;
|
||||
|
||||
[SerializeField] private float m_MinWidth = 40f;
|
||||
|
||||
public float MinWidth => m_MinWidth;
|
||||
|
||||
private Accordion m_Accordion;
|
||||
private RectTransform m_RectTransform;
|
||||
private LayoutElement m_LayoutElement;
|
||||
|
||||
[NonSerialized]
|
||||
private readonly TweenRunner<FloatTween> m_FloatTweenRunner;
|
||||
|
||||
protected AccordionElement()
|
||||
{
|
||||
if (this.m_FloatTweenRunner == null)
|
||||
this.m_FloatTweenRunner = new TweenRunner<FloatTween>();
|
||||
|
||||
this.m_FloatTweenRunner.Init(this);
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
base.transition = Transition.None;
|
||||
base.toggleTransition = ToggleTransition.None;
|
||||
this.m_Accordion = this.gameObject.GetComponentInParent<Accordion>();
|
||||
this.m_RectTransform = this.transform as RectTransform;
|
||||
this.m_LayoutElement = this.gameObject.GetComponent<LayoutElement>();
|
||||
this.onValueChanged.AddListener(OnValueChanged);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate()
|
||||
{
|
||||
base.OnValidate();
|
||||
this.m_Accordion = this.gameObject.GetComponentInParent<Accordion>();
|
||||
|
||||
if (this.group == null)
|
||||
{
|
||||
ToggleGroup tg = this.GetComponentInParent<ToggleGroup>();
|
||||
|
||||
if (tg != null)
|
||||
{
|
||||
this.group = tg;
|
||||
}
|
||||
}
|
||||
|
||||
LayoutElement le = this.gameObject.GetComponent<LayoutElement>();
|
||||
|
||||
if (le != null && m_Accordion != null)
|
||||
{
|
||||
if (this.isOn)
|
||||
{
|
||||
if (m_Accordion.ExpandVerticval)
|
||||
{
|
||||
le.preferredHeight = -1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
le.preferredWidth = -1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Accordion.ExpandVerticval)
|
||||
{
|
||||
le.preferredHeight = this.m_MinHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
le.preferredWidth = this.m_MinWidth;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public void OnValueChanged(bool state)
|
||||
{
|
||||
if (this.m_LayoutElement == null)
|
||||
return;
|
||||
|
||||
Accordion.Transition transition = (this.m_Accordion != null) ? this.m_Accordion.transition : Accordion.Transition.Instant;
|
||||
|
||||
if (transition == Accordion.Transition.Instant && m_Accordion != null)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
if (m_Accordion.ExpandVerticval)
|
||||
{
|
||||
this.m_LayoutElement.preferredHeight = -1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_LayoutElement.preferredWidth = -1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Accordion.ExpandVerticval)
|
||||
{
|
||||
this.m_LayoutElement.preferredHeight = this.m_MinHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_LayoutElement.preferredWidth = this.m_MinWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (transition == Accordion.Transition.Tween)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
if (m_Accordion.ExpandVerticval)
|
||||
{
|
||||
this.StartTween(this.m_MinHeight, this.GetExpandedHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.StartTween(this.m_MinWidth, this.GetExpandedWidth());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Accordion.ExpandVerticval)
|
||||
{
|
||||
this.StartTween(this.m_RectTransform.rect.height, this.m_MinHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.StartTween(this.m_RectTransform.rect.width, this.m_MinWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected float GetExpandedHeight()
|
||||
{
|
||||
if (this.m_LayoutElement == null)
|
||||
return this.m_MinHeight;
|
||||
|
||||
float originalPrefH = this.m_LayoutElement.preferredHeight;
|
||||
this.m_LayoutElement.preferredHeight = -1f;
|
||||
float h = LayoutUtility.GetPreferredHeight(this.m_RectTransform);
|
||||
this.m_LayoutElement.preferredHeight = originalPrefH;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
protected float GetExpandedWidth()
|
||||
{
|
||||
if (this.m_LayoutElement == null)
|
||||
return this.m_MinWidth;
|
||||
|
||||
float originalPrefW = this.m_LayoutElement.preferredWidth;
|
||||
this.m_LayoutElement.preferredWidth = -1f;
|
||||
float w = LayoutUtility.GetPreferredWidth(this.m_RectTransform);
|
||||
this.m_LayoutElement.preferredWidth = originalPrefW;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
protected void StartTween(float startFloat, float targetFloat)
|
||||
{
|
||||
float duration = (this.m_Accordion != null) ? this.m_Accordion.transitionDuration : 0.3f;
|
||||
|
||||
FloatTween info = new FloatTween
|
||||
{
|
||||
duration = duration,
|
||||
startFloat = startFloat,
|
||||
targetFloat = targetFloat
|
||||
};
|
||||
if (m_Accordion.ExpandVerticval)
|
||||
{
|
||||
info.AddOnChangedCallback(SetHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.AddOnChangedCallback(SetWidth);
|
||||
}
|
||||
info.ignoreTimeScale = true;
|
||||
this.m_FloatTweenRunner.StartTween(info);
|
||||
}
|
||||
|
||||
protected void SetHeight(float height)
|
||||
{
|
||||
if (this.m_LayoutElement == null)
|
||||
return;
|
||||
|
||||
this.m_LayoutElement.preferredHeight = height;
|
||||
}
|
||||
|
||||
protected void SetWidth(float width)
|
||||
{
|
||||
if (this.m_LayoutElement == null)
|
||||
return;
|
||||
|
||||
this.m_LayoutElement.preferredWidth = width;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3c9d341c4bc7de548937508e6f837144
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b9115417252d4cd42a5e167bdc1c2d3b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
|
@ -0,0 +1,120 @@
|
|||
///Credit ChoMPHi
|
||||
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
||||
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace UnityEngine.UI.Extensions.Tweens
|
||||
{
|
||||
public struct FloatTween : ITweenValue
|
||||
{
|
||||
public class FloatTweenCallback : UnityEvent<float> {}
|
||||
public class FloatFinishCallback : UnityEvent {}
|
||||
|
||||
private float m_StartFloat;
|
||||
private float m_TargetFloat;
|
||||
private float m_Duration;
|
||||
private bool m_IgnoreTimeScale;
|
||||
private FloatTweenCallback m_Target;
|
||||
private FloatFinishCallback m_Finish;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the starting float.
|
||||
/// </summary>
|
||||
/// <value>The start float.</value>
|
||||
public float startFloat
|
||||
{
|
||||
get { return m_StartFloat; }
|
||||
set { m_StartFloat = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target float.
|
||||
/// </summary>
|
||||
/// <value>The target float.</value>
|
||||
public float targetFloat
|
||||
{
|
||||
get { return m_TargetFloat; }
|
||||
set { m_TargetFloat = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the duration of the tween.
|
||||
/// </summary>
|
||||
/// <value>The duration.</value>
|
||||
public float duration
|
||||
{
|
||||
get { return m_Duration; }
|
||||
set { m_Duration = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="UnityEngine.UI.Tweens.ColorTween"/> should ignore time scale.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if ignore time scale; otherwise, <c>false</c>.</value>
|
||||
public bool ignoreTimeScale
|
||||
{
|
||||
get { return m_IgnoreTimeScale; }
|
||||
set { m_IgnoreTimeScale = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tweens the float based on percentage.
|
||||
/// </summary>
|
||||
/// <param name="floatPercentage">Float percentage.</param>
|
||||
public void TweenValue(float floatPercentage)
|
||||
{
|
||||
if (!ValidTarget())
|
||||
return;
|
||||
|
||||
m_Target.Invoke( Mathf.Lerp (m_StartFloat, m_TargetFloat, floatPercentage) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a on changed callback.
|
||||
/// </summary>
|
||||
/// <param name="callback">Callback.</param>
|
||||
public void AddOnChangedCallback(UnityAction<float> callback)
|
||||
{
|
||||
if (m_Target == null)
|
||||
m_Target = new FloatTweenCallback();
|
||||
|
||||
m_Target.AddListener(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a on finish callback.
|
||||
/// </summary>
|
||||
/// <param name="callback">Callback.</param>
|
||||
public void AddOnFinishCallback(UnityAction callback)
|
||||
{
|
||||
if (m_Finish == null)
|
||||
m_Finish = new FloatFinishCallback();
|
||||
|
||||
m_Finish.AddListener(callback);
|
||||
}
|
||||
|
||||
public bool GetIgnoreTimescale()
|
||||
{
|
||||
return m_IgnoreTimeScale;
|
||||
}
|
||||
|
||||
public float GetDuration()
|
||||
{
|
||||
return m_Duration;
|
||||
}
|
||||
|
||||
public bool ValidTarget()
|
||||
{
|
||||
return m_Target != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the on finish callback.
|
||||
/// </summary>
|
||||
public void Finished()
|
||||
{
|
||||
if (m_Finish != null)
|
||||
m_Finish.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e28e1e9e18f7daa4db5d1ac279d6ce66
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,15 @@
|
|||
///Credit ChoMPHi
|
||||
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions.Tweens
|
||||
{
|
||||
internal interface ITweenValue
|
||||
{
|
||||
void TweenValue(float floatPercentage);
|
||||
bool ignoreTimeScale { get; }
|
||||
float duration { get; }
|
||||
bool ValidTarget();
|
||||
void Finished();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9edf9da4c14ad2843879a2331b00f738
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
|
@ -0,0 +1,63 @@
|
|||
///Credit ChoMPHi
|
||||
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace UnityEngine.UI.Extensions.Tweens
|
||||
{
|
||||
// Tween runner, executes the given tween.
|
||||
// The coroutine will live within the given
|
||||
// behaviour container.
|
||||
internal class TweenRunner<T> where T : struct, ITweenValue
|
||||
{
|
||||
protected MonoBehaviour m_CoroutineContainer;
|
||||
protected IEnumerator m_Tween;
|
||||
|
||||
// utility function for starting the tween
|
||||
private static IEnumerator Start(T tweenInfo)
|
||||
{
|
||||
if (!tweenInfo.ValidTarget())
|
||||
yield break;
|
||||
|
||||
float elapsedTime = 0.0f;
|
||||
while (elapsedTime < tweenInfo.duration)
|
||||
{
|
||||
elapsedTime += tweenInfo.ignoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime;
|
||||
var percentage = Mathf.Clamp01 (elapsedTime / tweenInfo.duration);
|
||||
tweenInfo.TweenValue (percentage);
|
||||
yield return null;
|
||||
}
|
||||
tweenInfo.TweenValue (1.0f);
|
||||
tweenInfo.Finished();
|
||||
}
|
||||
|
||||
public void Init(MonoBehaviour coroutineContainer)
|
||||
{
|
||||
m_CoroutineContainer = coroutineContainer;
|
||||
}
|
||||
|
||||
public void StartTween(T info)
|
||||
{
|
||||
if (m_CoroutineContainer == null)
|
||||
{
|
||||
Debug.LogWarning ("Coroutine container not configured... did you forget to call Init?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_Tween != null)
|
||||
{
|
||||
m_CoroutineContainer.StopCoroutine (m_Tween);
|
||||
m_Tween = null;
|
||||
}
|
||||
|
||||
if (!m_CoroutineContainer.gameObject.activeInHierarchy)
|
||||
{
|
||||
info.TweenValue(1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
m_Tween = Start (info);
|
||||
m_CoroutineContainer.StartCoroutine (m_Tween);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d00ab96853b24074cb837ee70f07dddc
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue