Skip to content

Commit 5a9aeb5

Browse files
committed
Added Texture2D support
1 parent dd9c2b3 commit 5a9aeb5

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Editor/Utilities/RandomListDrawer.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ namespace Lachee.Utilities.Editor
1414
public class RandomListDrawerStyle
1515
{
1616
/// <summary>Dictionary lookup for custom drawers for the slider labels</summary>
17-
public Dictionary<Type, IRistBoxLabelDrawer> Drawers = new Dictionary<Type, IRistBoxLabelDrawer>()
18-
{
19-
{ typeof(void), new BasicRistDrawer() },
20-
{ typeof(Color), new ColorRistDrawer() },
21-
{ typeof(AnimationCurve), new AnimationCurveRistDrawer() },
22-
{ typeof(Sprite), new SpriteRistDrawer() },
23-
};
17+
public Dictionary<Type, IRistBoxLabelDrawer> Drawers;
2418

2519
public readonly Color[] Colors =
2620
{
@@ -43,6 +37,23 @@ public class RandomListDrawerStyle
4337
public readonly GUIStyle listPreButton = "RL FooterButton";
4438
public readonly GUIContent listIconToolbarMinus = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove selection from the list");
4539
public readonly GUIContent listIconToolbarPlus = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add to the list");
40+
41+
public RandomListDrawerStyle()
42+
{
43+
SpriteRistDrawer spriteRistDrawer = new SpriteRistDrawer();
44+
45+
Drawers = new Dictionary<Type, IRistBoxLabelDrawer>()
46+
{
47+
{ typeof(void), new BasicRistDrawer() },
48+
{ typeof(Color), new ColorRistDrawer() },
49+
{ typeof(AnimationCurve), new AnimationCurveRistDrawer() },
50+
51+
// They all reference the same object for efficiency
52+
{ typeof(Sprite), spriteRistDrawer },
53+
{ typeof(Texture), spriteRistDrawer },
54+
{ typeof(Texture2D), spriteRistDrawer },
55+
};
56+
}
4657
}
4758

4859
/// <summary>Interface used to draw labels on weight sliders</summary>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.lachee.utilities",
3-
"version": "1.3.5",
3+
"version": "1.3.6",
44
"displayName": "Lachee's Utilities",
55
"description": "Bunch of utility functionality",
66
"unity": "2019.1",

0 commit comments

Comments
 (0)