Browse Source

Merge pull request #704 from stevehalliwell/UnityReorderable

Unity reorderable
master
Chris Gregan 7 years ago committed by GitHub
parent
commit
51d342aeb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      Assets/Fungus/Scripts/Commands/SetCollider.cs
  2. 39
      Assets/Fungus/Scripts/Editor/BlockEditor.cs
  3. 5
      Assets/Fungus/Scripts/Editor/CallEditor.cs
  4. 4
      Assets/Fungus/Scripts/Editor/CharacterEditor.cs
  5. 44
      Assets/Fungus/Scripts/Editor/CommandEditor.cs
  6. 264
      Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs
  7. 5
      Assets/Fungus/Scripts/Editor/ControlAudioEditor.cs
  8. 135
      Assets/Fungus/Scripts/Editor/FlowchartEditor.cs
  9. 38
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs
  10. 5
      Assets/Fungus/Scripts/Editor/InvokeEventEditor.cs
  11. 5
      Assets/Fungus/Scripts/Editor/LabelEditor.cs
  12. 5
      Assets/Fungus/Scripts/Editor/MenuEditor.cs
  13. 5
      Assets/Fungus/Scripts/Editor/MenuTimerEditor.cs
  14. 7
      Assets/Fungus/Scripts/Editor/PortraitEditor.cs
  15. 34
      Assets/Fungus/Scripts/Editor/SaveDataEditor.cs
  16. 12
      Assets/Fungus/Scripts/Editor/SaveDataEditor.cs.meta
  17. 1
      Assets/Fungus/Scripts/Editor/SaveMenuEditor.cs
  18. 30
      Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs
  19. 12
      Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs.meta
  20. 5
      Assets/Fungus/Scripts/Editor/SayEditor.cs
  21. 40
      Assets/Fungus/Scripts/Editor/SetColliderEditor.cs
  22. 12
      Assets/Fungus/Scripts/Editor/SetColliderEditor.cs.meta
  23. 5
      Assets/Fungus/Scripts/Editor/SetVariableEditor.cs
  24. 7
      Assets/Fungus/Scripts/Editor/StageEditor.cs
  25. 5
      Assets/Fungus/Scripts/Editor/VariableConditionEditor.cs
  26. 4
      Assets/Fungus/Scripts/Editor/VariableEditor.cs
  27. 181
      Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs
  28. 5
      Assets/Fungus/Scripts/Editor/WriteEditor.cs
  29. 4
      Assets/Fungus/Scripts/Editor/WriterAudioEditor.cs
  30. 9
      Assets/Fungus/Thirdparty/Reorderable List Field.meta
  31. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo.meta
  32. 12
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviour.cs
  33. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviour.cs.meta
  34. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviourUnityScript.js
  35. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviourUnityScript.js.meta
  36. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor.meta
  37. 30
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/DemoBehaviourEditor.cs
  38. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/DemoBehaviourEditor.cs.meta
  39. 184
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/MultiListEditorWindowDemo.cs
  40. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/MultiListEditorWindowDemo.cs.meta
  41. 79
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/ReorderableListDemo.cs
  42. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/ReorderableListDemo.cs.meta
  43. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor.meta
  44. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu.meta
  45. 109
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuBuilder.cs
  46. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuBuilder.cs.meta
  47. 67
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuCommandAttribute.cs
  48. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuCommandAttribute.cs.meta
  49. 170
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMeta.cs
  50. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMeta.cs.meta
  51. 38
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenu.cs
  52. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenu.cs.meta
  53. 102
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenuBuilder.cs
  54. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenuBuilder.cs.meta
  55. 43
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdder.cs
  56. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdder.cs.meta
  57. 33
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenu.cs
  58. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenu.cs.meta
  59. 76
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuBuilder.cs
  60. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuBuilder.cs.meta
  61. 41
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuCommand.cs
  62. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuCommand.cs.meta
  63. 145
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/GenericListAdaptor.cs
  64. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/GenericListAdaptor.cs.meta
  65. 131
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListAdaptor.cs
  66. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListAdaptor.cs.meta
  67. 49
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListDropTarget.cs
  68. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListDropTarget.cs.meta
  69. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal.meta
  70. 140
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/GUIHelper.cs
  71. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/GUIHelper.cs.meta
  72. 193
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/ReorderableListResources.cs
  73. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/ReorderableListResources.cs.meta
  74. 179
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/SerializedPropertyUtility.cs
  75. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/SerializedPropertyUtility.cs.meta
  76. 2000
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListControl.cs
  77. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListControl.cs.meta
  78. 216
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListEvents.cs
  79. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListEvents.cs.meta
  80. 62
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListFlags.cs
  81. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListFlags.cs.meta
  82. 576
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListGUI.cs
  83. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListGUI.cs.meta
  84. 114
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListStyles.cs
  85. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListStyles.cs.meta
  86. 159
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/SerializedPropertyAdaptor.cs
  87. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Editor/SerializedPropertyAdaptor.cs.meta
  88. 21
      Assets/Fungus/Thirdparty/Reorderable List Field/LICENSE.txt
  89. 7
      Assets/Fungus/Thirdparty/Reorderable List Field/LICENSE.txt.meta
  90. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Properties.meta
  91. 36
      Assets/Fungus/Thirdparty/Reorderable List Field/Properties/AssemblyInfo.cs
  92. 11
      Assets/Fungus/Thirdparty/Reorderable List Field/Properties/AssemblyInfo.cs.meta
  93. 145
      Assets/Fungus/Thirdparty/Reorderable List Field/README.md
  94. 7
      Assets/Fungus/Thirdparty/Reorderable List Field/README.md.meta
  95. 8
      Assets/Fungus/Thirdparty/Reorderable List Field/Support.meta
  96. BIN
      Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chm
  97. 7
      Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chm.meta
  98. BIN
      Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chw
  99. 7
      Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chw.meta
  100. BIN
      Assets/Fungus/Thirdparty/Reorderable List Field/Support/Resources.zip
  101. Some files were not shown because too many files have changed in this diff Show More

5
Assets/Fungus/Scripts/Commands/SetCollider.cs

@ -97,6 +97,11 @@ namespace Fungus
return new Color32(235, 191, 217, 255);
}
public override bool IsReorderableArray(string propertyName)
{
return propertyName == "targetObjects";
}
#endregion
}

39
Assets/Fungus/Scripts/Editor/BlockEditor.cs

@ -9,7 +9,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Rotorz.ReorderableList;
using System.IO;
using System.Reflection;
@ -49,6 +48,9 @@ namespace Fungus.EditorUtils
static List<System.Type> commandTypes;
static List<System.Type> eventHandlerTypes;
private CommandListAdaptor commandListAdaptor;
private SerializedProperty commandListProperty;
static void CacheEventHandlerTypes()
{
eventHandlerTypes = EditorExtensions.FindDerivedTypes(typeof(EventHandler)).ToList();
@ -63,12 +65,27 @@ namespace Fungus.EditorUtils
protected virtual void OnEnable()
{
//this appears to happen when leaving playmode
try
{
if (serializedObject == null)
return;
}
catch (Exception)
{
return;
}
upIcon = FungusEditorResources.Up;
downIcon = FungusEditorResources.Down;
addIcon = FungusEditorResources.Add;
duplicateIcon = FungusEditorResources.Duplicate;
deleteIcon = FungusEditorResources.Delete;
commandListProperty = serializedObject.FindProperty("commandList");
commandListAdaptor = new CommandListAdaptor(target as Block, commandListProperty);
CacheEventHandlerTypes();
}
@ -97,6 +114,8 @@ namespace Fungus.EditorUtils
{
serializedObject.Update();
var block = target as Block;
// Execute any queued cut, copy, paste, etc. operations from the prevous GUI update
// We need to defer applying these operations until the following update because
// the ReorderableList control emits GUI errors if you clear the list in the same frame
@ -113,9 +132,6 @@ namespace Fungus.EditorUtils
actionList.Clear();
}
var block = target as Block;
SerializedProperty commandListProperty = serializedObject.FindProperty("commandList");
if (block == flowchart.SelectedBlock)
{
@ -150,20 +166,7 @@ namespace Fungus.EditorUtils
command.ParentBlock = block;
}
ReorderableListGUI.Title("Commands");
CommandListAdaptor adaptor = new CommandListAdaptor(commandListProperty, 0);
adaptor.nodeRect = block._NodeRect;
ReorderableListFlags flags = ReorderableListFlags.HideAddButton | ReorderableListFlags.HideRemoveButtons | ReorderableListFlags.DisableContextMenu;
if (block.CommandList.Count == 0)
{
EditorGUILayout.HelpBox("Press the + button below to add a command to the list.", MessageType.Info);
}
else
{
ReorderableListControl.DrawControlFromState(adaptor, null, flags);
}
commandListAdaptor.DrawCommandList();
// EventType.contextClick doesn't register since we moved the Block Editor to be inside
// a GUI Area, no idea why. As a workaround we just check for right click instead.

5
Assets/Fungus/Scripts/Editor/CallEditor.cs

@ -15,10 +15,9 @@ namespace Fungus.EditorUtils
protected SerializedProperty startIndexProp;
protected SerializedProperty callModeProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
targetFlowchartProp = serializedObject.FindProperty("targetFlowchart");
targetBlockProp = serializedObject.FindProperty("targetBlock");

4
Assets/Fungus/Scripts/Editor/CharacterEditor.cs

@ -3,7 +3,6 @@
using UnityEditor;
using UnityEngine;
using Rotorz.ReorderableList;
namespace Fungus.EditorUtils
{
@ -60,8 +59,7 @@ namespace Fungus.EditorUtils
GUI.DrawTexture(previewRect,characterTexture,ScaleMode.ScaleToFit,true,aspect);
}
ReorderableListGUI.Title(new GUIContent("Portraits", "Character image sprites to display in the dialog"));
ReorderableListGUI.ListField(portraitsProp);
EditorGUILayout.PropertyField(portraitsProp, new GUIContent("Portraits", "Character image sprites to display in the dialog"), true);
EditorGUILayout.HelpBox("All portrait images should use the exact same resolution to avoid positioning and tiling issues.", MessageType.Info);

44
Assets/Fungus/Scripts/Editor/CommandEditor.cs

@ -4,14 +4,14 @@
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using Rotorz.ReorderableList;
using UnityEditorInternal;
namespace Fungus.EditorUtils
{
[CustomEditor (typeof(Command), true)]
public class CommandEditor : Editor
{
#region statics
public static Command selectedCommand;
public static CommandInfoAttribute GetCommandInfo(System.Type commandType)
@ -34,6 +34,18 @@ namespace Fungus.EditorUtils
return retval;
}
#endregion statics
private Dictionary<string, ReorderableList> reorderableLists;
public virtual void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
reorderableLists = new Dictionary<string, ReorderableList>();
}
public virtual void DrawCommandInspectorGUI()
{
Command t = target as Command;
@ -148,8 +160,32 @@ namespace Fungus.EditorUtils
if (iterator.isArray &&
t.IsReorderableArray(iterator.name))
{
ReorderableListGUI.Title(new GUIContent(iterator.displayName, iterator.tooltip));
ReorderableListGUI.ListField(iterator);
ReorderableList reordList = null;
reorderableLists.TryGetValue(iterator.displayName, out reordList);
if(reordList == null)
{
var locSerProp = iterator.Copy();
//create and insert
reordList = new ReorderableList(serializedObject, locSerProp, true, false, true, true)
{
drawHeaderCallback = (Rect rect) =>
{
EditorGUI.LabelField(rect, locSerProp.displayName);
},
drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
EditorGUI.PropertyField(rect, locSerProp.GetArrayElementAtIndex(index));
},
elementHeightCallback = (int index) =>
{
return EditorGUI.GetPropertyHeight(locSerProp.GetArrayElementAtIndex(index), null, true);// + EditorGUIUtility.singleLineHeight;
}
};
reorderableLists.Add(iterator.displayName, reordList);
}
reordList.DoLayoutList();
}
else
{

264
Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs

@ -1,181 +1,98 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
// Copyright (c) 2012-2013 Rotorz Limited. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
using UnityEngine;
using UnityEditor;
using System;
using Rotorz.ReorderableList;
using UnityEditorInternal;
namespace Fungus.EditorUtils
{
public class CommandListAdaptor : IReorderableListAdaptor {
public class CommandListAdaptor
{
public void DrawCommandList()
{
if (block.CommandList.Count == 0)
{
EditorGUILayout.HelpBox("Press the + button below to add a command to the list.", MessageType.Info);
}
else
{
EditorGUI.indentLevel++;
list.DoLayoutList();
EditorGUI.indentLevel--;
}
}
protected SerializedProperty _arrayProperty;
protected ReorderableList list;
protected Block block;
public float fixedItemHeight;
public Rect nodeRect = new Rect();
public SerializedProperty this[int index] {
public SerializedProperty this[int index]
{
get { return _arrayProperty.GetArrayElementAtIndex(index); }
}
public SerializedProperty arrayProperty {
public SerializedProperty arrayProperty
{
get { return _arrayProperty; }
}
public CommandListAdaptor(SerializedProperty arrayProperty, float fixedItemHeight) {
public CommandListAdaptor(Block _block, SerializedProperty arrayProperty)
{
if (arrayProperty == null)
throw new ArgumentNullException("Array property was null.");
if (!arrayProperty.isArray)
throw new InvalidOperationException("Specified serialized propery is not an array.");
this._arrayProperty = arrayProperty;
this.fixedItemHeight = fixedItemHeight;
}
public CommandListAdaptor(SerializedProperty arrayProperty) : this(arrayProperty, 0f) {
}
public int Count {
get { return _arrayProperty.arraySize; }
}
public virtual bool CanDrag(int index) {
return true;
}
public virtual bool CanRemove(int index) {
return true;
}
public void Add() {
Command newCommand = AddNewCommand();
if (newCommand == null)
{
return;
}
int newIndex = _arrayProperty.arraySize;
++_arrayProperty.arraySize;
_arrayProperty.GetArrayElementAtIndex(newIndex).objectReferenceValue = newCommand;
}
public void Insert(int index) {
Command newCommand = AddNewCommand();
if (newCommand == null)
{
return;
}
_arrayProperty.InsertArrayElementAtIndex(index);
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = newCommand;
}
Command AddNewCommand()
{
Flowchart flowchart = FlowchartWindow.GetFlowchart();
if (flowchart == null)
{
return null;
}
var block = flowchart.SelectedBlock;
if (block == null)
{
return null;
}
var newCommand = Undo.AddComponent<Comment>(block.gameObject) as Command;
newCommand.ItemId = flowchart.NextItemId();
flowchart.ClearSelectedCommands();
flowchart.AddSelectedCommand(newCommand);
return newCommand;
}
public void Duplicate(int index) {
Command command = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as Command;
// Add the command as a new component
var parentBlock = command.GetComponent<Block>();
System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(parentBlock.gameObject, type) as Command;
newCommand.ItemId = newCommand.GetFlowchart().NextItemId();
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
{
field.SetValue(newCommand, field.GetValue(command));
}
_arrayProperty.InsertArrayElementAtIndex(index);
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = newCommand;
}
public void Remove(int index) {
// Remove the Fungus Command component
Command command = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as Command;
if (command != null)
{
Undo.DestroyObjectImmediate(command);
}
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = null;
_arrayProperty.DeleteArrayElementAtIndex(index);
}
public void Move(int sourceIndex, int destIndex) {
if (destIndex > sourceIndex)
--destIndex;
_arrayProperty.MoveArrayElement(sourceIndex, destIndex);
}
public void Clear() {
while (Count > 0)
{
Remove(0);
}
}
this.block = _block;
public void BeginGUI()
{}
list = new ReorderableList(arrayProperty.serializedObject, arrayProperty, true, true, false, false);
list.drawHeaderCallback = DrawHeader;
list.drawElementCallback = DrawItem;
//list.elementHeightCallback = GetElementHeight;
}
public void EndGUI()
{}
//private float GetElementHeight(int index)
//{
// return EditorGUI.GetPropertyHeight(this[index], null, true);// + EditorGUIUtility.singleLineHeight;
//}
public void DrawItemBackground(Rect position, int index) {
private void DrawHeader(Rect rect)
{
EditorGUI.LabelField(rect, new GUIContent("Commands"));
}
public void DrawItem(Rect position, int index)
public void DrawItem(Rect position, int index, bool selected, bool focused)
{
Command command = this[index].objectReferenceValue as Command;
if (command == null)
{
return;
}
CommandInfoAttribute commandInfoAttr = CommandEditor.GetCommandInfo(command.GetType());
if (commandInfoAttr == null)
{
return;
}
var flowchart = (Flowchart)command.GetFlowchart();
if (flowchart == null)
{
return;
}
bool isComment = command.GetType() == typeof(Comment);
bool isLabel = (command.GetType() == typeof(Label));
bool error = false;
string summary = command.GetSummary();
if (summary == null)
@ -209,9 +126,9 @@ namespace Fungus.EditorUtils
break;
}
}
string commandName = commandInfoAttr.CommandName;
GUIStyle commandLabelStyle = new GUIStyle(GUI.skin.box);
commandLabelStyle.normal.background = FungusEditorResources.CommandBackground;
int borderSize = 5;
@ -223,26 +140,26 @@ namespace Fungus.EditorUtils
commandLabelStyle.richText = true;
commandLabelStyle.fontSize = 11;
commandLabelStyle.padding.top -= 1;
float indentSize = 20;
float indentSize = 20;
for (int i = 0; i < command.IndentLevel; ++i)
{
Rect indentRect = position;
indentRect.x += i * indentSize - 21;
indentRect.x += i * indentSize;// - 21;
indentRect.width = indentSize + 1;
indentRect.y -= 2;
indentRect.height += 5;
GUI.backgroundColor = new Color(0.5f, 0.5f, 0.5f, 1f);
GUI.Box(indentRect, "", commandLabelStyle);
}
float commandNameWidth = Mathf.Max(commandLabelStyle.CalcSize(new GUIContent(commandName)).x, 90f);
float indentWidth = command.IndentLevel * indentSize;
Rect commandLabelRect = position;
commandLabelRect.x += indentWidth - 21;
commandLabelRect.x += indentWidth;// - 21;
commandLabelRect.y -= 2;
commandLabelRect.width -= (indentSize * command.IndentLevel - 22);
commandLabelRect.width -= (indentSize * command.IndentLevel);// - 22);
commandLabelRect.height += 5;
// There's a weird incompatibility between the Reorderable list control used for the command list and
@ -251,8 +168,8 @@ namespace Fungus.EditorUtils
// The workaround for now is to hide the reordering grabber from mouse clicks by extending the command
// selection rectangle to cover it. We are planning to totally replace the command list display system.
Rect clickRect = position;
clickRect.x -= 20;
clickRect.width += 20;
//clickRect.x -= 20;
//clickRect.width += 20;
// Select command via left click
if (Event.current.type == EventType.MouseDown &&
@ -265,7 +182,8 @@ namespace Fungus.EditorUtils
// Command key and shift key is not pressed
if (!EditorGUI.actionKey && !Event.current.shift)
{
BlockEditor.actionList.Add ( delegate {
BlockEditor.actionList.Add(delegate
{
flowchart.SelectedCommands.Remove(command);
flowchart.ClearSelectedCommands();
});
@ -274,7 +192,8 @@ namespace Fungus.EditorUtils
// Command key pressed
if (EditorGUI.actionKey)
{
BlockEditor.actionList.Add ( delegate {
BlockEditor.actionList.Add(delegate
{
flowchart.SelectedCommands.Remove(command);
});
Event.current.Use();
@ -287,13 +206,15 @@ namespace Fungus.EditorUtils
// Left click and no command key
if (!shift && !EditorGUI.actionKey && Event.current.button == 0)
{
BlockEditor.actionList.Add ( delegate {
BlockEditor.actionList.Add(delegate
{
flowchart.ClearSelectedCommands();
});
Event.current.Use();
}
BlockEditor.actionList.Add ( delegate {
BlockEditor.actionList.Add(delegate
{
flowchart.AddSelectedCommand(command);
});
@ -301,12 +222,12 @@ namespace Fungus.EditorUtils
int firstSelectedIndex = -1;
int lastSelectedIndex = -1;
if (flowchart.SelectedCommands.Count > 0)
{
if ( flowchart.SelectedBlock != null)
{
if (flowchart.SelectedBlock != null)
{
for (int i = 0; i < flowchart.SelectedBlock.CommandList.Count; i++)
{
Command commandInBlock = flowchart.SelectedBlock.CommandList[i];
Command commandInBlock = flowchart.SelectedBlock.CommandList[i];
foreach (Command selectedCommand in flowchart.SelectedCommands)
{
if (commandInBlock == selectedCommand)
@ -316,9 +237,9 @@ namespace Fungus.EditorUtils
}
}
}
for (int i = flowchart.SelectedBlock.CommandList.Count - 1; i >=0; i--)
for (int i = flowchart.SelectedBlock.CommandList.Count - 1; i >= 0; i--)
{
Command commandInBlock = flowchart.SelectedBlock.CommandList[i];
Command commandInBlock = flowchart.SelectedBlock.CommandList[i];
foreach (Command selectedCommand in flowchart.SelectedCommands)
{
if (commandInBlock == selectedCommand)
@ -331,7 +252,7 @@ namespace Fungus.EditorUtils
}
}
if (shift)
if (shift)
{
int currentIndex = command.CommandIndex;
if (firstSelectedIndex == -1 ||
@ -356,7 +277,8 @@ namespace Fungus.EditorUtils
for (int i = Math.Min(firstSelectedIndex, lastSelectedIndex); i < Math.Max(firstSelectedIndex, lastSelectedIndex); ++i)
{
var selectedCommand = flowchart.SelectedBlock.CommandList[i];
BlockEditor.actionList.Add ( delegate {
BlockEditor.actionList.Add(delegate
{
flowchart.AddSelectedCommand(selectedCommand);
});
}
@ -366,13 +288,13 @@ namespace Fungus.EditorUtils
}
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus)
}
Color commandLabelColor = Color.white;
if (flowchart.ColorCommands)
{
commandLabelColor = command.GetButtonColor();
}
if (commandIsSelected)
{
commandLabelColor = Color.green;
@ -385,9 +307,9 @@ namespace Fungus.EditorUtils
{
// TODO: Show warning icon
}
GUI.backgroundColor = commandLabelColor;
if (isComment)
{
GUI.Label(commandLabelRect, "", commandLabelStyle);
@ -406,7 +328,7 @@ namespace Fungus.EditorUtils
GUI.Label(commandLabelRect, commandNameLabel, commandLabelStyle);
}
if (command.ExecutingIconTimer > Time.realtimeSinceStartup)
{
Rect iconRect = new Rect(commandLabelRect);
@ -424,7 +346,7 @@ namespace Fungus.EditorUtils
GUI.color = storeColor;
}
Rect summaryRect = new Rect(commandLabelRect);
if (isComment)
{
@ -435,16 +357,16 @@ namespace Fungus.EditorUtils
summaryRect.x += commandNameWidth + 5;
summaryRect.width -= commandNameWidth + 5;
}
GUIStyle summaryStyle = new GUIStyle();
summaryStyle.fontSize = 10;
summaryStyle.fontSize = 10;
summaryStyle.padding.top += 5;
summaryStyle.richText = true;
summaryStyle.wordWrap = false;
summaryStyle.clipping = TextClipping.Clip;
commandLabelStyle.alignment = TextAnchor.MiddleLeft;
GUI.Label(summaryRect, summary, summaryStyle);
if (error)
{
GUISkin editorSkin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector);
@ -455,17 +377,9 @@ namespace Fungus.EditorUtils
GUI.Label(errorRect, editorSkin.GetStyle("CN EntryError").normal.background);
summaryRect.width -= 20;
}
GUI.backgroundColor = Color.white;
}
public virtual float GetItemHeight(int index) {
return fixedItemHeight != 0f
? fixedItemHeight
: EditorGUI.GetPropertyHeight(this[index], GUIContent.none, false)
;
}
}
}

5
Assets/Fungus/Scripts/Editor/ControlAudioEditor.cs

@ -17,10 +17,9 @@ namespace Fungus.EditorUtils
protected SerializedProperty fadeDurationProp;
protected SerializedProperty waitUntilFinishedProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
controlProp = serializedObject.FindProperty("control");
audioSourceProp = serializedObject.FindProperty("_audioSource");

135
Assets/Fungus/Scripts/Editor/FlowchartEditor.cs

@ -4,7 +4,6 @@
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using Rotorz.ReorderableList;
using System.Linq;
using System.Reflection;
@ -13,12 +12,6 @@ namespace Fungus.EditorUtils
[CustomEditor (typeof(Flowchart))]
public class FlowchartEditor : Editor
{
protected class AddVariableInfo
{
public Flowchart flowchart;
public System.Type variableType;
}
protected SerializedProperty descriptionProp;
protected SerializedProperty colorCommandsProp;
protected SerializedProperty hideComponentsProp;
@ -32,6 +25,8 @@ namespace Fungus.EditorUtils
protected SerializedProperty luaBindingNameProp;
protected Texture2D addTexture;
protected VariableListAdaptor variableListAdaptor;
protected virtual void OnEnable()
{
@ -51,6 +46,8 @@ namespace Fungus.EditorUtils
luaBindingNameProp = serializedObject.FindProperty("luaBindingName");
addTexture = FungusEditorResources.AddSmall;
variableListAdaptor = new VariableListAdaptor(variablesProp, target as Flowchart);
}
public override void OnInspectorGUI()
@ -72,8 +69,9 @@ namespace Fungus.EditorUtils
EditorGUILayout.PropertyField(luaBindingNameProp);
// Show list of commands to hide in Add Command menu
ReorderableListGUI.Title(new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip));
ReorderableListGUI.ListField(hideCommandsProp);
//ReorderableListGUI.Title(new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip));
//ReorderableListGUI.ListField(hideCommandsProp);
EditorGUILayout.PropertyField(hideCommandsProp, new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip), true);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
@ -97,9 +95,15 @@ namespace Fungus.EditorUtils
public virtual void DrawVariablesGUI(bool showVariableToggleButton, int w)
{
var t = target as Flowchart;
if(t == null)
{
return;
}
serializedObject.Update();
var t = target as Flowchart;
if (t.Variables.Count == 0)
{
@ -122,8 +126,6 @@ namespace Fungus.EditorUtils
}
else
{
Rect listRect = new Rect();
// Remove any null variables from the list
// Can sometimes happen when upgrading to a new version of Fungus (if .meta GUID changes for a variable class)
for (int i = t.Variables.Count - 1; i >= 0; i--)
@ -134,119 +136,12 @@ namespace Fungus.EditorUtils
}
}
ReorderableListGUI.Title("Variables");
VariableListAdaptor adaptor = new VariableListAdaptor(variablesProp, 0, w == 0 ? VariableListAdaptor.DefaultWidth : w);
ReorderableListFlags flags = ReorderableListFlags.DisableContextMenu | ReorderableListFlags.HideAddButton;
ReorderableListControl.DrawControlFromState(adaptor, null, flags);
listRect = GUILayoutUtility.GetLastRect();
float plusWidth = 32;
float plusHeight = 24;
Rect buttonRect = listRect;
float buttonHeight = 24;
buttonRect.x = 4;
buttonRect.y -= buttonHeight - 1;
buttonRect.height = buttonHeight;
if (!Application.isPlaying)
{
buttonRect.width -= 30;
}
if (showVariableToggleButton && GUI.Button(buttonRect, "Variables"))
{
t.VariablesExpanded = false;
}
// Draw disclosure triangle
Rect lastRect = buttonRect;
lastRect.x += 5;
lastRect.y += 5;
//this is not required, seems to be legacy that is hidden in the normal reorderable
if(showVariableToggleButton)
EditorGUI.Foldout(lastRect, true, "");
Rect plusRect = listRect;
plusRect.x += plusRect.width - plusWidth;
plusRect.y -= plusHeight - 1;
plusRect.width = plusWidth;
plusRect.height = plusHeight;
if (!Application.isPlaying &&
GUI.Button(plusRect, addTexture))
{
GenericMenu menu = new GenericMenu ();
List<System.Type> types = FindAllDerivedTypes<Variable>();
// Add variable types without a category
foreach (var type in types)
{
VariableInfoAttribute variableInfo = VariableEditor.GetVariableInfo(type);
if (variableInfo == null ||
variableInfo.Category != "")
{
continue;
}
AddVariableInfo addVariableInfo = new AddVariableInfo();
addVariableInfo.flowchart = t;
addVariableInfo.variableType = type;
GUIContent typeName = new GUIContent(variableInfo.VariableType);
menu.AddItem(typeName, false, AddVariable, addVariableInfo);
}
// Add types with a category
foreach (var type in types)
{
VariableInfoAttribute variableInfo = VariableEditor.GetVariableInfo(type);
if (variableInfo == null ||
variableInfo.Category == "")
{
continue;
}
AddVariableInfo info = new AddVariableInfo();
info.flowchart = t;
info.variableType = type;
GUIContent typeName = new GUIContent(variableInfo.Category + "/" + variableInfo.VariableType);
menu.AddItem(typeName, false, AddVariable, info);
}
menu.ShowAsContext ();
}
variableListAdaptor.DrawVarList(w);
}
serializedObject.ApplyModifiedProperties();
}
protected virtual void AddVariable(object obj)
{
AddVariableInfo addVariableInfo = obj as AddVariableInfo;
if (addVariableInfo == null)
{
return;
}
var flowchart = addVariableInfo.flowchart;
System.Type variableType = addVariableInfo.variableType;
Undo.RecordObject(flowchart, "Add Variable");
Variable newVariable = flowchart.gameObject.AddComponent(variableType) as Variable;
newVariable.Key = flowchart.GetUniqueVariableKey("");
flowchart.Variables.Add(newVariable);
// Because this is an async call, we need to force prefab instances to record changes
PrefabUtility.RecordPrefabInstancePropertyModifications(flowchart);
}
public static List<System.Type> FindAllDerivedTypes<T>()
{
return FindAllDerivedTypes<T>(Assembly.GetAssembly(typeof(T)));

38
Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

@ -135,6 +135,9 @@ namespace Fungus.EditorUtils
protected Block dragBlock;
protected static FungusState fungusState;
static protected VariableListAdaptor variableListAdaptor;
[MenuItem("Tools/Fungus/Flowchart Window")]
static void Init()
{
@ -143,6 +146,7 @@ namespace Fungus.EditorUtils
protected virtual void OnEnable()
{
// All block nodes use the same GUIStyle, but with a different background
nodeStyle.border = new RectOffset(20, 20, 5, 5);
nodeStyle.padding = nodeStyle.border;
@ -226,6 +230,16 @@ namespace Fungus.EditorUtils
}
}
if (fungusState.SelectedFlowchart == null)
{
variableListAdaptor = null;
}
else if (variableListAdaptor == null || variableListAdaptor.TargetFlowchart != fungusState.SelectedFlowchart)
{
var fsSO = new SerializedObject(fungusState.SelectedFlowchart);
variableListAdaptor = new VariableListAdaptor(fsSO.FindProperty("variables"), fungusState.SelectedFlowchart);
}
return fungusState.SelectedFlowchart;
}
@ -333,7 +347,7 @@ namespace Fungus.EditorUtils
GUILayout.Label("No Flowchart scene object selected");
return;
}
//target has changed, so clear the blockinspector
if (flowchart != prevFlowchart)
{
@ -496,9 +510,25 @@ namespace Fungus.EditorUtils
{
GUILayout.Space(8);
FlowchartEditor flowchartEditor = Editor.CreateEditor (flowchart) as FlowchartEditor;
flowchartEditor.DrawVariablesGUI(true, 0);
DestroyImmediate(flowchartEditor);
EditorGUI.BeginChangeCheck();
if (variableListAdaptor != null)
{
if (variableListAdaptor.TargetFlowchart != null)
{
//440 - space for scrollbar
variableListAdaptor.DrawVarList(400);
}
else
{
variableListAdaptor = null;
}
}
if(EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(flowchart);
}
Rect variableWindowRect = GUILayoutUtility.GetLastRect();
if (flowchart.VariablesExpanded && flowchart.Variables.Count > 0)

5
Assets/Fungus/Scripts/Editor/InvokeEventEditor.cs

@ -21,10 +21,9 @@ namespace Fungus.EditorUtils
protected SerializedProperty stringParameterProp;
protected SerializedProperty stringEventProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
descriptionProp = serializedObject.FindProperty("description");
delayProp = serializedObject.FindProperty("delay");

5
Assets/Fungus/Scripts/Editor/LabelEditor.cs

@ -51,10 +51,9 @@ namespace Fungus.EditorUtils
property.objectReferenceValue = labelObjects[selectedIndex];
}
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
keyProp = serializedObject.FindProperty("key");
}

5
Assets/Fungus/Scripts/Editor/MenuEditor.cs

@ -17,10 +17,9 @@ namespace Fungus.EditorUtils
protected SerializedProperty setMenuDialogProp;
protected SerializedProperty hideThisOptionProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
textProp = serializedObject.FindProperty("text");
descriptionProp = serializedObject.FindProperty("description");

5
Assets/Fungus/Scripts/Editor/MenuTimerEditor.cs

@ -12,10 +12,9 @@ namespace Fungus.EditorUtils
protected SerializedProperty durationProp;
protected SerializedProperty targetBlockProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
durationProp = serializedObject.FindProperty("_duration");
targetBlockProp = serializedObject.FindProperty("targetBlock");

7
Assets/Fungus/Scripts/Editor/PortraitEditor.cs

@ -25,11 +25,10 @@ namespace Fungus.EditorUtils
protected SerializedProperty waitUntilFinishedProp;
protected SerializedProperty moveProp;
protected SerializedProperty shiftIntoPlaceProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
stageProp = serializedObject.FindProperty("stage");
displayProp = serializedObject.FindProperty("display");

34
Assets/Fungus/Scripts/Editor/SaveDataEditor.cs

@ -1,34 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
#if UNITY_5_3_OR_NEWER
using UnityEngine;
using UnityEditor;
using Rotorz.ReorderableList;
namespace Fungus.EditorUtils
{
[CustomEditor (typeof(SaveData), true)]
public class SaveDataEditor : Editor
{
protected SerializedProperty flowchartsProp;
protected virtual void OnEnable()
{
flowchartsProp = serializedObject.FindProperty("flowcharts");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
ReorderableListGUI.Title("Flowcharts");
ReorderableListGUI.ListField(flowchartsProp);
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

12
Assets/Fungus/Scripts/Editor/SaveDataEditor.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 395934d0b0e6a48a396a25348aeaade5
timeCreated: 1484049679
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1
Assets/Fungus/Scripts/Editor/SaveMenuEditor.cs

@ -5,7 +5,6 @@
using UnityEngine;
using UnityEditor;
using Rotorz.ReorderableList;
namespace Fungus.EditorUtils
{

30
Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs

@ -1,30 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
#if UNITY_5_3_OR_NEWER
using UnityEngine;
using UnityEditor;
using Rotorz.ReorderableList;
namespace Fungus.EditorUtils
{
[CustomEditor (typeof(SavePointLoaded), true)]
public class SavePointLoadedEditor : EventHandlerEditor
{
protected SerializedProperty savePointKeysProp;
protected virtual void OnEnable()
{
savePointKeysProp = serializedObject.FindProperty("savePointKeys");
}
protected override void DrawProperties()
{
ReorderableListGUI.Title("Save Point Keys");
ReorderableListGUI.ListField(savePointKeysProp);
}
}
}
#endif

12
Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 8514e225c506c4938a5da19210cc6217
timeCreated: 1484049679
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

5
Assets/Fungus/Scripts/Editor/SayEditor.cs

@ -83,10 +83,9 @@ namespace Fungus.EditorUtils
protected SerializedProperty setSayDialogProp;
protected SerializedProperty waitForVOProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
characterProp = serializedObject.FindProperty("character");
portraitProp = serializedObject.FindProperty("portrait");

40
Assets/Fungus/Scripts/Editor/SetColliderEditor.cs

@ -1,40 +0,0 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEditor;
using UnityEngine;
using Rotorz.ReorderableList;
namespace Fungus.EditorUtils
{
[CustomEditor (typeof(SetCollider))]
public class SetColliderEditor : CommandEditor
{
protected SerializedProperty targetObjectsProp;
protected SerializedProperty targetTagProp;
protected SerializedProperty activeStateProp;
protected virtual void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
targetObjectsProp = serializedObject.FindProperty("targetObjects");
targetTagProp = serializedObject.FindProperty("targetTag");
activeStateProp = serializedObject.FindProperty("activeState");
}
public override void DrawCommandGUI()
{
serializedObject.Update();
ReorderableListGUI.Title(new GUIContent("Target Objects", "Objects containing collider components (2D or 3D)"));
ReorderableListGUI.ListField(targetObjectsProp);
EditorGUILayout.PropertyField(targetTagProp);
EditorGUILayout.PropertyField(activeStateProp);
serializedObject.ApplyModifiedProperties();
}
}
}

12
Assets/Fungus/Scripts/Editor/SetColliderEditor.cs.meta

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 672281668cfa249738d9dbc91f96b88e
timeCreated: 1432222536
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

5
Assets/Fungus/Scripts/Editor/SetVariableEditor.cs

@ -30,10 +30,9 @@ namespace Fungus.EditorUtils
protected List<SerializedProperty> variableDataProps;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
variableProp = serializedObject.FindProperty("variable");
setOperatorProp = serializedObject.FindProperty("setOperator");

7
Assets/Fungus/Scripts/Editor/StageEditor.cs

@ -15,11 +15,10 @@ namespace Fungus.EditorUtils
protected SerializedProperty useDefaultSettingsProp;
protected SerializedProperty fadeDurationProp;
protected SerializedProperty waitUntilFinishedProp;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
displayProp = serializedObject.FindProperty("display");
stageProp = serializedObject.FindProperty("stage");

5
Assets/Fungus/Scripts/Editor/VariableConditionEditor.cs

@ -15,10 +15,9 @@ namespace Fungus.EditorUtils
protected Dictionary<System.Type, SerializedProperty> propByVariableType;
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
variableProp = serializedObject.FindProperty("variable");
compareOperatorProp = serializedObject.FindProperty("compareOperator");

4
Assets/Fungus/Scripts/Editor/VariableEditor.cs

@ -12,8 +12,10 @@ namespace Fungus.EditorUtils
[CustomEditor (typeof(Variable), true)]
public class VariableEditor : CommandEditor
{
protected virtual void OnEnable()
public override void OnEnable()
{
base.OnEnable();
Variable t = target as Variable;
t.hideFlags = HideFlags.HideInInspector;
}

181
Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs

@ -1,124 +1,177 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
// Copyright (c) 2012-2013 Rotorz Limited. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
using UnityEngine;
using UnityEditor;
using System;
using Rotorz.ReorderableList;
using UnityEditorInternal;
using System.Collections.Generic;
namespace Fungus.EditorUtils
{
public class VariableListAdaptor : IReorderableListAdaptor
public class VariableListAdaptor
{
protected class AddVariableInfo
{
public Flowchart flowchart;
public System.Type variableType;
}
public static readonly int DefaultWidth = 80 + 100 + 140 + 60;
public static readonly int ScrollSpacer = 8;
public static readonly int ReorderListSkirts = 70;
public static readonly int ScrollSpacer = 0;
public static readonly int ReorderListSkirts = 50;
protected SerializedProperty _arrayProperty;
public float fixedItemHeight;
public int widthOfList;
private ReorderableList list;
public Flowchart TargetFlowchart { get; private set; }
public SerializedProperty this[int index]
{
get { return _arrayProperty.GetArrayElementAtIndex(index); }
}
public SerializedProperty arrayProperty
public Variable GetVarAt(int index)
{
get { return _arrayProperty; }
if (list.list != null)
return list.list[index] as Variable;
else
return this[index].objectReferenceValue as Variable;
}
public VariableListAdaptor(SerializedProperty arrayProperty, float fixedItemHeight, int widthOfList)
public VariableListAdaptor(SerializedProperty arrayProperty, Flowchart _targetFlowchart)
{
if (arrayProperty == null)
throw new ArgumentNullException("Array property was null.");
if (!arrayProperty.isArray)
throw new InvalidOperationException("Specified serialized propery is not an array.");
this.TargetFlowchart = _targetFlowchart;
this.fixedItemHeight = 0;
this._arrayProperty = arrayProperty;
this.fixedItemHeight = fixedItemHeight;
this.widthOfList = widthOfList - ScrollSpacer;
}
public VariableListAdaptor(SerializedProperty arrayProperty) : this(arrayProperty, 0f, DefaultWidth)
{
list = new ReorderableList(arrayProperty.serializedObject, arrayProperty, true, false, true, true);
list.drawElementCallback = DrawItem;
list.onRemoveCallback = RemoveItem;
list.onAddCallback = AddButton;
list.onRemoveCallback = RemoveItem;
list.elementHeightCallback = GetElementHeight;
}
public int Count
private float GetElementHeight(int index)
{
get { return _arrayProperty.arraySize; }
return /*EditorGUI.GetPropertyHeight(this[index], null, true) +*/ EditorGUIUtility.singleLineHeight;
}
public virtual bool CanDrag(int index)
private void RemoveItem(ReorderableList list)
{
return true;
int index = list.index;
// Remove the Fungus Variable component
Variable variable = this[index].objectReferenceValue as Variable;
Undo.DestroyObjectImmediate(variable);
}
public virtual bool CanRemove(int index)
private void AddButton(ReorderableList list)
{
return true;
}
GenericMenu menu = new GenericMenu();
List<System.Type> types = FlowchartEditor.FindAllDerivedTypes<Variable>();
public void Add()
{
int newIndex = _arrayProperty.arraySize;
++_arrayProperty.arraySize;
_arrayProperty.GetArrayElementAtIndex(newIndex).ResetValue();
}
// Add variable types without a category
foreach (var type in types)
{
VariableInfoAttribute variableInfo = VariableEditor.GetVariableInfo(type);
if (variableInfo == null ||
variableInfo.Category != "")
{
continue;
}
public void Insert(int index)
{
_arrayProperty.InsertArrayElementAtIndex(index);
_arrayProperty.GetArrayElementAtIndex(index).ResetValue();
}
AddVariableInfo addVariableInfo = new AddVariableInfo();
addVariableInfo.flowchart = TargetFlowchart;
addVariableInfo.variableType = type;
public void Duplicate(int index)
{
_arrayProperty.InsertArrayElementAtIndex(index);
}
GUIContent typeName = new GUIContent(variableInfo.VariableType);
public void Remove(int index)
{
// Remove the Fungus Variable component
Variable variable = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as Variable;
Undo.DestroyObjectImmediate(variable);
menu.AddItem(typeName, false, AddVariable, addVariableInfo);
}
// Add types with a category
foreach (var type in types)
{
VariableInfoAttribute variableInfo = VariableEditor.GetVariableInfo(type);
if (variableInfo == null ||
variableInfo.Category == "")
{
continue;
}
AddVariableInfo info = new AddVariableInfo();
info.flowchart = TargetFlowchart;
info.variableType = type;
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = null;
_arrayProperty.DeleteArrayElementAtIndex(index);
GUIContent typeName = new GUIContent(variableInfo.Category + "/" + variableInfo.VariableType);
menu.AddItem(typeName, false, AddVariable, info);
}
menu.ShowAsContext();
}
public void Move(int sourceIndex, int destIndex)
protected virtual void AddVariable(object obj)
{
if (destIndex > sourceIndex)
--destIndex;
_arrayProperty.MoveArrayElement(sourceIndex, destIndex);
AddVariableInfo addVariableInfo = obj as AddVariableInfo;
if (addVariableInfo == null)
{
return;
}
var flowchart = addVariableInfo.flowchart;
System.Type variableType = addVariableInfo.variableType;
Undo.RecordObject(flowchart, "Add Variable");
Variable newVariable = flowchart.gameObject.AddComponent(variableType) as Variable;
newVariable.Key = flowchart.GetUniqueVariableKey("");
flowchart.Variables.Add(newVariable);
// Because this is an async call, we need to force prefab instances to record changes
PrefabUtility.RecordPrefabInstancePropertyModifications(flowchart);
}
public void Clear()
public void DrawVarList(int w)
{
_arrayProperty.ClearArray();
}
//we want to eat the throw that occurs when switching back to editor from play
try
{
if (_arrayProperty == null || _arrayProperty.serializedObject == null)
return;
public void BeginGUI()
{ }
_arrayProperty.serializedObject.Update();
this.widthOfList = (w == 0 ? VariableListAdaptor.DefaultWidth : w) - ScrollSpacer;
public void EndGUI()
{ }
if (GUILayout.Button("Variables"))
{
_arrayProperty.isExpanded = !_arrayProperty.isExpanded;
}
public virtual void DrawItemBackground(Rect position, int index)
{
if (_arrayProperty.isExpanded)
{
list.DoLayoutList();
}
_arrayProperty.serializedObject.ApplyModifiedProperties();
}
catch (Exception)
{
}
}
public void DrawItem(Rect position, int index)
public void DrawItem(Rect position, int index, bool selected, bool focused)
{
Variable variable = this[index].objectReferenceValue as Variable;
Variable variable = GetVarAt(index);// this[index].objectReferenceValue as Variable;
if (variable == null)
{
@ -152,7 +205,7 @@ namespace Fungus.EditorUtils
return;
}
var flowchart = FlowchartWindow.GetFlowchart();
var flowchart = TargetFlowchart;
if (flowchart == null)
{
return;
@ -195,7 +248,7 @@ namespace Fungus.EditorUtils
// To access properties in a monobehavior, you have to new a SerializedObject
// http://answers.unity3d.com/questions/629803/findrelativeproperty-never-worked-for-me-how-does.html
SerializedObject variableObject = new SerializedObject(this[index].objectReferenceValue);
SerializedObject variableObject = new SerializedObject(variable);
variableObject.Update();
@ -240,14 +293,6 @@ namespace Fungus.EditorUtils
GUI.backgroundColor = Color.white;
}
public virtual float GetItemHeight(int index)
{
return fixedItemHeight != 0f
? fixedItemHeight
: EditorGUI.GetPropertyHeight(this[index], GUIContent.none, false)
;
}
}
}

5
Assets/Fungus/Scripts/Editor/WriteEditor.cs

@ -30,10 +30,9 @@ namespace Fungus.EditorUtils
EditorGUILayout.SelectableLabel(tagsText, GUI.skin.GetStyle("HelpBox"), GUILayout.MinHeight(pixelHeight));
}
protected virtual void OnEnable()
public override void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
base.OnEnable();
textObjectProp = serializedObject.FindProperty("textObject");
textProp = serializedObject.FindProperty("text");

4
Assets/Fungus/Scripts/Editor/WriterAudioEditor.cs

@ -3,7 +3,6 @@
using UnityEditor;
using UnityEngine;
using Rotorz.ReorderableList;
namespace Fungus.EditorUtils
{
@ -41,8 +40,7 @@ namespace Fungus.EditorUtils
EditorGUILayout.PropertyField(audioModeProp);
if ((AudioMode)audioModeProp.enumValueIndex == AudioMode.Beeps)
{
ReorderableListGUI.Title(new GUIContent("Beep Sounds", "A list of beep sounds to play at random"));
ReorderableListGUI.ListField(beepSoundsProp);
EditorGUILayout.PropertyField(beepSoundsProp, new GUIContent("Beep Sounds", "A list of beep sounds to play at random"),true);
}
else
{

9
Assets/Fungus/Thirdparty/Reorderable List Field.meta vendored

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: fb90622e4c0c8488e807119925da3a7a
folderAsset: yes
timeCreated: 1434110041
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Demo.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a747a40b0f1ab6f48b28b29fdb77f2ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

12
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviour.cs vendored

@ -1,12 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System.Collections.Generic;
using UnityEngine;
public class DemoBehaviour : MonoBehaviour {
public List<string> wishlist = new List<string>();
public List<Vector2> points = new List<Vector2>();
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviour.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: acf5477b21448904ebe3636dcb6a0276
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviourUnityScript.js vendored

@ -1,8 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
#pragma strict
import System.Collections.Generic;
var wishlist:List.<String> = new List.<String>();
var points:List.<Vector2> = new List.<Vector2>();

11
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/DemoBehaviourUnityScript.js.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 253f52cce58987b4e8f2108722555925
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bd53be4000846a648b766b6c79bf6bbd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

30
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/DemoBehaviourEditor.cs vendored

@ -1,30 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using Rotorz.ReorderableList;
using UnityEditor;
[CustomEditor(typeof(DemoBehaviour))]
public class DemoBehaviourEditor : Editor {
private SerializedProperty _wishlistProperty;
private SerializedProperty _pointsProperty;
private void OnEnable() {
_wishlistProperty = serializedObject.FindProperty("wishlist");
_pointsProperty = serializedObject.FindProperty("points");
}
public override void OnInspectorGUI() {
serializedObject.Update();
ReorderableListGUI.Title("Wishlist");
ReorderableListGUI.ListField(_wishlistProperty);
ReorderableListGUI.Title("Points");
ReorderableListGUI.ListField(_pointsProperty);
serializedObject.ApplyModifiedProperties();
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/DemoBehaviourEditor.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 036558d96cb3f6a418344bd5fb29215e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

184
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/MultiListEditorWindowDemo.cs vendored

@ -1,184 +0,0 @@
using UnityEngine;
using UnityEditor;
using Rotorz.ReorderableList;
using System.Collections.Generic;
public class MultiListEditorWindowDemo : EditorWindow {
[MenuItem("Window/Multi List Demo (C#)")]
private static void ShowWindow() {
GetWindow<MultiListEditorWindowDemo>("Multi List");
}
private class ExampleListAdaptor : GenericListAdaptor<string>, IReorderableListDropTarget {
private const float MouseDragThresholdInPixels = 0.6f;
// Static reference to the list adaptor of the selected item.
private static ExampleListAdaptor s_SelectedList;
// Static reference limits selection to one item in one list.
private static string s_SelectedItem;
// Position in GUI where mouse button was anchored before dragging occurred.
private static Vector2 s_MouseDownPosition;
// Holds data representing the item that is being dragged.
private class DraggedItem {
public static readonly string TypeName = typeof(DraggedItem).FullName;
public readonly ExampleListAdaptor SourceListAdaptor;
public readonly int Index;
public readonly string ShoppingItem;
public DraggedItem(ExampleListAdaptor sourceList, int index, string shoppingItem) {
SourceListAdaptor = sourceList;
Index = index;
ShoppingItem = shoppingItem;
}
}
public ExampleListAdaptor(IList<string> list) : base(list, null, 16f) {
}
public override void DrawItemBackground(Rect position, int index) {
if (this == s_SelectedList && List[index] == s_SelectedItem) {
Color restoreColor = GUI.color;
GUI.color = ReorderableListStyles.SelectionBackgroundColor;
GUI.DrawTexture(position, EditorGUIUtility.whiteTexture);
GUI.color = restoreColor;
}
}
public override void DrawItem(Rect position, int index) {
string shoppingItem = List[index];
int controlID = GUIUtility.GetControlID(FocusType.Passive);
switch (Event.current.GetTypeForControl(controlID)) {
case EventType.MouseDown:
Rect totalItemPosition = ReorderableListGUI.CurrentItemTotalPosition;
if (totalItemPosition.Contains(Event.current.mousePosition)) {
// Select this list item.
s_SelectedList = this;
s_SelectedItem = shoppingItem;
}
// Calculate rectangle of draggable area of the list item.
// This example excludes the grab handle at the left.
Rect draggableRect = totalItemPosition;
draggableRect.x = position.x;
draggableRect.width = position.width;
if (Event.current.button == 0 && draggableRect.Contains(Event.current.mousePosition)) {
// Select this list item.
s_SelectedList = this;
s_SelectedItem = shoppingItem;
// Lock onto this control whilst left mouse button is held so
// that we can start a drag-and-drop operation when user drags.
GUIUtility.hotControl = controlID;
s_MouseDownPosition = Event.current.mousePosition;
Event.current.Use();
}
break;
case EventType.MouseDrag:
if (GUIUtility.hotControl == controlID) {
GUIUtility.hotControl = 0;
// Begin drag-and-drop operation when the user drags the mouse
// pointer across the threshold. This threshold helps to avoid
// inadvertently starting a drag-and-drop operation.
if (Vector2.Distance(s_MouseDownPosition, Event.current.mousePosition) >= MouseDragThresholdInPixels) {
// Prepare data that will represent the item.
var item = new DraggedItem(this, index, shoppingItem);
// Start drag-and-drop operation with the Unity API.
DragAndDrop.PrepareStartDrag();
// Need to reset `objectReferences` and `paths` because `PrepareStartDrag`
// doesn't seem to reset these (at least, in Unity 4.x).
DragAndDrop.objectReferences = new Object[0];
DragAndDrop.paths = new string[0];
DragAndDrop.SetGenericData(DraggedItem.TypeName, item);
DragAndDrop.StartDrag(shoppingItem);
}
// Use this event so that the host window gets repainted with
// each mouse movement.
Event.current.Use();
}
break;
case EventType.Repaint:
EditorStyles.label.Draw(position, shoppingItem, false, false, false, false);
break;
}
}
public bool CanDropInsert(int insertionIndex) {
if (!ReorderableListControl.CurrentListPosition.Contains(Event.current.mousePosition))
return false;
// Drop insertion is possible if the current drag-and-drop operation contains
// the supported type of custom data.
return DragAndDrop.GetGenericData(DraggedItem.TypeName) is DraggedItem;
}
public void ProcessDropInsertion(int insertionIndex) {
if (Event.current.type == EventType.DragPerform) {
var draggedItem = DragAndDrop.GetGenericData(DraggedItem.TypeName) as DraggedItem;
// Are we just reordering within the same list?
if (draggedItem.SourceListAdaptor == this) {
Move(draggedItem.Index, insertionIndex);
}
else {
// Nope, we are moving the item!
List.Insert(insertionIndex, draggedItem.ShoppingItem);
draggedItem.SourceListAdaptor.Remove(draggedItem.Index);
// Ensure that the item remains selected at its new location!
s_SelectedList = this;
}
}
}
}
private List<string> _shoppingList;
private ExampleListAdaptor _shoppingListAdaptor;
private List<string> _purchaseList;
private ExampleListAdaptor _purchaseListAdaptor;
private void OnEnable() {
_shoppingList = new List<string>() { "Bread", "Carrots", "Beans", "Steak", "Coffee", "Fries" };
_shoppingListAdaptor = new ExampleListAdaptor(_shoppingList);
_purchaseList = new List<string>() { "Cheese", "Crackers" };
_purchaseListAdaptor = new ExampleListAdaptor(_purchaseList);
}
private void OnGUI() {
GUILayout.BeginHorizontal();
var columnWidth = GUILayout.Width(position.width / 2f - 6);
// Draw list control on left side of the window.
GUILayout.BeginVertical(columnWidth);
ReorderableListGUI.Title("Shopping List");
ReorderableListGUI.ListField(_shoppingListAdaptor);
GUILayout.EndVertical();
// Draw list control on right side of the window.
GUILayout.BeginVertical(columnWidth);
ReorderableListGUI.Title("Purchase List");
ReorderableListGUI.ListField(_purchaseListAdaptor);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/MultiListEditorWindowDemo.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a42361912a901e04bbe1405e84b81b8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

79
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/ReorderableListDemo.cs vendored

@ -1,79 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using Rotorz.ReorderableList;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class ReorderableListDemo : EditorWindow {
[MenuItem("Window/List Demo (C#)")]
static void ShowWindow() {
GetWindow<ReorderableListDemo>("List Demo");
}
public List<string> shoppingList;
public List<string> purchaseList;
private void OnEnable() {
shoppingList = new List<string>();
shoppingList.Add("Bread");
shoppingList.Add("Carrots");
shoppingList.Add("Beans");
shoppingList.Add("Steak");
shoppingList.Add("Coffee");
shoppingList.Add("Fries");
purchaseList = new List<string>();
purchaseList.Add("Cheese");
purchaseList.Add("Crackers");
}
private Vector2 _scrollPosition;
private void OnGUI() {
_scrollPosition = GUILayout.BeginScrollView(_scrollPosition);
ReorderableListGUI.Title("Shopping List");
ReorderableListGUI.ListField(shoppingList, PendingItemDrawer, DrawEmpty);
ReorderableListGUI.Title("Purchased Items");
ReorderableListGUI.ListField(purchaseList, PurchasedItemDrawer, DrawEmpty, ReorderableListFlags.HideAddButton | ReorderableListFlags.DisableReordering);
GUILayout.EndScrollView();
}
private string PendingItemDrawer(Rect position, string itemValue) {
// Text fields do not like null values!
if (itemValue == null)
itemValue = "";
position.width -= 50;
itemValue = EditorGUI.TextField(position, itemValue);
position.x = position.xMax + 5;
position.width = 45;
if (GUI.Button(position, "Info")) {
}
return itemValue;
}
private string PurchasedItemDrawer(Rect position, string itemValue) {
position.width -= 50;
GUI.Label(position, itemValue);
position.x = position.xMax + 5;
position.width = 45;
if (GUI.Button(position, "Info")) {
}
return itemValue;
}
private void DrawEmpty() {
GUILayout.Label("No items in list.", EditorStyles.miniLabel);
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Demo/Editor/ReorderableListDemo.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a8187beba641e99409b4648cca1becd3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Editor.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1351e3cf05fcef04cbafc172b277cd32
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 646cdcce8adedda43a7b99aaefae2f4a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

109
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuBuilder.cs vendored

@ -1,109 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
namespace Rotorz.ReorderableList {
/// <summary>
/// Factory methods that create <see cref="IElementAdderMenuBuilder{TContext}"/>
/// instances that can then be used to build element adder menus.
/// </summary>
/// <example>
/// <para>The following example demonstrates how to build and display a menu which
/// allows the user to add elements to a given context object upon clicking a button:</para>
/// <code language="csharp"><![CDATA[
/// public class ShoppingListElementAdder : IElementAdder<ShoppingList> {
/// public ShoppingListElementAdder(ShoppingList shoppingList) {
/// Object = shoppingList;
/// }
///
/// public ShoppingList Object { get; private set; }
///
/// public bool CanAddElement(Type type) {
/// return true;
/// }
/// public object AddElement(Type type) {
/// var instance = Activator.CreateInstance(type);
/// shoppingList.Add((ShoppingItem)instance);
/// return instance;
/// }
/// }
///
/// private void DrawAddMenuButton(ShoppingList shoppingList) {
/// var content = new GUIContent("Add Menu");
/// Rect position = GUILayoutUtility.GetRect(content, GUI.skin.button);
/// if (GUI.Button(position, content)) {
/// var builder = ElementAdderMenuBuilder.For<ShoppingList>(ShoppingItem);
/// builder.SetElementAdder(new ShoppingListElementAdder(shoppingList));
/// var menu = builder.GetMenu();
/// menu.DropDown(buttonPosition);
/// }
/// }
/// ]]></code>
/// <code language="unityscript"><![CDATA[
/// public class ShoppingListElementAdder extends IElementAdder.<ShoppingList> {
/// var _object:ShoppingList;
///
/// function ShoppingListElementAdder(shoppingList:ShoppingList) {
/// Object = shoppingList;
/// }
///
/// function get Object():ShoppingList { return _object; }
///
/// function CanAddElement(type:Type):boolean {
/// return true;
/// }
/// function AddElement(type:Type):System.Object {
/// var instance = Activator.CreateInstance(type);
/// shoppingList.Add((ShoppingItem)instance);
/// return instance;
/// }
/// }
///
/// function DrawAddMenuButton(shoppingList:ShoppingList) {
/// var content = new GUIContent('Add Menu');
/// var position = GUILayoutUtility.GetRect(content, GUI.skin.button);
/// if (GUI.Button(position, content)) {
/// var builder = ElementAdderMenuBuilder.For.<ShoppingList>(ShoppingItem);
/// builder.SetElementAdder(new ShoppingListElementAdder(shoppingList));
/// var menu = builder.GetMenu();
/// menu.DropDown(buttonPosition);
/// }
/// }
/// ]]></code>
/// </example>
public static class ElementAdderMenuBuilder {
/// <summary>
/// Gets a <see cref="IElementAdderMenuBuilder{TContext}"/> to build an element
/// adder menu for a context object of the type <typeparamref name="TContext"/>.
/// </summary>
/// <typeparam name="TContext">Type of the context object that elements can be added to.</typeparam>
/// <returns>
/// A new <see cref="IElementAdderMenuBuilder{TContext}"/> instance.
/// </returns>
/// <seealso cref="IElementAdderMenuBuilder{TContext}.SetContractType(Type)"/>
public static IElementAdderMenuBuilder<TContext> For<TContext>() {
return new GenericElementAdderMenuBuilder<TContext>();
}
/// <summary>
/// Gets a <see cref="IElementAdderMenuBuilder{TContext}"/> to build an element
/// adder menu for a context object of the type <typeparamref name="TContext"/>.
/// </summary>
/// <typeparam name="TContext">Type of the context object that elements can be added to.</typeparam>
/// <param name="contractType">Contract type of addable elements.</param>
/// <returns>
/// A new <see cref="IElementAdderMenuBuilder{TContext}"/> instance.
/// </returns>
/// <seealso cref="IElementAdderMenuBuilder{TContext}.SetContractType(Type)"/>
public static IElementAdderMenuBuilder<TContext> For<TContext>(Type contractType) {
var builder = For<TContext>();
builder.SetContractType(contractType);
return builder;
}
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuBuilder.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e6152605dacd77c4db43aa59c2498ba6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

67
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuCommandAttribute.cs vendored

@ -1,67 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
namespace Rotorz.ReorderableList {
/// <summary>
/// Annotate <see cref="IElementAdderMenuCommand{TContext}"/> implementations with a
/// <see cref="ElementAdderMenuCommandAttribute"/> to associate it with the contract
/// type of addable elements.
/// </summary>
/// <example>
/// <para>The following source code demonstrates how to add a helper menu command to
/// the add element menu of a shopping list:</para>
/// <code language="csharp"><![CDATA[
/// [ElementAdderMenuCommand(typeof(ShoppingItem))]
/// public class AddFavoriteShoppingItemsCommand : IElementAdderMenuCommand<ShoppingList> {
/// public AddFavoriteShoppingItemsCommand() {
/// Content = new GUIContent("Add Favorite Items");
/// }
///
/// public GUIContent Content { get; private set; }
///
/// public bool CanExecute(IElementAdder<ShoppingList> elementAdder) {
/// return true;
/// }
/// public void Execute(IElementAdder<ShoppingList> elementAdder) {
/// // TODO: Add favorite items to the shopping list!
/// }
/// }
/// ]]></code>
/// <code language="unityscript"><![CDATA[
/// @ElementAdderMenuCommand(ShoppingItem)
/// class AddFavoriteShoppingItemsCommand extends IElementAdderMenuCommand.<ShoppingList> {
/// var _content:GUIContent = new GUIContent('Add Favorite Items');
///
/// function get Content():GUIContent { return _content; }
///
/// function CanExecute(elementAdder:IElementAdder.<ShoppingList>):boolean {
/// return true;
/// }
/// function Execute(elementAdder:IElementAdder.<ShoppingList>) {
/// // TODO: Add favorite items to the shopping list!
/// }
/// }
/// ]]></code>
/// </example>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class ElementAdderMenuCommandAttribute : Attribute {
/// <summary>
/// Initializes a new instance of the <see cref="ElementAdderMenuCommandAttribute"/> class.
/// </summary>
/// <param name="contractType">Contract type of addable elements.</param>
public ElementAdderMenuCommandAttribute(Type contractType) {
ContractType = contractType;
}
/// <summary>
/// Gets the contract type of addable elements.
/// </summary>
public Type ContractType { get; private set; }
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMenuCommandAttribute.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: dab0906e0834f954b9c6427d5af66288
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

170
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMeta.cs vendored

@ -1,170 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
using System.Collections.Generic;
using System.Linq;
namespace Rotorz.ReorderableList {
/// <summary>
/// Provides meta information which is useful when creating new implementations of
/// the <see cref="IElementAdderMenuBuilder{TContext}"/> interface.
/// </summary>
public static class ElementAdderMeta {
#region Adder Menu Command Types
private static Dictionary<Type, Dictionary<Type, List<Type>>> s_ContextMap = new Dictionary<Type, Dictionary<Type, List<Type>>>();
private static IEnumerable<Type> GetMenuCommandTypes<TContext>() {
return
from a in AppDomain.CurrentDomain.GetAssemblies()
from t in a.GetTypes()
where t.IsClass && !t.IsAbstract && t.IsDefined(typeof(ElementAdderMenuCommandAttribute), false)
where typeof(IElementAdderMenuCommand<TContext>).IsAssignableFrom(t)
select t;
}
/// <summary>
/// Gets an array of the <see cref="IElementAdderMenuCommand{TContext}"/> types
/// that are associated with the specified <paramref name="contractType"/>.
/// </summary>
/// <typeparam name="TContext">Type of the context object that elements can be added to.</typeparam>
/// <param name="contractType">Contract type of addable elements.</param>
/// <returns>
/// An array containing zero or more <see cref="System.Type"/>.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// If <paramref name="contractType"/> is <c>null</c>.
/// </exception>
/// <seealso cref="GetMenuCommands{TContext}(Type)"/>
public static Type[] GetMenuCommandTypes<TContext>(Type contractType) {
if (contractType == null)
throw new ArgumentNullException("contractType");
Dictionary<Type, List<Type>> contractMap;
List<Type> commandTypes;
if (s_ContextMap.TryGetValue(typeof(TContext), out contractMap)) {
if (contractMap.TryGetValue(contractType, out commandTypes))
return commandTypes.ToArray();
}
else {
contractMap = new Dictionary<Type, List<Type>>();
s_ContextMap[typeof(TContext)] = contractMap;
}
commandTypes = new List<Type>();
foreach (var commandType in GetMenuCommandTypes<TContext>()) {
var attributes = (ElementAdderMenuCommandAttribute[])Attribute.GetCustomAttributes(commandType, typeof(ElementAdderMenuCommandAttribute));
if (!attributes.Any(a => a.ContractType == contractType))
continue;
commandTypes.Add(commandType);
}
contractMap[contractType] = commandTypes;
return commandTypes.ToArray();
}
/// <summary>
/// Gets an array of <see cref="IElementAdderMenuCommand{TContext}"/> instances
/// that are associated with the specified <paramref name="contractType"/>.
/// </summary>
/// <typeparam name="TContext">Type of the context object that elements can be added to.</typeparam>
/// <param name="contractType">Contract type of addable elements.</param>
/// <returns>
/// An array containing zero or more <see cref="IElementAdderMenuCommand{TContext}"/> instances.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// If <paramref name="contractType"/> is <c>null</c>.
/// </exception>
/// <seealso cref="GetMenuCommandTypes{TContext}(Type)"/>
public static IElementAdderMenuCommand<TContext>[] GetMenuCommands<TContext>(Type contractType) {
var commandTypes = GetMenuCommandTypes<TContext>(contractType);
var commands = new IElementAdderMenuCommand<TContext>[commandTypes.Length];
for (int i = 0; i < commandTypes.Length; ++i)
commands[i] = (IElementAdderMenuCommand<TContext>)Activator.CreateInstance(commandTypes[i]);
return commands;
}
#endregion
#region Concrete Element Types
private static Dictionary<Type, Type[]> s_ConcreteElementTypes = new Dictionary<Type, Type[]>();
private static IEnumerable<Type> GetConcreteElementTypesHelper(Type contractType) {
if (contractType == null)
throw new ArgumentNullException("contractType");
Type[] concreteTypes;
if (!s_ConcreteElementTypes.TryGetValue(contractType, out concreteTypes)) {
concreteTypes =
(from a in AppDomain.CurrentDomain.GetAssemblies()
from t in a.GetTypes()
where t.IsClass && !t.IsAbstract && contractType.IsAssignableFrom(t)
orderby t.Name
select t
).ToArray();
s_ConcreteElementTypes[contractType] = concreteTypes;
}
return concreteTypes;
}
/// <summary>
/// Gets a filtered array of the concrete element types that implement the
/// specified <paramref name="contractType"/>.
/// </summary>
/// <remarks>
/// <para>A type is excluded from the resulting array when one or more of the
/// specified <paramref name="filters"/> returns a value of <c>false</c>.</para>
/// </remarks>
/// <param name="contractType">Contract type of addable elements.</param>
/// <param name="filters">An array of zero or more filters.</param>
/// <returns>
/// An array of zero or more concrete element types.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// If <paramref name="contractType"/> is <c>null</c>.
/// </exception>
/// <seealso cref="GetConcreteElementTypes(Type)"/>
public static Type[] GetConcreteElementTypes(Type contractType, Func<Type, bool>[] filters) {
return
(from t in GetConcreteElementTypesHelper(contractType)
where IsTypeIncluded(t, filters)
select t
).ToArray();
}
/// <summary>
/// Gets an array of all the concrete element types that implement the specified
/// <paramref name="contractType"/>.
/// </summary>
/// <param name="contractType">Contract type of addable elements.</param>
/// <returns>
/// An array of zero or more concrete element types.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// If <paramref name="contractType"/> is <c>null</c>.
/// </exception>
/// <seealso cref="GetConcreteElementTypes(Type, Func{Type, bool}[])"/>
public static Type[] GetConcreteElementTypes(Type contractType) {
return GetConcreteElementTypesHelper(contractType).ToArray();
}
private static bool IsTypeIncluded(Type concreteType, Func<Type, bool>[] filters) {
if (filters != null)
foreach (var filter in filters)
if (!filter(concreteType))
return false;
return true;
}
#endregion
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/ElementAdderMeta.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 159bf54b15add1440aaed680e94b81fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

38
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenu.cs vendored

@ -1,38 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList {
internal sealed class GenericElementAdderMenu : IElementAdderMenu {
private GenericMenu _innerMenu = new GenericMenu();
public GenericElementAdderMenu() {
}
public void AddItem(GUIContent content, GenericMenu.MenuFunction handler) {
_innerMenu.AddItem(content, false, handler);
}
public void AddDisabledItem(GUIContent content) {
_innerMenu.AddDisabledItem(content);
}
public void AddSeparator(string path = "") {
_innerMenu.AddSeparator(path);
}
public bool IsEmpty {
get { return _innerMenu.GetItemCount() == 0; }
}
public void DropDown(Rect position) {
_innerMenu.DropDown(position);
}
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenu.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 662b5dcb25b78f94f9afe8d3f402b628
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

102
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenuBuilder.cs vendored

@ -1,102 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList {
internal sealed class GenericElementAdderMenuBuilder<TContext> : IElementAdderMenuBuilder<TContext> {
private static string NicifyTypeName(Type type) {
return ObjectNames.NicifyVariableName(type.Name);
}
private Type _contractType;
private IElementAdder<TContext> _elementAdder;
private Func<Type, string> _typeDisplayNameFormatter;
private List<Func<Type, bool>> _typeFilters = new List<Func<Type, bool>>();
private List<IElementAdderMenuCommand<TContext>> _customCommands = new List<IElementAdderMenuCommand<TContext>>();
public GenericElementAdderMenuBuilder() {
_typeDisplayNameFormatter = NicifyTypeName;
}
public void SetContractType(Type contractType) {
_contractType = contractType;
}
public void SetElementAdder(IElementAdder<TContext> elementAdder) {
_elementAdder = elementAdder;
}
public void SetTypeDisplayNameFormatter(Func<Type, string> formatter) {
_typeDisplayNameFormatter = formatter ?? NicifyTypeName;
}
public void AddTypeFilter(Func<Type, bool> typeFilter) {
if (typeFilter == null)
throw new ArgumentNullException("typeFilter");
_typeFilters.Add(typeFilter);
}
public void AddCustomCommand(IElementAdderMenuCommand<TContext> command) {
if (command == null)
throw new ArgumentNullException("command");
_customCommands.Add(command);
}
public IElementAdderMenu GetMenu() {
var menu = new GenericElementAdderMenu();
AddCommandsToMenu(menu, _customCommands);
if (_contractType != null) {
AddCommandsToMenu(menu, ElementAdderMeta.GetMenuCommands<TContext>(_contractType));
AddConcreteTypesToMenu(menu, ElementAdderMeta.GetConcreteElementTypes(_contractType, _typeFilters.ToArray()));
}
return menu;
}
private void AddCommandsToMenu(GenericElementAdderMenu menu, IList<IElementAdderMenuCommand<TContext>> commands) {
if (commands.Count == 0)
return;
if (!menu.IsEmpty)
menu.AddSeparator();
foreach (var command in commands) {
if (_elementAdder != null && command.CanExecute(_elementAdder))
menu.AddItem(command.Content, () => command.Execute(_elementAdder));
else
menu.AddDisabledItem(command.Content);
}
}
private void AddConcreteTypesToMenu(GenericElementAdderMenu menu, Type[] concreteTypes) {
if (concreteTypes.Length == 0)
return;
if (!menu.IsEmpty)
menu.AddSeparator();
foreach (var concreteType in concreteTypes) {
var content = new GUIContent(_typeDisplayNameFormatter(concreteType));
if (_elementAdder != null && _elementAdder.CanAddElement(concreteType))
menu.AddItem(content, () => {
if (_elementAdder.CanAddElement(concreteType))
_elementAdder.AddElement(concreteType);
});
else
menu.AddDisabledItem(content);
}
}
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/GenericElementAdderMenuBuilder.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: da8782cb7448c234fb86e9503326ce9c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

43
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdder.cs vendored

@ -1,43 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
namespace Rotorz.ReorderableList {
/// <summary>
/// Interface for an object which adds elements to a context object of the type
/// <typeparamref name="TContext"/>.
/// </summary>
/// <typeparam name="TContext">Type of the context object that elements can be added to.</typeparam>
public interface IElementAdder<TContext> {
/// <summary>
/// Gets the context object.
/// </summary>
TContext Object { get; }
/// <summary>
/// Determines whether a new element of the specified <paramref name="type"/> can
/// be added to the associated context object.
/// </summary>
/// <param name="type">Type of element to add.</param>
/// <returns>
/// A value of <c>true</c> if an element of the specified type can be added;
/// otherwise, a value of <c>false</c>.
/// </returns>
bool CanAddElement(Type type);
/// <summary>
/// Adds an element of the specified <paramref name="type"/> to the associated
/// context object.
/// </summary>
/// <param name="type">Type of element to add.</param>
/// <returns>
/// The new element.
/// </returns>
object AddElement(Type type);
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdder.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 811c0b5125dc50746b66457b5c96741d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

33
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenu.cs vendored

@ -1,33 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Interface for a menu interface.
/// </summary>
public interface IElementAdderMenu {
/// <summary>
/// Gets a value indicating whether the menu contains any items.
/// </summary>
/// <value>
/// <c>true</c> if the menu contains one or more items; otherwise, <c>false</c>.
/// </value>
bool IsEmpty { get; }
/// <summary>
/// Displays the drop-down menu inside an editor GUI.
/// </summary>
/// <remarks>
/// <para>This method should only be used during <b>OnGUI</b> and <b>OnSceneGUI</b>
/// events; for instance, inside an editor window, a custom inspector or scene view.</para>
/// </remarks>
/// <param name="position">Position of menu button in the GUI.</param>
void DropDown(Rect position);
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenu.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7452dc2d2d6305947ab39a48354ab4bb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

76
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuBuilder.cs vendored

@ -1,76 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
namespace Rotorz.ReorderableList {
/// <summary>
/// Interface for building an <see cref="IElementAdderMenu"/>.
/// </summary>
/// <typeparam name="TContext">Type of the context object that elements can be added to.</typeparam>
public interface IElementAdderMenuBuilder<TContext> {
/// <summary>
/// Sets contract type of the elements that can be included in the <see cref="IElementAdderMenu"/>.
/// Only non-abstract class types that are assignable from the <paramref name="contractType"/>
/// will be included in the built menu.
/// </summary>
/// <param name="contractType">Contract type of addable elements.</param>
void SetContractType(Type contractType);
/// <summary>
/// Set the <see cref="IElementAdder{TContext}"/> implementation which is used
/// when adding new elements to the context object.
/// </summary>
/// <remarks>
/// <para>Specify a value of <c>null</c> for <paramref name="elementAdder"/> to
/// prevent the selection of any types.</para>
/// </remarks>
/// <param name="elementAdder">Element adder.</param>
void SetElementAdder(IElementAdder<TContext> elementAdder);
/// <summary>
/// Set the function that formats the display of type names in the user interface.
/// </summary>
/// <remarks>
/// <para>Specify a value of <c>null</c> for <paramref name="formatter"/> to
/// assume the default formatting function.</para>
/// </remarks>
/// <param name="formatter">Function that formats display name of type; or <c>null</c>.</param>
void SetTypeDisplayNameFormatter(Func<Type, string> formatter);
/// <summary>
/// Adds a filter function which determines whether types can be included or
/// whether they need to be excluded.
/// </summary>
/// <remarks>
/// <para>If a filter function returns a value of <c>false</c> then that type
/// will not be included in the menu interface.</para>
/// </remarks>
/// <param name="typeFilter">Filter function.</param>
/// <exception cref="System.ArgumentNullException">
/// If <paramref name="typeFilter"/> is <c>null</c>.
/// </exception>
void AddTypeFilter(Func<Type, bool> typeFilter);
/// <summary>
/// Adds a custom command to the menu.
/// </summary>
/// <param name="command">The custom command.</param>
/// <exception cref="System.ArgumentNullException">
/// If <paramref name="command"/> is <c>null</c>.
/// </exception>
void AddCustomCommand(IElementAdderMenuCommand<TContext> command);
/// <summary>
/// Builds and returns a new <see cref="IElementAdderMenu"/> instance.
/// </summary>
/// <returns>
/// A new <see cref="IElementAdderMenu"/> instance each time the method is invoked.
/// </returns>
IElementAdderMenu GetMenu();
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuBuilder.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2810812b845cceb4e9a0f7c0de842f29
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

41
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuCommand.cs vendored

@ -1,41 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Interface for a menu command that can be included in an <see cref="IElementAdderMenu"/>
/// either by annotating an implementation of the <see cref="IElementAdderMenuCommand{TContext}"/>
/// interface with <see cref="ElementAdderMenuCommandAttribute"/> or directly by
/// calling <see cref="IElementAdderMenuBuilder{TContext}.AddCustomCommand"/>.
/// </summary>
/// <typeparam name="TContext">Type of the context object that elements can be added to.</typeparam>
public interface IElementAdderMenuCommand<TContext> {
/// <summary>
/// Gets the content of the menu command.
/// </summary>
GUIContent Content { get; }
/// <summary>
/// Determines whether the command can be executed.
/// </summary>
/// <param name="elementAdder">The associated element adder provides access to
/// the <typeparamref name="TContext"/> instance.</param>
/// <returns>
/// A value of <c>true</c> if the command can execute; otherwise, <c>false</c>.
/// </returns>
bool CanExecute(IElementAdder<TContext> elementAdder);
/// <summary>
/// Executes the command.
/// </summary>
/// <param name="elementAdder">The associated element adder provides access to
/// the <typeparamref name="TContext"/> instance.</param>
void Execute(IElementAdder<TContext> elementAdder);
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Element Adder Menu/IElementAdderMenuCommand.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3fc42d99c85c1bc409897df1dae25bd4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

145
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/GenericListAdaptor.cs vendored

@ -1,145 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Reorderable list adaptor for generic list.
/// </summary>
/// <remarks>
/// <para>This adaptor can be subclassed to add special logic to item height calculation.
/// You may want to implement a custom adaptor class where specialised functionality
/// is needed.</para>
/// <para>List elements which implement the <see cref="System.ICloneable"/> interface are
/// cloned using that interface upon duplication; otherwise the item value or reference is
/// simply copied.</para>
/// </remarks>
/// <typeparam name="T">Type of list element.</typeparam>
public class GenericListAdaptor<T> : IReorderableListAdaptor {
private IList<T> _list;
private ReorderableListControl.ItemDrawer<T> _itemDrawer;
/// <summary>
/// Fixed height of each list item.
/// </summary>
public float FixedItemHeight;
/// <summary>
/// Gets the underlying list data structure.
/// </summary>
public IList<T> List {
get { return _list; }
}
/// <summary>
/// Gets element from list.
/// </summary>
/// <param name="index">Zero-based index of element.</param>
/// <returns>
/// The element.
/// </returns>
public T this[int index] {
get { return _list[index]; }
}
#region Construction
/// <summary>
/// Initializes a new instance of <see cref="GenericListAdaptor{T}"/>.
/// </summary>
/// <param name="list">The list which can be reordered.</param>
/// <param name="itemDrawer">Callback to draw list item.</param>
/// <param name="itemHeight">Height of list item in pixels.</param>
public GenericListAdaptor(IList<T> list, ReorderableListControl.ItemDrawer<T> itemDrawer, float itemHeight) {
this._list = list;
this._itemDrawer = itemDrawer ?? ReorderableListGUI.DefaultItemDrawer;
this.FixedItemHeight = itemHeight;
}
#endregion
#region IReorderableListAdaptor - Implementation
/// <inheritdoc/>
public int Count {
get { return _list.Count; }
}
/// <inheritdoc/>
public virtual bool CanDrag(int index) {
return true;
}
/// <inheritdoc/>
public virtual bool CanRemove(int index) {
return true;
}
/// <inheritdoc/>
public virtual void Add() {
_list.Add(default(T));
}
/// <inheritdoc/>
public virtual void Insert(int index) {
_list.Insert(index, default(T));
}
/// <inheritdoc/>
public virtual void Duplicate(int index) {
T newItem = _list[index];
ICloneable existingItem = newItem as ICloneable;
if (existingItem != null)
newItem = (T)existingItem.Clone();
_list.Insert(index + 1, newItem);
}
/// <inheritdoc/>
public virtual void Remove(int index) {
_list.RemoveAt(index);
}
/// <inheritdoc/>
public virtual void Move(int sourceIndex, int destIndex) {
if (destIndex > sourceIndex)
--destIndex;
T item = _list[sourceIndex];
_list.RemoveAt(sourceIndex);
_list.Insert(destIndex, item);
}
/// <inheritdoc/>
public virtual void Clear() {
_list.Clear();
}
/// <inheritdoc/>
public virtual void BeginGUI() {
}
/// <inheritdoc/>
public virtual void EndGUI() {
}
/// <inheritdoc/>
public virtual void DrawItemBackground(Rect position, int index) {
}
/// <inheritdoc/>
public virtual void DrawItem(Rect position, int index) {
_list[index] = _itemDrawer(position, _list[index]);
}
/// <inheritdoc/>
public virtual float GetItemHeight(int index) {
return FixedItemHeight;
}
#endregion
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/GenericListAdaptor.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9860e7f6c1d1b8d45b13889a965e172f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

131
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListAdaptor.cs vendored

@ -1,131 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Adaptor allowing reorderable list control to interface with list data.
/// </summary>
/// <see cref="IReorderableListDropTarget"/>
public interface IReorderableListAdaptor {
/// <summary>
/// Gets count of elements in list.
/// </summary>
int Count { get; }
/// <summary>
/// Determines whether an item can be reordered by dragging mouse.
/// </summary>
/// <remarks>
/// <para>This should be a light-weight method since it will be used to determine
/// whether grab handle should be included for each item in a reorderable list.</para>
/// <para>Please note that returning a value of <c>false</c> does not prevent movement
/// on list item since other draggable items can be moved around it.</para>
/// </remarks>
/// <param name="index">Zero-based index for list element.</param>
/// <returns>
/// A value of <c>true</c> if item can be dragged; otherwise <c>false</c>.
/// </returns>
bool CanDrag(int index);
/// <summary>
/// Determines whether an item can be removed from list.
/// </summary>
/// <remarks>
/// <para>This should be a light-weight method since it will be used to determine
/// whether remove button should be included for each item in list.</para>
/// <para>This is redundant when <see cref="ReorderableListFlags.HideRemoveButtons"/>
/// is specified.</para>
/// </remarks>
/// <param name="index">Zero-based index for list element.</param>
/// <returns>
/// A value of <c>true</c> if item can be removed; otherwise <c>false</c>.
/// </returns>
bool CanRemove(int index);
/// <summary>
/// Add new element at end of list.
/// </summary>
void Add();
/// <summary>
/// Insert new element at specified index.
/// </summary>
/// <param name="index">Zero-based index for list element.</param>
void Insert(int index);
/// <summary>
/// Duplicate existing element.
/// </summary>
/// <remarks>
/// <para>Consider using the <see cref="System.ICloneable"/> interface to
/// duplicate list elements where appropriate.</para>
/// </remarks>
/// <param name="index">Zero-based index of list element.</param>
void Duplicate(int index);
/// <summary>
/// Remove element at specified index.
/// </summary>
/// <param name="index">Zero-based index of list element.</param>
void Remove(int index);
/// <summary>
/// Move element from source index to destination index.
/// </summary>
/// <param name="sourceIndex">Zero-based index of source element.</param>
/// <param name="destIndex">Zero-based index of destination element.</param>
void Move(int sourceIndex, int destIndex);
/// <summary>
/// Clear all elements from list.
/// </summary>
void Clear();
/// <summary>
/// Occurs before any list items are drawn.
/// </summary>
/// <remarks>
/// <para>This method is only used to handle GUI repaint events.</para>
/// </remarks>
/// <see cref="EndGUI()"/>
void BeginGUI();
/// <summary>
/// Occurs after all list items have been drawn.
/// </summary>
/// <remarks>
/// <para>This method is only used to handle GUI repaint events.</para>
/// </remarks>
/// <see cref="BeginGUI()"/>
void EndGUI();
/// <summary>
/// Draws background of a list item.
/// </summary>
/// <remarks>
/// <para>This method is only used to handle GUI repaint events.</para>
/// <para>Background of list item spans a slightly larger area than the main
/// interface that is drawn by <see cref="DrawItem(Rect, int)"/> since it is
/// drawn behind the grab handle.</para>
/// </remarks>
/// <param name="position">Total position of list element in GUI.</param>
/// <param name="index">Zero-based index of array element.</param>
void DrawItemBackground(Rect position, int index);
/// <summary>
/// Draws main interface for a list item.
/// </summary>
/// <remarks>
/// <para>This method is used to handle all GUI events.</para>
/// </remarks>
/// <param name="position">Position in GUI.</param>
/// <param name="index">Zero-based index of array element.</param>
void DrawItem(Rect position, int index);
/// <summary>
/// Gets height of list item in pixels.
/// </summary>
/// <param name="index">Zero-based index of array element.</param>
/// <returns>
/// Measurement in pixels.
/// </returns>
float GetItemHeight(int index);
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListAdaptor.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 27a7bce836d771f4a84b172af5132fe7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

49
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListDropTarget.cs vendored

@ -1,49 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
namespace Rotorz.ReorderableList {
/// <summary>
/// Can be implemented along with <see cref="IReorderableListAdaptor"/> when drop
/// insertion or ordering is desired.
/// </summary>
/// <remarks>
/// <para>This type of "drop" functionality can occur when the "drag" phase of the
/// drag and drop operation was initiated elsewhere. For example, a custom
/// <see cref="IReorderableListAdaptor"/> could insert entirely new items by
/// dragging and dropping from the Unity "Project" window.</para>
/// </remarks>
/// <see cref="IReorderableListAdaptor"/>
public interface IReorderableListDropTarget {
/// <summary>
/// Determines whether an item is being dragged and that it can be inserted
/// or moved by dropping somewhere into the reorderable list control.
/// </summary>
/// <remarks>
/// <para>This method is always called whilst drawing an editor GUI.</para>
/// </remarks>
/// <param name="insertionIndex">Zero-based index of insertion.</param>
/// <returns>
/// A value of <c>true</c> if item can be dropped; otherwise <c>false</c>.
/// </returns>
/// <see cref="UnityEditor.DragAndDrop"/>
bool CanDropInsert(int insertionIndex);
/// <summary>
/// Processes the current drop insertion operation when <see cref="CanDropInsert(int)"/>
/// returns a value of <c>true</c> to process, accept or cancel.
/// </summary>
/// <remarks>
/// <para>This method is always called whilst drawing an editor GUI.</para>
/// <para>This method is only called when <see cref="CanDropInsert(int)"/>
/// returns a value of <c>true</c>.</para>
/// </remarks>
/// <param name="insertionIndex">Zero-based index of insertion.</param>
/// <see cref="ReorderableListGUI.CurrentListControlID"/>
/// <see cref="UnityEditor.DragAndDrop"/>
void ProcessDropInsertion(int insertionIndex);
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/IReorderableListDropTarget.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d1806c8b705782141acdbee308edf82c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1080d4950a85a2b4da9d5653fff71a13
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

140
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/GUIHelper.cs vendored

@ -1,140 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList.Internal {
/// <summary>
/// Utility functions to assist with GUIs.
/// </summary>
/// <exclude/>
public static class GUIHelper {
static GUIHelper() {
var tyGUIClip = Type.GetType("UnityEngine.GUIClip,UnityEngine");
if (tyGUIClip != null) {
var piVisibleRect = tyGUIClip.GetProperty("visibleRect", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (piVisibleRect != null) {
var getMethod = piVisibleRect.GetGetMethod(true) ?? piVisibleRect.GetGetMethod(false);
VisibleRect = (Func<Rect>)Delegate.CreateDelegate(typeof(Func<Rect>), getMethod);
}
}
var miFocusTextInControl = typeof(EditorGUI).GetMethod("FocusTextInControl", BindingFlags.Static | BindingFlags.Public);
if (miFocusTextInControl == null)
miFocusTextInControl = typeof(GUI).GetMethod("FocusControl", BindingFlags.Static | BindingFlags.Public);
FocusTextInControl = (Action<string>)Delegate.CreateDelegate(typeof(Action<string>), miFocusTextInControl);
s_SeparatorColor = EditorGUIUtility.isProSkin
? new Color(0.11f, 0.11f, 0.11f)
: new Color(0.5f, 0.5f, 0.5f);
s_SeparatorStyle = new GUIStyle();
s_SeparatorStyle.normal.background = EditorGUIUtility.whiteTexture;
s_SeparatorStyle.stretchWidth = true;
}
/// <summary>
/// Gets visible rectangle within GUI.
/// </summary>
/// <remarks>
/// <para>VisibleRect = TopmostRect + scrollViewOffsets</para>
/// </remarks>
public static Func<Rect> VisibleRect;
/// <summary>
/// Focus control and text editor where applicable.
/// </summary>
public static Action<string> FocusTextInControl;
private static GUIStyle s_TempStyle = new GUIStyle();
/// <summary>
/// Draw texture using <see cref="GUIStyle"/> to workaround bug in Unity where
/// <see cref="GUI.DrawTexture"/> flickers when embedded inside a property drawer.
/// </summary>
/// <param name="position">Position of which to draw texture in space of GUI.</param>
/// <param name="texture">Texture.</param>
public static void DrawTexture(Rect position, Texture2D texture) {
if (Event.current.type != EventType.Repaint)
return;
s_TempStyle.normal.background = texture;
s_TempStyle.Draw(position, GUIContent.none, false, false, false, false);
}
private static GUIContent s_TempIconContent = new GUIContent();
private static readonly int s_IconButtonHint = "_ReorderableIconButton_".GetHashCode();
public static bool IconButton(Rect position, bool visible, Texture2D iconNormal, Texture2D iconActive, GUIStyle style) {
int controlID = GUIUtility.GetControlID(s_IconButtonHint, FocusType.Passive);
bool result = false;
position.height += 1;
switch (Event.current.GetTypeForControl(controlID)) {
case EventType.MouseDown:
// Do not allow button to be pressed using right mouse button since
// context menu should be shown instead!
if (GUI.enabled && Event.current.button != 1 && position.Contains(Event.current.mousePosition)) {
GUIUtility.hotControl = controlID;
GUIUtility.keyboardControl = 0;
Event.current.Use();
}
break;
case EventType.MouseDrag:
if (GUIUtility.hotControl == controlID)
Event.current.Use();
break;
case EventType.MouseUp:
if (GUIUtility.hotControl == controlID) {
GUIUtility.hotControl = 0;
result = position.Contains(Event.current.mousePosition);
Event.current.Use();
}
break;
case EventType.Repaint:
if (visible) {
bool isActive = GUIUtility.hotControl == controlID && position.Contains(Event.current.mousePosition);
s_TempIconContent.image = isActive ? iconActive : iconNormal;
position.height -= 1;
style.Draw(position, s_TempIconContent, isActive, isActive, false, false);
}
break;
}
return result;
}
public static bool IconButton(Rect position, Texture2D iconNormal, Texture2D iconActive, GUIStyle style) {
return IconButton(position, true, iconNormal, iconActive, style);
}
private static readonly Color s_SeparatorColor;
private static readonly GUIStyle s_SeparatorStyle;
public static void Separator(Rect position, Color color) {
if (Event.current.type == EventType.Repaint) {
Color restoreColor = GUI.color;
GUI.color = color;
s_SeparatorStyle.Draw(position, false, false, false, false);
GUI.color = restoreColor;
}
}
public static void Separator(Rect position) {
Separator(position, s_SeparatorColor);
}
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/GUIHelper.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 26c2c1b444cf6a446b03219116f2f827
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

193
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/ReorderableListResources.cs vendored

@ -1,193 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList.Internal {
/// <exclude/>
public enum ReorderableListTexture {
Icon_Add_Normal = 0,
Icon_Add_Active,
Icon_AddMenu_Normal,
Icon_AddMenu_Active,
Icon_Menu_Normal,
Icon_Menu_Active,
Icon_Remove_Normal,
Icon_Remove_Active,
Button_Normal,
Button_Active,
Button2_Normal,
Button2_Active,
TitleBackground,
ContainerBackground,
Container2Background,
GrabHandle,
}
/// <summary>
/// Resources to assist with reorderable list control.
/// </summary>
/// <exclude/>
public static class ReorderableListResources {
static ReorderableListResources() {
GenerateSpecialTextures();
LoadResourceAssets();
}
#region Texture Resources
/// <summary>
/// Resource assets for light skin.
/// </summary>
/// <remarks>
/// <para>Resource assets are PNG images which have been encoded using a base-64
/// string so that actual asset files are not necessary.</para>
/// </remarks>
private static string[] s_LightSkin = {
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACxJREFUeNpi/P//PwMM6OvrgzkXL15khIkxMRAABBUw6unp/afMBNo7EiDAAEKeD5EsXZcTAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAC1JREFUeNpi/P//PwMM3L17F8xRVlZmhIkxMRAABBUw3rlz5z9lJtDekQABBgCvqxGbQWpEqwAAAABJRU5ErkJggg==",
"iVBORw0KGgoAAAANSUhEUgAAABYAAAAICAYAAAD9aA/QAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAERJREFUeNpi/P//PwMxQF9fH6zw4sWLjMSoZ2KgEaCZwYz4ggLmfVwAX7AMjIuJjTxsPqOKi9EtA/GpFhQww2E0QIABAPF5IGHNU7adAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAABYAAAAICAYAAAD9aA/QAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAERJREFUeNpi/P//PwMx4O7du2CFysrKjMSoZ2KgEaCZwYz4ggLmfVwAX7AMjIuJjTxsPqOKi9EtA/GpFhQww2E0QIABACBuGkOOEiPJAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAICAYAAAAx8TU7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBJREFUeNpi/P//PwM6YGLAAigUZNHX18ewienixYuMyAJgPshJIKynp/cfxgYIMACCMhb+oVNPwwAAAABJRU5ErkJggg==",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAICAYAAAAx8TU7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpi/P//PwM6YGLAAigUZLl79y6GTUzKysqMyAJgPshJIHznzp3/MDZAgAEAkoIW/jHg7H4AAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAACCAIAAADq9gq6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABVJREFUeNpiVFZWZsAGmBhwAIAAAwAURgBt4C03ZwAAAABJRU5ErkJggg==",
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAACCAIAAADq9gq6AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABVJREFUeNpivHPnDgM2wMSAAwAEGAB8VgKYlvqkBwAAAABJRU5ErkJggg==",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAFCAYAAACJmvbYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEFJREFUeNpiKCoq+v/p06f/ly9fhmMQHyTOxIAH4JVkARHv379nkJeXhwuC+CDA+P//f4bi4uL/6Lp6e3sZAQIMACmoI7rWhl0KAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAFCAYAAACJmvbYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEFJREFUeNpiFBER+f/jxw8GNjY2Bhj49esXAwcHBwMTAx6AV5IFRPz58wdFEMZn/P//P4OoqOh/dF2vX79mBAgwADpeFCsbeaC+AAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFBJREFUeNpi/P//P0NxcfF/BjTQ29vLyFBUVPT/4cOH/z99+gTHID5InAWkSlBQkAEoANclLy8PppkY8AC8kmBj379/DzcKxgcBRnyuBQgwACVNLqBePwzmAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAElJREFUeNp8jjEKADEIBNdDrCz1/w+0tRQMOchxpHC6dVhW6m64e+MiIojMrDMTzPyJqoKq4r1sISJ3GQ8GRsln48/JNH27BBgAUhQbSyMxqzEAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAECAYAAABGM/VAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEFJREFUeNpi/P//P0NxcfF/BgRgZP78+fN/VVVVhpCQEAZjY2OGs2fPNrCApBwdHRkePHgAVwoWnDVrFgMyAAgwAAt4E1dCq1obAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAECAYAAABGM/VAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADtJREFUeNpi/P//P0NxcfF/Bijo7e1lZCgqKvr/6dOn/5cvXwbTID4TSPb9+/cM8vLyYBoEGLFpBwgwAHGiI8KoD3BZAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAECAIAAADJUWIXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpiDA0NZUACLEDc2dkJ4ZSXlzMxoAJGNPUAAQYAwbcFBwYygqkAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAkAAAAFCAYAAACXU8ZrAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACdJREFUeNpi/PTp038GAoClvr6ekBoGxv//CRrEwPL582fqWAcQYAAnaA2zsd+RkQAAAABJRU5ErkJggg==",
};
/// <summary>
/// Resource assets for dark skin.
/// </summary>
/// <remarks>
/// <para>Resource assets are PNG images which have been encoded using a base-64
/// string so that actual asset files are not necessary.</para>
/// </remarks>
private static string[] s_DarkSkin = {
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAKCAYAAACJxx+AAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAE9JREFUeNpi/P//PwM+wITMOXr06H8QxqmAoAnYAOORI0f+U2aCsrIy3ISFCxeC6fj4eIQCZG/CfGBtbc1IvBXIJqioqIA5d+7cgZsAEGAAsHYfVsuw0XYAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAKCAYAAACJxx+AAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEZJREFUeNpi/P//PwM+wITM+Q8FOBUQNAEbYPmPxRHIYoRN4OLignO+ffsGppHFGJFtgBnNCATEW4HMgRn9/ft3uBhAgAEAbZ0gJEmOtOAAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAABYAAAAKCAYAAACwoK7bAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAG1JREFUeNpi/P//PwMtABOxCo8ePfofhKluMM1cTCpgxBfGhLxubW3NOLhcrKKiApdcuHAhmI6Pj4fL37lzhxGXzxiJTW4wzdi8D3IAzGKY5VQJCpDLYT4B0WCfgFxMDFZWVv4PwoTUwNgAAQYA7Mltu4fEN4wAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAABYAAAAKCAYAAACwoK7bAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGVJREFUeNpi/P//PwMtABOxCv9DAdUNppmLSQWM+HxHyOuMQEB3F7Pgk+Ti4oKzv337hiH2/ft3nD5jJDaiYZqxeZ+Tk/M/zGKY5VQJCqDLGWE+AdEgPtEuBrkKZgg+NTB5gAADAJGHOCAbby7zAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAKCAYAAAB8OZQwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADpJREFUeNpi/P//PwM6YGLAAmghyHL06FEM65ni4+NRBMB8kDuVlZX/Hzly5D+IBrsbRMAkYGyAAAMAB7YiCOfAQ0cAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAKCAYAAAB8OZQwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADdJREFUeNpi/P//PwM6YGLAAmghyPIfi/VMXFxcKAJgPkghBwfH/3///v0H0WCNIAImAWMDBBgA09Igc2M/ueMAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAYAAACzzX7wAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi/P//PwM+wHL06FG8KpgYCABGZWVlvCYABBgA7/sHvGw+cz8AAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAYAAACzzX7wAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi/P//PwM+wPKfgAomBgKAhYuLC68CgAADAAxjByOjCHIRAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAFCAYAAACJmvbYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAERJREFUeNpiVFZW/u/i4sLw4sULBhiQkJBg2LNnDwMTAx6AV5IFRLx9+xZsFAyA+CDA+P//fwYVFZX/6Lru3LnDCBBgAEqlFEYRrf2nAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAFCAYAAACJmvbYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEFJREFUeNpiFBER+f/jxw8GNjY2Bhj49esXAwcHBwMTAx6AV5IFRPz58wdFEMZn/P//P4OoqOh/dF2vX79mBAgwADpeFCsbeaC+AAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAExJREFUeNpi/P//P4OKisp/BjRw584dRhaQhKGhIYOwsDBc4u3bt2ANLCAOSOLFixdwSQkJCTDNxIAH4JVkgdkBMwrGBwFGfK4FCDAAV1AdhemEguIAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAElJREFUeNp8jjEKADEIBNdDrCz1/w+0tRQMOchxpHC6dVhW6m64e+MiIojMrDMTzPyJqoKq4r1sISJ3GQ8GRsln48/JNH27BBgAUhQbSyMxqzEAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAECAYAAABGM/VAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADtJREFUeNpi/P//P4OKisp/Bii4c+cOIwtIQE9Pj+HLly9gQRCfBcQACbx69QqmmAEseO/ePQZkABBgAD04FXsmmijSAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAECAYAAABGM/VAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD1JREFUeNpi/P//P4OKisp/Bii4c+cOIwtIwMXFheHFixcMEhISYAVMINm3b9+CBUA0CDCiazc0NGQECDAAdH0YelA27kgAAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAECAYAAABGM/VAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACZJREFUeNpi/P//vxQDGmABEffv3/8ME1BUVORlYsACGLFpBwgwABaWCjfQEetnAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAAkAAAAFCAYAAACXU8ZrAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACRJREFUeNpizM3N/c9AADAqKysTVMTi5eXFSFAREFPHOoAAAwBCfwcAO8g48QAAAABJRU5ErkJggg==",
};
/// <summary>
/// Gets light or dark version of the specified texture.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static Texture2D GetTexture(ReorderableListTexture name) {
return s_Cached[(int)name];
}
#endregion
#region Generated Resources
public static Texture2D texHighlightColor { get; private set; }
/// <summary>
/// Generate special textures.
/// </summary>
private static void GenerateSpecialTextures() {
texHighlightColor = CreatePixelTexture("(Generated) Highlight Color", ReorderableListStyles.SelectionBackgroundColor);
}
/// <summary>
/// Create 1x1 pixel texture of specified color.
/// </summary>
/// <param name="name">Name for texture object.</param>
/// <param name="color">Pixel color.</param>
/// <returns>
/// The new <c>Texture2D</c> instance.
/// </returns>
public static Texture2D CreatePixelTexture(string name, Color color) {
var tex = new Texture2D(1, 1, TextureFormat.ARGB32, false, true);
tex.name = name;
tex.hideFlags = HideFlags.HideAndDontSave;
tex.filterMode = FilterMode.Point;
tex.SetPixel(0, 0, color);
tex.Apply();
return tex;
}
#endregion
#region Load PNG from Base-64 Encoded String
private static Texture2D[] s_Cached;
/// <summary>
/// Read textures from base-64 encoded strings. Automatically selects assets based
/// upon whether the light or dark (pro) skin is active.
/// </summary>
private static void LoadResourceAssets() {
var skin = EditorGUIUtility.isProSkin ? s_DarkSkin : s_LightSkin;
s_Cached = new Texture2D[skin.Length];
for (int i = 0; i < s_Cached.Length; ++i) {
// Get image data (PNG) from base64 encoded strings.
byte[] imageData = Convert.FromBase64String(skin[i]);
// Gather image size from image data.
int texWidth, texHeight;
GetImageSize(imageData, out texWidth, out texHeight);
// Generate texture asset.
var tex = new Texture2D(texWidth, texHeight, TextureFormat.ARGB32, false, true);
tex.hideFlags = HideFlags.HideAndDontSave;
tex.name = "(Generated) ReorderableList:" + i;
tex.filterMode = FilterMode.Point;
#if UNITY_2017_1_OR_NEWER
ImageConversion.LoadImage(tex, imageData, markNonReadable: true);
#else
tex.LoadImage(imageData);
#endif
s_Cached[i] = tex;
}
s_LightSkin = null;
s_DarkSkin = null;
}
/// <summary>
/// Read width and height if PNG file in pixels.
/// </summary>
/// <param name="imageData">PNG image data.</param>
/// <param name="width">Width of image in pixels.</param>
/// <param name="height">Height of image in pixels.</param>
private static void GetImageSize(byte[] imageData, out int width, out int height) {
width = ReadInt(imageData, 3 + 15);
height = ReadInt(imageData, 3 + 15 + 2 + 2);
}
private static int ReadInt(byte[] imageData, int offset) {
return (imageData[offset] << 8) | imageData[offset + 1];
}
#endregion
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/ReorderableListResources.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1d9acb5346b0f3c478d5678c6a0e4f42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

179
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/SerializedPropertyUtility.cs vendored

@ -1,179 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList.Internal {
/// <summary>
/// Utility functionality for <see cref="SerializedPropertyAdaptor"/> implementations.
/// </summary>
public static class SerializedPropertyUtility {
/// <summary>
/// Reset the value of a property.
/// </summary>
/// <param name="property">Serialized property for a serialized property.</param>
public static void ResetValue(SerializedProperty property) {
if (property == null)
throw new ArgumentNullException("property");
switch (property.propertyType) {
case SerializedPropertyType.Integer:
property.intValue = 0;
break;
case SerializedPropertyType.Boolean:
property.boolValue = false;
break;
case SerializedPropertyType.Float:
property.floatValue = 0f;
break;
case SerializedPropertyType.String:
property.stringValue = "";
break;
case SerializedPropertyType.Color:
property.colorValue = Color.black;
break;
case SerializedPropertyType.ObjectReference:
property.objectReferenceValue = null;
break;
case SerializedPropertyType.LayerMask:
property.intValue = 0;
break;
case SerializedPropertyType.Enum:
property.enumValueIndex = 0;
break;
case SerializedPropertyType.Vector2:
property.vector2Value = default(Vector2);
break;
case SerializedPropertyType.Vector3:
property.vector3Value = default(Vector3);
break;
case SerializedPropertyType.Vector4:
property.vector4Value = default(Vector4);
break;
case SerializedPropertyType.Rect:
property.rectValue = default(Rect);
break;
case SerializedPropertyType.ArraySize:
property.intValue = 0;
break;
case SerializedPropertyType.Character:
property.intValue = 0;
break;
case SerializedPropertyType.AnimationCurve:
property.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
break;
case SerializedPropertyType.Bounds:
property.boundsValue = default(Bounds);
break;
case SerializedPropertyType.Gradient:
//!TODO: Amend when Unity add a public API for setting the gradient.
break;
}
if (property.isArray) {
property.arraySize = 0;
}
ResetChildPropertyValues(property);
}
private static void ResetChildPropertyValues(SerializedProperty element) {
if (!element.hasChildren)
return;
var childProperty = element.Copy();
int elementPropertyDepth = element.depth;
bool enterChildren = true;
while (childProperty.Next(enterChildren) && childProperty.depth > elementPropertyDepth) {
enterChildren = false;
ResetValue(childProperty);
}
}
/// <summary>
/// Copies value of <paramref name="sourceProperty"/> into <pararef name="destProperty"/>.
/// </summary>
/// <param name="destProperty">Destination property.</param>
/// <param name="sourceProperty">Source property.</param>
public static void CopyPropertyValue(SerializedProperty destProperty, SerializedProperty sourceProperty) {
if (destProperty == null)
throw new ArgumentNullException("destProperty");
if (sourceProperty == null)
throw new ArgumentNullException("sourceProperty");
sourceProperty = sourceProperty.Copy();
destProperty = destProperty.Copy();
CopyPropertyValueSingular(destProperty, sourceProperty);
if (sourceProperty.hasChildren) {
int elementPropertyDepth = sourceProperty.depth;
while (sourceProperty.Next(true) && destProperty.Next(true) && sourceProperty.depth > elementPropertyDepth)
CopyPropertyValueSingular(destProperty, sourceProperty);
}
}
private static void CopyPropertyValueSingular(SerializedProperty destProperty, SerializedProperty sourceProperty) {
switch (destProperty.propertyType) {
case SerializedPropertyType.Integer:
destProperty.intValue = sourceProperty.intValue;
break;
case SerializedPropertyType.Boolean:
destProperty.boolValue = sourceProperty.boolValue;
break;
case SerializedPropertyType.Float:
destProperty.floatValue = sourceProperty.floatValue;
break;
case SerializedPropertyType.String:
destProperty.stringValue = sourceProperty.stringValue;
break;
case SerializedPropertyType.Color:
destProperty.colorValue = sourceProperty.colorValue;
break;
case SerializedPropertyType.ObjectReference:
destProperty.objectReferenceValue = sourceProperty.objectReferenceValue;
break;
case SerializedPropertyType.LayerMask:
destProperty.intValue = sourceProperty.intValue;
break;
case SerializedPropertyType.Enum:
destProperty.enumValueIndex = sourceProperty.enumValueIndex;
break;
case SerializedPropertyType.Vector2:
destProperty.vector2Value = sourceProperty.vector2Value;
break;
case SerializedPropertyType.Vector3:
destProperty.vector3Value = sourceProperty.vector3Value;
break;
case SerializedPropertyType.Vector4:
destProperty.vector4Value = sourceProperty.vector4Value;
break;
case SerializedPropertyType.Rect:
destProperty.rectValue = sourceProperty.rectValue;
break;
case SerializedPropertyType.ArraySize:
destProperty.intValue = sourceProperty.intValue;
break;
case SerializedPropertyType.Character:
destProperty.intValue = sourceProperty.intValue;
break;
case SerializedPropertyType.AnimationCurve:
destProperty.animationCurveValue = sourceProperty.animationCurveValue;
break;
case SerializedPropertyType.Bounds:
destProperty.boundsValue = sourceProperty.boundsValue;
break;
case SerializedPropertyType.Gradient:
//!TODO: Amend when Unity add a public API for setting the gradient.
break;
}
}
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/Internal/SerializedPropertyUtility.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e720cba766c708b40a725fddfbdb4436
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2000
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListControl.cs vendored

File diff suppressed because it is too large Load Diff

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListControl.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 02045e26a7a39c440ba538e3c9ca2248
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

216
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListEvents.cs vendored

@ -1,216 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
using System.ComponentModel;
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Arguments which are passed to <see cref="AddMenuClickedEventHandler"/>.
/// </summary>
public sealed class AddMenuClickedEventArgs : EventArgs {
/// <summary>
/// Gets adaptor to reorderable list container.
/// </summary>
public IReorderableListAdaptor Adaptor { get; private set; }
/// <summary>
/// Gets position of the add menu button.
/// </summary>
public Rect ButtonPosition { get; internal set; }
/// <summary>
/// Initializes a new instance of <see cref="ItemMovedEventArgs"/>.
/// </summary>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="buttonPosition">Position of the add menu button.</param>
public AddMenuClickedEventArgs(IReorderableListAdaptor adaptor, Rect buttonPosition) {
this.Adaptor = adaptor;
this.ButtonPosition = buttonPosition;
}
}
/// <summary>
/// An event handler which is invoked when the "Add Menu" button is clicked.
/// </summary>
/// <param name="sender">Object which raised event.</param>
/// <param name="args">Event arguments.</param>
public delegate void AddMenuClickedEventHandler(object sender, AddMenuClickedEventArgs args);
/// <summary>
/// Arguments which are passed to <see cref="ItemInsertedEventHandler"/>.
/// </summary>
public sealed class ItemInsertedEventArgs : EventArgs {
/// <summary>
/// Gets adaptor to reorderable list container which contains element.
/// </summary>
public IReorderableListAdaptor Adaptor { get; private set; }
/// <summary>
/// Gets zero-based index of item which was inserted.
/// </summary>
public int ItemIndex { get; private set; }
/// <summary>
/// Indicates if inserted item was duplicated from another item.
/// </summary>
public bool WasDuplicated { get; private set; }
/// <summary>
/// Initializes a new instance of <see cref="ItemInsertedEventArgs"/>.
/// </summary>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="itemIndex">Zero-based index of item.</param>
/// <param name="wasDuplicated">Indicates if inserted item was duplicated from another item.</param>
public ItemInsertedEventArgs(IReorderableListAdaptor adaptor, int itemIndex, bool wasDuplicated) {
this.Adaptor = adaptor;
this.ItemIndex = itemIndex;
this.WasDuplicated = wasDuplicated;
}
}
/// <summary>
/// An event handler which is invoked after new list item is inserted.
/// </summary>
/// <param name="sender">Object which raised event.</param>
/// <param name="args">Event arguments.</param>
public delegate void ItemInsertedEventHandler(object sender, ItemInsertedEventArgs args);
/// <summary>
/// Arguments which are passed to <see cref="ItemRemovingEventHandler"/>.
/// </summary>
public sealed class ItemRemovingEventArgs : CancelEventArgs {
/// <summary>
/// Gets adaptor to reorderable list container which contains element.
/// </summary>
public IReorderableListAdaptor Adaptor { get; private set; }
/// <summary>
/// Gets zero-based index of item which is being removed.
/// </summary>
public int ItemIndex { get; internal set; }
/// <summary>
/// Initializes a new instance of <see cref="ItemRemovingEventArgs"/>.
/// </summary>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="itemIndex">Zero-based index of item.</param>
public ItemRemovingEventArgs(IReorderableListAdaptor adaptor, int itemIndex) {
this.Adaptor = adaptor;
this.ItemIndex = itemIndex;
}
}
/// <summary>
/// An event handler which is invoked before a list item is removed.
/// </summary>
/// <remarks>
/// <para>Item removal can be cancelled by setting <see cref="CancelEventArgs.Cancel"/>
/// to <c>true</c>.</para>
/// </remarks>
/// <param name="sender">Object which raised event.</param>
/// <param name="args">Event arguments.</param>
public delegate void ItemRemovingEventHandler(object sender, ItemRemovingEventArgs args);
/// <summary>
/// Arguments which are passed to <see cref="ItemMovingEventHandler"/>.
/// </summary>
public sealed class ItemMovingEventArgs : CancelEventArgs {
/// <summary>
/// Gets adaptor to reorderable list container which contains element.
/// </summary>
public IReorderableListAdaptor Adaptor { get; private set; }
/// <summary>
/// Gets current zero-based index of item which is going to be moved.
/// </summary>
public int ItemIndex { get; internal set; }
/// <summary>
/// Gets the new candidate zero-based index for the item.
/// </summary>
/// <seealso cref="NewItemIndex"/>
public int DestinationItemIndex { get; internal set; }
/// <summary>
/// Gets zero-based index of item <strong>after</strong> it has been moved.
/// </summary>
/// <seealso cref="DestinationItemIndex"/>
public int NewItemIndex {
get {
int result = DestinationItemIndex;
if (result > ItemIndex)
--result;
return result;
}
}
/// <summary>
/// Initializes a new instance of <see cref="ItemMovingEventArgs"/>.
/// </summary>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="itemIndex">Zero-based index of item.</param>
/// <param name="destinationItemIndex">Xero-based index of item destination.</param>
public ItemMovingEventArgs(IReorderableListAdaptor adaptor, int itemIndex, int destinationItemIndex) {
this.Adaptor = adaptor;
this.ItemIndex = itemIndex;
this.DestinationItemIndex = destinationItemIndex;
}
}
/// <summary>
/// An event handler which is invoked before a list item is moved.
/// </summary>
/// <remarks>
/// <para>Moving of item can be cancelled by setting <see cref="CancelEventArgs.Cancel"/>
/// to <c>true</c>.</para>
/// </remarks>
/// <param name="sender">Object which raised event.</param>
/// <param name="args">Event arguments.</param>
public delegate void ItemMovingEventHandler(object sender, ItemMovingEventArgs args);
/// <summary>
/// Arguments which are passed to <see cref="ItemMovedEventHandler"/>.
/// </summary>
public sealed class ItemMovedEventArgs : EventArgs {
/// <summary>
/// Gets adaptor to reorderable list container which contains element.
/// </summary>
public IReorderableListAdaptor Adaptor { get; private set; }
/// <summary>
/// Gets old zero-based index of the item which was moved.
/// </summary>
public int OldItemIndex { get; internal set; }
/// <summary>
/// Gets new zero-based index of the item which was moved.
/// </summary>
public int NewItemIndex { get; internal set; }
/// <summary>
/// Initializes a new instance of <see cref="ItemMovedEventArgs"/>.
/// </summary>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="oldItemIndex">Old zero-based index of item.</param>
/// <param name="newItemIndex">New zero-based index of item.</param>
public ItemMovedEventArgs(IReorderableListAdaptor adaptor, int oldItemIndex, int newItemIndex) {
this.Adaptor = adaptor;
this.OldItemIndex = oldItemIndex;
this.NewItemIndex = newItemIndex;
}
}
/// <summary>
/// An event handler which is invoked after a list item is moved.
/// </summary>
/// <param name="sender">Object which raised event.</param>
/// <param name="args">Event arguments.</param>
public delegate void ItemMovedEventHandler(object sender, ItemMovedEventArgs args);
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListEvents.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1d75c9b7fc704a6488376beccd1a93a4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

62
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListFlags.cs vendored

@ -1,62 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System;
namespace Rotorz.ReorderableList {
/// <summary>
/// Additional flags which can be passed into reorderable list field.
/// </summary>
/// <example>
/// <para>Multiple flags can be specified if desired:</para>
/// <code language="csharp"><![CDATA[
/// var flags = ReorderableListFlags.HideAddButton | ReorderableListFlags.HideRemoveButtons;
/// ReorderableListGUI.ListField(list, flags);
/// ]]></code>
/// </example>
[Flags]
public enum ReorderableListFlags {
/// <summary>
/// Hide grab handles and disable reordering of list items.
/// </summary>
DisableReordering = 0x0001,
/// <summary>
/// Hide add button at base of control.
/// </summary>
HideAddButton = 0x0002,
/// <summary>
/// Hide remove buttons from list items.
/// </summary>
HideRemoveButtons = 0x0004,
/// <summary>
/// Do not display context menu upon right-clicking grab handle.
/// </summary>
DisableContextMenu = 0x0008,
/// <summary>
/// Hide "Duplicate" option from context menu.
/// </summary>
DisableDuplicateCommand = 0x0010,
/// <summary>
/// Do not automatically focus first control of newly added items.
/// </summary>
DisableAutoFocus = 0x0020,
/// <summary>
/// Show zero-based index of array elements.
/// </summary>
ShowIndices = 0x0040,
/// <exclude/>
[Obsolete("This flag is redundant because the clipping optimization was removed.")]
DisableClipping = 0x0080,
/// <summary>
/// Do not attempt to automatically scroll when list is inside a scroll view and
/// the mouse pointer is dragged outside of the visible portion of the list.
/// </summary>
DisableAutoScroll = 0x0100,
/// <summary>
/// Show "Size" field at base of list control.
/// </summary>
ShowSizeField = 0x0200,
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListFlags.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8413004edec065f4c881fdb12b5d48b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

576
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListGUI.cs vendored

@ -1,576 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Utility class for drawing reorderable lists.
/// </summary>
public static class ReorderableListGUI {
/// <summary>
/// Default list item height is 18 pixels.
/// </summary>
public const float DefaultItemHeight = 18;
/// <summary>
/// Gets or sets the zero-based index of the last item that was changed. A value of -1
/// indicates that no item was changed by list.
/// </summary>
/// <remarks>
/// <para>This property should not be set when items are added or removed.</para>
/// </remarks>
public static int IndexOfChangedItem { get; internal set; }
/// <summary>
/// Gets the control ID of the list that is currently being drawn.
/// </summary>
public static int CurrentListControlID {
get { return ReorderableListControl.CurrentListControlID; }
}
/// <summary>
/// Gets the position of the list control that is currently being drawn.
/// </summary>
/// <remarks>
/// <para>The value of this property should be ignored for <see cref="EventType.Layout"/>
/// type events when using reorderable list controls with automatic layout.</para>
/// </remarks>
/// <see cref="CurrentItemTotalPosition"/>
public static Rect CurrentListPosition {
get { return ReorderableListControl.CurrentListPosition; }
}
/// <summary>
/// Gets the zero-based index of the list item that is currently being drawn;
/// or a value of -1 if no item is currently being drawn.
/// </summary>
public static int CurrentItemIndex {
get { return ReorderableListControl.CurrentItemIndex; }
}
/// <summary>
/// Gets the total position of the list item that is currently being drawn.
/// </summary>
/// <remarks>
/// <para>The value of this property should be ignored for <see cref="EventType.Layout"/>
/// type events when using reorderable list controls with automatic layout.</para>
/// </remarks>
/// <see cref="CurrentItemIndex"/>
/// <see cref="CurrentListPosition"/>
public static Rect CurrentItemTotalPosition {
get { return ReorderableListControl.CurrentItemTotalPosition; }
}
#region Basic Item Drawers
/// <summary>
/// Default list item drawer implementation.
/// </summary>
/// <remarks>
/// <para>Always presents the label "Item drawer not implemented.".</para>
/// </remarks>
/// <param name="position">Position to draw list item control(s).</param>
/// <param name="item">Value of list item.</param>
/// <returns>
/// Unmodified value of list item.
/// </returns>
/// <typeparam name="T">Type of list item.</typeparam>
public static T DefaultItemDrawer<T>(Rect position, T item) {
GUI.Label(position, "Item drawer not implemented.");
return item;
}
/// <summary>
/// Draws text field allowing list items to be edited.
/// </summary>
/// <remarks>
/// <para>Null values are automatically changed to empty strings since null
/// values cannot be edited using a text field.</para>
/// <para>Value of <c>GUI.changed</c> is set to <c>true</c> if value of item
/// is modified.</para>
/// </remarks>
/// <param name="position">Position to draw list item control(s).</param>
/// <param name="item">Value of list item.</param>
/// <returns>
/// Modified value of list item.
/// </returns>
public static string TextFieldItemDrawer(Rect position, string item) {
if (item == null) {
item = "";
GUI.changed = true;
}
return EditorGUI.TextField(position, item);
}
#endregion
/// <summary>
/// Gets the default list control implementation.
/// </summary>
private static ReorderableListControl DefaultListControl { get; set; }
static ReorderableListGUI() {
DefaultListControl = new ReorderableListControl();
// Duplicate default styles to prevent user scripts from interferring with
// the default list control instance.
DefaultListControl.ContainerStyle = new GUIStyle(ReorderableListStyles.Container);
DefaultListControl.FooterButtonStyle = new GUIStyle(ReorderableListStyles.FooterButton);
DefaultListControl.ItemButtonStyle = new GUIStyle(ReorderableListStyles.ItemButton);
IndexOfChangedItem = -1;
}
private static GUIContent s_Temp = new GUIContent();
#region Title Control
/// <summary>
/// Draw title control for list field.
/// </summary>
/// <remarks>
/// <para>When needed, should be shown immediately before list field.</para>
/// </remarks>
/// <example>
/// <code language="csharp"><![CDATA[
/// ReorderableListGUI.Title(titleContent);
/// ReorderableListGUI.ListField(list, DynamicListGU.TextFieldItemDrawer);
/// ]]></code>
/// <code language="unityscript"><![CDATA[
/// ReorderableListGUI.Title(titleContent);
/// ReorderableListGUI.ListField(list, DynamicListGU.TextFieldItemDrawer);
/// ]]></code>
/// </example>
/// <param name="title">Content for title control.</param>
public static void Title(GUIContent title) {
Rect position = GUILayoutUtility.GetRect(title, ReorderableListStyles.Title);
Title(position, title);
GUILayout.Space(-1);
}
/// <summary>
/// Draw title control for list field.
/// </summary>
/// <remarks>
/// <para>When needed, should be shown immediately before list field.</para>
/// </remarks>
/// <example>
/// <code language="csharp"><![CDATA[
/// ReorderableListGUI.Title("Your Title");
/// ReorderableListGUI.ListField(list, DynamicListGU.TextFieldItemDrawer);
/// ]]></code>
/// <code language="unityscript"><![CDATA[
/// ReorderableListGUI.Title('Your Title');
/// ReorderableListGUI.ListField(list, DynamicListGU.TextFieldItemDrawer);
/// ]]></code>
/// </example>
/// <param name="title">Text for title control.</param>
public static void Title(string title) {
s_Temp.text = title;
Title(s_Temp);
}
/// <summary>
/// Draw title control for list field with absolute positioning.
/// </summary>
/// <param name="position">Position of control.</param>
/// <param name="title">Content for title control.</param>
public static void Title(Rect position, GUIContent title) {
if (Event.current.type == EventType.Repaint)
ReorderableListStyles.Title.Draw(position, title, false, false, false, false);
}
/// <summary>
/// Draw title control for list field with absolute positioning.
/// </summary>
/// <param name="position">Position of control.</param>
/// <param name="text">Text for title control.</param>
public static void Title(Rect position, string text) {
s_Temp.text = text;
Title(position, s_Temp);
}
#endregion
#region List<T> Control
/// <summary>
/// Draw list field control.
/// </summary>
/// <param name="list">The list which can be reordered.</param>
/// <param name="drawItem">Callback to draw list item.</param>
/// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
/// <param name="itemHeight">Height of a single list item.</param>
/// <param name="flags">Optional flags to pass into list field.</param>
/// <typeparam name="T">Type of list item.</typeparam>
private static void DoListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmpty drawEmpty, float itemHeight, ReorderableListFlags flags) {
var adaptor = new GenericListAdaptor<T>(list, drawItem, itemHeight);
ReorderableListControl.DrawControlFromState(adaptor, drawEmpty, flags);
}
/// <summary>
/// Draw list field control with absolute positioning.
/// </summary>
/// <param name="position">Position of control.</param>
/// <param name="list">The list which can be reordered.</param>
/// <param name="drawItem">Callback to draw list item.</param>
/// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
/// <param name="itemHeight">Height of a single list item.</param>
/// <param name="flags">Optional flags to pass into list field.</param>
/// <typeparam name="T">Type of list item.</typeparam>
private static void DoListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmptyAbsolute drawEmpty, float itemHeight, ReorderableListFlags flags) {
var adaptor = new GenericListAdaptor<T>(list, drawItem, itemHeight);
ReorderableListControl.DrawControlFromState(position, adaptor, drawEmpty, flags);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmpty drawEmpty, float itemHeight, ReorderableListFlags flags) {
DoListField<T>(list, drawItem, drawEmpty, itemHeight, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmptyAbsolute drawEmpty, float itemHeight, ReorderableListFlags flags) {
DoListFieldAbsolute<T>(position, list, drawItem, drawEmpty, itemHeight, flags);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmpty drawEmpty, float itemHeight) {
DoListField<T>(list, drawItem, drawEmpty, itemHeight, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmptyAbsolute drawEmpty, float itemHeight) {
DoListFieldAbsolute<T>(position, list, drawItem, drawEmpty, itemHeight, 0);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags) {
DoListField<T>(list, drawItem, drawEmpty, DefaultItemHeight, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags) {
DoListFieldAbsolute<T>(position, list, drawItem, drawEmpty, DefaultItemHeight, flags);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmpty drawEmpty) {
DoListField<T>(list, drawItem, drawEmpty, DefaultItemHeight, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListControl.DrawEmptyAbsolute drawEmpty) {
DoListFieldAbsolute<T>(position, list, drawItem, drawEmpty, DefaultItemHeight, 0);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, float itemHeight, ReorderableListFlags flags) {
DoListField<T>(list, drawItem, null, itemHeight, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, float itemHeight, ReorderableListFlags flags) {
DoListFieldAbsolute<T>(position, list, drawItem, null, itemHeight, flags);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, float itemHeight) {
DoListField<T>(list, drawItem, null, itemHeight, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, float itemHeight) {
DoListFieldAbsolute<T>(position, list, drawItem, null, itemHeight, 0);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListFlags flags) {
DoListField<T>(list, drawItem, null, DefaultItemHeight, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem, ReorderableListFlags flags) {
DoListFieldAbsolute<T>(position, list, drawItem, null, DefaultItemHeight, flags);
}
/// <inheritdoc cref="DoListField{T}(IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmpty, float, ReorderableListFlags)"/>
public static void ListField<T>(IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem) {
DoListField<T>(list, drawItem, null, DefaultItemHeight, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute{T}(Rect, IList{T}, ReorderableListControl.ItemDrawer{T}, ReorderableListControl.DrawEmptyAbsolute, float, ReorderableListFlags)"/>
public static void ListFieldAbsolute<T>(Rect position, IList<T> list, ReorderableListControl.ItemDrawer<T> drawItem) {
DoListFieldAbsolute<T>(position, list, drawItem, null, DefaultItemHeight, 0);
}
/// <summary>
/// Calculate height of list field for absolute positioning.
/// </summary>
/// <param name="itemCount">Count of items in list.</param>
/// <param name="itemHeight">Fixed height of list item.</param>
/// <param name="flags">Optional flags to pass into list field.</param>
/// <returns>
/// Required list height in pixels.
/// </returns>
public static float CalculateListFieldHeight(int itemCount, float itemHeight, ReorderableListFlags flags) {
// We need to push/pop flags so that nested controls are properly calculated.
var restoreFlags = DefaultListControl.Flags;
try {
DefaultListControl.Flags = flags;
return DefaultListControl.CalculateListHeight(itemCount, itemHeight);
}
finally {
DefaultListControl.Flags = restoreFlags;
}
}
/// <inheritdoc cref="CalculateListFieldHeight(int, float, ReorderableListFlags)"/>
public static float CalculateListFieldHeight(int itemCount, ReorderableListFlags flags) {
return CalculateListFieldHeight(itemCount, DefaultItemHeight, flags);
}
/// <inheritdoc cref="CalculateListFieldHeight(int, float, ReorderableListFlags)"/>
public static float CalculateListFieldHeight(int itemCount, float itemHeight) {
return CalculateListFieldHeight(itemCount, itemHeight, 0);
}
/// <inheritdoc cref="CalculateListFieldHeight(int, float, ReorderableListFlags)"/>
public static float CalculateListFieldHeight(int itemCount) {
return CalculateListFieldHeight(itemCount, DefaultItemHeight, 0);
}
#endregion
#region SerializedProperty Control
/// <summary>
/// Draw list field control for serializable property array.
/// </summary>
/// <param name="arrayProperty">Serializable property.</param>
/// <param name="fixedItemHeight">Use fixed height for items rather than <see cref="UnityEditor.EditorGUI.GetPropertyHeight(SerializedProperty)"/>.</param>
/// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
/// <param name="flags">Optional flags to pass into list field.</param>
private static void DoListField(SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags) {
var adaptor = new SerializedPropertyAdaptor(arrayProperty, fixedItemHeight);
ReorderableListControl.DrawControlFromState(adaptor, drawEmpty, flags);
}
/// <summary>
/// Draw list field control for serializable property array.
/// </summary>
/// <param name="position">Position of control.</param>
/// <param name="arrayProperty">Serializable property.</param>
/// <param name="fixedItemHeight">Use fixed height for items rather than <see cref="UnityEditor.EditorGUI.GetPropertyHeight(SerializedProperty)"/>.</param>
/// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
/// <param name="flags">Optional flags to pass into list field.</param>
private static void DoListFieldAbsolute(Rect position, SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags) {
var adaptor = new SerializedPropertyAdaptor(arrayProperty, fixedItemHeight);
ReorderableListControl.DrawControlFromState(position, adaptor, drawEmpty, flags);
}
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags) {
DoListField(arrayProperty, 0, drawEmpty, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags) {
DoListFieldAbsolute(position, arrayProperty, 0, drawEmpty, flags);
}
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty, ReorderableListControl.DrawEmpty drawEmpty) {
DoListField(arrayProperty, 0, drawEmpty, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty, ReorderableListControl.DrawEmptyAbsolute drawEmpty) {
DoListFieldAbsolute(position, arrayProperty, 0, drawEmpty, 0);
}
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty, ReorderableListFlags flags) {
DoListField(arrayProperty, 0, null, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty, ReorderableListFlags flags) {
DoListFieldAbsolute(position, arrayProperty, 0, null, flags);
}
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty) {
DoListField(arrayProperty, 0, null, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty) {
DoListFieldAbsolute(position, arrayProperty, 0, null, 0);
}
/// <summary>
/// Calculate height of list field for absolute positioning.
/// </summary>
/// <param name="arrayProperty">Serializable property.</param>
/// <param name="flags">Optional flags to pass into list field.</param>
/// <returns>
/// Required list height in pixels.
/// </returns>
public static float CalculateListFieldHeight(SerializedProperty arrayProperty, ReorderableListFlags flags) {
// We need to push/pop flags so that nested controls are properly calculated.
var restoreFlags = DefaultListControl.Flags;
try {
DefaultListControl.Flags = flags;
return DefaultListControl.CalculateListHeight(new SerializedPropertyAdaptor(arrayProperty));
}
finally {
DefaultListControl.Flags = restoreFlags;
}
}
/// <inheritdoc cref="CalculateListFieldHeight(SerializedProperty, ReorderableListFlags)"/>
public static float CalculateListFieldHeight(SerializedProperty arrayProperty) {
return CalculateListFieldHeight(arrayProperty, 0);
}
#endregion
#region SerializedProperty Control (Fixed Item Height)
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags) {
DoListField(arrayProperty, fixedItemHeight, drawEmpty, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags) {
DoListFieldAbsolute(position, arrayProperty, fixedItemHeight, drawEmpty, flags);
}
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmpty drawEmpty) {
DoListField(arrayProperty, fixedItemHeight, drawEmpty, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmptyAbsolute drawEmpty) {
DoListFieldAbsolute(position, arrayProperty, fixedItemHeight, drawEmpty, 0);
}
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListFlags flags) {
DoListField(arrayProperty, fixedItemHeight, null, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListFlags flags) {
DoListFieldAbsolute(position, arrayProperty, fixedItemHeight, null, flags);
}
/// <inheritdoc cref="DoListField(SerializedProperty, float, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(SerializedProperty arrayProperty, float fixedItemHeight) {
DoListField(arrayProperty, fixedItemHeight, null, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, SerializedProperty, float, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, SerializedProperty arrayProperty, float fixedItemHeight) {
DoListFieldAbsolute(position, arrayProperty, fixedItemHeight, null, 0);
}
#endregion
#region Adaptor Control
/// <summary>
/// Draw list field control for adapted collection.
/// </summary>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
/// <param name="flags">Optional flags to pass into list field.</param>
private static void DoListField(IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags = 0) {
ReorderableListControl.DrawControlFromState(adaptor, drawEmpty, flags);
}
/// <summary>
/// Draw list field control for adapted collection.
/// </summary>
/// <param name="position">Position of control.</param>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param>
/// <param name="flags">Optional flags to pass into list field.</param>
private static void DoListFieldAbsolute(Rect position, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags = 0) {
ReorderableListControl.DrawControlFromState(position, adaptor, drawEmpty, flags);
}
/// <inheritdoc cref="DoListField(IReorderableListAdaptor, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmpty drawEmpty, ReorderableListFlags flags) {
DoListField(adaptor, drawEmpty, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdaptor, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags) {
DoListFieldAbsolute(position, adaptor, drawEmpty, flags);
}
/// <inheritdoc cref="DoListField(IReorderableListAdaptor, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmpty drawEmpty) {
DoListField(adaptor, drawEmpty, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdaptor, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, IReorderableListAdaptor adaptor, ReorderableListControl.DrawEmptyAbsolute drawEmpty) {
DoListFieldAbsolute(position, adaptor, drawEmpty, 0);
}
/// <inheritdoc cref="DoListField(IReorderableListAdaptor, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(IReorderableListAdaptor adaptor, ReorderableListFlags flags) {
DoListField(adaptor, null, flags);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdaptor, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, IReorderableListAdaptor adaptor, ReorderableListFlags flags) {
DoListFieldAbsolute(position, adaptor, null, flags);
}
/// <inheritdoc cref="DoListField(IReorderableListAdaptor, ReorderableListControl.DrawEmpty, ReorderableListFlags)"/>
public static void ListField(IReorderableListAdaptor adaptor) {
DoListField(adaptor, null, 0);
}
/// <inheritdoc cref="DoListFieldAbsolute(Rect, IReorderableListAdaptor, ReorderableListControl.DrawEmptyAbsolute, ReorderableListFlags)"/>
public static void ListFieldAbsolute(Rect position, IReorderableListAdaptor adaptor) {
DoListFieldAbsolute(position, adaptor, null, 0);
}
/// <summary>
/// Calculate height of list field for adapted collection.
/// </summary>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <param name="flags">Optional flags to pass into list field.</param>
/// <returns>
/// Required list height in pixels.
/// </returns>
public static float CalculateListFieldHeight(IReorderableListAdaptor adaptor, ReorderableListFlags flags) {
// We need to push/pop flags so that nested controls are properly calculated.
var restoreFlags = DefaultListControl.Flags;
try {
DefaultListControl.Flags = flags;
return DefaultListControl.CalculateListHeight(adaptor);
}
finally {
DefaultListControl.Flags = restoreFlags;
}
}
/// <inheritdoc cref="CalculateListFieldHeight(IReorderableListAdaptor, ReorderableListFlags)"/>
public static float CalculateListFieldHeight(IReorderableListAdaptor adaptor) {
return CalculateListFieldHeight(adaptor, 0);
}
#endregion
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListGUI.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0cda42c9be3a73c469749c5422090d9a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

114
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListStyles.cs vendored

@ -1,114 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using Rotorz.ReorderableList.Internal;
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Styles for the <see cref="ReorderableListControl"/>.
/// </summary>
public static class ReorderableListStyles {
static ReorderableListStyles() {
Title = new GUIStyle();
Title.border = new RectOffset(2, 2, 2, 1);
Title.margin = new RectOffset(5, 5, 5, 0);
Title.padding = new RectOffset(5, 5, 3, 3);
Title.alignment = TextAnchor.MiddleLeft;
Title.normal.background = ReorderableListResources.GetTexture(ReorderableListTexture.TitleBackground);
Title.normal.textColor = EditorGUIUtility.isProSkin
? new Color(0.8f, 0.8f, 0.8f)
: new Color(0.2f, 0.2f, 0.2f);
Container = new GUIStyle();
Container.border = new RectOffset(2, 2, 2, 2);
Container.margin = new RectOffset(5, 5, 0, 0);
Container.padding = new RectOffset(2, 2, 2, 2);
Container.normal.background = ReorderableListResources.GetTexture(ReorderableListTexture.ContainerBackground);
Container2 = new GUIStyle(Container);
Container2.normal.background = ReorderableListResources.GetTexture(ReorderableListTexture.Container2Background);
FooterButton = new GUIStyle();
FooterButton.fixedHeight = 16;
FooterButton.alignment = TextAnchor.MiddleCenter;
FooterButton.normal.background = ReorderableListResources.GetTexture(ReorderableListTexture.Button_Normal);
FooterButton.active.background = ReorderableListResources.GetTexture(ReorderableListTexture.Button_Active);
FooterButton.border = new RectOffset(3, 3, 1, 3);
FooterButton.padding = new RectOffset(2, 2, 0, 2);
FooterButton.clipping = TextClipping.Overflow;
FooterButton2 = new GUIStyle();
FooterButton2.fixedHeight = 18;
FooterButton2.alignment = TextAnchor.MiddleCenter;
FooterButton2.normal.background = ReorderableListResources.GetTexture(ReorderableListTexture.Button2_Normal);
FooterButton2.active.background = ReorderableListResources.GetTexture(ReorderableListTexture.Button2_Active);
FooterButton2.border = new RectOffset(3, 3, 3, 3);
FooterButton2.padding = new RectOffset(2, 2, 2, 2);
FooterButton2.clipping = TextClipping.Overflow;
ItemButton = new GUIStyle();
ItemButton.active.background = ReorderableListResources.CreatePixelTexture("Dark Pixel (List GUI)", new Color32(18, 18, 18, 255));
ItemButton.imagePosition = ImagePosition.ImageOnly;
ItemButton.alignment = TextAnchor.MiddleCenter;
ItemButton.overflow = new RectOffset(0, 0, -1, 0);
ItemButton.padding = new RectOffset(0, 0, 1, 0);
ItemButton.contentOffset = new Vector2(0, -1f);
SelectedItem = new GUIStyle();
SelectedItem.normal.background = ReorderableListResources.texHighlightColor;
SelectedItem.normal.textColor = Color.white;
SelectedItem.fontSize = 12;
}
/// <summary>
/// Gets style for title header.
/// </summary>
public static GUIStyle Title { get; private set; }
/// <summary>
/// Gets style for the background of list control.
/// </summary>
public static GUIStyle Container { get; private set; }
/// <summary>
/// Gets an alternative style for the background of list control.
/// </summary>
public static GUIStyle Container2 { get; private set; }
/// <summary>
/// Gets style for footer button.
/// </summary>
public static GUIStyle FooterButton { get; private set; }
/// <summary>
/// Gets an alternative style for footer button.
/// </summary>
public static GUIStyle FooterButton2 { get; private set; }
/// <summary>
/// Gets style for remove item button.
/// </summary>
public static GUIStyle ItemButton { get; private set; }
/// <summary>
/// Gets style for the background of a selected item.
/// </summary>
public static GUIStyle SelectedItem { get; private set; }
/// <summary>
/// Gets color for the horizontal lines that appear between list items.
/// </summary>
public static Color HorizontalLineColor {
get { return EditorGUIUtility.isProSkin ? new Color(1f, 1f, 1f, 0.14f) : new Color(0.59f, 0.59f, 0.59f, 0.55f); }
}
/// <summary>
/// Gets color of background for a selected list item.
/// </summary>
public static Color SelectionBackgroundColor {
get { return EditorGUIUtility.isProSkin ? new Color32(62, 95, 150, 255) : new Color32(62, 125, 231, 255); }
}
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/ReorderableListStyles.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c4843f314e955fb459f99b33194fbebd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

159
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/SerializedPropertyAdaptor.cs vendored

@ -1,159 +0,0 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
using Rotorz.ReorderableList.Internal;
using System;
using UnityEditor;
using UnityEngine;
namespace Rotorz.ReorderableList {
/// <summary>
/// Reorderable list adaptor for serialized array property.
/// </summary>
/// <remarks>
/// <para>This adaptor can be subclassed to add special logic to item height calculation.
/// You may want to implement a custom adaptor class where specialised functionality
/// is needed.</para>
/// <para>List elements are <b>not</b> cloned using the <see cref="System.ICloneable"/>
/// interface when using a <see cref="UnityEditor.SerializedProperty"/> to
/// manipulate lists.</para>
/// </remarks>
public class SerializedPropertyAdaptor : IReorderableListAdaptor {
private SerializedProperty _arrayProperty;
/// <summary>
/// Fixed height of each list item.
/// </summary>
/// <remarks>
/// <para>Non-zero value overrides property drawer height calculation
/// which is more efficient.</para>
/// </remarks>
public float FixedItemHeight;
/// <summary>
/// Gets element from list.
/// </summary>
/// <param name="index">Zero-based index of element.</param>
/// <returns>
/// Serialized property wrapper for array element.
/// </returns>
public SerializedProperty this[int index] {
get { return _arrayProperty.GetArrayElementAtIndex(index); }
}
/// <summary>
/// Gets the underlying serialized array property.
/// </summary>
public SerializedProperty arrayProperty {
get { return _arrayProperty; }
}
#region Construction
/// <summary>
/// Initializes a new instance of <see cref="SerializedPropertyAdaptor"/>.
/// </summary>
/// <param name="arrayProperty">Serialized property for entire array.</param>
/// <param name="fixedItemHeight">Non-zero height overrides property drawer height calculation.</param>
public SerializedPropertyAdaptor(SerializedProperty arrayProperty, float fixedItemHeight) {
if (arrayProperty == null)
throw new ArgumentNullException("Array property was null.");
if (!arrayProperty.isArray)
throw new InvalidOperationException("Specified serialized propery is not an array.");
this._arrayProperty = arrayProperty;
this.FixedItemHeight = fixedItemHeight;
}
/// <summary>
/// Initializes a new instance of <see cref="SerializedPropertyAdaptor"/>.
/// </summary>
/// <param name="arrayProperty">Serialized property for entire array.</param>
public SerializedPropertyAdaptor(SerializedProperty arrayProperty) : this(arrayProperty, 0f) {
}
#endregion
#region IReorderableListAdaptor - Implementation
/// <inheritdoc/>
public int Count {
get { return _arrayProperty.arraySize; }
}
/// <inheritdoc/>
public virtual bool CanDrag(int index) {
return true;
}
/// <inheritdoc/>
public virtual bool CanRemove(int index) {
return true;
}
/// <inheritdoc/>
public void Add() {
int newIndex = _arrayProperty.arraySize;
++_arrayProperty.arraySize;
SerializedPropertyUtility.ResetValue(_arrayProperty.GetArrayElementAtIndex(newIndex));
}
/// <inheritdoc/>
public void Insert(int index) {
_arrayProperty.InsertArrayElementAtIndex(index);
SerializedPropertyUtility.ResetValue(_arrayProperty.GetArrayElementAtIndex(index));
}
/// <inheritdoc/>
public void Duplicate(int index) {
_arrayProperty.InsertArrayElementAtIndex(index);
}
/// <inheritdoc/>
public void Remove(int index) {
// Unity doesn't remove element when it contains an object reference.
var elementProperty = _arrayProperty.GetArrayElementAtIndex(index);
if (elementProperty.propertyType == SerializedPropertyType.ObjectReference)
elementProperty.objectReferenceValue = null;
_arrayProperty.DeleteArrayElementAtIndex(index);
}
/// <inheritdoc/>
public void Move(int sourceIndex, int destIndex) {
if (destIndex > sourceIndex)
--destIndex;
_arrayProperty.MoveArrayElement(sourceIndex, destIndex);
}
/// <inheritdoc/>
public void Clear() {
_arrayProperty.ClearArray();
}
/// <inheritdoc/>
public virtual void BeginGUI() {
}
/// <inheritdoc/>
public virtual void EndGUI() {
}
/// <inheritdoc/>
public virtual void DrawItemBackground(Rect position, int index) {
}
/// <inheritdoc/>
public virtual void DrawItem(Rect position, int index) {
EditorGUI.PropertyField(position, this[index], GUIContent.none, false);
}
/// <inheritdoc/>
public virtual float GetItemHeight(int index) {
return FixedItemHeight != 0f
? FixedItemHeight
: EditorGUI.GetPropertyHeight(this[index], GUIContent.none, false)
;
}
#endregion
}
}

11
Assets/Fungus/Thirdparty/Reorderable List Field/Editor/SerializedPropertyAdaptor.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 591bfb933f0cb1a429927d177e35f97d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

21
Assets/Fungus/Thirdparty/Reorderable List Field/LICENSE.txt vendored

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2013-2015 Rotorz Limited
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

7
Assets/Fungus/Thirdparty/Reorderable List Field/LICENSE.txt.meta vendored

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 8fc66c8c3ee484548a40e9b4cb50f206
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Properties.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: adbb9aeb25106a54e9af119d9d77e332
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

36
Assets/Fungus/Thirdparty/Reorderable List Field/Properties/AssemblyInfo.cs vendored

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Editor.ReorderableList")]
[assembly: AssemblyDescription("Reorderable list field for custom Unity editor scripts.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rotorz Limited")]
[assembly: AssemblyProduct("Editor.ReorderableList")]
[assembly: AssemblyCopyright("©2013-2016 Rotorz Limited. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("15882e08-6b4f-459f-a1d0-e4b26821f344")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.4.4.0")]

11
Assets/Fungus/Thirdparty/Reorderable List Field/Properties/AssemblyInfo.cs.meta vendored

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9229bf01f21bb1842a94bbabd158f241
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

145
Assets/Fungus/Thirdparty/Reorderable List Field/README.md vendored

@ -1,145 +0,0 @@
README
======
List control for Unity allowing editor developers to add reorderable list controls to
their GUIs. Supports generic lists and serialized property arrays, though additional
collection types can be supported by implementing `Rotorz.ReorderableList.IReorderableListAdaptor`.
Licensed under the MIT license. See LICENSE file in the project root for full license
information. DO NOT contribute to this project unless you accept the terms of the
contribution agreement.
![screenshot](https://bitbucket.org/rotorz/reorderable-list-editor-field-for-unity/raw/master/screenshot.png)
Features
--------
- Drag and drop reordering!
- Automatically scrolls if inside a scroll view whilst reordering.
- Easily customized using flags.
- Adaptors for `IList<T>` and `SerializedProperty`.
- Subscribe to add/remove item events.
- Supports mixed item heights.
- Disable drag and/or removal on per-item basis.
- Drop insertion (for use with `UnityEditor.DragAndDrop`).
- Styles can be overridden on per-list basis if desired.
- Subclass list control to override context menu.
- Add drop-down to add menu (or instead of add menu).
- Helper functionality to build element adder menus.
- User guide (Asset Path/Support/User Guide.pdf).
- API reference documentation (Asset Path/Support/API Reference.chm).
Preview (showing drop insertion feature)
----------------------------------------
![preview](https://bitbucket.org/rotorz/reorderable-list-editor-field-for-unity/raw/master/preview.gif)
Installing scripts
------------------
This control can be added to your project by importing the Unity package which
contains a compiled class library (DLL). This can be used by C# and UnityScript
developers.
- [Download RotorzReorderableList_v0.4.3 Package (requires Unity 4.5.5+)](<https://bitbucket.org/rotorz/reorderable-list-editor-field-for-unity/downloads/RotorzReorderableList_v0.4.3.unitypackage>)
If you would prefer to use the non-compiled source code version in your project,
copy the contents of this repository somewhere into your project.
**Note to UnityScript (*.js) developers:**
UnityScript will not work with the source code version of this project unless
the contents of this repository is placed at the path "Assets/Plugins/ReorderableList"
due to compilation ordering.
Example 1: Serialized array of strings (C#)
-------------------------------------------
:::csharp
SerializedProperty _wishlistProperty;
SerializedProperty _pointsProperty;
void OnEnable() {
_wishlistProperty = serializedObject.FindProperty("wishlist");
_pointsProperty = serializedObject.FindProperty("points");
}
public override void OnInspectorGUI() {
serializedObject.Update();
ReorderableListGUI.Title("Wishlist");
ReorderableListGUI.ListField(_wishlistProperty);
ReorderableListGUI.Title("Points");
ReorderableListGUI.ListField(_pointsProperty, ReorderableListFlags.ShowIndices);
serializedObject.ApplyModifiedProperties();
}
Example 2: List of strings (UnityScript)
----------------------------------------
:::javascript
var yourList:List.<String> = new List.<String>();
function OnGUI() {
ReorderableListGUI.ListField(yourList, CustomListItem, DrawEmpty);
}
function CustomListItem(position:Rect, itemValue:String):String {
// Text fields do not like null values!
if (itemValue == null)
itemValue = '';
return EditorGUI.TextField(position, itemValue);
}
function DrawEmpty() {
GUILayout.Label('No items in list.', EditorStyles.miniLabel);
}
Refer to API reference for further examples!
Submission to the Unity Asset Store
-----------------------------------
If you wish to include this asset as part of a package for the asset store, please
include the latest package version as-is to avoid conflict issues in user projects.
It is important that license and documentation files are included and remain intact.
**To include a modified version within your package:**
- Ensure that license and documentation files are included and remain intact. It should
be clear that these relate to the reorderable list field library.
- Copyright and license information must remain intact in source files.
- Change the namespace `Rotorz.ReorderableList` to something unique and DO NOT use the
name "Rotorz". For example, `YourName.ReorderableList` or `YourName.Internal.ReorderableList`.
- Place files somewhere within your own asset folder to avoid causing conflicts with
other assets which make use of this project.
Useful links
------------
- [Rotorz Website](<http://rotorz.com>)
Contribution Agreement
----------------------
This project is licensed under the MIT license (see LICENSE). To be in the best
position to enforce these licenses the copyright status of this project needs to
be as simple as possible. To achieve this the following terms and conditions
must be met:
- All contributed content (including but not limited to source code, text,
image, videos, bug reports, suggestions, ideas, etc.) must be the
contributors own work.
- The contributor disclaims all copyright and accepts that their contributed
content will be released to the public domain.
- The act of submitting a contribution indicates that the contributor agrees
with this agreement. This includes (but is not limited to) pull requests, issues,
tickets, e-mails, newsgroups, blogs, forums, etc.

7
Assets/Fungus/Thirdparty/Reorderable List Field/README.md.meta vendored

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: c4b649ac64aa4bd428c41192aba38c61
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Fungus/Thirdparty/Reorderable List Field/Support.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 457a6fa816de84a4bb30c03f176b4554
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chm vendored

Binary file not shown.

7
Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chm.meta vendored

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ff01767a12436d745bc2fc6157a4f303
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chw vendored

Binary file not shown.

7
Assets/Fungus/Thirdparty/Reorderable List Field/Support/API Reference.chw.meta vendored

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 2a6cc2b87d678a44f9aac32c49b2373f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Fungus/Thirdparty/Reorderable List Field/Support/Resources.zip vendored

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save