File tree Expand file tree Collapse file tree 10 files changed +316
-222
lines changed
Expand file tree Collapse file tree 10 files changed +316
-222
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 11///Credit perchik
22///Sourced from - http://forum.unity3d.com/threads/receive-onclick-event-and-pass-it-on-to-lower-ui-elements.293642/
33
4- using System ;
54using System . Collections . Generic ;
65using System . Linq ;
76
@@ -132,6 +131,9 @@ public class SelectionTextChangedEvent : Events.UnityEvent<string> { }
132131 [ System . Serializable ]
133132 public class SelectionValidityChangedEvent : Events . UnityEvent < bool > { }
134133
134+ [ System . Serializable ]
135+ public class ItemSelectedEvent : Events . UnityEvent < string > { }
136+
135137 [ System . Serializable ]
136138 public class ControlDisabledEvent : Events . UnityEvent < bool > { }
137139
@@ -142,6 +144,8 @@ public class ControlDisabledEvent : Events.UnityEvent<bool> { }
142144 public SelectionValidityChangedEvent OnSelectionValidityChanged ;
143145 // fires in both cases
144146 public SelectionChangedEvent OnSelectionChanged ;
147+ // fires when an item is clicked
148+ public ItemSelectedEvent OnItemSelected ;
145149 // fires when item is changed;
146150 public ControlDisabledEvent OnControlDisabled ;
147151
@@ -359,10 +363,10 @@ private void RebuildPanel()
359363 /// <param name="item"></param>
360364 private void OnItemClicked ( string item )
361365 {
362- //Debug.Log("item " + item + " clicked");
363366 Text = item ;
364367 _mainInput . text = Text ;
365368 ToggleDropdownPanel ( true ) ;
369+ OnItemSelected ? . Invoke ( Text ) ;
366370 }
367371
368372 private void RedrawPanel ( )
Original file line number Diff line number Diff line change 22/// Sourced from - http://forum.unity3d.com/members/melang.593409/
33/// NOT supported in Unity 2022
44
5+ using System ;
56#if ! UNITY_2022_1_OR_NEWER
67using System . Collections . Generic ;
8+ #endif
9+
710namespace UnityEngine . UI . Extensions
811{
12+ #if UNITY_2022_1_OR_NEWER
13+ [ Obsolete ( "BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead." ) ]
14+ public class BestFitOutline : Shadow
15+ {
16+ }
17+ #else
918 [ AddComponentMenu ( "UI/Effects/Extensions/BestFit Outline" ) ]
1019 public class BestFitOutline : Shadow
1120 {
@@ -61,5 +70,5 @@ public override void ModifyMesh (Mesh mesh)
6170 }
6271 }
6372 }
64- }
65- #endif
73+ #endif
74+ }
Original file line number Diff line number Diff line change 1- /// Credit Breyer
2- /// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
3- #if ! UNITY_2022_1_OR_NEWER
1+
2+ using System ;
43
54namespace UnityEngine . UI . Extensions
65{
6+ #if UNITY_2022_1_OR_NEWER
7+ [ Obsolete ( "CurvedText is not supported in Unity 2022.1 or newer. Use TMPro instead." ) ]
8+ public class CurvedText : BaseMeshEffect
9+ {
10+ public override void ModifyMesh ( VertexHelper vh )
11+ {
12+ }
13+ }
14+ #else
715 [ RequireComponent ( typeof ( Text ) ) ]
816 [ RequireComponent ( typeof ( RectTransform ) ) ]
917 [ AddComponentMenu ( "UI/Effects/Extensions/Curved Text" ) ]
@@ -83,5 +91,5 @@ protected override void OnRectTransformDimensionsChange()
8391 }
8492 }
8593 }
86- }
87- #endif
94+ #endif
95+ }
Original file line number Diff line number Diff line change 1- /// adaption for cylindrical bending by herbst
1+
2+ using System ;
3+
4+ /// adaption for cylindrical bending by herbst
25/// Credit Breyer
36/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
4- #if ! UNITY_2022_1_OR_NEWER
5-
67namespace UnityEngine . UI . Extensions
78{
9+ #if UNITY_2022_1_OR_NEWER
10+ [ Obsolete ( "CylinderText is not supported in Unity 2022.1 or newer. Use TMPro instead." ) ]
11+ public class CylinderText : BaseMeshEffect
12+ {
13+ public override void ModifyMesh ( VertexHelper vh )
14+ {
15+ }
16+ }
17+ #else
818 [ RequireComponent ( typeof ( Text ) ) ]
919 [ RequireComponent ( typeof ( RectTransform ) ) ]
1020 [ AddComponentMenu ( "UI/Effects/Extensions/Cylinder Text" ) ]
@@ -53,5 +63,5 @@ public override void ModifyMesh(VertexHelper vh)
5363 }
5464 }
5565 }
56- }
57- #endif
66+ #endif
67+ }
Original file line number Diff line number Diff line change 1- /// Credit Deeperbeige
2- /// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
3- /*
1+ /*
42
53Produces an simple tracking/letter-spacing effect on UI Text components.
64
@@ -42,9 +40,23 @@ This component doesn't really work with Rich Text. You don't need to remember to
4240*/
4341#if ! UNITY_2022_1_OR_NEWER
4442using System . Collections . Generic ;
43+ #endif
44+
45+ using System ;
4546
47+ /// Credit Deeperbeige
48+ /// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
4649namespace UnityEngine . UI . Extensions
4750{
51+ #if UNITY_2022_1_OR_NEWER
52+ [ Obsolete ( "LetterSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead." ) ]
53+ public class LetterSpacing : BaseMeshEffect
54+ {
55+ public override void ModifyMesh ( VertexHelper vh )
56+ {
57+ }
58+ }
59+ #else
4860 [ AddComponentMenu ( "UI/Effects/Extensions/Letter Spacing" ) ]
4961 ///Summary
5062 /// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
@@ -55,13 +67,13 @@ public class LetterSpacing : BaseMeshEffect
5567
5668 protected LetterSpacing ( ) { }
5769
58- #if UNITY_EDITOR
70+ #if UNITY_EDITOR
5971 protected override void OnValidate ( )
6072 {
6173 spacing = m_spacing ;
6274 base . OnValidate ( ) ;
6375 }
64- #endif
76+ #endif
6577
6678 public float spacing
6779 {
@@ -171,5 +183,5 @@ public override void ModifyMesh(VertexHelper vh)
171183 vh . AddUIVertexTriangleStream ( verts ) ;
172184 }
173185 }
174- }
175- #endif
186+ #endif
187+ }
Original file line number Diff line number Diff line change 1- /// Credit herbst / derived from LetterSpacing by Deeperbeige
2- /// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
31/*
42
53Produces an simple mono-spacing effect on UI Text components.
@@ -41,11 +39,24 @@ This component doesn't really work with Rich Text. You don't need to remember to
4139
4240*/
4341#if ! UNITY_2022_1_OR_NEWER
44-
4542using System . Collections . Generic ;
43+ #endif
4644
45+ using System ;
46+
47+ /// Credit herbst / derived from LetterSpacing by Deeperbeige
48+ /// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
4749namespace UnityEngine . UI . Extensions
4850{
51+ #if UNITY_2022_1_OR_NEWER
52+ [ Obsolete ( "MonoSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead." ) ]
53+ public class MonoSpacing : BaseMeshEffect
54+ {
55+ public override void ModifyMesh ( VertexHelper vh )
56+ {
57+ }
58+ }
59+ #else
4960 [ AddComponentMenu ( "UI/Effects/Extensions/Mono Spacing" ) ]
5061 [ RequireComponent ( typeof ( Text ) ) ]
5162 [ RequireComponent ( typeof ( RectTransform ) ) ]
@@ -76,13 +87,13 @@ protected override void Awake()
7687 rectTransform = text . GetComponent < RectTransform > ( ) ;
7788 }
7889
79- #if UNITY_EDITOR
90+ #if UNITY_EDITOR
8091 protected override void OnValidate ( )
8192 {
8293 Spacing = m_spacing ;
8394 base . OnValidate ( ) ;
8495 }
85- #endif
96+ #endif
8697
8798 public float Spacing
8899 {
@@ -190,5 +201,5 @@ public override void ModifyMesh(VertexHelper vh)
190201 vh . AddUIVertexTriangleStream ( verts ) ;
191202 }
192203 }
193- }
194- #endif
204+ #endif
205+ }
Original file line number Diff line number Diff line change 1+
2+ #if ! UNITY_2022_1_OR_NEWER
3+ using System . Collections . Generic ;
4+ #endif
5+
6+ using System ;
7+
18/// Credit Melang, Lee Hui
29/// Sourced from - http://forum.unity3d.com/members/melang.593409/
310/// GC Alloc fix - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/130
411/// NOT supported in Unity 2022
5-
6- #if ! UNITY_2022_1_OR_NEWER
7- using System . Collections . Generic ;
812namespace UnityEngine . UI . Extensions
913{
14+ #if UNITY_2022_1_OR_NEWER
15+ [ Obsolete ( "BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead." ) ]
16+ public class NicerOutline : BaseMeshEffect
17+ {
18+ public override void ModifyMesh ( VertexHelper vh )
19+ {
20+ }
21+ }
22+ #else
1023 //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
1124 [ AddComponentMenu ( "UI/Effects/Extensions/Nicer Outline" ) ]
1225 public class NicerOutline : BaseMeshEffect
@@ -194,5 +207,5 @@ protected override void OnValidate ()
194207 }
195208#endif
196209 }
197- }
198- #endif
210+ #endif
211+ }
Original file line number Diff line number Diff line change @@ -223,12 +223,21 @@ private void SetScrollContainerPosition()
223223 /// <summary>
224224 /// used for changing / updating between screen resolutions
225225 /// </summary>
226- public void UpdateLayout ( )
226+ public void UpdateLayout ( bool resetPositionToStart = false )
227227 {
228228 _lerp = false ;
229229 DistributePages ( ) ;
230+
231+ if ( resetPositionToStart )
232+ {
233+ _currentPage = StartingScreen ;
234+ }
235+
230236 if ( MaskArea )
237+ {
231238 UpdateVisible ( ) ;
239+ }
240+
232241 SetScrollContainerPosition ( ) ;
233242 OnCurrentScreenChange ( _currentPage ) ;
234243 }
Original file line number Diff line number Diff line change @@ -218,11 +218,21 @@ private void SetScrollContainerPosition()
218218 /// <summary>
219219 /// used for changing / updating between screen resolutions
220220 /// </summary>
221- public void UpdateLayout ( )
221+ public void UpdateLayout ( bool resetPositionToStart = false )
222222 {
223223 _lerp = false ;
224224 DistributePages ( ) ;
225- if ( MaskArea ) UpdateVisible ( ) ;
225+
226+ if ( resetPositionToStart )
227+ {
228+ _currentPage = StartingScreen ;
229+ }
230+
231+ if ( MaskArea )
232+ {
233+ UpdateVisible ( ) ;
234+ }
235+
226236 SetScrollContainerPosition ( ) ;
227237 OnCurrentScreenChange ( _currentPage ) ;
228238 }
You can’t perform that action at this time.
0 commit comments