-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from eviltwo/1.1.1-dev
1.1.1 dev
- Loading branch information
Showing
15 changed files
with
154 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
InputGlyphs/Assets/InputGlyphs/Scripts/Editor/GlyphsLayoutDataDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace InputGlyphs.Display.Editor | ||
{ | ||
[CustomPropertyDrawer(typeof(GlyphsLayoutData))] | ||
public class GlyphsLayoutDataDrawer : PropertyDrawer | ||
{ | ||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
{ | ||
using (new EditorGUI.PropertyScope(position, label, property)) | ||
{ | ||
var rect = position; | ||
rect.height = EditorGUIUtility.singleLineHeight; | ||
|
||
var layoutProperty = property.FindPropertyRelative(nameof(GlyphsLayoutData.Layout)); | ||
EditorGUI.PropertyField(rect, layoutProperty, new GUIContent($"Glyphs {layoutProperty.displayName}")); | ||
rect.y += EditorGUIUtility.singleLineHeight; | ||
|
||
var layout = (GlyphsLayout)layoutProperty.intValue; | ||
if (layout == GlyphsLayout.Horizontal) | ||
{ | ||
var maxCountProperty = property.FindPropertyRelative(nameof(GlyphsLayoutData.MaxCount)); | ||
EditorGUI.PropertyField(rect, maxCountProperty, new GUIContent($"Glyphs {maxCountProperty.displayName}")); | ||
} | ||
} | ||
} | ||
|
||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) | ||
{ | ||
var layoutProperty = property.FindPropertyRelative(nameof(GlyphsLayoutData.Layout)); | ||
var layout = (GlyphsLayout)layoutProperty.intValue; | ||
var lineCount = layout == GlyphsLayout.Horizontal ? 2 : 1; | ||
return EditorGUIUtility.singleLineHeight * lineCount; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
InputGlyphs/Assets/InputGlyphs/Scripts/Editor/GlyphsLayoutDataDrawer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/GlyphsLayout.cs
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/GlyphsLayoutData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
|
||
namespace InputGlyphs.Display | ||
{ | ||
[Serializable] | ||
public struct GlyphsLayoutData | ||
{ | ||
public GlyphsLayout Layout; | ||
public int MaxCount; | ||
|
||
public static GlyphsLayoutData Default => new GlyphsLayoutData | ||
{ | ||
Layout = GlyphsLayout.Horizontal, | ||
MaxCount = 4, | ||
}; | ||
} | ||
|
||
public enum GlyphsLayout | ||
{ | ||
Single = 1, | ||
Horizontal = 2, | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.