Skip to content

Commit

Permalink
Added Texture2D support
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachee committed Aug 10, 2022
1 parent dd9c2b3 commit 5a9aeb5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 18 additions & 7 deletions Editor/Utilities/RandomListDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ namespace Lachee.Utilities.Editor
public class RandomListDrawerStyle
{
/// <summary>Dictionary lookup for custom drawers for the slider labels</summary>
public Dictionary<Type, IRistBoxLabelDrawer> Drawers = new Dictionary<Type, IRistBoxLabelDrawer>()
{
{ typeof(void), new BasicRistDrawer() },
{ typeof(Color), new ColorRistDrawer() },
{ typeof(AnimationCurve), new AnimationCurveRistDrawer() },
{ typeof(Sprite), new SpriteRistDrawer() },
};
public Dictionary<Type, IRistBoxLabelDrawer> Drawers;

public readonly Color[] Colors =
{
Expand All @@ -43,6 +37,23 @@ public class RandomListDrawerStyle
public readonly GUIStyle listPreButton = "RL FooterButton";
public readonly GUIContent listIconToolbarMinus = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove selection from the list");
public readonly GUIContent listIconToolbarPlus = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add to the list");

public RandomListDrawerStyle()
{
SpriteRistDrawer spriteRistDrawer = new SpriteRistDrawer();

Drawers = new Dictionary<Type, IRistBoxLabelDrawer>()
{
{ typeof(void), new BasicRistDrawer() },
{ typeof(Color), new ColorRistDrawer() },
{ typeof(AnimationCurve), new AnimationCurveRistDrawer() },

// They all reference the same object for efficiency
{ typeof(Sprite), spriteRistDrawer },
{ typeof(Texture), spriteRistDrawer },
{ typeof(Texture2D), spriteRistDrawer },
};
}
}

/// <summary>Interface used to draw labels on weight sliders</summary>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.lachee.utilities",
"version": "1.3.5",
"version": "1.3.6",
"displayName": "Lachee's Utilities",
"description": "Bunch of utility functionality",
"unity": "2019.1",
Expand Down

0 comments on commit 5a9aeb5

Please sign in to comment.