-
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.
HUGE breakthrough, see commit description
- Finally understood what the deal is with Assembly Definitions - Package BUILDS FINALLY - Rough WORKING version of SebTodosLists - Namespaces needs to be redefined - Finally understood the main difference between Runtime and Editor folders, put script in correct ones - etc...
- Loading branch information
Showing
23 changed files
with
211 additions
and
160 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,78 @@ | ||
using SebEssentials; | ||
using UnityEditor; | ||
using UnityEditor.AnimatedValues; | ||
using UnityEngine; | ||
|
||
[CustomEditor(typeof(ItemAnimator))] | ||
public class ItemAnimatorEditor : Editor | ||
{ | ||
public AnimBool isFloatingToggle; | ||
public AnimBool isRotatingToggle; | ||
private ItemAnimator.RotationDirection rot; | ||
|
||
private void OnEnable() | ||
{ | ||
isFloatingToggle = new AnimBool(); | ||
isRotatingToggle = new AnimBool(); | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
namespace SebEssentials | ||
{ | ||
[CustomEditor(typeof(ItemAnimator))] | ||
public class ItemAnimatorEditor : Editor | ||
{ | ||
ItemAnimator t = target as ItemAnimator; | ||
|
||
isFloatingToggle.target = EditorGUILayout.ToggleLeft( | ||
new GUIContent("Floating", | ||
"Set to true if you want your object to bob up and down, and to make the parameters available."), | ||
isFloatingToggle.target, GuiStylesBank.boldStyle); | ||
public AnimBool isFloatingToggle; | ||
public AnimBool isRotatingToggle; | ||
private ItemAnimator.RotationDirection rot; | ||
|
||
if (EditorGUILayout.BeginFadeGroup(isFloatingToggle.faded)) | ||
private void OnEnable() | ||
{ | ||
EditorGUILayout.BeginVertical(); | ||
t.isFloating = true; | ||
t.intensity = | ||
EditorGUILayout.Slider( | ||
new GUIContent("Amplitude", | ||
"Amplitude of the vertical movement. The higher the value, the higher the range. The middle will always be the starting position."), | ||
t.intensity, 0, 30); | ||
t.speed = EditorGUILayout.Slider( | ||
new GUIContent("Speed", | ||
"The speed of the variation. The higher the value, the shorter the time will be to execute a complete cycle."), | ||
t.speed, 0, 30); | ||
EditorGUILayout.EndVertical(); | ||
isFloatingToggle = new AnimBool(); | ||
isRotatingToggle = new AnimBool(); | ||
} | ||
else | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
t.isFloating = false; | ||
} | ||
ItemAnimator t = target as ItemAnimator; | ||
|
||
EditorGUILayout.EndFadeGroup(); | ||
isFloatingToggle.target = EditorGUILayout.ToggleLeft( | ||
new GUIContent("Floating", | ||
"Set to true if you want your object to bob up and down, and to make the parameters available."), | ||
isFloatingToggle.target, GuiStylesBank.boldStyle); | ||
|
||
isRotatingToggle.target = | ||
EditorGUILayout.ToggleLeft( | ||
new GUIContent("Rotating", | ||
"Set it to true if you want your object to rotate, and have the rest of the parameters available."), | ||
isRotatingToggle.target, GuiStylesBank.boldStyle); | ||
if (EditorGUILayout.BeginFadeGroup(isRotatingToggle.faded)) | ||
{ | ||
t.isRotating = true; | ||
t.rotationDirection = | ||
(ItemAnimator.RotationDirection) EditorGUILayout.EnumPopup( | ||
new GUIContent("Rotation direction", | ||
"Technically, you could just put a negative value to rotate in the opposite direction, but I wanted to have a fancy inspector."), | ||
t.rotationDirection); | ||
t.rotateSpeed = | ||
EditorGUILayout.Slider(new GUIContent("Rotating speed", "I think that you get what this one is for :)"), | ||
t.rotateSpeed, .1f, 30f); | ||
} | ||
else | ||
{ | ||
t.isRotating = false; | ||
} | ||
if (EditorGUILayout.BeginFadeGroup(isFloatingToggle.faded)) | ||
{ | ||
EditorGUILayout.BeginVertical(); | ||
t.isFloating = true; | ||
t.intensity = | ||
EditorGUILayout.Slider( | ||
new GUIContent("Amplitude", | ||
"Amplitude of the vertical movement. The higher the value, the higher the range. The middle will always be the starting position."), | ||
t.intensity, 0, 30); | ||
t.speed = EditorGUILayout.Slider( | ||
new GUIContent("Speed", | ||
"The speed of the variation. The higher the value, the shorter the time will be to execute a complete cycle."), | ||
t.speed, 0, 30); | ||
EditorGUILayout.EndVertical(); | ||
} | ||
else | ||
{ | ||
t.isFloating = false; | ||
} | ||
|
||
EditorGUILayout.EndFadeGroup(); | ||
EditorGUILayout.EndFadeGroup(); | ||
|
||
isRotatingToggle.target = | ||
EditorGUILayout.ToggleLeft( | ||
new GUIContent("Rotating", | ||
"Set it to true if you want your object to rotate, and have the rest of the parameters available."), | ||
isRotatingToggle.target, GuiStylesBank.boldStyle); | ||
if (EditorGUILayout.BeginFadeGroup(isRotatingToggle.faded)) | ||
{ | ||
t.isRotating = true; | ||
t.rotationDirection = | ||
(ItemAnimator.RotationDirection) EditorGUILayout.EnumPopup( | ||
new GUIContent("Rotation direction", | ||
"Technically, you could just put a negative value to rotate in the opposite direction, but I wanted to have a fancy inspector."), | ||
t.rotationDirection); | ||
t.rotateSpeed = | ||
EditorGUILayout.Slider( | ||
new GUIContent("Rotating speed", "I think that you get what this one is for :)"), | ||
t.rotateSpeed, .1f, 30f); | ||
} | ||
else | ||
{ | ||
t.isRotating = false; | ||
} | ||
|
||
EditorGUILayout.EndFadeGroup(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
[CreateAssetMenu(fileName = "New Todo list", menuName = "Todo list")] | ||
public class TodosAndNotes : ScriptableObject | ||
{ | ||
public string title; | ||
public string content; | ||
public List<String> todos; | ||
|
||
public void Init(string title, string content, List<string> todos) | ||
{ | ||
this.title = title; | ||
this.content = content; | ||
this.todos = todos; | ||
} | ||
|
||
} |
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,114 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using SebEssentials; | ||
|
||
public class TodosAndNotesEditorWindow : EditorWindow | ||
{ | ||
public string noteTitle; | ||
public string notes; | ||
private string[] todos; | ||
private int todoCap; | ||
private string path = "Assets/nameless.asset"; | ||
|
||
|
||
private void Awake() | ||
{ | ||
todos = new string[todoCap]; | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
GUILayout.Label("Todos and notes", EditorStyles.whiteLargeLabel); | ||
|
||
FirstBlock(); | ||
|
||
List(); | ||
|
||
|
||
Export(); | ||
} | ||
|
||
private void List() | ||
{ | ||
GUILayout.BeginHorizontal(); | ||
|
||
if (GUILayout.Button(new GUIContent("-", "Remove a line"), EditorStyles.miniButton, GUILayout.Width(30), | ||
GUILayout.Height(30))) | ||
{ | ||
todoCap--; | ||
Array.Resize(ref todos, todoCap); | ||
} | ||
|
||
EditorGUILayout.LabelField(todoCap.ToString(), EditorStyles.whiteLargeLabel, GUILayout.MaxWidth(40)); | ||
|
||
if (GUILayout.Button(new GUIContent("+", "Add a line"), EditorStyles.miniButton, GUILayout.Width(30), | ||
GUILayout.Height(30))) | ||
{ | ||
todoCap++; | ||
Array.Resize(ref todos, todoCap); | ||
} | ||
|
||
GUILayout.EndHorizontal(); | ||
|
||
for (int i = 0; i < todoCap; i++) | ||
{ | ||
EditorGUILayout.BeginHorizontal(); | ||
todos[i] = EditorGUILayout.TextField(todos[i]); | ||
if (GUILayout.Button("X")) | ||
{ | ||
var temp = todos.ToList(); | ||
temp.RemoveAt(i); | ||
todos = new List<string>(temp).ToArray(); | ||
todoCap--; | ||
} | ||
|
||
EditorGUILayout.EndHorizontal(); | ||
} | ||
} | ||
|
||
private void Export() | ||
{ | ||
GUILayout.BeginHorizontal(); | ||
EditorGUILayout.PrefixLabel("Path : "); | ||
path = EditorGUILayout.TextField(path); | ||
|
||
if (GUILayout.Button("Export as Scriptable Object")) | ||
{ | ||
TodosAndNotes asset = CreateInstance<TodosAndNotes>(); | ||
asset.title = noteTitle; | ||
asset.content = notes; | ||
asset.todos = todos.ToList(); | ||
var temp = path; | ||
path = AssetDatabase.GenerateUniqueAssetPath($"{path}/{noteTitle}.asset"); | ||
AssetDatabase.CreateAsset(asset, path); | ||
AssetDatabase.SaveAssets(); | ||
EditorUtility.FocusProjectWindow(); | ||
Selection.activeObject = asset; | ||
path = String.Empty; | ||
} | ||
|
||
GUILayout.EndHorizontal(); | ||
} | ||
|
||
private void FirstBlock() | ||
{ | ||
EditorGUILayout.BeginVertical(); | ||
EditorGUILayout.LabelField("Title"); | ||
noteTitle = EditorGUILayout.TextField(noteTitle); | ||
EditorGUILayout.EndVertical(); | ||
EditorGUILayout.BeginVertical(); | ||
EditorGUILayout.LabelField("Content"); | ||
notes = EditorGUILayout.TextArea(notes, GUILayout.Height(50)); | ||
EditorGUILayout.EndVertical(); | ||
} | ||
|
||
|
||
[MenuItem("Tools/SebEssentials/Todos")] | ||
public static void ShowWindow() | ||
{ | ||
GetWindow<TodosAndNotesEditorWindow>("Todos and notes"); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
Libraries/SebEssentials.Libraries.asmdef → Editor/com.SebEssentials.Editor.asmdef
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
2 changes: 1 addition & 1 deletion
2
...aries/SebEssentials.Libraries.asmdef.meta → Editor/com.SebEssentials.Editor.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.