1
This commit is contained in:
82
Assets/Packages/com.unity.uiextensions/CHANGELOG.md
Normal file
82
Assets/Packages/com.unity.uiextensions/CHANGELOG.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# 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/).
|
||||
|
||||
## Release 2.3.2 - Rejuvenation - 2023/11/26
|
||||
|
||||
2023 is certainly an interesting year to keep you on your toes, and finding time to keep managing all the requests and updates that come in are taking their toll, especially for a FREE project, but nonetheless, I still do it.
|
||||
|
||||
Mainly bugfixes for the end of year update, promoting some resolutions that have been verified and tested since the last release.
|
||||
|
||||
To get up to speed with the Unity UI Extensions, check out the [Getting Started](https://unity-ui-extensions.github.io/GettingStarted.html) Page.
|
||||
|
||||
> Ways to get in touch:
|
||||
>
|
||||
> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions
|
||||
> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project
|
||||
>
|
||||
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||
|
||||
## Breaking changes
|
||||
|
||||
For customers upgrading from earlier versions of Unity to Unity 2020, please be aware of the Breaking change related to Text Based components. You will need to manually replace any UI using the older ```Text``` component and replace them with ```TextMeshPro``` versions. This is unavoidable due to Unity deprecating the Text component.
|
||||
|
||||
> New users to 2022 are unaffected as all the Editor commands have been updated to use the newer TextMeshPro versions.
|
||||
|
||||
For more details, see the [deprecation notice](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions/428) on GitHub.
|
||||
|
||||
## Added
|
||||
|
||||
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
|
||||
|
||||
## Changed
|
||||
|
||||
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
|
||||
- fix: Resolved an issue where the last line in a flow layout group would overflow the rect bounds.
|
||||
- fix: GetPosition when Segments is null (@victornor)
|
||||
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
|
||||
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
|
||||
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
|
||||
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
|
||||
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
|
||||
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
|
||||
|
||||
## Deprecated
|
||||
|
||||
- All deprecated Text based components now have "obsolete" tags, to avoid breaking code. Note, these do not function in 2022 and above, as Unity have "changed" things. For any affected component, I recommend updating to use TextMeshPro native features.
|
||||
|
||||
## Additional Notes
|
||||
|
||||
### [Installation Instructions](https://unity-ui-extensions.github.io/UPMInstallation.html)
|
||||
|
||||
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
|
||||
|
||||
New for 2020, we have added OpenUPM support and the package can be installed using the following [OpenUPM CLI](https://openupm.com/docs/) command:
|
||||
|
||||
```cli
|
||||
`openupm add com.unity.uiextensions`
|
||||
```
|
||||
|
||||
> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation).
|
||||
|
||||
- Unity Package Manager - manual
|
||||
|
||||
Alternatively, you can also add the package manually through the Unity package manager using the scope ```com.unity.uiextensions```, see the [Unity Package Manager docs](https://learn.unity.com/tutorial/the-package-manager) for more information.
|
||||
|
||||
- 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
|
||||
|
||||
### UPM
|
||||
|
||||
If you are using UPM to gain access to the Unity UI Extensions, then you only need to update to the latest version in the Package Manager, no other changes needed.
|
||||
|
||||
### Customers using the .UnityPackage
|
||||
|
||||
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/Packages/com.unity.uiextensions/CHANGELOG.md.meta
Normal file
7
Assets/Packages/com.unity.uiextensions/CHANGELOG.md.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03470ebba317a0549a5582f18f4d2383
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a08421c5c57e4f44883b819982489d7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,102 @@
|
||||
<!-- Offline documentation -->
|
||||
|
||||
# About Unity UI Extensions
|
||||
|
||||
The Unity UI Extensions project is a collection of extension scripts/effects and controls to enhance your Unity UI experience. This includes over 70+ controls, utilities, effects and some much-needed love to make the most out of the Unity UI system (formally uGUI) in Unity.
|
||||
[Check out our Tumblr page for a sneak peek](https://www.tumblr.com/blog/unityuiextensions)
|
||||
|
||||
You can follow the UI Extensions team for updates and news on:
|
||||
|
||||
### [Twitter - #unityuiextensions](https://twitter.com/search?q=%23unityuiextensions) / [Facebook](https://www.facebook.com/UnityUIExtensions/) / [YouTube](https://www.youtube.com/@UnityUIExtensions)
|
||||
|
||||
> Ways to get in touch:
|
||||
>
|
||||
> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project
|
||||
> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions
|
||||
|
||||
# Installing Unity UI Extensions
|
||||
|
||||
To install this package, follow the instructions in the Package Manager documentation.
|
||||
|
||||
For more details on [Getting Started](https://unity-ui-extensions.github.io/GettingStarted) please checkout the [online documentation here](https://unity-ui-extensions.github.io/).
|
||||
|
||||
# Using Unity UI Extensions
|
||||
|
||||
The UI Extensions project provides many automated functions to add the various controls contained within the project commonly accessed via "***GameObject -> UI -> Extensions -> 'Control'***" from the editor menu. This will add the UI object and all the necessary components to make that control work in the scene in a default state.
|
||||
|
||||
Some of the features are also available through the GameObject "Add Component" menu in the inspector.
|
||||
|
||||
For a full list of the controls and how they are used, please see the [online documentation](https://unity-ui-extensions.github.io/Controls.html) for the project.
|
||||
|
||||
# Technical details
|
||||
|
||||
## Requirements
|
||||
|
||||
This version of the Unity UI Extensions is compatible with the following versions of the Unity Editor:
|
||||
|
||||
- 2019 and above - the recommended path for 2019+ is to use the Unity Package Manager to get access to the package. Full details for installing via UPM can be [found here](https://unity-ui-extensions.github.io/UPMInstallation.html).
|
||||
|
||||
> Alternatively, the Asset packages have been tested to work with 2019 as well if you prefer to install that way.
|
||||
|
||||
- 2018 and below - for 2018 and use this package, you will have to import the asset package(s), either from the Asset Store or from the alternate download locations [listed here](https://unity-ui-extensions.github.io/Downloads).
|
||||
|
||||
## [Release Notes](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
|
||||
|
||||
## Release 2.3.2 - Rejuvenation - 2023/11/26
|
||||
|
||||
2023 is certainly an interesting year to keep you on your toes, and finding time to keep managing all the requests and updates that come in are taking their toll, especially for a FREE project, but nonetheless, I still do it.
|
||||
|
||||
Mainly bugfixes for the end of year update, promoting some resolutions that have been verified and tested since the last release.
|
||||
|
||||
To get up to speed with the Unity UI Extensions, check out the [Getting Started](https://unity-ui-extensions.github.io/GettingStarted.html) Page.
|
||||
|
||||
> Ways to get in touch:
|
||||
>
|
||||
> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions
|
||||
> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project
|
||||
>
|
||||
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||
|
||||
## Breaking changes
|
||||
|
||||
For customers upgrading from earlier versions of Unity to Unity 2020, please be aware of the Breaking change related to Text Based components. You will need to manually replace any UI using the older ```Text``` component and replace them with ```TextMeshPro``` versions. This is unavoidable due to Unity deprecating the Text component.
|
||||
|
||||
> New users to 2022 are unaffected as all the Editor commands have been updated to use the newer TextMeshPro versions.
|
||||
|
||||
For more details, see the [deprecation notice](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions/428) on GitHub.
|
||||
|
||||
## Added
|
||||
|
||||
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
|
||||
|
||||
## Changed
|
||||
|
||||
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
|
||||
- fix: Resolved an issue where the last line in a flow layout group would overflow the rect bounds.
|
||||
- fix: GetPosition when Segments is null (@victornor)
|
||||
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
|
||||
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
|
||||
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
|
||||
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
|
||||
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
|
||||
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
|
||||
|
||||
## Deprecated
|
||||
|
||||
- All deprecated Text based components now have "obsolete" tags, to avoid breaking code. Note, these do not function in 2022 and above, as Unity have "changed" things. For any affected component, I recommend updating to use TextMeshPro native features.
|
||||
|
||||
- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
|
||||
|
||||
## 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.
|
||||
|
||||
# Document revision history
|
||||
|
||||
|Date|Details|
|
||||
|-|-|
|
||||
|July 9th, 2020|2019.4 (v2.2) released, first UPM deployment live |
|
||||
|September 3rd, 2019|2019.1 (v2.1) released, First major update for the 2.0 series.|
|
||||
|August 8th, 2020|2019.4 (v2.2) released, New UPM Delivery.|
|
||||
|October 10th, 2020|2019.5 (v2.2) released, New UPM fast delivery|
|
||||
|February 7th, 2022|v2.3 released, New Home, UPM fast delivery via OpenUPM|
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 539edee228eb76c40a9a5a1f7a165130
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Packages/com.unity.uiextensions/Editor.meta
Normal file
9
Assets/Packages/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,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1047f9974e7ee1478bbf5490a7a62d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
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:
|
||||
@@ -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,93 @@
|
||||
/// 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();
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
Vector3 newCornerPos = Handles.FreeMoveHandle(script.transform.TransformPoint(cornerPos), HandleUtility.GetHandleSize(script.transform.TransformPoint(cornerPos)) / 7, Vector3.one, Handles.SphereHandleCap);
|
||||
#else
|
||||
Vector3 newCornerPos = Handles.FreeMoveHandle(script.transform.TransformPoint(cornerPos), script.transform.rotation, HandleUtility.GetHandleSize(script.transform.TransformPoint(cornerPos)) / 7, Vector3.one, Handles.SphereHandleCap);
|
||||
#endif
|
||||
|
||||
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,120 @@
|
||||
/// 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()
|
||||
{
|
||||
#if UNITY_2023_1_OR_NEWER
|
||||
canvasGroups = GameObject.FindObjectsByType<CanvasGroup>(FindObjectsSortMode.None);
|
||||
#else
|
||||
canvasGroups = GameObject.FindObjectsOfType<CanvasGroup>();
|
||||
#endif
|
||||
}
|
||||
|
||||
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,119 @@
|
||||
/// Credit setchi (https://github.com/setchi)
|
||||
/// Sourced from - https://github.com/setchi/FancyScrollView
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.AnimatedValues;
|
||||
|
||||
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 draggable;
|
||||
SerializedProperty scrollbar;
|
||||
|
||||
AnimBool showElasticity;
|
||||
AnimBool showInertiaRelatedValues;
|
||||
|
||||
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");
|
||||
draggable = serializedObject.FindProperty("draggable");
|
||||
scrollbar = serializedObject.FindProperty("scrollbar");
|
||||
|
||||
showElasticity = new AnimBool(Repaint);
|
||||
showInertiaRelatedValues = new AnimBool(Repaint);
|
||||
SetAnimBools(true);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
showElasticity.valueChanged.RemoveListener(Repaint);
|
||||
showInertiaRelatedValues.valueChanged.RemoveListener(Repaint);
|
||||
}
|
||||
|
||||
void SetAnimBools(bool instant)
|
||||
{
|
||||
SetAnimBool(showElasticity, !movementType.hasMultipleDifferentValues && movementType.enumValueIndex == (int)MovementType.Elastic, instant);
|
||||
SetAnimBool(showInertiaRelatedValues, !inertia.hasMultipleDifferentValues && inertia.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e82bfdd42ec254849830933cbaf350fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,121 @@
|
||||
///Credit brogan89
|
||||
///Sourced from - https://github.com/brogan89/MinMaxSlider
|
||||
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[CustomEditor(typeof(MinMaxSlider), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class MinMaxSliderEditor : SelectableEditor
|
||||
{
|
||||
private SerializedProperty _customCamera;
|
||||
private SerializedProperty _sliderBounds;
|
||||
private SerializedProperty _minHandle;
|
||||
private SerializedProperty _maxHandle;
|
||||
private SerializedProperty _minText;
|
||||
private SerializedProperty _maxText;
|
||||
private SerializedProperty _textFormat;
|
||||
private SerializedProperty _middleGraphic;
|
||||
private SerializedProperty _minLimit;
|
||||
private SerializedProperty _maxLimit;
|
||||
private SerializedProperty _wholeNumbers;
|
||||
private SerializedProperty _minValue;
|
||||
private SerializedProperty _maxValue;
|
||||
|
||||
private SerializedProperty _onValueChanged;
|
||||
|
||||
private readonly GUIContent label = new GUIContent("Min Max Values");
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
_customCamera = serializedObject.FindProperty("customCamera");
|
||||
_sliderBounds = serializedObject.FindProperty("sliderBounds");
|
||||
_minHandle = serializedObject.FindProperty("minHandle");
|
||||
_maxHandle = serializedObject.FindProperty("maxHandle");
|
||||
_minText = serializedObject.FindProperty("minText");
|
||||
_maxText = serializedObject.FindProperty("maxText");
|
||||
_textFormat = serializedObject.FindProperty("textFormat");
|
||||
_middleGraphic = serializedObject.FindProperty("middleGraphic");
|
||||
_minLimit = serializedObject.FindProperty("minLimit");
|
||||
_maxLimit = serializedObject.FindProperty("maxLimit");
|
||||
_wholeNumbers = serializedObject.FindProperty("wholeNumbers");
|
||||
_minValue = serializedObject.FindProperty("minValue");
|
||||
_maxValue = serializedObject.FindProperty("maxValue");
|
||||
_onValueChanged = serializedObject.FindProperty("onValueChanged");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
serializedObject.Update();
|
||||
|
||||
float minLimitOld = _minLimit.floatValue;
|
||||
float maxLimitOld = _maxLimit.floatValue;
|
||||
float minValueOld = _minValue.floatValue;
|
||||
float maxValueOld = _maxValue.floatValue;
|
||||
|
||||
EditorGUILayout.PropertyField(_customCamera);
|
||||
EditorGUILayout.PropertyField(_sliderBounds);
|
||||
EditorGUILayout.PropertyField(_minHandle);
|
||||
EditorGUILayout.PropertyField(_maxHandle);
|
||||
EditorGUILayout.PropertyField(_middleGraphic);
|
||||
|
||||
EditorGUILayout.PropertyField(_minText);
|
||||
EditorGUILayout.PropertyField(_maxText);
|
||||
EditorGUILayout.PropertyField(_textFormat);
|
||||
|
||||
EditorGUILayout.PropertyField(_minLimit);
|
||||
EditorGUILayout.PropertyField(_maxLimit);
|
||||
|
||||
EditorGUILayout.PropertyField(_wholeNumbers);
|
||||
EditorGUILayout.PropertyField(_minValue);
|
||||
EditorGUILayout.PropertyField(_maxValue);
|
||||
|
||||
float minValue = Mathf.Clamp(_minValue.floatValue, _minLimit.floatValue, _maxLimit.floatValue);
|
||||
float maxValue = Mathf.Clamp(_maxValue.floatValue, _minLimit.floatValue, _maxLimit.floatValue);
|
||||
EditorGUILayout.MinMaxSlider(label, ref minValue, ref maxValue, _minLimit.floatValue, _maxLimit.floatValue);
|
||||
|
||||
bool anyValueChanged = !IsEqualFloat(minValueOld, minValue)
|
||||
|| !IsEqualFloat(maxValueOld, maxValue)
|
||||
|| !IsEqualFloat(minLimitOld, _minLimit.floatValue)
|
||||
|| !IsEqualFloat(maxLimitOld, _maxLimit.floatValue);
|
||||
|
||||
if (anyValueChanged)
|
||||
{
|
||||
MinMaxSlider slider = (MinMaxSlider)target;
|
||||
|
||||
// force limits to ints if whole numbers.
|
||||
// needed to do this here because it wouldn't set in component script for some reason
|
||||
if (slider.wholeNumbers)
|
||||
{
|
||||
_minLimit.floatValue = Mathf.RoundToInt(_minLimit.floatValue);
|
||||
_maxLimit.floatValue = Mathf.RoundToInt(_maxLimit.floatValue);
|
||||
}
|
||||
|
||||
// set slider values
|
||||
slider.SetValues(minValue, maxValue, _minLimit.floatValue, _maxLimit.floatValue);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.PropertyField(_onValueChanged);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if floating point numbers are within 0.01f (close enough to be considered equal)
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
private static bool IsEqualFloat(float a, float b)
|
||||
{
|
||||
return Math.Abs(a - b) < 0.01f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69352ed1561021b48ac258f81f48a988
|
||||
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,134 @@
|
||||
/// 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_Direction;
|
||||
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_Direction = serializedObject.FindProperty("m_Direction");
|
||||
|
||||
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_Direction);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
RangeSlider.Direction direction = (RangeSlider.Direction)m_Direction.enumValueIndex;
|
||||
foreach (var obj in serializedObject.targetObjects)
|
||||
{
|
||||
RangeSlider rangeSlider = obj as RangeSlider;
|
||||
rangeSlider.SetDirection(direction, true);
|
||||
}
|
||||
}
|
||||
|
||||
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,87 @@
|
||||
/// 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 System;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[Obsolete("ScrollPositionController has been replaced by the Scroller component", true)]
|
||||
[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:
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "UnityUIExtensions.editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:343deaaf83e0cee4ca978e7df0b80d21",
|
||||
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
|
||||
"GUID:cf414061cae3a954baf92763590f3127",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c053729641303074282de705dbd4b1b8
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
135
Assets/Packages/com.unity.uiextensions/Editor/uGUITools.cs
Normal file
135
Assets/Packages/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("Tools/UnityUIExtensions/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("Tools/UnityUIExtensions/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("Tools/UnityUIExtensions/Mirror Horizontally Around Anchors %;")]
|
||||
static void MirrorHorizontallyAnchors()
|
||||
{
|
||||
MirrorHorizontally(false);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/UnityUIExtensions/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("Tools/UnityUIExtensions/Mirror Vertically Around Anchors %'")]
|
||||
static void MirrorVerticallyAnchors()
|
||||
{
|
||||
MirrorVertically(false);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/UnityUIExtensions/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/Packages/com.unity.uiextensions/LICENSE.md
Normal file
22
Assets/Packages/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/Packages/com.unity.uiextensions/LICENSE.md.meta
Normal file
7
Assets/Packages/com.unity.uiextensions/LICENSE.md.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85fbb9f9f8b4fa3439349b9c4c495006
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
240
Assets/Packages/com.unity.uiextensions/README.md
Normal file
240
Assets/Packages/com.unity.uiextensions/README.md
Normal file
@@ -0,0 +1,240 @@
|
||||
# Unity UI Extensions README
|
||||
|
||||
This is an extension project for the new Unity UI system which can be found at: [Unity UI Source](https://github.com/Unity-Technologies/uGUI)
|
||||
|
||||
> [Check out the control demos on our Tumblr page](https://unityuiextensions.tumblr.com/)
|
||||
|
||||
[](https://openupm.com/packages/com.unity.uiextensions/)
|
||||
[](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/main-publish.yml)
|
||||
[](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-publish.yml)
|
||||
[](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-buildandtestupmrelease.yml)
|
||||
|
||||
## [Intro](https://unity-ui-extensions.github.io/GettingStarted)
|
||||
|
||||
For more info, here's a little introduction video for the project:
|
||||
|
||||
[](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 - #unityuiextensions](https://twitter.com/search?q=%23unityuiextensions) / [Facebook](https://www.facebook.com/UnityUIExtensions/) / [YouTube](https://www.youtube.com/@UnityUIExtensions)
|
||||
|
||||
> Ways to get in touch:
|
||||
>
|
||||
> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project
|
||||
> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions
|
||||
|
||||
-----
|
||||
|
||||
## [What is this repository for?](https://unity-ui-extensions.github.io/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 Latest - Version 2.3](https://unity-ui-extensions.github.io/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**
|
||||
|
||||
| [](https://unityuiextensions.itch.io/uiextensions2-0 "Download from Itch.IO") | [](https://unionassets.com/unity-ui-extensions "Download from Union Assets") | [](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 [GitHub site](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/releases) if you prefer
|
||||
|
||||
To view previous releases, visit the [release archive](https://unity-ui-extensions.github.io/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**
|
||||
|
||||
|[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=89L8T9N6BR7LJ "Donating via Paypal")|[](https://ko-fi.com/uiextensions "Buy us a Coffee")|
|
||||
|-|-|
|
||||
|||
|
||||
|
||||
> (PayPal account not required and you can remain anonymous if you wish)
|
||||
|
||||
-----
|
||||
|
||||
## [Getting Started](https://unity-ui-extensions.github.io/GettingStarted)
|
||||
|
||||
To get started with the project, here's a little guide:
|
||||
|
||||
[](http://www.youtube.com/watch?v=sVLeYmsNQAI "Unity UI getting started video")
|
||||
|
||||
-----
|
||||
|
||||
## [Updates:](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
|
||||
|
||||
## Release 2.3.2 - Rejuvenation - 2023/11/26
|
||||
|
||||
2023 is certainly an interesting year to keep you on your toes, and finding time to keep managing all the requests and updates that come in are taking their toll, especially for a FREE project, but nonetheless, I still do it.
|
||||
|
||||
Mainly bugfixes for the end of year update, promoting some resolutions that have been verified and tested since the last release.
|
||||
|
||||
To get up to speed with the Unity UI Extensions, check out the [Getting Started](https://unity-ui-extensions.github.io/GettingStarted.html) Page.
|
||||
|
||||
> Ways to get in touch:
|
||||
>
|
||||
> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions
|
||||
> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project
|
||||
>
|
||||
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||
|
||||
## Breaking changes
|
||||
|
||||
For customers upgrading from earlier versions of Unity to Unity 2020, please be aware of the Breaking change related to Text Based components. You will need to manually replace any UI using the older ```Text``` component and replace them with ```TextMeshPro``` versions. This is unavoidable due to Unity deprecating the Text component.
|
||||
|
||||
> New users to 2022 are unaffected as all the Editor commands have been updated to use the newer TextMeshPro versions.
|
||||
|
||||
For more details, see the [deprecation notice](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions/428) on GitHub.
|
||||
|
||||
## Added
|
||||
|
||||
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
|
||||
|
||||
## Changed
|
||||
|
||||
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
|
||||
- fix: Resolved an issue where the last line in a flow layout group would overflow the rect bounds.
|
||||
- fix: GetPosition when Segments is null (@victornor)
|
||||
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
|
||||
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
|
||||
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
|
||||
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
|
||||
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
|
||||
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
|
||||
|
||||
## Deprecated
|
||||
|
||||
- All deprecated Text based components now have "obsolete" tags, to avoid breaking code. Note, these do not function in 2022 and above, as Unity have "changed" things. For any affected component, I recommend updating to use TextMeshPro native features.
|
||||
|
||||
- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
|
||||
|
||||
## 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://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
|
||||
|
||||
-----
|
||||
|
||||
## [Controls and extensions listed in this project](https://unity-ui-extensions.github.io/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)
|
||||
>
|
||||
> | [](https://www.tumblr.com/blog/unityuiextensions "UI Line Renderer") | [](https://www.tumblr.com/blog/unityuiextensions "UI Knob") | [](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://unity-ui-extensions.github.io/Controls)
|
||||
|
||||
[Controls](https://unity-ui-extensions.github.io/Controls.html#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|MinMax SLider|
|
||||
|
||||
[Primitives](https://unity-ui-extensions.github.io/Controls.html#primitives)
|
||||
|
||||
|UILineRenderer|UILineTextureRenderer|UICircle|DiamondGraph|UICornerCut|
|
||||
|-|-|-|-|-|
|
||||
|UIPolygon|UISquircle||||
|
||||
|
||||
[Layouts](https://unity-ui-extensions.github.io/Controls.html#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 (obsolete)|Content Scroll Snap Horizontal|Scroller|
|
||||
|ResizePanel|RescalePanel|RescaleDragPanel|||
|
||||
|
||||
[Effects](https://unity-ui-extensions.github.io/Controls.html#effect-components)
|
||||
|
||||
|Best Fit Outline|Curved Text|Gradient|Gradient2|Letter Spacing|
|
||||
|-|-|-|-|-|
|
||||
|NicerOutline|RaycastMask|UIFlippable|UIImageCrop|SoftAlphaMask|
|
||||
|CylinderText|UIParticleSystem|CurlyUI|Shine Effect|Shader Effects|
|
||||
|
||||
> Text Effects are not supported with TextMeshPro due to its architecture, try using the native TextMeshPro effects instead.
|
||||
|
||||
[Additional Components](https://unity-ui-extensions.github.io/Controls.html#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://unity-ui-extensions.github.io/UPMInstallation.html)
|
||||
|
||||
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
|
||||
|
||||
New for 2020, we have added OpenUPM support and the package can be installed using the following [OpenUPM CLI](https://openupm.com/docs/) command:
|
||||
|
||||
```cli
|
||||
`openupm add com.unity.uiextensions`
|
||||
```
|
||||
|
||||
> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation).
|
||||
|
||||
- Unity Package Manager - manual
|
||||
|
||||
Alternatively, you can also add the package manually through the Unity package manager using the scope ```com.unity.uiextensions```, see the [Unity Package Manager docs](https://learn.unity.com/tutorial/the-package-manager) for more information.
|
||||
|
||||
- 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://unity-ui-extensions.github.io/ContributionGuidelines)
|
||||
|
||||
Got a script you want added? Then just fork the [GitHub repository](https://github.com/unity-UI-Extensions/com.unity.uiextensions) 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://raw.githubusercontent.com/Unity-UI-Extensions/com.unity.uiextensions/release/LICENSE.md)
|
||||
|
||||
All scripts conform to the BSD3 license and are free to use / distribute. See the [LICENSE](https://raw.githubusercontent.com/Unity-UI-Extensions/com.unity.uiextensions/release/LICENSE.md) file for more information =
|
||||
|
||||
## [Like what you see?](https://unity-ui-extensions.github.io/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://unity-ui-extensions.github.io/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://unity-ui-extensions.github.io/Downloads)
|
||||
|
||||
Please see the [full downloads list](https://unity-ui-extensions.github.io/Downloads) for all previous releases and their corresponding download links.
|
||||
7
Assets/Packages/com.unity.uiextensions/README.md.meta
Normal file
7
Assets/Packages/com.unity.uiextensions/README.md.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3d1b86f715775647bde436195bbfaf0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Packages/com.unity.uiextensions/Runtime.meta
Normal file
8
Assets/Packages/com.unity.uiextensions/Runtime.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dae773db9d022de4b891928437a0c082
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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,104 @@
|
||||
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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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,104 @@
|
||||
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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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,103 @@
|
||||
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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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,103 @@
|
||||
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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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,107 @@
|
||||
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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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,104 @@
|
||||
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;
|
||||
}
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_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,226 @@
|
||||
///Credit ChoMPHi
|
||||
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
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);
|
||||
}
|
||||
|
||||
private new IEnumerator Start()
|
||||
{
|
||||
base.Start();
|
||||
yield return new WaitForEndOfFrame(); // Wait for the first frame
|
||||
OnValueChanged(this.isOn);
|
||||
}
|
||||
|
||||
#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:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user