Skip to content

Commit

Permalink
Merge pull request #74 from tangrams/enum-popup
Browse files Browse the repository at this point in the history
Use better API enum popup
  • Loading branch information
matteblair authored Nov 2, 2017
2 parents a9f87ef + bb826ea commit 95b0329
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
13 changes: 1 addition & 12 deletions Assets/Editor/PolygonBuilderEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ public class PolygonBuilderEditor : EditorBase
[SerializeField]
private bool show;

[SerializeField]
private int selectedExtrusionType = -1;

public PolygonBuilderEditor()
: base()
{
Expand Down Expand Up @@ -53,16 +50,8 @@ public PolygonBuilder.Options OnInspectorGUI(PolygonBuilder.Options options)
return options;
}

if (selectedExtrusionType == -1)
{
selectedExtrusionType = (int) options.Extrusion;
}

options.MaxHeight = EditorGUILayout.FloatField("Max Height: ", options.MaxHeight);
var extrusionTypeList = Enum.GetValues(typeof(PolygonBuilder.ExtrusionType)).Cast<PolygonBuilder.ExtrusionType>();
var extrusionTypeStringList = extrusionTypeList.Select(type => type.ToString());
selectedExtrusionType = EditorGUILayout.Popup("Extrusion type: ", selectedExtrusionType, extrusionTypeStringList.ToArray());
options.Extrusion = (PolygonBuilder.ExtrusionType) selectedExtrusionType;
options.Extrusion = (PolygonBuilder.ExtrusionType)EditorGUILayout.EnumPopup("Extrusion type: ", options.Extrusion);
options.Enabled = EditorGUILayout.Toggle("Enabled: ", options.Enabled);

SavePreferences();
Expand Down
13 changes: 1 addition & 12 deletions Assets/Editor/PolylineBuilderEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ public class PolylineBuilderEditor : EditorBase
[SerializeField]
private bool show;

[SerializeField]
private int selectedExtrusionType = -1;

public PolylineBuilderEditor()
: base()
{
Expand Down Expand Up @@ -55,17 +52,9 @@ public PolylineBuilder.Options OnInspectorGUI(PolylineBuilder.Options options)
return options;
}

if (selectedExtrusionType == -1)
{
selectedExtrusionType = (int) options.Extrusion;
}

options.Width = EditorGUILayout.FloatField("Width: ", options.Width);
options.MaxHeight = EditorGUILayout.FloatField("Max Height: ", options.MaxHeight);
var extrusionTypeList = Enum.GetValues(typeof(PolygonBuilder.ExtrusionType)).Cast<PolygonBuilder.ExtrusionType>();
var extrusionTypeStringList = extrusionTypeList.Select(type => type.ToString());
selectedExtrusionType = EditorGUILayout.Popup("Extrusion type:", selectedExtrusionType, extrusionTypeStringList.ToArray());
options.Extrusion = (PolygonBuilder.ExtrusionType) selectedExtrusionType;
options.Extrusion = (PolygonBuilder.ExtrusionType)EditorGUILayout.EnumPopup("Extrusion type: ", options.Extrusion);
options.Enabled = EditorGUILayout.Toggle("Enabled: ", options.Enabled);

SavePreferences();
Expand Down

0 comments on commit 95b0329

Please sign in to comment.