-
Notifications
You must be signed in to change notification settings - Fork 38
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 #167 from brunomikoski/feature/not-sure
Bug fixes and improvements
- Loading branch information
Showing
20 changed files
with
425 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Collections.Generic; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace BrunoMikoski.ScriptableObjectCollections | ||
{ | ||
public class MoveToCollectionWindow : EditorWindow | ||
{ | ||
private List<ISOCItem> itemsToMove; | ||
private List<ScriptableObjectCollection> availableCollections; | ||
|
||
public static void ShowWindow(List<ISOCItem> items, List<ScriptableObjectCollection> collections) | ||
{ | ||
MoveToCollectionWindow window = GetWindow<MoveToCollectionWindow>("Move to Collection"); | ||
window.itemsToMove = items; | ||
window.availableCollections = collections; | ||
window.ShowPopup(); | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
EditorGUILayout.LabelField("Select a Collection to Move Items", EditorStyles.boldLabel); | ||
|
||
if (availableCollections == null || availableCollections.Count == 0) | ||
{ | ||
EditorGUILayout.LabelField("No available collections."); | ||
return; | ||
} | ||
|
||
foreach (ScriptableObjectCollection collection in availableCollections) | ||
{ | ||
if (GUILayout.Button(collection.name)) | ||
{ | ||
foreach (ISOCItem item in itemsToMove) | ||
{ | ||
SOCItemUtility.MoveItem(item, collection); | ||
EditorUtility.SetDirty(collection); | ||
} | ||
|
||
Close(); | ||
} | ||
} | ||
} | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
Scripts/Editor/PropertyDrawers/CollectionReferenceLongGuidDrawer.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,29 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace BrunoMikoski.ScriptableObjectCollections.Picker | ||
{ | ||
[CustomPropertyDrawer(typeof(CollectionReferenceLongGuidAttribute))] | ||
public class CollectionReferenceLongGuidDrawer : PropertyDrawer | ||
{ | ||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) | ||
{ | ||
return EditorGUIUtility.singleLineHeight; | ||
} | ||
|
||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
{ | ||
LongGuid collectionGUID = (LongGuid)property.boxedValue; | ||
|
||
ScriptableObjectCollection collection = null; | ||
if (collectionGUID.IsValid()) | ||
{ | ||
collection = CollectionsRegistry.Instance.GetCollectionByGUID(collectionGUID); | ||
} | ||
|
||
EditorGUI.BeginDisabledGroup(true); | ||
EditorGUI.ObjectField(position, "Collection", collection, typeof(ScriptableObjectCollection), false); | ||
EditorGUI.EndDisabledGroup(); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Scripts/Editor/PropertyDrawers/CollectionReferenceLongGuidDrawer.cs.meta
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.