-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
StateMachine
and AttributePropertyDrawer
Refactoring, restructure project
- Loading branch information
Showing
41 changed files
with
330 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Evolunity for Unity | ||
// Copyright © 2020 Bogdan Nikolayev <bodix321@gmail.com> | ||
// All Rights Reserved | ||
|
||
using System.Linq; | ||
using Evolutex.Evolunity.Extensions; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Evolutex.Evolunity.Editor.Drawers | ||
{ | ||
public abstract class AttributePropertyDrawer<T> : PropertyDrawer where T : PropertyAttribute | ||
{ | ||
protected abstract SerializedPropertyType[] SupportedTypes { get; } | ||
|
||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) => -2f; | ||
|
||
protected T Attribute => (T) attribute; | ||
|
||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
{ | ||
if (IsSupported(property)) | ||
{ | ||
OnValidatedGUI(position, property, label); | ||
} | ||
else | ||
{ | ||
string typeErrorText = "Type " + property.propertyType | ||
+ " is not supported with this property attribute.\n\n" | ||
+ "Supported property types:\n" | ||
+ SupportedTypes.AsString(x => "- " + x, "\n"); | ||
|
||
EditorGUI.HelpBox(GUILayoutUtility.GetRect(new GUIContent(typeErrorText), EditorStyles.helpBox), | ||
typeErrorText, MessageType.Error); | ||
} | ||
} | ||
|
||
protected virtual bool IsSupported(SerializedProperty property) | ||
{ | ||
return SupportedTypes.Any(x => x == property.propertyType); | ||
} | ||
|
||
protected virtual void OnValidatedGUI(Rect position, SerializedProperty property, GUIContent label) { } | ||
} | ||
} |
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
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Evolunity for Unity | ||
// Copyright © 2020 Bogdan Nikolayev <bodix321@gmail.com> | ||
// All Rights Reserved | ||
|
||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Evolutex.Evolunity.Editor.Windows | ||
{ | ||
public class Config : EditorWindow | ||
{ | ||
[MenuItem("Window/General/Config")] | ||
private static void ShowWindow() | ||
{ | ||
Config window = GetWindow<Config>(); | ||
window.titleContent = new GUIContent("Config"); | ||
window.Show(); | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
Application.targetFrameRate = | ||
EditorGUILayout.IntSlider("Target frame rate", Application.targetFrameRate, 0, 300); | ||
} | ||
} | ||
} |
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
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.