commit
e909d73a6a
|
@ -52,16 +52,28 @@ jobs:
|
||||||
unityVersion: 2021.3
|
unityVersion: 2021.3
|
||||||
build-target: WSAPlayer
|
build-target: WSAPlayer
|
||||||
- os: windows
|
- os: windows
|
||||||
unityVersion: 2022.2
|
unityVersion: 2022.3
|
||||||
build-target: Android
|
build-target: Android
|
||||||
- os: macOS
|
- os: macOS
|
||||||
unityVersion: 2022.2
|
unityVersion: 2022.3
|
||||||
build-target: iOS
|
build-target: iOS
|
||||||
- os: windows
|
- os: windows
|
||||||
unityVersion: 2022.2
|
unityVersion: 2022.3
|
||||||
build-target: StandaloneWindows64
|
build-target: StandaloneWindows64
|
||||||
- os: windows
|
- os: windows
|
||||||
unityVersion: 2022.2
|
unityVersion: 2022.3
|
||||||
|
build-target: WSAPlayer
|
||||||
|
- os: windows
|
||||||
|
unityVersion: 2023.1
|
||||||
|
build-target: Android
|
||||||
|
- os: macOS
|
||||||
|
unityVersion: 2023.1
|
||||||
|
build-target: iOS
|
||||||
|
- os: windows
|
||||||
|
unityVersion: 2023.1
|
||||||
|
build-target: StandaloneWindows64
|
||||||
|
- os: windows
|
||||||
|
unityVersion: 2023.1
|
||||||
build-target: WSAPlayer
|
build-target: WSAPlayer
|
||||||
steps:
|
steps:
|
||||||
- name: Script Version
|
- name: Script Version
|
||||||
|
|
73
CHANGELOG.md
73
CHANGELOG.md
|
@ -4,17 +4,18 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
||||||
|
|
||||||
## Release 2.3 - Reanimation - 2022/02/07
|
## Release 2.3.2 - Rejuvenation - 2023/11/26
|
||||||
|
|
||||||
It has been a tough time for all since the last update, but things have been moving steadily along. In the past few months there has been a concerted effort to revamp and update the project ready for Unity 2022, as well as migrating the source repository over to GitHub and refreshing all the things.
|
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.
|
||||||
We hope the new release is better for everyone and we have paid close attention to the editor menus and places to find all the controls for this release.
|
|
||||||
|
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.
|
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:
|
> 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
|
> - [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
|
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||||
|
|
||||||
|
@ -28,64 +29,23 @@ For more details, see the [deprecation notice](https://github.com/Unity-UI-Exten
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Added new FIFO based UI Line Render when dynamic line rendering is needed.
|
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
|
||||||
- Added ResetSelectableHighlight component.
|
|
||||||
- Added SetArc method to UICircle as requested.
|
|
||||||
- Added new UIHorizontalScroller based on UIVerticalScroller.
|
|
||||||
- Added OnHighlightChanged and OnPressChanged events for UI Button.
|
|
||||||
- Added error handling around setting Unity UI Components for Vertical/Horizontal ScrollSnaps.
|
|
||||||
- Added Editor Menu Option to create a Min/Max slider.
|
|
||||||
- Added the ability to set a specific item for combobox controls on start and not just the first.
|
|
||||||
- Added the ability to disable the combo boxes and make them read-only.
|
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
- Refresh FancyScrollView with the latest fixes
|
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
|
||||||
- All Text based components updated to use TextMeshPro from Unity 2022 **Breaking Change**
|
- 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)
|
||||||
- Clean-up and reset pivots on scene start.
|
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
|
||||||
- Merged in feature/improved-ui-highlightable (pull request UILineRenderer - issues with specifying point locations at runtime #123).
|
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
|
||||||
- Merged in fix/rangesliderfix (pull request HorizontalScrollSnap Mask Area doesn't work when content created dynamically #125).
|
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
|
||||||
- Merged in fix/infinitescrollcontentsize (pull request Gradient initialization should be in Awake() #126).
|
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
|
||||||
- Merged in feature/controlTouchUp (pull request UILineRenderer mesh not updating in Editor scene view #127).
|
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
|
||||||
- Upgraded RangeSlider to work in both Horizontal and Vertical setups.
|
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
|
||||||
- Merged in RangeSlider-upgrade. (pull request Newtonsoft.Json.dll conflict #131)
|
|
||||||
- Updated UIVertical scroller to be 2022 compliant.
|
|
||||||
- Updated Curly UI to wait until end of the frame to recalculate positions.
|
|
||||||
- Updated Depth Texture sampler in UI Particles Shaders.
|
|
||||||
- Updated Points to always be an array of 1 when set to nothing for the Line Renderer.
|
|
||||||
- Updated Cooldown button to work with Keyboard input.
|
|
||||||
- Removed unneeded size calculation which caused some issues with mixed content.
|
|
||||||
- Resolved an issue whereby the last row in a flow layout group would not size correctly.
|
|
||||||
- Updated all components using "LayoutGroup" to override their OnDisable.
|
|
||||||
- Updated validation in the new MinMaxSlider.
|
|
||||||
- Updated Editor create options to add the correct Event System Input manager.
|
|
||||||
- Updated initialisation logic to not cause an endless loop in the TabNavigationHelper.
|
|
||||||
- Updated "Action" use to "UnityAction" to avoid Unity issues for DropDowns.
|
|
||||||
- Updated UIVerticalScroller for standards.
|
|
||||||
- Updated ReorderableList/ReorderableListElement to prevent creating a fake object for non-transferable items.
|
|
||||||
- Updated panel drawing for ComboBox controls and added DropdownOffset.
|
|
||||||
- Updated build issue with ReorderableListElement.
|
|
||||||
- Updated NonDrawingGraphic to require a CanvasRender, else it causes an error on run.
|
|
||||||
|
|
||||||
## Deprecated
|
## Deprecated
|
||||||
|
|
||||||
- Marked ScrollPositionController as Obsolete, users should use the new Scoller.
|
- 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.
|
||||||
- BestFitOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
|
|
||||||
- NicerOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
|
|
||||||
- Marked TileSizeFitter as obsolete as Unity has made this unworkable.
|
|
||||||
|
|
||||||
## Fixed
|
|
||||||
|
|
||||||
- Resolved issues with DisplayAbove and using a 0 ItemsToDisplay for ComboBox controls.
|
|
||||||
- Resolved startup issue that prevented the control from being used (Unity changed the start order in some instances), this was causing null reference issues with comboboxes.
|
|
||||||
- Patch fix for UILineRenderer.
|
|
||||||
- Resolves issue where the lower range value would become stuck when moving.
|
|
||||||
- Updated Infinite scroll to work with content of different sizes.
|
|
||||||
- Updated Dropdown list to NOT resize text Rect on draw.
|
|
||||||
- Revised the Curly UI fix as it was preventing the graphic from being updated in the scene view.
|
|
||||||
- Cleanup and ensuring the UIParticleSystem is disposed in onDestroy correctly.
|
|
||||||
- Clean up range slider unused variables.
|
|
||||||
|
|
||||||
## Additional Notes
|
## Additional Notes
|
||||||
|
|
||||||
|
@ -98,6 +58,7 @@ New for 2020, we have added OpenUPM support and the package can be installed usi
|
||||||
```cli
|
```cli
|
||||||
`openupm add com.unity.uiextensions`
|
`openupm add com.unity.uiextensions`
|
||||||
```
|
```
|
||||||
|
|
||||||
> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation).
|
> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation).
|
||||||
|
|
||||||
- Unity Package Manager - manual
|
- Unity Package Manager - manual
|
||||||
|
|
|
@ -42,17 +42,18 @@ This version of the Unity UI Extensions is compatible with the following version
|
||||||
|
|
||||||
## [Release Notes](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
|
## [Release Notes](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
|
||||||
|
|
||||||
## Release 2.3 - Reanimation - 2022/02/07
|
## Release 2.3.2 - Rejuvenation - 2023/11/26
|
||||||
|
|
||||||
It has been a tough time for all since the last update, but things have been moving steadily along. In the past few months there has been a concerted effort to revamp and update the project ready for Unity 2022, as well as migrating the source repository over to GitHub and refreshing all the things.
|
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.
|
||||||
We hope the new release is better for everyone and we have paid close attention to the editor menus and places to find all the controls for this release.
|
|
||||||
|
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.
|
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:
|
> 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
|
> - [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
|
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||||
|
|
||||||
|
@ -66,64 +67,23 @@ For more details, see the [deprecation notice](https://github.com/Unity-UI-Exten
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Added new FIFO based UI Line Render when dynamic line rendering is needed.
|
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
|
||||||
- Added ResetSelectableHighlight component.
|
|
||||||
- Added SetArc method to UICircle as requested.
|
|
||||||
- Added new UIHorizontalScroller based on UIVerticalScroller.
|
|
||||||
- Added OnHighlightChanged and OnPressChanged events for UI Button.
|
|
||||||
- Added error handling around setting Unity UI Components for Vertical/Horizontal ScrollSnaps.
|
|
||||||
- Added Editor Menu Option to create a Min/Max slider.
|
|
||||||
- Added the ability to set a specific item for combobox controls on start and not just the first.
|
|
||||||
- Added the ability to disable the combo boxes and make them read-only.
|
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
- Refresh FancyScrollView with the latest fixes
|
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
|
||||||
- All Text based components updated to use TextMeshPro from Unity 2022 **Breaking Change**
|
- 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)
|
||||||
- Clean-up and reset pivots on scene start.
|
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
|
||||||
- Merged in feature/improved-ui-highlightable (pull request UILineRenderer - issues with specifying point locations at runtime #123).
|
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
|
||||||
- Merged in fix/ragesliderfix (pull request HorizontalScrollSnap Mask Area doesn't work when content created dynamically #125).
|
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
|
||||||
- Merged in fix/infinitescrollcontentsize (pull request Gradient initialization should be in Awake() #126).
|
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
|
||||||
- Merged in feature/controlTouchUp (pull request UILineRenderer mesh not updating in Editor scene view #127).
|
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
|
||||||
- Upgraded RangeSlider to work in both Horizontal and Vertical setups.
|
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
|
||||||
- Merged in RangeSlider-upgrade. (pull request Newtonsoft.Json.dll conflict #131)
|
|
||||||
- Updated UIVertical scroller to be 2022 compliant.
|
|
||||||
- Updated Curly UI to wait until end of the frame to recalculate positions.
|
|
||||||
- Updated Depth Texture sampler in UI Particles Shaders.
|
|
||||||
- Updated Points to always be an array of 1 when set to nothing for the Line Renderer.
|
|
||||||
- Updated Cooldown button to work with Keyboard input.
|
|
||||||
- Removed unneeded size calculation which caused some issues with mixed content.
|
|
||||||
- Resolved an issue whereby the last row in a flow layout group would not size correctly.
|
|
||||||
- Updated all components using "LayoutGroup" to override their OnDisable.
|
|
||||||
- Updated validation in the new MinMaxSlider.
|
|
||||||
- Updated Editor create options to add the correct Event System Input manager.
|
|
||||||
- Updated initialisation logic to not cause an endless loop in the TabNavigationHelper.
|
|
||||||
- Updated "Action" use to "UnityAction" to avoid Unity issues for DropDowns.
|
|
||||||
- Updated UIVerticalScroller for standards.
|
|
||||||
- Updated ReorderableList/ReorderableListElement to prevent creating a fake object for non-transferable items.
|
|
||||||
- Updated panel drawing for ComboBox controls and added DropdownOffset.
|
|
||||||
- Updated build issue with ReorderableListElement.
|
|
||||||
- Updated NonDrawingGraphic to require a CanvasRender, else it causes an error on run.
|
|
||||||
|
|
||||||
## Deprecated
|
## Deprecated
|
||||||
|
|
||||||
- Marked ScrollPositionController as Obsolete, users should use the new Scoller.
|
- 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.
|
||||||
- BestFitOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
|
|
||||||
- NicerOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
|
|
||||||
- Marked TileSizeFitter as obsolete as Unity has made this unworkable.
|
|
||||||
|
|
||||||
## Fixed
|
|
||||||
|
|
||||||
- Resolved issues with DisplayAbove and using a 0 ItemsToDisplay for ComboBox controls.
|
|
||||||
- Resolved startup issue that prevented the control from being used (Unity changed the start order in some instances), this was causing null reference issues with comboboxes.
|
|
||||||
- Patch fix for UILineRenderer.
|
|
||||||
- Resolves issue where the lower range value would become stuck when moving.
|
|
||||||
- Updated Infinite scroll to work with content of different sizes.
|
|
||||||
- Updated Dropdown list to NOT resize text Rect on draw.
|
|
||||||
- Revised the Curly UI fix as it was preventing the graphic from being updated in the scene view.
|
|
||||||
- Cleanup and ensuring the UIParticleSystem is disposed in onDestroy correctly.
|
|
||||||
- Clean up range slider unused variables.
|
|
||||||
|
|
||||||
- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
|
- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void ObtainCanvasGroups()
|
void ObtainCanvasGroups()
|
||||||
{
|
{
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
canvasGroups = GameObject.FindObjectsByType<CanvasGroup>(FindObjectsSortMode.None);
|
||||||
|
#else
|
||||||
canvasGroups = GameObject.FindObjectsOfType<CanvasGroup>();
|
canvasGroups = GameObject.FindObjectsOfType<CanvasGroup>();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnGUI()
|
void OnGUI()
|
||||||
|
|
|
@ -159,7 +159,11 @@ namespace UnityEditor.UI
|
||||||
|
|
||||||
private static void CreateEventSystem(bool select, GameObject parent)
|
private static void CreateEventSystem(bool select, GameObject parent)
|
||||||
{
|
{
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
var esys = Object.FindFirstObjectByType<EventSystem>();
|
||||||
|
#else
|
||||||
var esys = Object.FindObjectOfType<EventSystem>();
|
var esys = Object.FindObjectOfType<EventSystem>();
|
||||||
|
#endif
|
||||||
if (esys == null)
|
if (esys == null)
|
||||||
{
|
{
|
||||||
var eventSystem = new GameObject("EventSystem");
|
var eventSystem = new GameObject("EventSystem");
|
||||||
|
@ -191,7 +195,11 @@ namespace UnityEditor.UI
|
||||||
return canvas.gameObject;
|
return canvas.gameObject;
|
||||||
|
|
||||||
// No canvas in selection or its parents? Then use just any canvas..
|
// No canvas in selection or its parents? Then use just any canvas..
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
canvas = Object.FindFirstObjectByType<Canvas>();
|
||||||
|
#else
|
||||||
canvas = Object.FindObjectOfType(typeof(Canvas)) as Canvas;
|
canvas = Object.FindObjectOfType(typeof(Canvas)) as Canvas;
|
||||||
|
#endif
|
||||||
if (canvas != null && canvas.gameObject.activeInHierarchy)
|
if (canvas != null && canvas.gameObject.activeInHierarchy)
|
||||||
return canvas.gameObject;
|
return canvas.gameObject;
|
||||||
|
|
||||||
|
@ -1121,7 +1129,7 @@ namespace UnityEditor.UI
|
||||||
mainButtonRT.anchorMin = Vector2.zero;
|
mainButtonRT.anchorMin = Vector2.zero;
|
||||||
mainButtonRT.anchorMax = Vector2.one;
|
mainButtonRT.anchorMax = Vector2.one;
|
||||||
mainButtonRT.sizeDelta = Vector2.zero;
|
mainButtonRT.sizeDelta = Vector2.zero;
|
||||||
Events.UnityEventTools.AddBoolPersistentListener(mainButton.GetComponent<Button>().onClick, new UnityEngine.Events.UnityAction<bool>(dropDownList.ToggleDropdownPanel), true);
|
Events.UnityEventTools.AddPersistentListener(mainButton.GetComponent<Button>().onClick, dropDownList.ToggleDropdownPanel);
|
||||||
var mainButtonText = mainButton.GetComponentInChildren<Text>();
|
var mainButtonText = mainButton.GetComponentInChildren<Text>();
|
||||||
mainButtonText.alignment = TextAnchor.MiddleLeft;
|
mainButtonText.alignment = TextAnchor.MiddleLeft;
|
||||||
mainButtonText.text = "Select Item...";
|
mainButtonText.text = "Select Item...";
|
||||||
|
@ -1149,7 +1157,7 @@ namespace UnityEditor.UI
|
||||||
overlayRT.sizeDelta = new Vector2(0f, 1f);
|
overlayRT.sizeDelta = new Vector2(0f, 1f);
|
||||||
overlayRT.pivot = new Vector2(0f, 1f);
|
overlayRT.pivot = new Vector2(0f, 1f);
|
||||||
overlay.AddComponent<Image>().color = new Color(0.243f, 0.871f, 0f, 0f);
|
overlay.AddComponent<Image>().color = new Color(0.243f, 0.871f, 0f, 0f);
|
||||||
Events.UnityEventTools.AddBoolPersistentListener(overlay.AddComponent<Button>().onClick, new UnityEngine.Events.UnityAction<bool>(dropDownList.ToggleDropdownPanel), true);
|
Events.UnityEventTools.AddPersistentListener(overlay.AddComponent<Button>().onClick, dropDownList.ToggleDropdownPanel);
|
||||||
//Overlay Scroll Panel
|
//Overlay Scroll Panel
|
||||||
var overlayScrollPanelRT = overlayScrollPanel.GetComponent<RectTransform>();
|
var overlayScrollPanelRT = overlayScrollPanel.GetComponent<RectTransform>();
|
||||||
overlayScrollPanelRT.position += new Vector3(0, -cbbRT.sizeDelta.y, 0);
|
overlayScrollPanelRT.position += new Vector3(0, -cbbRT.sizeDelta.y, 0);
|
||||||
|
@ -1257,7 +1265,11 @@ namespace UnityEditor.UI
|
||||||
|
|
||||||
private static void CreateToolTipItem(bool select, GameObject parent)
|
private static void CreateToolTipItem(bool select, GameObject parent)
|
||||||
{
|
{
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
var btti = Object.FindFirstObjectByType<BoundTooltipItem>();
|
||||||
|
#else
|
||||||
var btti = Object.FindObjectOfType<BoundTooltipItem>();
|
var btti = Object.FindObjectOfType<BoundTooltipItem>();
|
||||||
|
#endif
|
||||||
if (btti == null)
|
if (btti == null)
|
||||||
{
|
{
|
||||||
var boundTooltipItem = CreateUIObject("ToolTipItem", parent.GetComponentInParent<Canvas>().gameObject);
|
var boundTooltipItem = CreateUIObject("ToolTipItem", parent.GetComponentInParent<Canvas>().gameObject);
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
public static class uGUITools
|
public static class uGUITools
|
||||||
{
|
{
|
||||||
[MenuItem("uGUI/Anchors to Corners %[")]
|
[MenuItem("Tools/UnityUIExtensions/Anchors to Corners %[")]
|
||||||
static void AnchorsToCorners()
|
static void AnchorsToCorners()
|
||||||
{
|
{
|
||||||
if (Selection.transforms == null || Selection.transforms.Length == 0)
|
if (Selection.transforms == null || Selection.transforms.Length == 0)
|
||||||
|
@ -37,7 +37,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
Undo.CollapseUndoOperations(undoGroup);
|
Undo.CollapseUndoOperations(undoGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("uGUI/Corners to Anchors %]")]
|
[MenuItem("Tools/UnityUIExtensions/Corners to Anchors %]")]
|
||||||
static void CornersToAnchors()
|
static void CornersToAnchors()
|
||||||
{
|
{
|
||||||
if (Selection.transforms == null || Selection.transforms.Length == 0)
|
if (Selection.transforms == null || Selection.transforms.Length == 0)
|
||||||
|
@ -60,13 +60,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
Undo.CollapseUndoOperations(undoGroup);
|
Undo.CollapseUndoOperations(undoGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("uGUI/Mirror Horizontally Around Anchors %;")]
|
[MenuItem("Tools/UnityUIExtensions/Mirror Horizontally Around Anchors %;")]
|
||||||
static void MirrorHorizontallyAnchors()
|
static void MirrorHorizontallyAnchors()
|
||||||
{
|
{
|
||||||
MirrorHorizontally(false);
|
MirrorHorizontally(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("uGUI/Mirror Horizontally Around Parent Center %:")]
|
[MenuItem("Tools/UnityUIExtensions/Mirror Horizontally Around Parent Center %:")]
|
||||||
static void MirrorHorizontallyParent()
|
static void MirrorHorizontallyParent()
|
||||||
{
|
{
|
||||||
MirrorHorizontally(true);
|
MirrorHorizontally(true);
|
||||||
|
@ -96,13 +96,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("uGUI/Mirror Vertically Around Anchors %'")]
|
[MenuItem("Tools/UnityUIExtensions/Mirror Vertically Around Anchors %'")]
|
||||||
static void MirrorVerticallyAnchors()
|
static void MirrorVerticallyAnchors()
|
||||||
{
|
{
|
||||||
MirrorVertically(false);
|
MirrorVertically(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("uGUI/Mirror Vertically Around Parent Center %\"")]
|
[MenuItem("Tools/UnityUIExtensions/Mirror Vertically Around Parent Center %\"")]
|
||||||
static void MirrorVerticallyParent()
|
static void MirrorVerticallyParent()
|
||||||
{
|
{
|
||||||
MirrorVertically(true);
|
MirrorVertically(true);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2b2dba57650838e285c3336b4a26847931462570
|
Subproject commit 1cfaa42b3fcc454950009cc03a8280fd18e38197
|
87
README.md
87
README.md
|
@ -4,6 +4,11 @@ This is an extension project for the new Unity UI system which can be found at:
|
||||||
|
|
||||||
> [Check out the control demos on our Tumblr page](https://unityuiextensions.tumblr.com/)
|
> [Check out the control demos on our Tumblr page](https://unityuiextensions.tumblr.com/)
|
||||||
|
|
||||||
|
[![openupm](https://img.shields.io/npm/v/com.unity.uiextensions?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.unity.uiextensions/)
|
||||||
|
[![Publish main branch and increment version](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/main-publish.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/main-publish.yml)
|
||||||
|
[![Publish development branch on Merge](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-publish.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-publish.yml)
|
||||||
|
[![Build and test UPM packages for platforms, all branches except main](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-buildandtestupmrelease.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-buildandtestupmrelease.yml)
|
||||||
|
|
||||||
## [Intro](https://unity-ui-extensions.github.io/GettingStarted)
|
## [Intro](https://unity-ui-extensions.github.io/GettingStarted)
|
||||||
|
|
||||||
For more info, here's a little introduction video for the project:
|
For more info, here's a little introduction video for the project:
|
||||||
|
@ -69,17 +74,18 @@ To get started with the project, here's a little guide:
|
||||||
|
|
||||||
## [Updates:](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
|
## [Updates:](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
|
||||||
|
|
||||||
## Release 2.3 - Reanimation - 2022/02/07
|
## Release 2.3.2 - Rejuvenation - 2023/11/26
|
||||||
|
|
||||||
It has been a tough time for all since the last update, but things have been moving steadily along. In the past few months there has been a concerted effort to revamp and update the project ready for Unity 2022, as well as migrating the source repository over to GitHub and refreshing all the things.
|
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.
|
||||||
We hope the new release is better for everyone and we have paid close attention to the editor menus and places to find all the controls for this release.
|
|
||||||
|
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.
|
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:
|
> 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
|
> - [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
|
> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D
|
||||||
|
|
||||||
|
@ -93,66 +99,25 @@ For more details, see the [deprecation notice](https://github.com/Unity-UI-Exten
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Added new FIFO based UI Line Render when dynamic line rendering is needed.
|
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
|
||||||
- Added ResetSelectableHighlight component.
|
|
||||||
- Added SetArc method to UICircle as requested.
|
|
||||||
- Added new UIHorizontalScroller based on UIVerticalScroller.
|
|
||||||
- Added OnHighlightChanged and OnPressChanged events for UI Button.
|
|
||||||
- Added error handling around setting Unity UI Components for Vertical/Horizontal ScrollSnaps.
|
|
||||||
- Added Editor Menu Option to create a Min/Max slider.
|
|
||||||
- Added the ability to set a specific item for combobox controls on start and not just the first.
|
|
||||||
- Added the ability to disable the combo boxes and make them read-only.
|
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
- Refresh FancyScrollView with the latest fixes
|
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
|
||||||
- All Text based components updated to use TextMeshPro from Unity 2022 **Breaking Change**
|
- 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)
|
||||||
- Clean-up and reset pivots on scene start.
|
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
|
||||||
- Merged in feature/improved-ui-highlightable (pull request UILineRenderer - issues with specifying point locations at runtime #123).
|
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
|
||||||
- Merged in fix/ragesliderfix (pull request HorizontalScrollSnap Mask Area doesn't work when content created dynamically #125).
|
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
|
||||||
- Merged in fix/infinitescrollcontentsize (pull request Gradient initialization should be in Awake() #126).
|
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
|
||||||
- Merged in feature/controlTouchUp (pull request UILineRenderer mesh not updating in Editor scene view #127).
|
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
|
||||||
- Upgraded RangeSlider to work in both Horizontal and Vertical setups.
|
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
|
||||||
- Merged in RangeSlider-upgrade. (pull request Newtonsoft.Json.dll conflict #131)
|
|
||||||
- Updated UIVertical scroller to be 2022 compliant.
|
|
||||||
- Updated Curly UI to wait until end of the frame to recalculate positions.
|
|
||||||
- Updated Depth Texture sampler in UI Particles Shaders.
|
|
||||||
- Updated Points to always be an array of 1 when set to nothing for the Line Renderer.
|
|
||||||
- Updated Cooldown button to work with Keyboard input.
|
|
||||||
- Removed unneeded size calculation which caused some issues with mixed content.
|
|
||||||
- Resolved an issue whereby the last row in a flow layout group would not size correctly.
|
|
||||||
- Updated all components using "LayoutGroup" to override their OnDisable.
|
|
||||||
- Updated validation in the new MinMaxSlider.
|
|
||||||
- Updated Editor create options to add the correct Event System Input manager.
|
|
||||||
- Updated initialisation logic to not cause an endless loop in the TabNavigationHelper.
|
|
||||||
- Updated "Action" use to "UnityAction" to avoid Unity issues for DropDowns.
|
|
||||||
- Updated UIVerticalScroller for standards.
|
|
||||||
- Updated ReorderableList/ReorderableListElement to prevent creating a fake object for non-transferable items.
|
|
||||||
- Updated panel drawing for ComboBox controls and added DropdownOffset.
|
|
||||||
- Updated build issue with ReorderableListElement.
|
|
||||||
- Updated NonDrawingGraphic to require a CanvasRender, else it causes an error on run.
|
|
||||||
|
|
||||||
## Deprecated
|
## Deprecated
|
||||||
|
|
||||||
- Marked ScrollPositionController as Obsolete, users should use the new Scoller.
|
- 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.
|
||||||
- BestFitOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
|
|
||||||
- NicerOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
|
|
||||||
- Marked TileSizeFitter as obsolete as Unity has made this unworkable.
|
|
||||||
|
|
||||||
## Fixed
|
- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
|
||||||
|
|
||||||
- Resolved issues with DisplayAbove and using a 0 ItemsToDisplay for ComboBox controls.
|
|
||||||
- Resolved startup issue that prevented the control from being used (Unity changed the start order in some instances), this was causing null reference issues with comboboxes.
|
|
||||||
- Patch fix for UILineRenderer.
|
|
||||||
- Resolves issue where the lower range value would become stuck when moving.
|
|
||||||
- Updated Infinite scroll to work with content of different sizes.
|
|
||||||
- Updated Dropdown list to NOT resize text Rect on draw.
|
|
||||||
- Revised the Curly UI fix as it was preventing the graphic from being updated in the scene view.
|
|
||||||
- Cleanup and ensuring the UIParticleSystem is disposed in onDestroy correctly.
|
|
||||||
- Clean up range slider unused variables.
|
|
||||||
|
|
||||||
* [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
|
|
||||||
|
|
||||||
## Upgrade Notes
|
## Upgrade Notes
|
||||||
|
|
||||||
|
@ -209,6 +174,8 @@ There are almost 70+ extension controls / effect and other utilities in the proj
|
||||||
|NicerOutline|RaycastMask|UIFlippable|UIImageCrop|SoftAlphaMask|
|
|NicerOutline|RaycastMask|UIFlippable|UIImageCrop|SoftAlphaMask|
|
||||||
|CylinderText|UIParticleSystem|CurlyUI|Shine Effect|Shader Effects|
|
|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)
|
[Additional Components](https://unity-ui-extensions.github.io/Controls.html#additional-components)
|
||||||
|
|
||||||
|ReturnKeyTrigger|TabNavigation|uGUITools|ScrollRectTweener|ScrollRectLinker|
|
|ReturnKeyTrigger|TabNavigation|uGUITools|ScrollRectTweener|ScrollRectLinker|
|
||||||
|
@ -249,9 +216,9 @@ Got a script you want added? Then just fork the [GitHub repository](https://gith
|
||||||
|
|
||||||
Just ensure:
|
Just ensure:
|
||||||
|
|
||||||
* The header of the script should match the standard used in all scripts.
|
- 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.
|
- 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)
|
- (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)
|
## [License](https://raw.githubusercontent.com/Unity-UI-Extensions/com.unity.uiextensions/release/LICENSE.md)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using UnityEngine.UI.Extensions.Tweens;
|
using UnityEngine.UI.Extensions.Tweens;
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
|
@ -45,6 +46,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
this.onValueChanged.AddListener(OnValueChanged);
|
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
|
#if UNITY_EDITOR
|
||||||
protected override void OnValidate()
|
protected override void OnValidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
///Credit perchik
|
///Credit perchik
|
||||||
///Sourced from - http://forum.unity3d.com/threads/receive-onclick-event-and-pass-it-on-to-lower-ui-elements.293642/
|
///Sourced from - http://forum.unity3d.com/threads/receive-onclick-event-and-pass-it-on-to-lower-ui-elements.293642/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -132,6 +131,9 @@ namespace UnityEngine.UI.Extensions
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class SelectionValidityChangedEvent : Events.UnityEvent<bool> { }
|
public class SelectionValidityChangedEvent : Events.UnityEvent<bool> { }
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class ItemSelectedEvent : Events.UnityEvent<string> { }
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
|
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
|
||||||
|
|
||||||
|
@ -142,6 +144,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
public SelectionValidityChangedEvent OnSelectionValidityChanged;
|
public SelectionValidityChangedEvent OnSelectionValidityChanged;
|
||||||
// fires in both cases
|
// fires in both cases
|
||||||
public SelectionChangedEvent OnSelectionChanged;
|
public SelectionChangedEvent OnSelectionChanged;
|
||||||
|
// fires when an item is clicked
|
||||||
|
public ItemSelectedEvent OnItemSelected;
|
||||||
// fires when item is changed;
|
// fires when item is changed;
|
||||||
public ControlDisabledEvent OnControlDisabled;
|
public ControlDisabledEvent OnControlDisabled;
|
||||||
|
|
||||||
|
@ -359,10 +363,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
private void OnItemClicked(string item)
|
private void OnItemClicked(string item)
|
||||||
{
|
{
|
||||||
//Debug.Log("item " + item + " clicked");
|
|
||||||
Text = item;
|
Text = item;
|
||||||
_mainInput.text = Text;
|
_mainInput.text = Text;
|
||||||
ToggleDropdownPanel(true);
|
ToggleDropdownPanel(true);
|
||||||
|
OnItemSelected?.Invoke(Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RedrawPanel()
|
private void RedrawPanel()
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
public void SelectItemIndex(int index)
|
public void SelectItemIndex(int index)
|
||||||
{
|
{
|
||||||
ToggleDropdownPanel(false);
|
ToggleDropdownPanel();
|
||||||
OnItemClicked(index);
|
OnItemClicked(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (indx != _selectedIndex && OnSelectionChanged != null) OnSelectionChanged.Invoke(indx);
|
if (indx != _selectedIndex && OnSelectionChanged != null) OnSelectionChanged.Invoke(indx);
|
||||||
|
|
||||||
_selectedIndex = indx;
|
_selectedIndex = indx;
|
||||||
ToggleDropdownPanel(true);
|
ToggleDropdownPanel();
|
||||||
UpdateSelected();
|
UpdateSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleDropdownPanel(false);
|
ToggleDropdownPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -13,7 +13,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
foreach (var list in FindObjectsByType<ReorderableList>(FindObjectsSortMode.None))
|
||||||
|
#else
|
||||||
foreach (var list in FindObjectsOfType<ReorderableList>())
|
foreach (var list in FindObjectsOfType<ReorderableList>())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
list.OnElementDropped.AddListener(ElementDropped);
|
list.OnElementDropped.AddListener(ElementDropped);
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
// If we do not have a group of selectables already set, we'll just loop through every object that's a monobehaviour, and look for selectable interfaces in them
|
// If we do not have a group of selectables already set, we'll just loop through every object that's a monobehaviour, and look for selectable interfaces in them
|
||||||
if (selectableGroup == null) {
|
if (selectableGroup == null) {
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
behavioursToGetSelectionsFrom = GameObject.FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None);
|
||||||
|
#else
|
||||||
behavioursToGetSelectionsFrom = GameObject.FindObjectsOfType<MonoBehaviour>();
|
behavioursToGetSelectionsFrom = GameObject.FindObjectsOfType<MonoBehaviour>();
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
behavioursToGetSelectionsFrom = selectableGroup;
|
behavioursToGetSelectionsFrom = selectableGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,19 @@
|
||||||
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
|
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
|
||||||
/// NOT supported in Unity 2022
|
/// NOT supported in Unity 2022
|
||||||
|
|
||||||
|
using System;
|
||||||
#if !UNITY_2022_1_OR_NEWER
|
#if !UNITY_2022_1_OR_NEWER
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
|
#if UNITY_2022_1_OR_NEWER
|
||||||
|
[Obsolete("BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
|
||||||
|
public class BestFitOutline : Shadow
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#else
|
||||||
[AddComponentMenu("UI/Effects/Extensions/BestFit Outline")]
|
[AddComponentMenu("UI/Effects/Extensions/BestFit Outline")]
|
||||||
public class BestFitOutline : Shadow
|
public class BestFitOutline : Shadow
|
||||||
{
|
{
|
||||||
|
@ -61,5 +70,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
|
@ -1,13 +1,18 @@
|
||||||
/// Credit Breyer
|
|
||||||
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
|
using System;
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
#if UNITY_2022_1_OR_NEWER
|
#if UNITY_2022_1_OR_NEWER
|
||||||
[RequireComponent(typeof(TMPro.TMP_Text))]
|
[Obsolete("CurvedText is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
|
||||||
|
public class CurvedText : BaseMeshEffect
|
||||||
|
{
|
||||||
|
public override void ModifyMesh(VertexHelper vh)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
[RequireComponent(typeof(Text))]
|
[RequireComponent(typeof(Text))]
|
||||||
#endif
|
|
||||||
[RequireComponent(typeof(RectTransform))]
|
[RequireComponent(typeof(RectTransform))]
|
||||||
[AddComponentMenu("UI/Effects/Extensions/Curved Text")]
|
[AddComponentMenu("UI/Effects/Extensions/Curved Text")]
|
||||||
public class CurvedText : BaseMeshEffect
|
public class CurvedText : BaseMeshEffect
|
||||||
|
@ -86,4 +91,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -1,14 +1,21 @@
|
||||||
/// adaption for cylindrical bending by herbst
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
/// adaption for cylindrical bending by herbst
|
||||||
/// Credit Breyer
|
/// Credit Breyer
|
||||||
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
|
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
#if UNITY_2022_1_OR_NEWER
|
#if UNITY_2022_1_OR_NEWER
|
||||||
[RequireComponent(typeof(TMPro.TMP_Text))]
|
[Obsolete("CylinderText is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
|
||||||
|
public class CylinderText : BaseMeshEffect
|
||||||
|
{
|
||||||
|
public override void ModifyMesh(VertexHelper vh)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
[RequireComponent(typeof(Text))]
|
[RequireComponent(typeof(Text))]
|
||||||
#endif
|
|
||||||
[RequireComponent(typeof(RectTransform))]
|
[RequireComponent(typeof(RectTransform))]
|
||||||
[AddComponentMenu("UI/Effects/Extensions/Cylinder Text")]
|
[AddComponentMenu("UI/Effects/Extensions/Cylinder Text")]
|
||||||
public class CylinderText : BaseMeshEffect
|
public class CylinderText : BaseMeshEffect
|
||||||
|
@ -56,4 +63,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
/// Credit Deeperbeige
|
/*
|
||||||
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
|
|
||||||
/*
|
|
||||||
|
|
||||||
Produces an simple tracking/letter-spacing effect on UI Text components.
|
Produces an simple tracking/letter-spacing effect on UI Text components.
|
||||||
|
|
||||||
|
@ -40,11 +38,25 @@ use HTML-like tags in your text. Try it out, you'll see what I mean. It doesn't
|
||||||
break down entirely, but it doesn't really do what you'd want either.
|
break down entirely, but it doesn't really do what you'd want either.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
#if !UNITY_2022_1_OR_NEWER
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
/// Credit Deeperbeige
|
||||||
|
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
|
#if UNITY_2022_1_OR_NEWER
|
||||||
|
[Obsolete("LetterSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
|
||||||
|
public class LetterSpacing : BaseMeshEffect
|
||||||
|
{
|
||||||
|
public override void ModifyMesh(VertexHelper vh)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
[AddComponentMenu("UI/Effects/Extensions/Letter Spacing")]
|
[AddComponentMenu("UI/Effects/Extensions/Letter Spacing")]
|
||||||
///Summary
|
///Summary
|
||||||
/// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
|
/// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
|
||||||
|
@ -55,13 +67,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
protected LetterSpacing() { }
|
protected LetterSpacing() { }
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
protected override void OnValidate()
|
protected override void OnValidate()
|
||||||
{
|
{
|
||||||
spacing = m_spacing;
|
spacing = m_spacing;
|
||||||
base.OnValidate();
|
base.OnValidate();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public float spacing
|
public float spacing
|
||||||
{
|
{
|
||||||
|
@ -74,6 +86,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Awake()
|
||||||
|
{
|
||||||
|
Debug.Log($"Awake, [{m_spacing}]");
|
||||||
|
}
|
||||||
|
|
||||||
public override void ModifyMesh(VertexHelper vh)
|
public override void ModifyMesh(VertexHelper vh)
|
||||||
{
|
{
|
||||||
if (! IsActive()) return;
|
if (! IsActive()) return;
|
||||||
|
@ -81,11 +98,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
List<UIVertex> verts = new List<UIVertex>();
|
List<UIVertex> verts = new List<UIVertex>();
|
||||||
vh.GetUIVertexStream(verts);
|
vh.GetUIVertexStream(verts);
|
||||||
|
|
||||||
#if UNITY_2022_1_OR_NEWER
|
|
||||||
var text = GetComponent<TMPro.TMP_Text>();
|
|
||||||
#else
|
|
||||||
var text = GetComponent<Text>();
|
var text = GetComponent<Text>();
|
||||||
#endif
|
|
||||||
if (text == null)
|
if (text == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("LetterSpacing: Missing Text component");
|
Debug.LogWarning("LetterSpacing: Missing Text component");
|
||||||
|
@ -98,28 +112,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
float alignmentFactor = 0;
|
float alignmentFactor = 0;
|
||||||
int glyphIdx = 0;
|
int glyphIdx = 0;
|
||||||
|
|
||||||
#if UNITY_2022_1_OR_NEWER
|
|
||||||
switch (text.alignment)
|
|
||||||
{
|
|
||||||
case TMPro.TextAlignmentOptions.BottomLeft:
|
|
||||||
case TMPro.TextAlignmentOptions.MidlineLeft:
|
|
||||||
case TMPro.TextAlignmentOptions.TopLeft:
|
|
||||||
alignmentFactor = 0f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TMPro.TextAlignmentOptions.BottomJustified:
|
|
||||||
case TMPro.TextAlignmentOptions.MidlineJustified:
|
|
||||||
case TMPro.TextAlignmentOptions.TopJustified:
|
|
||||||
alignmentFactor = 0.5f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TMPro.TextAlignmentOptions.BottomRight:
|
|
||||||
case TMPro.TextAlignmentOptions.MidlineRight:
|
|
||||||
case TMPro.TextAlignmentOptions.TopRight:
|
|
||||||
alignmentFactor = 1f;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
switch (text.alignment)
|
switch (text.alignment)
|
||||||
{
|
{
|
||||||
case TextAnchor.LowerLeft:
|
case TextAnchor.LowerLeft:
|
||||||
|
@ -140,7 +132,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
alignmentFactor = 1f;
|
alignmentFactor = 1f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int lineIdx=0; lineIdx < lines.Length; lineIdx++)
|
for (int lineIdx=0; lineIdx < lines.Length; lineIdx++)
|
||||||
{
|
{
|
||||||
|
@ -192,4 +183,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
vh.AddUIVertexTriangleStream(verts);
|
vh.AddUIVertexTriangleStream(verts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -1,5 +1,3 @@
|
||||||
/// Credit herbst / derived from LetterSpacing by Deeperbeige
|
|
||||||
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Produces an simple mono-spacing effect on UI Text components.
|
Produces an simple mono-spacing effect on UI Text components.
|
||||||
|
@ -40,17 +38,27 @@ use HTML-like tags in your text. Try it out, you'll see what I mean. It doesn't
|
||||||
break down entirely, but it doesn't really do what you'd want either.
|
break down entirely, but it doesn't really do what you'd want either.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
#if !UNITY_2022_1_OR_NEWER
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
/// Credit herbst / derived from LetterSpacing by Deeperbeige
|
||||||
|
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
[AddComponentMenu("UI/Effects/Extensions/Mono Spacing")]
|
|
||||||
#if UNITY_2022_1_OR_NEWER
|
#if UNITY_2022_1_OR_NEWER
|
||||||
[RequireComponent(typeof(TMPro.TMP_Text))]
|
[Obsolete("MonoSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
|
||||||
|
public class MonoSpacing : BaseMeshEffect
|
||||||
|
{
|
||||||
|
public override void ModifyMesh(VertexHelper vh)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
[AddComponentMenu("UI/Effects/Extensions/Mono Spacing")]
|
||||||
[RequireComponent(typeof(Text))]
|
[RequireComponent(typeof(Text))]
|
||||||
#endif
|
|
||||||
[RequireComponent(typeof(RectTransform))]
|
[RequireComponent(typeof(RectTransform))]
|
||||||
///Summary
|
///Summary
|
||||||
/// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
|
/// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
|
||||||
|
@ -62,21 +70,15 @@ namespace UnityEngine.UI.Extensions
|
||||||
public bool UseHalfCharWidth = false;
|
public bool UseHalfCharWidth = false;
|
||||||
|
|
||||||
private RectTransform rectTransform;
|
private RectTransform rectTransform;
|
||||||
#if UNITY_2022_1_OR_NEWER
|
|
||||||
private TMPro.TMP_Text text;
|
|
||||||
#else
|
|
||||||
private Text text;
|
private Text text;
|
||||||
#endif
|
|
||||||
|
|
||||||
protected MonoSpacing() { }
|
protected MonoSpacing() { }
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
#if UNITY_2022_1_OR_NEWER
|
|
||||||
text = GetComponent<TMPro.TMP_Text>();
|
|
||||||
#else
|
|
||||||
text = GetComponent<Text>();
|
text = GetComponent<Text>();
|
||||||
#endif
|
|
||||||
if (text == null)
|
if (text == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning("MonoSpacing: Missing Text component");
|
Debug.LogWarning("MonoSpacing: Missing Text component");
|
||||||
|
@ -85,13 +87,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
rectTransform = text.GetComponent<RectTransform>();
|
rectTransform = text.GetComponent<RectTransform>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
protected override void OnValidate()
|
protected override void OnValidate()
|
||||||
{
|
{
|
||||||
Spacing = m_spacing;
|
Spacing = m_spacing;
|
||||||
base.OnValidate();
|
base.OnValidate();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public float Spacing
|
public float Spacing
|
||||||
{
|
{
|
||||||
|
@ -117,28 +119,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
float alignmentFactor = 0;
|
float alignmentFactor = 0;
|
||||||
int glyphIdx = 0;
|
int glyphIdx = 0;
|
||||||
|
|
||||||
#if UNITY_2022_1_OR_NEWER
|
|
||||||
switch (text.alignment)
|
|
||||||
{
|
|
||||||
case TMPro.TextAlignmentOptions.BottomLeft:
|
|
||||||
case TMPro.TextAlignmentOptions.MidlineLeft:
|
|
||||||
case TMPro.TextAlignmentOptions.TopLeft:
|
|
||||||
alignmentFactor = 0f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TMPro.TextAlignmentOptions.BottomJustified:
|
|
||||||
case TMPro.TextAlignmentOptions.MidlineJustified:
|
|
||||||
case TMPro.TextAlignmentOptions.TopJustified:
|
|
||||||
alignmentFactor = 0.5f;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TMPro.TextAlignmentOptions.BottomRight:
|
|
||||||
case TMPro.TextAlignmentOptions.MidlineRight:
|
|
||||||
case TMPro.TextAlignmentOptions.TopRight:
|
|
||||||
alignmentFactor = 1f;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
switch (text.alignment)
|
switch (text.alignment)
|
||||||
{
|
{
|
||||||
case TextAnchor.LowerLeft:
|
case TextAnchor.LowerLeft:
|
||||||
|
@ -159,7 +139,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
alignmentFactor = 1f;
|
alignmentFactor = 1f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
for (int lineIdx=0; lineIdx < lines.Length; lineIdx++)
|
for (int lineIdx=0; lineIdx < lines.Length; lineIdx++)
|
||||||
{
|
{
|
||||||
string line = lines[lineIdx];
|
string line = lines[lineIdx];
|
||||||
|
@ -221,4 +201,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
vh.AddUIVertexTriangleStream(verts);
|
vh.AddUIVertexTriangleStream(verts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
}
|
|
@ -1,12 +1,25 @@
|
||||||
|
|
||||||
|
#if !UNITY_2022_1_OR_NEWER
|
||||||
|
using System.Collections.Generic;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
/// Credit Melang, Lee Hui
|
/// Credit Melang, Lee Hui
|
||||||
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
|
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
|
||||||
/// GC Alloc fix - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/130
|
/// GC Alloc fix - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/130
|
||||||
/// NOT supported in Unity 2022
|
/// NOT supported in Unity 2022
|
||||||
|
|
||||||
#if !UNITY_2022_1_OR_NEWER
|
|
||||||
using System.Collections.Generic;
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
|
#if UNITY_2022_1_OR_NEWER
|
||||||
|
[Obsolete("BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
|
||||||
|
public class NicerOutline : BaseMeshEffect
|
||||||
|
{
|
||||||
|
public override void ModifyMesh(VertexHelper vh)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
//An outline that looks a bit nicer than the default one. It has less "holes" in the outline by drawing more copies of the effect
|
//An outline that looks a bit nicer than the default one. It has less "holes" in the outline by drawing more copies of the effect
|
||||||
[AddComponentMenu("UI/Effects/Extensions/Nicer Outline")]
|
[AddComponentMenu("UI/Effects/Extensions/Nicer Outline")]
|
||||||
public class NicerOutline : BaseMeshEffect
|
public class NicerOutline : BaseMeshEffect
|
||||||
|
@ -134,7 +147,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
start += ApplyText(m_Verts, vh, start);
|
start += ApplyText(m_Verts, vh, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ApplyOutlineNoGC(List<UIVertex> verts, Color color, float x, float y, VertexHelper vh, int startIndex)
|
private int ApplyOutlineNoGC(List<UIVertex> verts, Color32 color, float x, float y, VertexHelper vh, int startIndex)
|
||||||
{
|
{
|
||||||
int length = verts.Count;
|
int length = verts.Count;
|
||||||
for (int i = 0; i < length; ++i)
|
for (int i = 0; i < length; ++i)
|
||||||
|
@ -194,5 +207,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
/// Vertical Flow by Ramon Molossi
|
/// Vertical Flow by Ramon Molossi
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
|
@ -17,27 +18,32 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
public enum Axis { Horizontal = 0, Vertical = 1 }
|
public enum Axis { Horizontal = 0, Vertical = 1 }
|
||||||
|
|
||||||
public float SpacingX = 0f;
|
|
||||||
public float SpacingY = 0f;
|
|
||||||
public bool ExpandHorizontalSpacing = false;
|
|
||||||
|
|
||||||
public bool ChildForceExpandWidth = false;
|
|
||||||
public bool ChildForceExpandHeight = false;
|
|
||||||
public bool invertOrder = false;
|
|
||||||
private float _layoutHeight;
|
private float _layoutHeight;
|
||||||
private float _layoutWidth;
|
private float _layoutWidth;
|
||||||
|
|
||||||
[SerializeField] protected Axis m_StartAxis = Axis.Horizontal;
|
public float SpacingX = 0f;
|
||||||
public Axis startAxis { get { return m_StartAxis; } set { SetProperty(ref m_StartAxis, value); } }
|
public float SpacingY = 0f;
|
||||||
|
public bool ExpandHorizontalSpacing = false;
|
||||||
|
public bool ChildForceExpandWidth = false;
|
||||||
|
public bool ChildForceExpandHeight = false;
|
||||||
|
public bool invertOrder = false;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
protected Axis m_StartAxis = Axis.Horizontal;
|
||||||
|
|
||||||
|
public Axis StartAxis { get { return m_StartAxis; } set { SetProperty(ref m_StartAxis, value); } }
|
||||||
|
|
||||||
public override void CalculateLayoutInputHorizontal()
|
public override void CalculateLayoutInputHorizontal()
|
||||||
{
|
{
|
||||||
if (startAxis == Axis.Horizontal) {
|
if (StartAxis == Axis.Horizontal)
|
||||||
base.CalculateLayoutInputHorizontal ();
|
{
|
||||||
var minWidth = GetGreatestMinimumChildWidth () + padding.left + padding.right;
|
base.CalculateLayoutInputHorizontal();
|
||||||
SetLayoutInputForAxis (minWidth, -1, -1, 0);
|
var minWidth = GetGreatestMinimumChildWidth() + padding.left + padding.right;
|
||||||
} else {
|
SetLayoutInputForAxis(minWidth, -1, -1, 0);
|
||||||
_layoutWidth = SetLayout (0, true);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_layoutWidth = SetLayout(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,49 +60,36 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
public override void CalculateLayoutInputVertical()
|
public override void CalculateLayoutInputVertical()
|
||||||
{
|
{
|
||||||
if (startAxis == Axis.Horizontal) {
|
if (StartAxis == Axis.Horizontal)
|
||||||
_layoutHeight = SetLayout (1, true);
|
{
|
||||||
} else {
|
_layoutHeight = SetLayout(1, true);
|
||||||
base.CalculateLayoutInputHorizontal ();
|
}
|
||||||
var minHeight = GetGreatestMinimumChildHeigth () + padding.bottom + padding.top;
|
else
|
||||||
SetLayoutInputForAxis (minHeight, -1, -1, 1);
|
{
|
||||||
|
base.CalculateLayoutInputHorizontal();
|
||||||
|
var minHeight = GetGreatestMinimumChildHeigth() + padding.bottom + padding.top;
|
||||||
|
SetLayoutInputForAxis(minHeight, -1, -1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool IsCenterAlign
|
protected bool IsCenterAlign
|
||||||
{
|
{
|
||||||
get
|
get => childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter || childAlignment == TextAnchor.UpperCenter;
|
||||||
{
|
|
||||||
return childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter ||
|
|
||||||
childAlignment == TextAnchor.UpperCenter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool IsRightAlign
|
protected bool IsRightAlign
|
||||||
{
|
{
|
||||||
get
|
get => childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.MiddleRight || childAlignment == TextAnchor.UpperRight;
|
||||||
{
|
|
||||||
return childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.MiddleRight ||
|
|
||||||
childAlignment == TextAnchor.UpperRight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool IsMiddleAlign
|
protected bool IsMiddleAlign
|
||||||
{
|
{
|
||||||
get
|
get => childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight || childAlignment == TextAnchor.MiddleCenter;
|
||||||
{
|
|
||||||
return childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight ||
|
|
||||||
childAlignment == TextAnchor.MiddleCenter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool IsLowerAlign
|
protected bool IsLowerAlign
|
||||||
{
|
{
|
||||||
get
|
get => childAlignment == TextAnchor.LowerLeft || childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.LowerCenter;
|
||||||
{
|
|
||||||
return childAlignment == TextAnchor.LowerLeft || childAlignment == TextAnchor.LowerRight ||
|
|
||||||
childAlignment == TextAnchor.LowerCenter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -122,25 +115,34 @@ namespace UnityEngine.UI.Extensions
|
||||||
float counterOffset = 0;
|
float counterOffset = 0;
|
||||||
float groupSize = 0;
|
float groupSize = 0;
|
||||||
float workingSize = 0;
|
float workingSize = 0;
|
||||||
if (startAxis == Axis.Horizontal) {
|
if (StartAxis == Axis.Horizontal)
|
||||||
|
{
|
||||||
groupSize = groupHeight;
|
groupSize = groupHeight;
|
||||||
workingSize = groupWidth - padding.left - padding.right;
|
workingSize = groupWidth - padding.left - padding.right;
|
||||||
if (IsLowerAlign) {
|
if (IsLowerAlign)
|
||||||
|
{
|
||||||
offset = (float)padding.bottom;
|
offset = (float)padding.bottom;
|
||||||
counterOffset = (float)padding.top;
|
counterOffset = (float)padding.top;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
offset = (float)padding.top;
|
offset = (float)padding.top;
|
||||||
counterOffset = (float)padding.bottom;
|
counterOffset = (float)padding.bottom;
|
||||||
}
|
}
|
||||||
spacingBetweenBars = SpacingY;
|
spacingBetweenBars = SpacingY;
|
||||||
spacingBetweenElements = SpacingX;
|
spacingBetweenElements = SpacingX;
|
||||||
} else if (startAxis == Axis.Vertical) {
|
}
|
||||||
|
else if (StartAxis == Axis.Vertical)
|
||||||
|
{
|
||||||
groupSize = groupWidth;
|
groupSize = groupWidth;
|
||||||
workingSize = groupHeight - padding.top - padding.bottom;
|
workingSize = groupHeight - padding.top - padding.bottom;
|
||||||
if (IsRightAlign) {
|
if (IsRightAlign)
|
||||||
|
{
|
||||||
offset = (float)padding.right;
|
offset = (float)padding.right;
|
||||||
counterOffset = (float)padding.left;
|
counterOffset = (float)padding.left;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
offset = (float)padding.left;
|
offset = (float)padding.left;
|
||||||
counterOffset = (float)padding.right;
|
counterOffset = (float)padding.right;
|
||||||
}
|
}
|
||||||
|
@ -151,50 +153,59 @@ namespace UnityEngine.UI.Extensions
|
||||||
var currentBarSize = 0f;
|
var currentBarSize = 0f;
|
||||||
var currentBarSpace = 0f;
|
var currentBarSpace = 0f;
|
||||||
|
|
||||||
for (var i = 0; i < rectChildren.Count; i++) {
|
for (var i = 0; i < rectChildren.Count; i++)
|
||||||
|
{
|
||||||
int index = i;
|
int index = i;
|
||||||
var child = rectChildren [index];
|
var child = rectChildren[index];
|
||||||
float childSize = 0;
|
float childSize = 0;
|
||||||
float childOtherSize = 0;
|
float childOtherSize = 0;
|
||||||
//get height and width of elements.
|
//get height and width of elements.
|
||||||
if (startAxis == Axis.Horizontal) {
|
if (StartAxis == Axis.Horizontal)
|
||||||
if (invertOrder) {
|
{
|
||||||
|
if (invertOrder)
|
||||||
|
{
|
||||||
index = IsLowerAlign ? rectChildren.Count - 1 - i : i;
|
index = IsLowerAlign ? rectChildren.Count - 1 - i : i;
|
||||||
}
|
}
|
||||||
child = rectChildren [index];
|
child = rectChildren[index];
|
||||||
childSize = LayoutUtility.GetPreferredSize (child, 0);
|
childSize = LayoutUtility.GetPreferredSize(child, 0);
|
||||||
childSize = Mathf.Min (childSize, workingSize);
|
childSize = Mathf.Min(childSize, workingSize);
|
||||||
childOtherSize = LayoutUtility.GetPreferredSize (child, 1);
|
childOtherSize = LayoutUtility.GetPreferredSize(child, 1);
|
||||||
} else if (startAxis == Axis.Vertical) {
|
}
|
||||||
if (invertOrder) {
|
else if (StartAxis == Axis.Vertical)
|
||||||
|
{
|
||||||
|
if (invertOrder)
|
||||||
|
{
|
||||||
index = IsRightAlign ? rectChildren.Count - 1 - i : i;
|
index = IsRightAlign ? rectChildren.Count - 1 - i : i;
|
||||||
}
|
}
|
||||||
child = rectChildren [index];
|
child = rectChildren[index];
|
||||||
childSize = LayoutUtility.GetPreferredSize (child, 1);
|
childSize = LayoutUtility.GetPreferredSize(child, 1);
|
||||||
childSize = Mathf.Min (childSize, workingSize);
|
childSize = Mathf.Min(childSize, workingSize);
|
||||||
childOtherSize = LayoutUtility.GetPreferredSize (child, 0);
|
childOtherSize = LayoutUtility.GetPreferredSize(child, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If adding this element would exceed the bounds of the container,
|
// If adding this element would exceed the bounds of the container,
|
||||||
// go to a new bar after processing the current bar
|
// go to a new bar after processing the current bar
|
||||||
if (currentBarSize + childSize > workingSize) {
|
if (currentBarSize + childSize > workingSize)
|
||||||
|
{
|
||||||
currentBarSize -= spacingBetweenElements;
|
currentBarSize -= spacingBetweenElements;
|
||||||
|
|
||||||
// Process current bar elements positioning
|
// Process current bar elements positioning
|
||||||
if (!layoutInput) {
|
if (!layoutInput)
|
||||||
if (startAxis == Axis.Horizontal) {
|
{
|
||||||
float newOffset = CalculateRowVerticalOffset (groupSize, offset, currentBarSpace);
|
if (StartAxis == Axis.Horizontal)
|
||||||
LayoutRow (_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
|
{
|
||||||
} else if (startAxis == Axis.Vertical) {
|
float newOffset = CalculateRowVerticalOffset(groupSize, offset, currentBarSpace);
|
||||||
float newOffset = CalculateColHorizontalOffset (groupSize, offset, currentBarSpace);
|
LayoutRow(_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
|
||||||
LayoutCol (_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
|
}
|
||||||
|
else if (StartAxis == Axis.Vertical)
|
||||||
|
{
|
||||||
|
float newOffset = CalculateColHorizontalOffset(groupSize, offset, currentBarSpace);
|
||||||
|
LayoutCol(_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear existing bar
|
// Clear existing bar
|
||||||
_itemList.Clear ();
|
_itemList.Clear();
|
||||||
|
|
||||||
// Add the current bar space to total barSpace accumulator, and reset to 0 for the next row
|
// Add the current bar space to total barSpace accumulator, and reset to 0 for the next row
|
||||||
offset += currentBarSpace;
|
offset += currentBarSpace;
|
||||||
|
@ -202,31 +213,28 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
currentBarSpace = 0;
|
currentBarSpace = 0;
|
||||||
currentBarSize = 0;
|
currentBarSize = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBarSize += childSize;
|
currentBarSize += childSize;
|
||||||
_itemList.Add (child);
|
_itemList.Add(child);
|
||||||
|
|
||||||
// We need the largest element height to determine the starting position of the next line
|
// We need the largest element height to determine the starting position of the next line
|
||||||
if (childOtherSize > currentBarSpace) {
|
currentBarSpace = childOtherSize > currentBarSpace ? childOtherSize : currentBarSpace;
|
||||||
currentBarSpace = childOtherSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't do this for the last one
|
|
||||||
if (i < rectChildren.Count - 1){
|
|
||||||
currentBarSize += spacingBetweenElements;
|
currentBarSize += spacingBetweenElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Layout the final bar
|
// Layout the final bar
|
||||||
if (!layoutInput) {
|
if (!layoutInput)
|
||||||
if (startAxis == Axis.Horizontal) {
|
{
|
||||||
float newOffset = CalculateRowVerticalOffset (groupHeight, offset, currentBarSpace);
|
if (StartAxis == Axis.Horizontal)
|
||||||
|
{
|
||||||
|
float newOffset = CalculateRowVerticalOffset(groupHeight, offset, currentBarSpace);
|
||||||
currentBarSize -= spacingBetweenElements;
|
currentBarSize -= spacingBetweenElements;
|
||||||
LayoutRow (_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
|
LayoutRow(_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
|
||||||
}else if (startAxis == Axis.Vertical) {
|
}
|
||||||
|
else if (StartAxis == Axis.Vertical)
|
||||||
|
{
|
||||||
float newOffset = CalculateColHorizontalOffset(groupWidth, offset, currentBarSpace);
|
float newOffset = CalculateColHorizontalOffset(groupWidth, offset, currentBarSpace);
|
||||||
currentBarSize -= spacingBetweenElements;
|
currentBarSize -= spacingBetweenElements;
|
||||||
LayoutCol(_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
|
LayoutCol(_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
|
||||||
|
@ -239,7 +247,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
offset += currentBarSpace;
|
offset += currentBarSpace;
|
||||||
offset += counterOffset;
|
offset += counterOffset;
|
||||||
|
|
||||||
if (layoutInput) {
|
if (layoutInput)
|
||||||
|
{
|
||||||
SetLayoutInputForAxis(offset, offset, -1, axis);
|
SetLayoutInputForAxis(offset, offset, -1, axis);
|
||||||
}
|
}
|
||||||
return offset;
|
return offset;
|
||||||
|
@ -247,87 +256,109 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
private float CalculateRowVerticalOffset(float groupHeight, float yOffset, float currentRowHeight)
|
private float CalculateRowVerticalOffset(float groupHeight, float yOffset, float currentRowHeight)
|
||||||
{
|
{
|
||||||
if (IsLowerAlign) {
|
if (IsLowerAlign)
|
||||||
|
{
|
||||||
return groupHeight - yOffset - currentRowHeight;
|
return groupHeight - yOffset - currentRowHeight;
|
||||||
} else if (IsMiddleAlign) {
|
|
||||||
return groupHeight * 0.5f - _layoutHeight * 0.5f + yOffset;
|
|
||||||
} else {
|
|
||||||
return yOffset;
|
|
||||||
}
|
}
|
||||||
|
else if (IsMiddleAlign)
|
||||||
|
{
|
||||||
|
return groupHeight * 0.5f - _layoutHeight * 0.5f + yOffset;
|
||||||
|
}
|
||||||
|
return yOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float CalculateColHorizontalOffset(float groupWidth, float xOffset, float currentColWidth)
|
private float CalculateColHorizontalOffset(float groupWidth, float xOffset, float currentColWidth)
|
||||||
{
|
{
|
||||||
if (IsRightAlign) {
|
if (IsRightAlign)
|
||||||
|
{
|
||||||
return groupWidth - xOffset - currentColWidth;
|
return groupWidth - xOffset - currentColWidth;
|
||||||
} else if (IsCenterAlign) {
|
|
||||||
return groupWidth * 0.5f - _layoutWidth * 0.5f + xOffset;
|
|
||||||
} else {
|
|
||||||
return xOffset;
|
|
||||||
}
|
}
|
||||||
|
else if (IsCenterAlign)
|
||||||
|
{
|
||||||
|
return groupWidth * 0.5f - _layoutWidth * 0.5f + xOffset;
|
||||||
|
}
|
||||||
|
return xOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void LayoutRow(IList<RectTransform> contents, float rowWidth, float rowHeight, float maxWidth, float xOffset, float yOffset, int axis)
|
protected void LayoutRow(IList<RectTransform> contents, float rowWidth, float rowHeight, float maxWidth, float xOffset, float yOffset, int axis)
|
||||||
{
|
{
|
||||||
var xPos = xOffset;
|
var xPos = xOffset;
|
||||||
|
|
||||||
if (!ChildForceExpandWidth && IsCenterAlign) {
|
if (!ChildForceExpandWidth && IsCenterAlign)
|
||||||
|
{
|
||||||
xPos += (maxWidth - rowWidth) * 0.5f;
|
xPos += (maxWidth - rowWidth) * 0.5f;
|
||||||
} else if (!ChildForceExpandWidth && IsRightAlign) {
|
}
|
||||||
|
else if (!ChildForceExpandWidth && IsRightAlign)
|
||||||
|
{
|
||||||
xPos += (maxWidth - rowWidth);
|
xPos += (maxWidth - rowWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
var extraWidth = 0f;
|
var extraWidth = 0f;
|
||||||
var extraSpacing = 0f;
|
var extraSpacing = 0f;
|
||||||
|
|
||||||
if (ChildForceExpandWidth) {
|
if (ChildForceExpandWidth)
|
||||||
extraWidth = (maxWidth - rowWidth)/_itemList.Count;
|
{
|
||||||
|
extraWidth = (maxWidth - rowWidth) / contents.Count;
|
||||||
}
|
}
|
||||||
else if (ExpandHorizontalSpacing) {
|
else if (ExpandHorizontalSpacing)
|
||||||
extraSpacing = (maxWidth - rowWidth)/(_itemList.Count - 1);
|
{
|
||||||
if (_itemList.Count > 1) {
|
extraSpacing = (maxWidth - rowWidth) / (contents.Count - 1);
|
||||||
if (IsCenterAlign) {
|
if (contents.Count > 1)
|
||||||
xPos -= extraSpacing * 0.5f * (_itemList.Count - 1);
|
{
|
||||||
} else if (IsRightAlign) {
|
if (IsCenterAlign)
|
||||||
xPos -= extraSpacing * (_itemList.Count - 1);
|
{
|
||||||
|
xPos -= extraSpacing * 0.5f * (contents.Count - 1);
|
||||||
|
}
|
||||||
|
else if (IsRightAlign)
|
||||||
|
{
|
||||||
|
xPos -= extraSpacing * (contents.Count - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < _itemList.Count; j++) {
|
for (var j = 0; j < contents.Count; j++)
|
||||||
|
{
|
||||||
|
var index = IsLowerAlign ? contents.Count - 1 - j : j;
|
||||||
|
|
||||||
var index = IsLowerAlign ? _itemList.Count - 1 - j : j;
|
var rowChild = contents[index];
|
||||||
|
|
||||||
var rowChild = _itemList[index];
|
|
||||||
|
|
||||||
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0) + extraWidth;
|
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0) + extraWidth;
|
||||||
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1);
|
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1);
|
||||||
|
|
||||||
if (ChildForceExpandHeight)
|
if (ChildForceExpandHeight)
|
||||||
|
{
|
||||||
rowChildHeight = rowHeight;
|
rowChildHeight = rowHeight;
|
||||||
|
}
|
||||||
|
|
||||||
rowChildWidth = Mathf.Min(rowChildWidth, maxWidth);
|
rowChildWidth = Mathf.Min(rowChildWidth, maxWidth);
|
||||||
|
|
||||||
var yPos = yOffset;
|
var yPos = yOffset;
|
||||||
|
|
||||||
if (IsMiddleAlign) {
|
if (IsMiddleAlign)
|
||||||
|
{
|
||||||
yPos += (rowHeight - rowChildHeight) * 0.5f;
|
yPos += (rowHeight - rowChildHeight) * 0.5f;
|
||||||
} else if (IsLowerAlign) {
|
}
|
||||||
|
else if (IsLowerAlign)
|
||||||
|
{
|
||||||
yPos += (rowHeight - rowChildHeight);
|
yPos += (rowHeight - rowChildHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExpandHorizontalSpacing && j > 0) {
|
if (ExpandHorizontalSpacing && j > 0)
|
||||||
|
{
|
||||||
xPos += extraSpacing;
|
xPos += extraSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axis == 0) {
|
if (axis == 0)
|
||||||
SetChildAlongAxis (rowChild, 0, xPos, rowChildWidth);
|
{
|
||||||
} else {
|
SetChildAlongAxis(rowChild, 0, xPos, rowChildWidth);
|
||||||
SetChildAlongAxis (rowChild, 1, yPos, rowChildHeight);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetChildAlongAxis(rowChild, 1, yPos, rowChildHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't do horizontal spacing for the last one
|
// Don't do horizontal spacing for the last one
|
||||||
if (j < _itemList.Count - 1) {
|
if (j < contents.Count - 1)
|
||||||
|
{
|
||||||
xPos += rowChildWidth + SpacingX;
|
xPos += rowChildWidth + SpacingX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,39 +368,49 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
var yPos = yOffset;
|
var yPos = yOffset;
|
||||||
|
|
||||||
if (!ChildForceExpandHeight && IsMiddleAlign) {
|
if (!ChildForceExpandHeight && IsMiddleAlign)
|
||||||
|
{
|
||||||
yPos += (maxHeight - colHeight) * 0.5f;
|
yPos += (maxHeight - colHeight) * 0.5f;
|
||||||
} else if (!ChildForceExpandHeight && IsLowerAlign) {
|
}
|
||||||
|
else if (!ChildForceExpandHeight && IsLowerAlign)
|
||||||
|
{
|
||||||
yPos += (maxHeight - colHeight);
|
yPos += (maxHeight - colHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
var extraHeight = 0f;
|
var extraHeight = 0f;
|
||||||
var extraSpacing = 0f;
|
var extraSpacing = 0f;
|
||||||
|
|
||||||
if (ChildForceExpandHeight) {
|
if (ChildForceExpandHeight)
|
||||||
extraHeight = (maxHeight - colHeight)/_itemList.Count;
|
{
|
||||||
|
extraHeight = (maxHeight - colHeight) / contents.Count;
|
||||||
}
|
}
|
||||||
else if (ExpandHorizontalSpacing) {
|
else if (ExpandHorizontalSpacing)
|
||||||
extraSpacing = (maxHeight - colHeight)/(_itemList.Count - 1);
|
{
|
||||||
if (_itemList.Count > 1) {
|
extraSpacing = (maxHeight - colHeight) / (contents.Count - 1);
|
||||||
if (IsMiddleAlign) {
|
if (contents.Count > 1)
|
||||||
yPos -= extraSpacing * 0.5f * (_itemList.Count - 1);
|
{
|
||||||
} else if (IsLowerAlign) {
|
if (IsMiddleAlign)
|
||||||
yPos -= extraSpacing * (_itemList.Count - 1);
|
{
|
||||||
|
yPos -= extraSpacing * 0.5f * (contents.Count - 1);
|
||||||
|
}
|
||||||
|
else if (IsLowerAlign)
|
||||||
|
{
|
||||||
|
yPos -= extraSpacing * (contents.Count - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < _itemList.Count; j++) {
|
for (var j = 0; j < contents.Count; j++)
|
||||||
|
{
|
||||||
|
var index = IsRightAlign ? contents.Count - 1 - j : j;
|
||||||
|
|
||||||
var index = IsRightAlign ? _itemList.Count - 1 - j : j;
|
var rowChild = contents[index];
|
||||||
|
|
||||||
var rowChild = _itemList[index];
|
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0);
|
||||||
|
|
||||||
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0) ;
|
|
||||||
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1) + extraHeight;
|
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1) + extraHeight;
|
||||||
|
|
||||||
if (ChildForceExpandWidth) {
|
if (ChildForceExpandWidth)
|
||||||
|
{
|
||||||
rowChildWidth = colWidth;
|
rowChildWidth = colWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,25 +418,32 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
var xPos = xOffset;
|
var xPos = xOffset;
|
||||||
|
|
||||||
if (IsCenterAlign) {
|
if (IsCenterAlign)
|
||||||
|
{
|
||||||
xPos += (colWidth - rowChildWidth) * 0.5f;
|
xPos += (colWidth - rowChildWidth) * 0.5f;
|
||||||
} else if (IsRightAlign) {
|
}
|
||||||
|
else if (IsRightAlign)
|
||||||
|
{
|
||||||
xPos += (colWidth - rowChildWidth);
|
xPos += (colWidth - rowChildWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
if (ExpandHorizontalSpacing && j > 0)
|
||||||
if (ExpandHorizontalSpacing && j > 0) {
|
{
|
||||||
yPos += extraSpacing;
|
yPos += extraSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axis == 0) {
|
if (axis == 0)
|
||||||
SetChildAlongAxis (rowChild, 0, xPos, rowChildWidth);
|
{
|
||||||
} else {
|
SetChildAlongAxis(rowChild, 0, xPos, rowChildWidth);
|
||||||
SetChildAlongAxis (rowChild, 1, yPos, rowChildHeight);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetChildAlongAxis(rowChild, 1, yPos, rowChildHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't do vertical spacing for the last one
|
// Don't do vertical spacing for the last one
|
||||||
if (j < _itemList.Count - 1) {
|
if (j < contents.Count - 1)
|
||||||
|
{
|
||||||
yPos += rowChildHeight + SpacingY;
|
yPos += rowChildHeight + SpacingY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,9 +452,9 @@ namespace UnityEngine.UI.Extensions
|
||||||
public float GetGreatestMinimumChildWidth()
|
public float GetGreatestMinimumChildWidth()
|
||||||
{
|
{
|
||||||
var max = 0f;
|
var max = 0f;
|
||||||
for (var i = 0; i < rectChildren.Count; i++) {
|
for (var i = 0; i < rectChildren.Count; i++)
|
||||||
|
{
|
||||||
var w = LayoutUtility.GetMinWidth(rectChildren[i]);
|
var w = LayoutUtility.GetMinWidth(rectChildren[i]);
|
||||||
|
|
||||||
max = Mathf.Max(w, max);
|
max = Mathf.Max(w, max);
|
||||||
}
|
}
|
||||||
return max;
|
return max;
|
||||||
|
@ -415,9 +463,9 @@ namespace UnityEngine.UI.Extensions
|
||||||
public float GetGreatestMinimumChildHeigth()
|
public float GetGreatestMinimumChildHeigth()
|
||||||
{
|
{
|
||||||
var max = 0f;
|
var max = 0f;
|
||||||
for (var i = 0; i < rectChildren.Count; i++) {
|
for (var i = 0; i < rectChildren.Count; i++)
|
||||||
|
{
|
||||||
var w = LayoutUtility.GetMinHeight(rectChildren[i]);
|
var w = LayoutUtility.GetMinHeight(rectChildren[i]);
|
||||||
|
|
||||||
max = Mathf.Max(w, max);
|
max = Mathf.Max(w, max);
|
||||||
}
|
}
|
||||||
return max;
|
return max;
|
||||||
|
@ -428,7 +476,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
m_Tracker.Clear();
|
m_Tracker.Clear();
|
||||||
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
|
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -223,12 +223,21 @@ namespace UnityEngine.UI.Extensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// used for changing / updating between screen resolutions
|
/// used for changing / updating between screen resolutions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateLayout()
|
public void UpdateLayout(bool resetPositionToStart = false)
|
||||||
{
|
{
|
||||||
_lerp = false;
|
_lerp = false;
|
||||||
DistributePages();
|
DistributePages();
|
||||||
|
|
||||||
|
if (resetPositionToStart)
|
||||||
|
{
|
||||||
|
_currentPage = StartingScreen;
|
||||||
|
}
|
||||||
|
|
||||||
if (MaskArea)
|
if (MaskArea)
|
||||||
|
{
|
||||||
UpdateVisible();
|
UpdateVisible();
|
||||||
|
}
|
||||||
|
|
||||||
SetScrollContainerPosition();
|
SetScrollContainerPosition();
|
||||||
OnCurrentScreenChange(_currentPage);
|
OnCurrentScreenChange(_currentPage);
|
||||||
}
|
}
|
||||||
|
@ -328,6 +337,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (distance == 0)
|
||||||
|
{
|
||||||
|
EndScreenChange();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,11 +218,21 @@ namespace UnityEngine.UI.Extensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// used for changing / updating between screen resolutions
|
/// used for changing / updating between screen resolutions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateLayout()
|
public void UpdateLayout(bool resetPositionToStart = false)
|
||||||
{
|
{
|
||||||
_lerp = false;
|
_lerp = false;
|
||||||
DistributePages();
|
DistributePages();
|
||||||
if (MaskArea) UpdateVisible();
|
|
||||||
|
if (resetPositionToStart)
|
||||||
|
{
|
||||||
|
_currentPage = StartingScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MaskArea)
|
||||||
|
{
|
||||||
|
UpdateVisible();
|
||||||
|
}
|
||||||
|
|
||||||
SetScrollContainerPosition();
|
SetScrollContainerPosition();
|
||||||
OnCurrentScreenChange(_currentPage);
|
OnCurrentScreenChange(_currentPage);
|
||||||
}
|
}
|
||||||
|
@ -321,6 +331,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (distance == 0)
|
||||||
|
{
|
||||||
|
EndScreenChange();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,8 +296,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
PopulateMesh (vh, pointsToDraw);
|
PopulateMesh (vh, pointsToDraw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private UIVertex[] CreateLineCap(Vector2 start, Vector2 end, SegmentType type)
|
private UIVertex[] CreateLineCap(Vector2 start, Vector2 end, SegmentType type)
|
||||||
|
@ -419,7 +417,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
return Segments[segmentIndex - 1][index - 1];
|
return Segments[segmentIndex - 1][index - 1];
|
||||||
}
|
}
|
||||||
else if (Segments.Count > 0)
|
else if (Segments?.Count > 0)
|
||||||
{
|
{
|
||||||
var segmentIndexCount = 0;
|
var segmentIndexCount = 0;
|
||||||
var indexCount = index;
|
var indexCount = index;
|
||||||
|
@ -443,6 +441,29 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates the position of a point on the curve, given t (0-1), start point, control points and end point.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="t">Required Percentage between start and end point, in the range 0 to 1</param>
|
||||||
|
/// <param name="p1">Required Starting point</param>
|
||||||
|
/// <param name="p1">Required Control point 1</param>
|
||||||
|
/// <param name="p1">Required Control point 2</param>
|
||||||
|
/// <param name="p1">Required End point</param>
|
||||||
|
/// <returns>Vector2 position of point on curve at t percentage between p1 and p4</returns>
|
||||||
|
public Vector2 CalculatePointOnCurve(float t, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
|
||||||
|
{
|
||||||
|
var t2 = t * t;
|
||||||
|
var t3 = t2 * t;
|
||||||
|
|
||||||
|
var x = p1.x + (-p1.x * 3 + t * (3 * p1.x - p1.x * t)) * t + (3 * p2.x + t * (-6 * p2.x + p2.x * 3 * t)) * t +
|
||||||
|
(p3.x * 3 - p3.x * 3 * t) * t2 + p4.x * t3;
|
||||||
|
|
||||||
|
var y = p1.y + (-p1.y * 3 + t * (3 * p1.y - p1.y * t)) * t + (3 * p2.y + t * (-6 * p2.y + p2.y * 3 * t)) * t +
|
||||||
|
(p3.y * 3 - p3.y * 3 * t) * t2 + p4.y * t3;
|
||||||
|
|
||||||
|
return new Vector2(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the Vector2 position of a line within a specific segment
|
/// Get the Vector2 position of a line within a specific segment
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -478,6 +499,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
m_points = new Vector2[1];
|
m_points = new Vector2[1];
|
||||||
}
|
}
|
||||||
|
if (transform.GetComponent<RectTransform>().position != Vector3.zero)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("A Line Renderer component should be on a RectTransform positioned at (0,0,0), do not use in child Objects.\nFor best results, create separate RectTransforms as children of the canvas positioned at (0,0) for a UILineRenderer and do not move.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
|
{
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
instance = GameObject.FindFirstObjectByType<BoundTooltipItem>();
|
||||||
|
#else
|
||||||
instance = GameObject.FindObjectOfType<BoundTooltipItem>();
|
instance = GameObject.FindObjectOfType<BoundTooltipItem>();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
|
{
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
instance = FindFirstObjectByType<ToolTip>();
|
||||||
|
#else
|
||||||
instance = FindObjectOfType<ToolTip>();
|
instance = FindObjectOfType<ToolTip>();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,24 @@
|
||||||
/// Credit SimonDarksideJ
|
/// Credit SimonDarksideJ
|
||||||
|
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
/*
|
/// <summary>
|
||||||
Handy Selectable script to un-highlight a selectable component in Unity (e.g. a Button) when the user moves away from it, EVEN IF the user has holding a button on it.
|
/// Handy Selectable script to un-highlight a selectable component in Unity (e.g. a Button) when the user moves away from it, EVEN IF the user has holding a button on it.
|
||||||
|
/// Resolves the situation where Unity UI Components remain in a highlighted state even after the pointer has moved away (e.g. user holding a button, mouse, pointer down).
|
||||||
Resolves the situation where Unity UI Components remain in a highlighted state even after the pointer has moved away (e.g. user holding a button, mouse, pointer down).
|
/// Now whenever the cursor leaves the component, it will force the UI component to revert to un-highlighted.
|
||||||
Now whenever the cursor leaves the component, it will force the UI component to revert to un-highlighted.
|
/// </summary>
|
||||||
*/
|
|
||||||
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
[AddComponentMenu("UI/Extensions/ResetSelectableHighlight", 31)]
|
[AddComponentMenu("UI/Extensions/ResetSelectableHighlight", 31)]
|
||||||
[RequireComponent(typeof(Selectable))]
|
[RequireComponent(typeof(Selectable))]
|
||||||
public class ResetSelectableHighlight : MonoBehaviour, IPointerExitHandler
|
public class ResetSelectableHighlight : MonoBehaviour, IPointerExitHandler
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Selectable attachedSelectable;
|
private Selectable attachedSelectable = null;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
private void Awake()
|
||||||
void Awake()
|
|
||||||
{
|
{
|
||||||
if (!attachedSelectable)
|
if (attachedSelectable == null || !attachedSelectable)
|
||||||
{
|
{
|
||||||
attachedSelectable = GetComponent<Selectable>();
|
attachedSelectable = GetComponent<Selectable>();
|
||||||
}
|
}
|
||||||
|
@ -31,6 +26,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
public void OnPointerExit(PointerEventData eventData)
|
public void OnPointerExit(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
|
if (!attachedSelectable.interactable)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
attachedSelectable.targetGraphic.CrossFadeColor(attachedSelectable.colors.normalColor, 0f, true, true);
|
attachedSelectable.targetGraphic.CrossFadeColor(attachedSelectable.colors.normalColor, 0f, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
bool updateLine = false;
|
bool updateLine = false;
|
||||||
for (int i = 0; i < transforms.Length; i++)
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
{
|
{
|
||||||
|
if (transforms[i] == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!updateLine && previousPositions[i] != transforms[i].position)
|
if (!updateLine && previousPositions[i] != transforms[i].position)
|
||||||
{
|
{
|
||||||
updateLine = true;
|
updateLine = true;
|
||||||
|
@ -60,6 +64,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
// First, convert the pivot to worldspace
|
// First, convert the pivot to worldspace
|
||||||
for (int i = 0; i < transforms.Length; i++)
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
{
|
{
|
||||||
|
if (transforms[i] == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
worldSpaces[i] = transforms[i].TransformPoint(thisPivot);
|
worldSpaces[i] = transforms[i].TransformPoint(thisPivot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +91,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
previousPositions = new Vector3[transforms.Length];
|
previousPositions = new Vector3[transforms.Length];
|
||||||
for (int i = 0; i < transforms.Length; i++)
|
for (int i = 0; i < transforms.Length; i++)
|
||||||
{
|
{
|
||||||
|
if (transforms[i] == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
previousPositions[i] = transforms[i].position;
|
previousPositions[i] = transforms[i].position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "com.unity.uiextensions",
|
"name": "com.unity.uiextensions",
|
||||||
"displayName": "Unity UI Extensions",
|
"displayName": "Unity UI Extensions",
|
||||||
"version": "2.3.0",
|
"version": "2.3.2-pre.5",
|
||||||
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
|
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
|
||||||
"author": "Simon darkside Jackson <@SimonDarksideJ>",
|
"author": "Simon darkside Jackson <@SimonDarksideJ>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
|
Loading…
Reference in New Issue