-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35a5a27
commit c80b13d
Showing
13 changed files
with
188 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace MinimalUtility.Editor.DataBind | ||
{ | ||
using MinimalUtility.DataBind; | ||
|
||
internal static class DataBindUtils | ||
{ | ||
public static Type GetTargetType(Type type) | ||
{ | ||
var baseType = type.BaseType; | ||
while (baseType != null) | ||
{ | ||
if (baseType.IsGenericType && baseType.GetGenericTypeDefinition() == typeof(TargetBindElement<>)) | ||
{ | ||
return baseType.GetGenericArguments()[0]; | ||
} | ||
baseType = baseType.BaseType; | ||
} | ||
throw new InvalidOperationException("TargetBindElement<> not found in the type hierarchy."); | ||
} | ||
|
||
public static Texture2D? LoadRemoveIcon() | ||
{ | ||
return EditorGUIUtility.Load("Toolbar Minus") as Texture2D; | ||
} | ||
|
||
public static Texture2D? LoadMiniTypeThumbnail(Type type) | ||
{ | ||
#if ENABLE_TEXTMESHPRO | ||
if (type == typeof(TMPro.TextMeshProUGUI) || type == typeof(TMPro.TMP_InputField)) | ||
{ | ||
#if UNITY_2023_2_OR_NEWER | ||
return AssetDatabase.LoadAssetAtPath<Texture2D>( | ||
"Packages/com.unity.ugui/Editor Resources/Gizmos/TMP - Text Component Icon.psd"); | ||
#else | ||
return AssetDatabase.LoadAssetAtPath<Texture2D>( | ||
"Packages/com.unity.textmeshpro/Editor Resources/Gizmos/TMP - Text Component Icon.psd"); | ||
#endif | ||
} | ||
#endif | ||
return AssetPreview.GetMiniTypeThumbnail(type) ?? EditorGUIUtility.Load("Cs Script Icon") as Texture2D; | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Packages/MinimalUtility/Editor/DataBind/DataBindUtils.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
7 changes: 2 additions & 5 deletions
7
Packages/MinimalUtility/Editor/DataBind/IItemSelectHandler.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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
#if ENABLE_UGUI | ||
#nullable enable | ||
#nullable enable | ||
|
||
namespace MinimalUtility.Editor.DataBind | ||
{ | ||
internal interface IItemSelectHandler | ||
{ | ||
void OnItemSelected(System.Type type); | ||
} | ||
} | ||
|
||
#endif | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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
4 changes: 3 additions & 1 deletion
4
Packages/MinimalUtility/Runtime/DataBind/DataBindMenuAttribute.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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
using System; | ||
#nullable enable | ||
|
||
using System; | ||
|
||
namespace MinimalUtility.DataBind | ||
{ | ||
|
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,31 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using UnityEngine; | ||
|
||
namespace MinimalUtility.DataBind | ||
{ | ||
[Serializable] | ||
public struct ParseOption | ||
{ | ||
[SerializeField, Tooltip("数字書式指定文字列")] | ||
private string _format; | ||
|
||
[SerializeField] | ||
private NumberOption _numberOption; | ||
|
||
public ReadOnlySpan<char> format => string.IsNullOrEmpty(_format) ? default : _format.AsSpan(); | ||
|
||
public NumberOption numberOption => _numberOption; | ||
} | ||
|
||
public enum NumberOption | ||
{ | ||
[InspectorName("設定なし")] | ||
None, | ||
[InspectorName("絶対値")] | ||
Absolute, | ||
[InspectorName("負の値化")] | ||
Negative | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.