Browse Source

Merge pull request #127 from FungusGames/UnityEvents

Merged changes to support UnityEvent properties and other improvements
master
Chris Gregan 9 years ago
parent
commit
ce0a908269
  1. 3
      Assets/Fungus/Flowchart/Editor/BlockEditor.cs
  2. 68
      Assets/Fungus/Flowchart/Editor/BlockInspector.cs
  3. 17
      Assets/Fungus/Flowchart/Editor/CommandEditor.cs
  4. 99
      Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs
  5. 71
      Assets/Fungus/Flowchart/Editor/InvokeEditor.cs
  6. 4
      Assets/Fungus/Flowchart/Editor/InvokeEditor.cs.meta
  7. 38
      Assets/Fungus/Flowchart/Editor/SendEventEditor.cs
  8. 104
      Assets/Fungus/Flowchart/Editor/VariableEditor.cs
  9. 5
      Assets/Fungus/Flowchart/Scripts/Block.cs
  10. 18
      Assets/Fungus/Flowchart/Scripts/Command.cs
  11. 133
      Assets/Fungus/Flowchart/Scripts/Commands/Invoke.cs
  12. 4
      Assets/Fungus/Flowchart/Scripts/Commands/Invoke.cs.meta
  13. 2
      Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs
  14. 8
      Assets/Fungus/Flowchart/Scripts/Variable.cs
  15. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs
  16. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs
  17. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs
  18. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs
  19. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs
  20. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs
  21. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs
  22. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs
  23. 13
      Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs
  24. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs
  25. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs
  26. 12
      Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs
  27. 6
      Assets/Fungus/Narrative/Editor/SayEditor.cs
  28. 9
      Assets/Fungus/Thirdparty/ComboBox.meta
  29. 433
      Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab
  30. 8
      Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab.meta
  31. 798
      Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity
  32. 6
      Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity.meta
  33. 9
      Assets/Fungus/Thirdparty/ComboBox/Scripts.meta
  34. 681
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs
  35. 4
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs.meta
  36. 115
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs
  37. 10
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs.meta
  38. 9
      Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor.meta
  39. 107
      Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs
  40. 10
      Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs.meta
  41. 56
      Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs
  42. 10
      Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs.meta
  43. 9
      Assets/Fungus/UI/Editor.meta

3
Assets/Fungus/Flowchart/Editor/BlockEditor.cs

@ -29,7 +29,7 @@ namespace Fungus
public int index;
}
protected static List<Action> actionList = new List<Action>();
public static List<Action> actionList = new List<Action>();
protected Texture2D upIcon;
protected Texture2D downIcon;
@ -131,6 +131,7 @@ namespace Fungus
Event.current.button == 1)
{
ShowContextMenu();
Event.current.Use();
}
if (GUIUtility.keyboardControl == 0) //Only call keyboard shortcuts when not typing in a text field

68
Assets/Fungus/Flowchart/Editor/BlockInspector.cs

@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.Serialization;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
@ -26,6 +27,23 @@ namespace Fungus
protected bool resize = false;
protected float topPanelHeight = 50;
// Cache the block and command editors so we only create and destroy them
// when a different block / command is selected.
protected BlockEditor activeBlockEditor;
protected CommandEditor activeCommandEditor;
protected Command activeCommand; // Command currently being inspected
// Cached command editors to avoid creating / destroying editors more than necessary
protected Dictionary<Command, CommandEditor> cachedCommandEditors = new Dictionary<Command, CommandEditor>();
protected void OnDisable()
{
foreach (CommandEditor commandEditor in cachedCommandEditors.Values)
{
DestroyImmediate(commandEditor);
}
}
public override void OnInspectorGUI ()
{
BlockInspector blockInspector = target as BlockInspector;
@ -38,15 +56,21 @@ namespace Fungus
Flowchart flowchart = block.GetFlowchart();
BlockEditor blockEditor = Editor.CreateEditor(block) as BlockEditor;
blockEditor.DrawBlockName(flowchart);
if (activeBlockEditor == null ||
block != activeBlockEditor.target)
{
DestroyImmediate(activeBlockEditor);
activeBlockEditor = Editor.CreateEditor(block) as BlockEditor;
}
activeBlockEditor.DrawBlockName(flowchart);
// Using a custom rect area to get the correct 5px indent for the scroll views
Rect blockRect = new Rect(5, topPanelHeight, Screen.width - 6, Screen.height - 70);
GUILayout.BeginArea(blockRect);
blockScrollPos = GUILayout.BeginScrollView(blockScrollPos, GUILayout.Height(flowchart.blockViewHeight));
blockEditor.DrawBlockGUI(flowchart);
activeBlockEditor.DrawBlockGUI(flowchart);
GUILayout.EndScrollView();
Command inspectCommand = null;
@ -61,23 +85,49 @@ namespace Fungus
{
GUILayout.EndArea();
Repaint();
DestroyImmediate(blockEditor);
return;
}
// Only change the activeCommand at the start of the GUI call sequence
if (Event.current.type == EventType.Layout)
{
activeCommand = inspectCommand;
}
DrawCommandUI(flowchart, inspectCommand);
}
public void DrawCommandUI(Flowchart flowchart, Command inspectCommand)
{
ResizeScrollView(flowchart);
GUILayout.Space(7);
blockEditor.DrawButtonToolbar();
activeBlockEditor.DrawButtonToolbar();
commandScrollPos = GUILayout.BeginScrollView(commandScrollPos);
if (inspectCommand != null)
{
CommandEditor commandEditor = Editor.CreateEditor(inspectCommand) as CommandEditor;
commandEditor.DrawCommandInspectorGUI();
DestroyImmediate(commandEditor);
if (activeCommandEditor == null ||
inspectCommand != activeCommandEditor.target)
{
// See if we have a cached version of the command editor already,
// if not then create a new one.
if (cachedCommandEditors.ContainsKey(inspectCommand))
{
activeCommandEditor = cachedCommandEditors[inspectCommand];
}
else
{
activeCommandEditor = Editor.CreateEditor(inspectCommand) as CommandEditor;
cachedCommandEditors[inspectCommand] = activeCommandEditor;
}
}
if (activeCommandEditor != null)
{
activeCommandEditor.DrawCommandInspectorGUI();
}
}
GUILayout.EndScrollView();
@ -97,8 +147,6 @@ namespace Fungus
GUI.color = Color.white;
Repaint();
DestroyImmediate(blockEditor);
}
private void ResizeScrollView(Flowchart flowchart)

17
Assets/Fungus/Flowchart/Editor/CommandEditor.cs

@ -3,6 +3,7 @@ using UnityEditorInternal;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Rotorz.ReorderableList;
namespace Fungus
{
@ -113,6 +114,8 @@ namespace Fungus
public virtual void DrawCommandGUI()
{
Command t = target as Command;
// Code below was copied from here
// http://answers.unity3d.com/questions/550829/how-to-add-a-script-field-in-custom-inspector.html
@ -131,8 +134,22 @@ namespace Fungus
continue;
}
if (!t.IsPropertyVisible(iterator.name))
{
continue;
}
if (iterator.isArray &&
t.IsReorderableArray(iterator.name))
{
ReorderableListGUI.Title(new GUIContent(iterator.displayName, iterator.tooltip));
ReorderableListGUI.ListField(iterator);
}
else
{
EditorGUILayout.PropertyField(iterator, true, new GUILayoutOption[0]);
}
}
serializedObject.ApplyModifiedProperties();
}

99
Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs

@ -19,10 +19,6 @@ namespace Fungus
public Rect nodeRect = new Rect();
public static bool pinShiftToTop;
public static int firstSelectedIndex = 0;
public static int lastSelectedIndex = 0;
public SerializedProperty this[int index] {
get { return _arrayProperty.GetArrayElementAtIndex(index); }
}
@ -248,10 +244,19 @@ namespace Fungus
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
// the UnityEvent list control used in some commands. In play mode, if you click on the reordering grabber
// for a command in the list it causes the UnityEvent list to spew null exception errors.
// 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;
// Select command via left click
if (Event.current.type == EventType.MouseDown &&
Event.current.button == 0 &&
position.Contains(Event.current.mousePosition))
clickRect.Contains(Event.current.mousePosition))
{
if (flowchart.selectedCommands.Contains(command) && Event.current.button == 0)
{
@ -259,45 +264,41 @@ namespace Fungus
// Command key and shift key is not pressed
if (!EditorGUI.actionKey && !Event.current.shift)
{
BlockEditor.actionList.Add ( delegate {
flowchart.selectedCommands.Remove(command);
flowchart.ClearSelectedCommands();
});
}
// Command key pressed
if (EditorGUI.actionKey)
{
BlockEditor.actionList.Add ( delegate {
flowchart.selectedCommands.Remove(command);
}
// Shift key pressed
if (Event.current.shift)
{
flowchart.ClearSelectedCommands();
if (pinShiftToTop)
{
for (int i = firstSelectedIndex; i < index+1; ++i)
{
flowchart.AddSelectedCommand(flowchart.selectedBlock.commandList[i]);
}
}
else
{
for (int i = index; i < lastSelectedIndex+1; ++i)
{
flowchart.AddSelectedCommand(flowchart.selectedBlock.commandList[i]);
}
}
});
Event.current.Use();
}
}
else
{
bool shift = Event.current.shift;
// Left click and no command key
if (!Event.current.shift && !EditorGUI.actionKey && Event.current.button == 0)
if (!shift && !EditorGUI.actionKey && Event.current.button == 0)
{
BlockEditor.actionList.Add ( delegate {
flowchart.ClearSelectedCommands();
});
Event.current.Use();
}
BlockEditor.actionList.Add ( delegate {
flowchart.AddSelectedCommand(command);
});
bool firstSelectedCommandFound = false;
// Find first and last selected commands
int firstSelectedIndex = -1;
int lastSelectedIndex = -1;
if (flowchart.selectedCommands.Count > 0)
{
if ( flowchart.selectedBlock != null)
@ -305,39 +306,63 @@ namespace Fungus
for (int i = 0; i < flowchart.selectedBlock.commandList.Count; i++)
{
Command commandInBlock = flowchart.selectedBlock.commandList[i];
foreach (Command selectedCommand in flowchart.selectedCommands)
{
if (commandInBlock == selectedCommand)
{
if (!firstSelectedCommandFound)
{
firstSelectedIndex = i;
firstSelectedCommandFound = true;
break;
}
}
}
for (int i = flowchart.selectedBlock.commandList.Count - 1; i >=0; i--)
{
Command commandInBlock = flowchart.selectedBlock.commandList[i];
foreach (Command selectedCommand in flowchart.selectedCommands)
{
if (commandInBlock == selectedCommand)
{
lastSelectedIndex = i;
break;
}
}
}
}
}
if (Event.current.shift)
if (shift)
{
for (int i = firstSelectedIndex; i < lastSelectedIndex; ++i)
int currentIndex = command.commandIndex;
if (firstSelectedIndex == -1 ||
lastSelectedIndex == -1)
{
flowchart.AddSelectedCommand(flowchart.selectedBlock.commandList[i]);
// No selected command found - select entire list
firstSelectedIndex = 0;
lastSelectedIndex = currentIndex;
}
else
{
if (currentIndex < firstSelectedIndex)
{
firstSelectedIndex = currentIndex;
}
if (index == firstSelectedIndex)
if (currentIndex > lastSelectedIndex)
{
pinShiftToTop = false;
lastSelectedIndex = currentIndex;
}
else if (index == lastSelectedIndex)
}
for (int i = Math.Min(firstSelectedIndex, lastSelectedIndex); i < Math.Max(firstSelectedIndex, lastSelectedIndex); ++i)
{
pinShiftToTop = true;
Command selectedCommand = flowchart.selectedBlock.commandList[i];
BlockEditor.actionList.Add ( delegate {
flowchart.AddSelectedCommand(selectedCommand);
});
}
}
Event.current.Use();
}
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus)
}

71
Assets/Fungus/Flowchart/Editor/InvokeEditor.cs

@ -0,0 +1,71 @@
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
[CustomEditor (typeof(Invoke))]
public class InvokeEditor : CommandEditor
{
protected SerializedProperty delayProp;
protected SerializedProperty invokeTypeProp;
protected SerializedProperty staticEventProp;
protected SerializedProperty booleanParameterProp;
protected SerializedProperty booleanEventProp;
protected SerializedProperty integerParameterProp;
protected SerializedProperty integerEventProp;
protected SerializedProperty floatParameterProp;
protected SerializedProperty floatEventProp;
protected SerializedProperty stringParameterProp;
protected SerializedProperty stringEventProp;
protected virtual void OnEnable()
{
delayProp = serializedObject.FindProperty("delay");
invokeTypeProp = serializedObject.FindProperty("invokeType");
staticEventProp = serializedObject.FindProperty("staticEvent");
booleanParameterProp = serializedObject.FindProperty("booleanParameter");
booleanEventProp = serializedObject.FindProperty("booleanEvent");
integerParameterProp = serializedObject.FindProperty("integerParameter");
integerEventProp = serializedObject.FindProperty("integerEvent");
floatParameterProp = serializedObject.FindProperty("floatParameter");
floatEventProp = serializedObject.FindProperty("floatEvent");
stringParameterProp = serializedObject.FindProperty("stringParameter");
stringEventProp = serializedObject.FindProperty("stringEvent");
}
public override void DrawCommandGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(delayProp);
EditorGUILayout.PropertyField(invokeTypeProp);
switch ((Invoke.InvokeType)invokeTypeProp.enumValueIndex)
{
case Invoke.InvokeType.Static:
EditorGUILayout.PropertyField(staticEventProp);
break;
case Invoke.InvokeType.DynamicBoolean:
EditorGUILayout.PropertyField(booleanEventProp);
EditorGUILayout.PropertyField(booleanParameterProp);
break;
case Invoke.InvokeType.DynamicInteger:
EditorGUILayout.PropertyField(integerEventProp);
EditorGUILayout.PropertyField(integerParameterProp);
break;
case Invoke.InvokeType.DynamicFloat:
EditorGUILayout.PropertyField(floatEventProp);
EditorGUILayout.PropertyField(floatParameterProp);
break;
case Invoke.InvokeType.DynamicString:
EditorGUILayout.PropertyField(stringEventProp);
EditorGUILayout.PropertyField(stringParameterProp);
break;
}
serializedObject.ApplyModifiedProperties();
}
}
}

4
Assets/Fungus/Flowchart/Scripts/Commands/GetText.cs.meta → Assets/Fungus/Flowchart/Editor/InvokeEditor.cs.meta

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 54baf7aee38a7425ca4bd2addbfcfdcf
timeCreated: 1431530474
guid: 1de123a9a8da54ff49b112d39101366b
timeCreated: 1437051529
licenseType: Free
MonoImporter:
serializedVersion: 2

38
Assets/Fungus/Flowchart/Editor/SendEventEditor.cs

@ -1,38 +0,0 @@
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/*
[CustomEditor (typeof(SendEvent))]
public class SendEventEditor : CommandEditor
{
protected SerializedProperty targetEventProp;
protected SerializedProperty stopCurrentFlowchartProp;
protected virtual void OnEnable()
{
targetEventProp = serializedObject.FindProperty("targetEvent");
stopCurrentFlowchartProp = serializedObject.FindProperty("stopCurrentFlowchart");
}
public override void DrawCommandGUI()
{
// For some reason the serializedObject has already been disposed by the time this method is called
// The workaround is to acquire a new serializedObject and find the targetEvent property every time.
// This could be a bug in the Unity 4.6 beta so try to aquire the property in OnEnable() again some time.
serializedObject.Update();
serializedObject.Update();
EditorGUILayout.PropertyField(targetEventProp);
EditorGUILayout.PropertyField(stopCurrentFlowchartProp);
serializedObject.ApplyModifiedProperties();
}
}
*/
}

104
Assets/Fungus/Flowchart/Editor/VariableEditor.cs

@ -35,13 +35,14 @@ namespace Fungus
static public void VariableField(SerializedProperty property,
GUIContent label,
Flowchart flowchart,
string defaultText,
Func<Variable, bool> filter,
Func<string, int, string[], int> drawer = null)
{
List<string> variableKeys = new List<string>();
List<Variable> variableObjects = new List<Variable>();
variableKeys.Add("<None>");
variableKeys.Add(defaultText);
variableObjects.Add(null);
List<Variable> variables = flowchart.variables;
@ -82,6 +83,14 @@ namespace Fungus
List<Variable> publicVars = fs.GetPublicVariables();
foreach (Variable v in publicVars)
{
if (filter != null)
{
if (!filter(v))
{
continue;
}
}
variableKeys.Add(fs.name + " / " + v.key);
variableObjects.Add(v);
@ -140,6 +149,7 @@ namespace Fungus
VariableEditor.VariableField(property,
label,
FlowchartWindow.GetFlowchart(),
variableProperty.defaultText,
compare,
(s,t,u) => (EditorGUI.Popup(position, s, t, u)));
@ -173,9 +183,35 @@ namespace Fungus
return;
}
const int popupWidth = 65;
Command command = property.serializedObject.targetObject as Command;
if (command == null)
{
return;
}
Flowchart flowchart = command.GetFlowchart() as Flowchart;
if (flowchart == null)
{
return;
}
Rect controlRect = EditorGUI.PrefixLabel(position, label);
if (EditorGUI.GetPropertyHeight(valueProp, label) > EditorGUIUtility.singleLineHeight)
{
DrawMultiLineProperty(position, label, referenceProp, valueProp, flowchart);
}
else
{
DrawSingleLineProperty(position, label, referenceProp, valueProp, flowchart);
}
EditorGUI.EndProperty();
}
protected virtual void DrawSingleLineProperty(Rect rect, GUIContent label, SerializedProperty referenceProp, SerializedProperty valueProp, Flowchart flowchart)
{
const int popupWidth = 100;
Rect controlRect = EditorGUI.PrefixLabel(rect, label);
Rect valueRect = controlRect;
valueRect.width = controlRect.width - popupWidth - 5;
Rect popupRect = controlRect;
@ -187,56 +223,52 @@ namespace Fungus
popupRect.width = popupWidth;
}
Flowchart flowchart = property.serializedObject.targetObject as Flowchart;
if (flowchart == null)
{
Command command = property.serializedObject.targetObject as Command;
if (command != null)
{
flowchart = command.GetFlowchart();
}
EditorGUI.PropertyField(popupRect, referenceProp, new GUIContent(""));
}
if (flowchart != null)
protected virtual void DrawMultiLineProperty(Rect rect, GUIContent label, SerializedProperty referenceProp, SerializedProperty valueProp, Flowchart flowchart)
{
T selectedVariable = referenceProp.objectReferenceValue as T;
const int popupWidth = 100;
List<string> variableKeys = new List<string>();
List<Variable> variableObjects = new List<Variable>();
variableKeys.Add("<Value>");
variableObjects.Add(null);
Rect controlRect = rect;
Rect valueRect = controlRect;
valueRect.width = controlRect.width - 5;
Rect popupRect = controlRect;
int index = 0;
int selectedIndex = 0;
foreach (Variable v in flowchart.variables)
if (referenceProp.objectReferenceValue == null)
{
if (v == null)
EditorGUI.PropertyField(valueRect, valueProp, label);
popupRect.x = rect.width - popupWidth + 5;
popupRect.width = popupWidth;
}
else
{
continue;
popupRect = EditorGUI.PrefixLabel(rect, label);
}
EditorGUI.PropertyField(popupRect, referenceProp, new GUIContent(""));
}
if (v.GetType() != typeof(T))
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
continue;
VariableInfoAttribute typeInfo = VariableEditor.GetVariableInfo(typeof(T));
if (typeInfo == null)
{
return EditorGUIUtility.singleLineHeight;
}
variableKeys.Add(v.key);
variableObjects.Add(v);
string propNameBase = typeInfo.VariableType;
propNameBase = Char.ToLowerInvariant(propNameBase[0]) + propNameBase.Substring(1);
index++;
SerializedProperty referenceProp = property.FindPropertyRelative(propNameBase + "Ref");
if (v == selectedVariable)
if (referenceProp.objectReferenceValue != null)
{
selectedIndex = index;
}
return EditorGUIUtility.singleLineHeight;
}
selectedIndex = EditorGUI.Popup(popupRect, selectedIndex, variableKeys.ToArray());
referenceProp.objectReferenceValue = variableObjects[selectedIndex];
}
EditorGUI.EndProperty();
SerializedProperty valueProp = property.FindPropertyRelative(propNameBase + "Val");
return EditorGUI.GetPropertyHeight(valueProp, label);
}
}

5
Assets/Fungus/Flowchart/Scripts/Block.cs

@ -71,6 +71,11 @@ namespace Fungus
int index = 0;
foreach (Command command in commandList)
{
if (command == null)
{
continue;
}
command.parentBlock = this;
command.commandIndex = index++;
}

18
Assets/Fungus/Flowchart/Scripts/Command.cs

@ -166,6 +166,24 @@ namespace Fungus
{
return Color.white;
}
/**
* Returns true if the specified property should be displayed in the inspector.
* This is useful for hiding certain properties based on the value of another property.
*/
public virtual bool IsPropertyVisible(string propertyName)
{
return true;
}
/**
* Returns true if the specified property should be displayed as a reorderable list in the inspector.
* This only applies for array properties and has no effect for non-array properties.
*/
public virtual bool IsReorderableArray(string propertyName)
{
return false;
}
}
}

133
Assets/Fungus/Flowchart/Scripts/Commands/Invoke.cs

@ -0,0 +1,133 @@
using UnityEngine;
using System.Collections;
using System;
using UnityEngine.Events;
namespace Fungus
{
[CommandInfo("Scripting",
"Invoke",
"Calls a list of methods via the Unity UI EventSystem.")]
[AddComponentMenu("")]
// This command uses the UnityEvent system to call methods in script.
// http://docs.unity3d.com/Manual/UnityEvents.html
public class Invoke : Command
{
[Serializable] public class BooleanEvent : UnityEvent<bool> {}
[Serializable] public class IntegerEvent : UnityEvent<int> {}
[Serializable] public class FloatEvent : UnityEvent<float> {}
[Serializable] public class StringEvent : UnityEvent<string> {}
public enum InvokeType
{
Static, // Call a method with an optional constant value parameter
DynamicBoolean, // Call a method with an optional boolean constant / variable parameter
DynamicInteger, // Call a method with an optional integer constant / variable parameter
DynamicFloat, // Call a method with an optional float constant / variable parameter
DynamicString // Call a method with an optional string constant / variable parameter
}
[Tooltip("Delay (in seconds) before the methods will be called")]
public float delay;
public InvokeType invokeType;
[Tooltip("List of methods to call. Supports methods with no parameters or exactly one string, int, float or object parameter.")]
public UnityEvent staticEvent = new UnityEvent();
[Tooltip("Boolean parameter to pass to the invoked methods.")]
public BooleanData booleanParameter;
[Tooltip("List of methods to call. Supports methods with one boolean parameter.")]
public BooleanEvent booleanEvent = new BooleanEvent();
[Tooltip("Integer parameter to pass to the invoked methods.")]
public IntegerData integerParameter;
[Tooltip("List of methods to call. Supports methods with one integer parameter.")]
public IntegerEvent integerEvent = new IntegerEvent();
[Tooltip("Float parameter to pass to the invoked methods.")]
public FloatData floatParameter;
[Tooltip("List of methods to call. Supports methods with one float parameter.")]
public FloatEvent floatEvent = new FloatEvent();
[Tooltip("String parameter to pass to the invoked methods.")]
public StringData stringParameter;
[Tooltip("List of methods to call. Supports methods with one string parameter.")]
public StringEvent stringEvent = new StringEvent();
public override void OnEnter()
{
if (delay == 0f)
{
DoInvoke();
}
else
{
Invoke("DoInvoke", delay);
}
Continue();
}
protected virtual void DoInvoke()
{
switch (invokeType)
{
default:
case InvokeType.Static:
staticEvent.Invoke();
break;
case InvokeType.DynamicBoolean:
booleanEvent.Invoke(booleanParameter);
break;
case InvokeType.DynamicInteger:
integerEvent.Invoke(integerParameter);
break;
case InvokeType.DynamicFloat:
floatEvent.Invoke(floatParameter);
break;
case InvokeType.DynamicString:
stringEvent.Invoke(stringParameter);
break;
}
}
public override string GetSummary()
{
string summary = invokeType.ToString() + " ";
switch (invokeType)
{
default:
case InvokeType.Static:
summary += staticEvent.GetPersistentEventCount();
break;
case InvokeType.DynamicBoolean:
summary += booleanEvent.GetPersistentEventCount();
break;
case InvokeType.DynamicInteger:
summary += integerEvent.GetPersistentEventCount();
break;
case InvokeType.DynamicFloat:
summary += floatEvent.GetPersistentEventCount();
break;
case InvokeType.DynamicString:
summary += stringEvent.GetPersistentEventCount();
break;
}
return summary + " methods";
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
}
}

4
Assets/Fungus/Flowchart/Scripts/Commands/SetText.cs.meta → Assets/Fungus/Flowchart/Scripts/Commands/Invoke.cs.meta

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 7ec5abc702c3f400b91bbeb2b8328d02
timeCreated: 1431529735
guid: 95d9ff288f3904c05ada7ac9c9a075bb
timeCreated: 1436969477
licenseType: Free
MonoImporter:
serializedVersion: 2

2
Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs

@ -33,7 +33,7 @@ namespace Fungus
return "Error: No game object selected";
}
return targetGameObject.name;
return targetGameObject.name + " = " + activeState.GetDescription();
}
public override Color GetButtonColor()

8
Assets/Fungus/Flowchart/Scripts/Variable.cs

@ -32,6 +32,14 @@ namespace Fungus
this.VariableTypes = variableTypes;
}
public VariablePropertyAttribute (string defaultText, params System.Type[] variableTypes)
{
this.defaultText = defaultText;
this.VariableTypes = variableTypes;
}
public String defaultText = "<None>";
public System.Type[] VariableTypes { get; set; }
}

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/BooleanVariable.cs

@ -36,11 +36,23 @@ namespace Fungus
public struct BooleanData
{
[SerializeField]
[VariableProperty("<Value>", typeof(BooleanVariable))]
public BooleanVariable booleanRef;
[SerializeField]
public bool booleanVal;
public BooleanData(bool v)
{
booleanVal = v;
booleanRef = null;
}
public static implicit operator bool(BooleanData booleanData)
{
return booleanData.Value;
}
public bool Value
{
get { return (booleanRef == null) ? booleanVal : booleanRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/ColorVariable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct ColorData
{
[SerializeField]
[VariableProperty("<Value>", typeof(ColorVariable))]
public ColorVariable colorRef;
[SerializeField]
public Color colorVal;
public ColorData(Color v)
{
colorVal = v;
colorRef = null;
}
public static implicit operator Color(ColorData colorData)
{
return colorData.Value;
}
public Color Value
{
get { return (colorRef == null) ? colorVal : colorRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/FloatVariable.cs

@ -44,11 +44,23 @@ namespace Fungus
public struct FloatData
{
[SerializeField]
[VariableProperty("<Value>", typeof(FloatVariable))]
public FloatVariable floatRef;
[SerializeField]
public float floatVal;
public FloatData(float v)
{
floatVal = v;
floatRef = null;
}
public static implicit operator float(FloatData floatData)
{
return floatData.Value;
}
public float Value
{
get { return (floatRef == null) ? floatVal : floatRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/GameObjectVariable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct GameObjectData
{
[SerializeField]
[VariableProperty("<Value>", typeof(GameObjectVariable))]
public GameObjectVariable gameObjectRef;
[SerializeField]
public GameObject gameObjectVal;
public GameObjectData(GameObject v)
{
gameObjectVal = v;
gameObjectRef = null;
}
public static implicit operator GameObject(GameObjectData gameObjectData)
{
return gameObjectData.Value;
}
public GameObject Value
{
get { return (gameObjectRef == null) ? gameObjectVal : gameObjectRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/IntegerVariable.cs

@ -44,11 +44,23 @@ namespace Fungus
public struct IntegerData
{
[SerializeField]
[VariableProperty("<Value>", typeof(IntegerVariable))]
public IntegerVariable integerRef;
[SerializeField]
public int integerVal;
public IntegerData(int v)
{
integerVal = v;
integerRef = null;
}
public static implicit operator int(IntegerData integerData)
{
return integerData.Value;
}
public int Value
{
get { return (integerRef == null) ? integerVal : integerRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/MaterialVariable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct MaterialData
{
[SerializeField]
[VariableProperty("<Value>", typeof(MaterialVariable))]
public MaterialVariable materialRef;
[SerializeField]
public Material materialVal;
public MaterialData(Material v)
{
materialVal = v;
materialRef = null;
}
public static implicit operator Material(MaterialData materialData)
{
return materialData.Value;
}
public Material Value
{
get { return (materialRef == null) ? materialVal : materialRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/ObjectVariable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct ObjectData
{
[SerializeField]
[VariableProperty("<Value>", typeof(ObjectVariable))]
public ObjectVariable objectRef;
[SerializeField]
public Object objectVal;
public ObjectData(Object v)
{
objectVal = v;
objectRef = null;
}
public static implicit operator Object(ObjectData objectData)
{
return objectData.Value;
}
public Object Value
{
get { return (objectRef == null) ? objectVal : objectRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/SpriteVariable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct SpriteData
{
[SerializeField]
[VariableProperty("<Value>", typeof(SpriteVariable))]
public SpriteVariable spriteRef;
[SerializeField]
public Sprite spriteVal;
public SpriteData(Sprite v)
{
spriteVal = v;
spriteRef = null;
}
public static implicit operator Sprite(SpriteData spriteData)
{
return spriteData.Value;
}
public Sprite Value
{
get { return (spriteRef == null) ? spriteVal : spriteRef.value; }

13
Assets/Fungus/Flowchart/Scripts/VariableTypes/StringVariable.cs

@ -34,11 +34,24 @@ namespace Fungus
public struct StringData
{
[SerializeField]
[VariableProperty("<Value>", typeof(StringVariable))]
public StringVariable stringRef;
[TextArea(1,10)]
[SerializeField]
public string stringVal;
public StringData(string v)
{
stringVal = v;
stringRef = null;
}
public static implicit operator string(StringData spriteData)
{
return spriteData.Value;
}
public string Value
{
get { return (stringRef == null) ? stringVal : stringRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/TextureVariable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct TextureData
{
[SerializeField]
[VariableProperty("<Value>", typeof(TextureVariable))]
public TextureVariable textureRef;
[SerializeField]
public Texture textureVal;
public TextureData(Texture v)
{
textureVal = v;
textureRef = null;
}
public static implicit operator Texture(TextureData textureData)
{
return textureData.Value;
}
public Texture Value
{
get { return (textureRef == null) ? textureVal : textureRef.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector2Variable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct Vector2Data
{
[SerializeField]
[VariableProperty("<Value>", typeof(Vector2Variable))]
public Vector2Variable vector2Ref;
[SerializeField]
public Vector2 vector2Val;
public Vector2Data(Vector2 v)
{
vector2Val = v;
vector2Ref = null;
}
public static implicit operator Vector2(Vector2Data vector2Data)
{
return vector2Data.Value;
}
public Vector2 Value
{
get { return (vector2Ref == null) ? vector2Val : vector2Ref.value; }

12
Assets/Fungus/Flowchart/Scripts/VariableTypes/Vector3Variable.cs

@ -12,11 +12,23 @@ namespace Fungus
public struct Vector3Data
{
[SerializeField]
[VariableProperty("<Value>", typeof(Vector3Variable))]
public Vector3Variable vector3Ref;
[SerializeField]
public Vector3 vector3Val;
public Vector3Data(Vector3 v)
{
vector3Val = v;
vector3Ref = null;
}
public static implicit operator Vector3(Vector3Data vector3Data)
{
return vector3Data.Value;
}
public Vector3 Value
{
get { return (vector3Ref == null) ? vector3Val : vector3Ref.value; }

6
Assets/Fungus/Narrative/Editor/SayEditor.cs

@ -18,8 +18,7 @@ namespace Fungus
{
string tagsText = "";
tagsText += "\n";
tagsText += "\t-------- DEFAULT TAGS --------\n\n";
tagsText += "" +
tagsText += "\t-------- DEFAULT TAGS --------\n\n" +
"\t{b} Bold Text {/b}\n" +
"\t{i} Italic Text {/i}\n" +
"\t{color=red} Color Text (color){/color}\n" +
@ -43,8 +42,9 @@ namespace Fungus
"\t{audiopause=AudioObjectName} Pause Audio\n" +
"\t{audiostop=AudioObjectName} Stop Audio\n" +
"\n" +
"\t{m} Broadcast message\n" +
"\t{m=MessageName} Broadcast message\n" +
"\t{$VarName} Substitute variable";
if (CustomTag.activeCustomTags.Count > 0)
{
tagsText += "\n\n\t-------- CUSTOM TAGS --------";

9
Assets/Fungus/Thirdparty/ComboBox.meta vendored

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

433
Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab vendored

@ -0,0 +1,433 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &109132
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22455272}
m_Layer: 0
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &113240
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22408100}
- 222: {fileID: 22233812}
- 114: {fileID: 11484036}
- 225: {fileID: 22581862}
m_Layer: 0
m_Name: Arrow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &124302
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22481784}
- 114: {fileID: 11481176}
m_Layer: 0
m_Name: ComboBox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &136152
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22497688}
- 222: {fileID: 22244812}
- 114: {fileID: 11435456}
m_Layer: 0
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &139690
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22450736}
- 222: {fileID: 22275660}
- 114: {fileID: 11443144}
- 114: {fileID: 11458428}
m_Layer: 0
m_Name: ComboButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &197142
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22408564}
- 222: {fileID: 22249438}
- 114: {fileID: 11463460}
m_Layer: 0
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &11435456
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136152}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 3
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.20000005
m_Text: Select item
--- !u!114 &11443144
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11458428
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 11443144}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &11463460
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197142}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11481176
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 124302}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 764efac649a181e4d8ab7e0941f263b4, type: 3}
m_Name:
m_EditorClassIdentifier:
Sprite_UISprite: {fileID: 0}
Sprite_Background: {fileID: 0}
_interactable: 1
_itemsToDisplay: 4
_hideFirstItem: 1
_selectedIndex: 0
_items:
- _caption: Select item
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 1
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 2
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 3
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 1
- _caption: Item 4
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 5
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 6
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 7
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
--- !u!114 &11484036
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u25BC"
--- !u!222 &22233812
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
--- !u!222 &22244812
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136152}
--- !u!222 &22249438
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197142}
--- !u!222 &22275660
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
--- !u!224 &22408100
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: .5, z: 1}
m_Children: []
m_Father: {fileID: 22455272}
m_RootOrder: 1
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 0}
m_Pivot: {x: 1, y: .5}
--- !u!224 &22408564
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197142}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 22450736}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 4, y: -4}
m_SizeDelta: {x: 22, y: -8}
m_Pivot: {x: 0, y: 1}
--- !u!224 &22450736
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 22408564}
- {fileID: 22497688}
m_Father: {fileID: 22455272}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22455272
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 109132}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 22450736}
- {fileID: 22408100}
m_Father: {fileID: 22481784}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22481784
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 124302}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 22455272}
m_Father: {fileID: 0}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22497688
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136152}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 22450736}
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 10, y: 0}
m_SizeDelta: {x: -6, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!225 &22581862
CanvasGroup:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 124302}
m_IsPrefabParent: 1

8
Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab.meta vendored

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 65e6951c5bb5a4425876dde3504230f9
timeCreated: 1435836084
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

798
Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity vendored

@ -0,0 +1,798 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!127 &3
LevelGameManager:
m_ObjectHideFlags: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 1
m_BakeResolution: 50
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 0
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_LightmapSnapshot: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &5
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: .5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: .166666657
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &118098217
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 118098221}
- 223: {fileID: 118098220}
- 114: {fileID: 118098219}
- 114: {fileID: 118098218}
m_Layer: 0
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &118098218
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &118098219
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &118098220
Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_Enabled: 1
serializedVersion: 2
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!224 &118098221
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 584710810}
m_Father: {fileID: 0}
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &189900987
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 189900988}
- 222: {fileID: 189900991}
- 114: {fileID: 189900990}
- 225: {fileID: 189900989}
m_Layer: 0
m_Name: Arrow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &189900988
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: .5, z: 1}
m_Children: []
m_Father: {fileID: 1075148776}
m_RootOrder: 1
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 0}
m_Pivot: {x: 1, y: .5}
--- !u!225 &189900989
CanvasGroup:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!114 &189900990
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u25BC"
--- !u!222 &189900991
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
--- !u!1 &556050592
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 556050593}
- 222: {fileID: 556050596}
- 114: {fileID: 556050595}
- 114: {fileID: 556050594}
m_Layer: 0
m_Name: ComboButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &556050593
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1334474371}
- {fileID: 608930524}
m_Father: {fileID: 1075148776}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &556050594
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 556050595}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &556050595
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &556050596
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
--- !u!1 &584710809
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 584710810}
- 114: {fileID: 584710811}
m_Layer: 0
m_Name: ComboBox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &584710810
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 584710809}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1075148776}
m_Father: {fileID: 118098221}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &584710811
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 584710809}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 764efac649a181e4d8ab7e0941f263b4, type: 3}
m_Name:
m_EditorClassIdentifier:
Sprite_UISprite: {fileID: 0}
Sprite_Background: {fileID: 0}
_interactable: 1
_itemsToDisplay: 4
_hideFirstItem: 1
_selectedIndex: 0
_items:
- _caption: Select item
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 1
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 2
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 3
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 1
- _caption: Item 4
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 5
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 6
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 7
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
--- !u!1 &608930523
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 608930524}
- 222: {fileID: 608930526}
- 114: {fileID: 608930525}
m_Layer: 0
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &608930524
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 608930523}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 556050593}
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 10, y: 0}
m_SizeDelta: {x: -6, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &608930525
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 608930523}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 3
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.20000005
m_Text: Select item
--- !u!222 &608930526
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 608930523}
--- !u!1 &846109954
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 846109958}
- 114: {fileID: 846109957}
- 114: {fileID: 846109956}
- 114: {fileID: 846109955}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &846109955
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AllowActivationOnStandalone: 0
--- !u!114 &846109956
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: .5
m_AllowActivationOnMobileDevice: 0
--- !u!114 &846109957
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &846109958
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
--- !u!1 &1075148775
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1075148776}
m_Layer: 0
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1075148776
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1075148775}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 556050593}
- {fileID: 189900988}
m_Father: {fileID: 584710810}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!1 &1334474370
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1334474371}
- 222: {fileID: 1334474373}
- 114: {fileID: 1334474372}
m_Layer: 0
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1334474371
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1334474370}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 556050593}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 4, y: -4}
m_SizeDelta: {x: 22, y: -8}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1334474372
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1334474370}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1334474373
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1334474370}
--- !u!1 &1383163942
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1383163944}
- 114: {fileID: 1383163943}
m_Layer: 0
m_Name: _FungusState
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1383163943
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1383163942}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3}
m_Name:
m_EditorClassIdentifier:
selectedFlowchart: {fileID: 0}
--- !u!4 &1383163944
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1383163942}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!1 &1771269060
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1771269065}
- 20: {fileID: 1771269064}
- 92: {fileID: 1771269063}
- 124: {fileID: 1771269062}
- 81: {fileID: 1771269061}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1771269061
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_Enabled: 1
--- !u!124 &1771269062
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_Enabled: 1
--- !u!92 &1771269063
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_Enabled: 1
--- !u!20 &1771269064
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
m_StereoMirrorMode: 0
--- !u!4 &1771269065
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0

6
Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity.meta vendored

@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: ce27f67d97a4b6e4f95525d833130c6e
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Fungus/Thirdparty/ComboBox/Scripts.meta vendored

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

681
Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs vendored

@ -0,0 +1,681 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
[RequireComponent(typeof(RectTransform))]
public class ComboBox : MonoBehaviour
{
public Sprite Sprite_UISprite;
public Sprite Sprite_Background;
public Action<int> OnSelectionChanged;
[SerializeField]
private bool _interactable = true;
public bool Interactable
{
get
{
return _interactable;
}
set
{
_interactable = value;
var button = comboButtonRectTransform.GetComponent<Button>();
button.interactable = _interactable;
var image = comboImageRectTransform.GetComponent<Image>();
image.color = image.sprite == null ? new Color(1.0f, 1.0f, 1.0f, 0.0f) : _interactable ? button.colors.normalColor : button.colors.disabledColor;
if (!Application.isPlaying)
return;
if (!_interactable && overlayGO.activeSelf)
ToggleComboBox(false);
}
}
[SerializeField]
private int _itemsToDisplay = 4;
public int ItemsToDisplay
{
get
{
return _itemsToDisplay;
}
set
{
if (_itemsToDisplay == value)
return;
_itemsToDisplay = value;
Refresh();
}
}
[SerializeField]
private bool _hideFirstItem;
public bool HideFirstItem
{
get
{
return _hideFirstItem;
}
set
{
if (value)
scrollOffset--;
else
scrollOffset++;
_hideFirstItem = value;
Refresh();
}
}
[SerializeField]
private int _selectedIndex = 0;
public int SelectedIndex
{
get
{
return _selectedIndex;
}
set
{
if (_selectedIndex == value)
return;
if (value > -1 && value < Items.Length)
{
_selectedIndex = value;
RefreshSelected();
}
}
}
[SerializeField]
private ComboBoxItem[] _items;
public ComboBoxItem[] Items
{
get
{
if (_items == null)
_items = new ComboBoxItem[0];
return _items;
}
set
{
_items = value;
Refresh();
}
}
private GameObject overlayGO;
private int scrollOffset;
private float _scrollbarWidth = 20.0f;
private RectTransform _rectTransform;
private RectTransform rectTransform
{
get
{
if (_rectTransform == null)
_rectTransform = GetComponent<RectTransform>();
return _rectTransform;
}
set
{
_rectTransform = value;
}
}
private RectTransform _buttonRectTransform;
private RectTransform buttonRectTransform
{
get
{
if (_buttonRectTransform == null)
_buttonRectTransform = rectTransform.Find("Button").GetComponent<RectTransform>();
return _buttonRectTransform;
}
set
{
_buttonRectTransform = value;
}
}
private RectTransform _comboButtonRectTransform;
private RectTransform comboButtonRectTransform
{
get
{
if (_comboButtonRectTransform == null)
_comboButtonRectTransform = buttonRectTransform.Find("ComboButton").GetComponent<RectTransform>();
return _comboButtonRectTransform;
}
set
{
_comboButtonRectTransform = value;
}
}
private RectTransform _comboImageRectTransform;
private RectTransform comboImageRectTransform
{
get
{
if (_comboImageRectTransform == null)
_comboImageRectTransform = comboButtonRectTransform.Find("Image").GetComponent<RectTransform>();
return _comboImageRectTransform;
}
set
{
_comboImageRectTransform = value;
}
}
private RectTransform _comboTextRectTransform;
private RectTransform comboTextRectTransform
{
get
{
if (_comboTextRectTransform == null)
_comboTextRectTransform = comboButtonRectTransform.Find("Text").GetComponent<RectTransform>();
return _comboTextRectTransform;
}
set
{
_comboTextRectTransform = value;
}
}
private RectTransform _comboArrowRectTransform;
private RectTransform comboArrowRectTransform
{
get
{
if (_comboArrowRectTransform == null)
_comboArrowRectTransform = buttonRectTransform.Find("Arrow").GetComponent<RectTransform>();
return _comboArrowRectTransform;
}
set
{
_comboArrowRectTransform = value;
}
}
private RectTransform _scrollPanelRectTransfrom;
private RectTransform scrollPanelRectTransfrom
{
get
{
if (_scrollPanelRectTransfrom == null)
_scrollPanelRectTransfrom = rectTransform.Find("Overlay/ScrollPanel").GetComponent<RectTransform>();
return _scrollPanelRectTransfrom;
}
set
{
_scrollPanelRectTransfrom = value;
}
}
private RectTransform _itemsRectTransfrom;
private RectTransform itemsRectTransfrom
{
get
{
if (_itemsRectTransfrom == null)
_itemsRectTransfrom = scrollPanelRectTransfrom.Find("Items").GetComponent<RectTransform>();
return _itemsRectTransfrom;
}
set
{
_itemsRectTransfrom = value;
}
}
private RectTransform _scrollbarRectTransfrom;
private RectTransform scrollbarRectTransfrom
{
get
{
if (_scrollbarRectTransfrom == null)
_scrollbarRectTransfrom = scrollPanelRectTransfrom.Find("Scrollbar").GetComponent<RectTransform>();
return _scrollbarRectTransfrom;
}
set
{
_scrollbarRectTransfrom = value;
}
}
private RectTransform _slidingAreaRectTransform;
private RectTransform slidingAreaRectTransform
{
get
{
if (_slidingAreaRectTransform == null)
_slidingAreaRectTransform = scrollbarRectTransfrom.Find("SlidingArea").GetComponent<RectTransform>();
return _slidingAreaRectTransform;
}
set
{
_slidingAreaRectTransform = value;
}
}
private RectTransform _handleRectTransfrom;
private RectTransform handleRectTransfrom
{
get
{
if (_handleRectTransfrom == null)
_handleRectTransfrom = slidingAreaRectTransform.Find("Handle").GetComponent<RectTransform>();
return _handleRectTransfrom;
}
set
{
_handleRectTransfrom = value;
}
}
private void Awake()
{
InitControl();
}
public void OnItemClicked(int index)
{
var selectionChanged = index != SelectedIndex;
SelectedIndex = index;
ToggleComboBox(true);
if (selectionChanged && OnSelectionChanged != null)
OnSelectionChanged(index);
}
public void AddItems(params object[] list)
{
var cbItems = new List<ComboBoxItem>();
foreach (var obj in list)
{
if (obj is ComboBoxItem)
{
var item = (ComboBoxItem)obj;
cbItems.Add(item);
continue;
}
if (obj is string)
{
var item = new ComboBoxItem((string)obj, null, false, null);
cbItems.Add(item);
continue;
}
if (obj is Sprite)
{
var item = new ComboBoxItem(null, (Sprite)obj, false, null);
cbItems.Add(item);
continue;
}
throw new Exception("Only ComboBoxItem, string and Sprite types are allowed");
}
var newItems = new ComboBoxItem[Items.Length + cbItems.Count];
Items.CopyTo(newItems, 0);
cbItems.ToArray().CopyTo(newItems, Items.Length);
Refresh();
Items = newItems;
}
public void ClearItems()
{
Items = new ComboBoxItem[0];
}
public void CreateControl()
{
rectTransform = GetComponent<RectTransform>();
var buttonGO = new GameObject("Button");
buttonGO.transform.SetParent(transform, false);
buttonRectTransform = buttonGO.AddComponent<RectTransform>();
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.x);
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y);
buttonRectTransform.anchoredPosition = Vector2.zero;
var comboButtonGO = new GameObject("ComboButton");
comboButtonGO.transform.SetParent(buttonRectTransform, false);
comboButtonRectTransform = comboButtonGO.AddComponent<RectTransform>();
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, buttonRectTransform.sizeDelta.x);
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, buttonRectTransform.sizeDelta.y);
comboButtonRectTransform.anchoredPosition = Vector2.zero;
var comboButtonImage = comboButtonGO.AddComponent<Image>();
comboButtonImage.sprite = Sprite_UISprite;
comboButtonImage.type = Image.Type.Sliced;
var comboButtonButton = comboButtonGO.AddComponent<Button>();
comboButtonButton.targetGraphic = comboButtonImage;
var comboButtonColors = new ColorBlock();
comboButtonColors.normalColor = new Color32(255, 255, 255, 255);
comboButtonColors.highlightedColor = new Color32(245, 245, 245, 255);
comboButtonColors.pressedColor = new Color32(200, 200, 200, 255);
comboButtonColors.disabledColor = new Color32(200, 200, 200, 128);
comboButtonColors.colorMultiplier = 1.0f;
comboButtonColors.fadeDuration = 0.1f;
comboButtonButton.colors = comboButtonColors;
var comboArrowGO = new GameObject("Arrow");
comboArrowGO.transform.SetParent(buttonRectTransform, false);
var comboArrowText = comboArrowGO.AddComponent<Text>();
comboArrowText.color = new Color32(0, 0, 0, 255);
comboArrowText.alignment = TextAnchor.MiddleCenter;
comboArrowText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
comboArrowText.text = "▼";
comboArrowRectTransform.localScale = new Vector3(1.0f, 0.5f, 1.0f);
comboArrowRectTransform.pivot = new Vector2(1.0f, 0.5f);
comboArrowRectTransform.anchorMin = Vector2.right;
comboArrowRectTransform.anchorMax = Vector2.one;
comboArrowRectTransform.anchoredPosition = Vector2.zero;
comboArrowRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboButtonRectTransform.sizeDelta.y);
comboArrowRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, comboButtonRectTransform.sizeDelta.y);
var comboArrowCanvasGroup = comboArrowGO.AddComponent<CanvasGroup>();
comboArrowCanvasGroup.interactable = false;
comboArrowCanvasGroup.blocksRaycasts = false;
var comboImageGO = new GameObject("Image");
comboImageGO.transform.SetParent(comboButtonRectTransform, false);
var comboImageImage = comboImageGO.AddComponent<Image>();
comboImageImage.color = new Color32(255, 255, 255, 0);
comboImageRectTransform.pivot = Vector2.up;
comboImageRectTransform.anchorMin = Vector2.zero;
comboImageRectTransform.anchorMax = Vector2.up;
comboImageRectTransform.anchoredPosition = new Vector2(4.0f, -4.0f);
comboImageRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboButtonRectTransform.sizeDelta.y - 8.0f);
comboImageRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, comboButtonRectTransform.sizeDelta.y - 8.0f);
var comboTextGO = new GameObject("Text");
comboTextGO.transform.SetParent(comboButtonRectTransform, false);
var comboTextText = comboTextGO.AddComponent<Text>();
comboTextText.color = new Color32(0, 0, 0, 255);
comboTextText.alignment = TextAnchor.MiddleLeft;
comboTextText.lineSpacing = 1.2f;
comboTextText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
comboTextRectTransform.pivot = Vector2.up;
comboTextRectTransform.anchorMin = Vector2.zero;
comboTextRectTransform.anchorMax = Vector2.one;
comboTextRectTransform.anchoredPosition = new Vector2(10.0f, 0.0f);
comboTextRectTransform.offsetMax = new Vector2(4.0f, 0.0f);
comboTextRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, comboButtonRectTransform.sizeDelta.y);
}
public void InitControl()
{
var cbi = transform.Find("Button/ComboButton/Image");
var cbt = transform.Find("Button/ComboButton/Text");
var cba = transform.Find("Button/Arrow");
if (cbi == null || cbt == null || cba == null)
{
foreach (Transform child in transform)
Destroy(child);
CreateControl();
}
comboButtonRectTransform.GetComponent<Button>().onClick.AddListener(() => { ToggleComboBox(false); });
var dropdownHeight = comboButtonRectTransform.sizeDelta.y * Mathf.Min(ItemsToDisplay, Items.Length - (HideFirstItem ? 1 : 0));
overlayGO = new GameObject("Overlay");
overlayGO.SetActive(false);
var overlayImage = overlayGO.AddComponent<Image>();
overlayImage.color = new Color32(0, 0, 0, 0);
var canvasTransform = transform;
while (canvasTransform.GetComponent<Canvas>() == null)
canvasTransform = canvasTransform.parent;
overlayGO.transform.SetParent(canvasTransform, false);
var overlayRectTransform = overlayGO.GetComponent<RectTransform>();
overlayRectTransform.anchorMin = Vector2.zero;
overlayRectTransform.anchorMax = Vector2.one;
overlayRectTransform.offsetMin = Vector2.zero;
overlayRectTransform.offsetMax = Vector2.zero;
overlayGO.transform.SetParent(transform, false);
var overlayButton = overlayGO.AddComponent<Button>();
overlayButton.targetGraphic = overlayImage;
overlayButton.onClick.AddListener(() => { ToggleComboBox(false); });
var scrollPanelGO = new GameObject("ScrollPanel");
var scrollPanelImage = scrollPanelGO.AddComponent<Image>();
scrollPanelImage.sprite = Sprite_UISprite;
scrollPanelImage.type = Image.Type.Sliced;
scrollPanelGO.transform.SetParent(overlayGO.transform, false);
scrollPanelRectTransfrom.pivot = new Vector2(0.5f, 1.0f);
scrollPanelRectTransfrom.anchorMin = Vector2.zero;
scrollPanelRectTransfrom.anchorMax = Vector2.one;
scrollPanelGO.transform.SetParent(transform, false);
scrollPanelRectTransfrom.anchoredPosition = new Vector2(0.0f, -comboButtonRectTransform.sizeDelta.y);
scrollPanelGO.transform.SetParent(overlayGO.transform, false);
scrollPanelRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboButtonRectTransform.sizeDelta.x);
scrollPanelRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
var scrollPanelScrollRect = scrollPanelGO.AddComponent<ScrollRect>();
scrollPanelScrollRect.horizontal = false;
scrollPanelScrollRect.elasticity = 0.0f;
scrollPanelScrollRect.movementType = ScrollRect.MovementType.Clamped;
scrollPanelScrollRect.inertia = false;
scrollPanelScrollRect.scrollSensitivity = comboButtonRectTransform.sizeDelta.y;
scrollPanelGO.AddComponent<Mask>();
var scrollbarWidth = Items.Length - (HideFirstItem ? 1 : 0) > _itemsToDisplay ? _scrollbarWidth : 0.0f;
var itemsGO = new GameObject("Items");
itemsGO.transform.SetParent(scrollPanelGO.transform, false);
itemsRectTransfrom = itemsGO.AddComponent<RectTransform>();
itemsRectTransfrom.pivot = Vector2.up;
itemsRectTransfrom.anchorMin = Vector2.up;
itemsRectTransfrom.anchorMax = Vector2.one;
itemsRectTransfrom.anchoredPosition = Vector2.right;
itemsRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollPanelRectTransfrom.sizeDelta.x - scrollbarWidth);
var itemsContentSizeFitter = itemsGO.AddComponent<ContentSizeFitter>();
itemsContentSizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
itemsContentSizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var itemsGridLayoutGroup = itemsGO.AddComponent<GridLayoutGroup>();
itemsGridLayoutGroup.cellSize = new Vector2(comboButtonRectTransform.sizeDelta.x - scrollbarWidth, comboButtonRectTransform.sizeDelta.y);
itemsGridLayoutGroup.constraint = GridLayoutGroup.Constraint.FixedColumnCount;
itemsGridLayoutGroup.constraintCount = 1;
scrollPanelScrollRect.content = itemsRectTransfrom;
var scrollbarGO = new GameObject("Scrollbar");
scrollbarGO.transform.SetParent(scrollPanelGO.transform, false);
var scrollbarImage = scrollbarGO.AddComponent<Image>();
scrollbarImage.sprite = Sprite_Background;
scrollbarImage.type = Image.Type.Sliced;
var scrollbarScrollbar = scrollbarGO.AddComponent<Scrollbar>();
var scrollbarColors = new ColorBlock();
scrollbarColors.normalColor = new Color32(128, 128, 128, 128);
scrollbarColors.highlightedColor = new Color32(128, 128, 128, 178);
scrollbarColors.pressedColor = new Color32(88, 88, 88, 178);
scrollbarColors.disabledColor = new Color32(64, 64, 64, 128);
scrollbarColors.colorMultiplier = 2.0f;
scrollbarColors.fadeDuration = 0.1f;
scrollbarScrollbar.colors = scrollbarColors;
scrollPanelScrollRect.verticalScrollbar = scrollbarScrollbar;
scrollbarScrollbar.direction = Scrollbar.Direction.BottomToTop;
scrollbarRectTransfrom.pivot = Vector2.one;
scrollbarRectTransfrom.anchorMin = Vector2.one;
scrollbarRectTransfrom.anchorMax = Vector2.one;
scrollbarRectTransfrom.anchoredPosition = Vector2.zero;
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollbarWidth);
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
var slidingAreaGO = new GameObject("SlidingArea");
slidingAreaGO.transform.SetParent(scrollbarGO.transform, false);
slidingAreaRectTransform = slidingAreaGO.AddComponent<RectTransform>();
slidingAreaRectTransform.anchoredPosition = Vector2.zero;
slidingAreaRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0);
slidingAreaRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight - scrollbarRectTransfrom.sizeDelta.x);
var handleGO = new GameObject("Handle");
handleGO.transform.SetParent(slidingAreaGO.transform, false);
var handleImage = handleGO.AddComponent<Image>();
handleImage.sprite = Sprite_UISprite;
handleImage.type = Image.Type.Sliced;
handleImage.color = new Color32(255, 255, 255, 150);
scrollbarScrollbar.targetGraphic = handleImage;
scrollbarScrollbar.handleRect = handleRectTransfrom;
handleRectTransfrom.pivot = new Vector2(0.5f, 0.5f);
handleRectTransfrom.anchorMin = new Vector2(0.5f, 0.5f);
handleRectTransfrom.anchorMax = new Vector2(0.5f, 0.5f);
handleRectTransfrom.anchoredPosition = Vector2.zero;
handleRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollbarWidth);
handleRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, scrollbarWidth);
Interactable = Interactable;
if (Items.Length < 1)
return;
Refresh();
}
public void Refresh()
{
var itemsGridLayoutGroup = itemsRectTransfrom.GetComponent<GridLayoutGroup>();
var itemsLength = Items.Length - (HideFirstItem ? 1 : 0);
var dropdownHeight = comboButtonRectTransform.sizeDelta.y * Mathf.Min(_itemsToDisplay, itemsLength);
var scrollbarWidth = itemsLength > ItemsToDisplay ? _scrollbarWidth : 0.0f;
scrollPanelRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollbarWidth);
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
slidingAreaRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight - scrollbarRectTransfrom.sizeDelta.x);
itemsRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollPanelRectTransfrom.sizeDelta.x - scrollbarWidth);
itemsGridLayoutGroup.cellSize = new Vector2(comboButtonRectTransform.sizeDelta.x - scrollbarWidth, comboButtonRectTransform.sizeDelta.y);
for (var i = itemsRectTransfrom.childCount - 1; i > -1; i--)
DestroyImmediate(itemsRectTransfrom.GetChild(0).gameObject);
for (var i = 0; i < Items.Length; i++)
{
if (HideFirstItem && i == 0)
continue;
var item = Items[i];
item.OnUpdate = Refresh;
var itemTransform = Instantiate(comboButtonRectTransform) as Transform;
itemTransform.SetParent(itemsRectTransfrom, false);
itemTransform.GetComponent<Image>().sprite = null;
var itemText = itemTransform.Find("Text").GetComponent<Text>();
itemText.text = item.Caption;
if (item.IsDisabled)
itemText.color = new Color32(174, 174, 174, 255);
var itemImage = itemTransform.Find("Image").GetComponent<Image>();
itemImage.sprite = item.Image;
itemImage.color = item.Image == null ? new Color32(255, 255, 255, 0) : item.IsDisabled ? new Color32(255, 255, 255, 147) : new Color32(255, 255, 255, 255);
var itemButton = itemTransform.GetComponent<Button>();
itemButton.interactable = !item.IsDisabled;
var index = i;
itemButton.onClick.AddListener(
delegate()
{
OnItemClicked(index);
if (item.OnSelect != null)
item.OnSelect();
}
);
}
RefreshSelected();
UpdateComboBoxImages();
UpdateGraphics();
FixScrollOffset();
}
public void RefreshSelected()
{
var comboButtonImage = comboImageRectTransform.GetComponent<Image>();
var item = SelectedIndex > -1 && SelectedIndex < Items.Length ? Items[SelectedIndex] : null;
var includeImage = item != null && item.Image != null;
comboButtonImage.sprite = includeImage ? item.Image : null;
var comboButtonButton = comboButtonRectTransform.GetComponent<Button>();
comboButtonImage.color = includeImage ? (Interactable ? comboButtonButton.colors.normalColor : comboButtonButton.colors.disabledColor) : new Color(1.0f, 1.0f, 1.0f, 0);
UpdateComboBoxImage(comboButtonRectTransform, includeImage);
comboTextRectTransform.GetComponent<Text>().text = item != null ? item.Caption : "";
if (!Application.isPlaying)
return;
var i = 0;
foreach (Transform child in itemsRectTransfrom)
{
comboButtonImage = child.GetComponent<Image>();
comboButtonImage.color = SelectedIndex == i + (HideFirstItem ? 1 : 0) ? comboButtonButton.colors.highlightedColor : comboButtonButton.colors.normalColor;
i++;
}
}
private void UpdateComboBoxImages()
{
var includeImages = false;
foreach (var item in Items)
{
if (item.Image != null)
{
includeImages = true;
break;
}
}
foreach (Transform child in itemsRectTransfrom)
UpdateComboBoxImage(child, includeImages);
}
private void UpdateComboBoxImage(Transform comboButton, bool includeImage)
{
comboButton.Find("Text").GetComponent<RectTransform>().offsetMin = Vector2.right * (includeImage ? comboImageRectTransform.rect.width + 8.0f : 10.0f);
}
private void FixScrollOffset()
{
var selectedIndex = SelectedIndex + (HideFirstItem ? 1 : 0);
if (selectedIndex < scrollOffset)
scrollOffset = selectedIndex;
else
if (selectedIndex > scrollOffset + ItemsToDisplay - 1)
scrollOffset = selectedIndex - ItemsToDisplay + 1;
var itemsCount = Items.Length - (HideFirstItem ? 1 : 0);
if (scrollOffset > itemsCount - ItemsToDisplay)
scrollOffset = itemsCount - ItemsToDisplay;
if (scrollOffset < 0)
scrollOffset = 0;
itemsRectTransfrom.anchoredPosition = new Vector2(0.0f, scrollOffset * rectTransform.sizeDelta.y);
}
private void ToggleComboBox(bool directClick)
{
overlayGO.SetActive(!overlayGO.activeSelf);
if (overlayGO.activeSelf)
{
var curTransform = transform;
do
{
curTransform.SetAsLastSibling();
}
while ((curTransform = curTransform.parent) != null);
FixScrollOffset();
}
else
if (directClick)
scrollOffset = (int)Mathf.Round(itemsRectTransfrom.anchoredPosition.y / rectTransform.sizeDelta.y);
}
public void UpdateGraphics()
{
if (overlayGO != null)
{
var scrollbarWidth = Items.Length - (HideFirstItem ? 1 : 0) > ItemsToDisplay ? _scrollbarWidth : 0.0f;
handleRectTransfrom.offsetMin = -scrollbarWidth / 2 * Vector2.one;
handleRectTransfrom.offsetMax = scrollbarWidth / 2 * Vector2.one;
}
if (rectTransform.sizeDelta != buttonRectTransform.sizeDelta && buttonRectTransform.sizeDelta == comboButtonRectTransform.sizeDelta)
{
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.x);
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y);
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.x);
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y);
comboArrowRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.y);
comboImageRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboImageRectTransform.rect.height);
comboTextRectTransform.offsetMax = new Vector2(4.0f, 0.0f);
if (overlayGO == null)
return;
scrollPanelRectTransfrom.SetParent(transform, false);
scrollPanelRectTransfrom.anchoredPosition = new Vector2(0.0f, -comboButtonRectTransform.sizeDelta.y);
scrollPanelRectTransfrom.SetParent(overlayGO.transform, false);
scrollPanelRectTransfrom.GetComponent<ScrollRect>().scrollSensitivity = comboButtonRectTransform.sizeDelta.y;
UpdateComboBoxImage(comboButtonRectTransform, Items[SelectedIndex].Image != null);
Refresh();
}
}
}

4
Assets/Fungus/Flowchart/Editor/SendEventEditor.cs.meta → Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs.meta vendored

@ -1,8 +1,10 @@
fileFormatVersion: 2
guid: bac7aca93b77a4b78a6357a2c13ad26d
guid: 764efac649a181e4d8ab7e0941f263b4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

115
Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs vendored

@ -0,0 +1,115 @@
using UnityEngine;
using UnityEngine.UI;
using System;
[Serializable]
public class ComboBoxItem
{
[SerializeField]
private string _caption;
public string Caption
{
get
{
return _caption;
}
set
{
_caption = value;
if (OnUpdate != null)
OnUpdate();
}
}
[SerializeField]
private Sprite _image;
public Sprite Image
{
get
{
return _image;
}
set
{
_image = value;
if (OnUpdate != null)
OnUpdate();
}
}
[SerializeField]
private bool _isDisabled;
public bool IsDisabled
{
get
{
return _isDisabled;
}
set
{
_isDisabled = value;
if (OnUpdate != null)
OnUpdate();
}
}
public Action OnSelect;
internal Action OnUpdate;
public ComboBoxItem(string caption)
{
_caption = caption;
}
public ComboBoxItem(Sprite image)
{
_image = image;
}
public ComboBoxItem(string caption, bool disabled)
{
_caption = caption;
_isDisabled = disabled;
}
public ComboBoxItem(Sprite image, bool disabled)
{
_image = image;
_isDisabled = disabled;
}
public ComboBoxItem(string caption, Sprite image, bool disabled)
{
_caption = caption;
_image = image;
_isDisabled = disabled;
}
public ComboBoxItem(string caption, Sprite image, bool disabled, Action onSelect)
{
_caption = caption;
_image = image;
_isDisabled = disabled;
OnSelect = onSelect;
}
public ComboBoxItem(string caption, Sprite image, Action onSelect)
{
_caption = caption;
_image = image;
OnSelect = onSelect;
}
public ComboBoxItem(string caption, Action onSelect)
{
_caption = caption;
OnSelect = onSelect;
}
public ComboBoxItem(Sprite image, Action onSelect)
{
_image = image;
OnSelect = onSelect;
}
}

10
Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs.meta vendored

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

9
Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor.meta vendored

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

107
Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs vendored

@ -0,0 +1,107 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(ComboBox))]
public class ComboBoxEditor : Editor
{
public override void OnInspectorGUI()
{
var comboBoxGO = target as ComboBox;
var allowUpdate = comboBoxGO.transform.Find("Button") != null;
if (allowUpdate)
comboBoxGO.UpdateGraphics();
EditorGUI.BeginChangeCheck();
DrawDefaultInspector();
if (EditorGUI.EndChangeCheck())
{
if (Application.isPlaying)
{
comboBoxGO.HideFirstItem = comboBoxGO.HideFirstItem;
comboBoxGO.Interactable = comboBoxGO.Interactable;
}
else
if (allowUpdate)
comboBoxGO.RefreshSelected();
}
}
}
public class ComboBoxMenuItem
{
[MenuItem("GameObject/UI/ComboBox")]
public static void CreateComboBox()
{
var canvas = Object.FindObjectOfType<Canvas>();
var canvasGO = canvas == null ? null : canvas.gameObject;
if (canvasGO == null)
{
canvasGO = new GameObject("Canvas");
canvas = canvasGO.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasGO.AddComponent<CanvasScaler>();
canvasGO.AddComponent<GraphicRaycaster>();
}
var eventSystem = Object.FindObjectOfType<EventSystem>();
var eventSystemGO = eventSystem == null ? null : eventSystem.gameObject;
if (eventSystemGO == null)
{
eventSystemGO = new GameObject("EventSystem");
eventSystem = eventSystemGO.AddComponent<EventSystem>();
eventSystemGO.AddComponent<StandaloneInputModule>();
eventSystemGO.AddComponent<TouchInputModule>();
}
var comboBoxGO = new GameObject("ComboBox");
comboBoxGO.transform.SetParent(canvasGO.transform, false);
var rTransform = comboBoxGO.AddComponent<RectTransform>();
rTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160);
rTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 30);
for (var i = 0; i < Selection.objects.Length; i++)
{
var selected = Selection.objects[i] as GameObject;
var hierarchyItem = selected.transform;
canvas = null;
while (hierarchyItem != null && (canvas = hierarchyItem.GetComponent<Canvas>()) == null)
hierarchyItem = hierarchyItem.parent;
if (canvas != null)
{
comboBoxGO.transform.SetParent(selected.transform, false);
break;
}
}
rTransform.anchoredPosition = Vector2.zero;
var comboBox = comboBoxGO.AddComponent<ComboBox>();
LoadAssets();
comboBox.Sprite_UISprite = Sprite_UISprite;
comboBox.Sprite_Background = Sprite_Background;
comboBox.CreateControl();
Selection.activeGameObject = comboBoxGO;
}
private static Sprite Sprite_UISprite;
private static Sprite Sprite_Background;
public static void LoadAssets()
{
while (Sprite_UISprite == null || Sprite_Background == null)
{
var sprites = Resources.FindObjectsOfTypeAll<Sprite>();
foreach (var sprite in sprites)
switch (sprite.name)
{
case "UISprite":
Sprite_UISprite = sprite;
break;
case "Background":
Sprite_Background = sprite;
break;
}
if (Sprite_UISprite == null || Sprite_Background == null)
AssetDatabase.LoadAllAssetsAtPath("Resources/unity_builtin_extra");
}
}
}

10
Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs.meta vendored

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

56
Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs vendored

@ -0,0 +1,56 @@
using UnityEngine;
public class TestComboBox : MonoBehaviour
{
public ComboBox comboBox;
public Sprite image;
private void Start()
{
var itemMakeBig = new ComboBoxItem("Make me big!");
var itemMakeNormal = new ComboBoxItem("Normal", image, true);
var itemMakeSmall = new ComboBoxItem("Make me small!");
itemMakeBig.OnSelect += () =>
{
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 180);
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 40);
comboBox.UpdateGraphics();
itemMakeBig.Caption = "Big";
itemMakeBig.IsDisabled = true;
itemMakeNormal.Caption = "Make me normal!";
itemMakeNormal.IsDisabled = false;
itemMakeSmall.Caption = "Make me small!";
itemMakeSmall.IsDisabled = false;
};
itemMakeNormal.OnSelect += () =>
{
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160);
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 30);
comboBox.UpdateGraphics();
itemMakeBig.Caption = "Make me big!";
itemMakeBig.IsDisabled = false;
itemMakeNormal.Caption = "Normal";
itemMakeNormal.IsDisabled = true;
itemMakeSmall.Caption = "Make me small!";
itemMakeSmall.IsDisabled = false;
};
itemMakeSmall.OnSelect += () =>
{
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160);
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 20);
comboBox.UpdateGraphics();
itemMakeBig.Caption = "Make me big!";
itemMakeBig.IsDisabled = false;
itemMakeNormal.Caption = "Make me normal!";
itemMakeNormal.IsDisabled = false;
itemMakeSmall.Caption = "Small";
itemMakeSmall.IsDisabled = true;
};
comboBox.AddItems(itemMakeBig, itemMakeNormal, itemMakeSmall);
comboBox.SelectedIndex = 1;
comboBox.OnSelectionChanged += (int index) =>
{
Camera.main.backgroundColor = new Color32((byte)Random.Range(0, 256), (byte)Random.Range(0, 256), (byte)Random.Range(0, 256), 255);
};
}
}

10
Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs.meta vendored

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 04953fda07e4b074e922be8606477017
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Fungus/UI/Editor.meta

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7ebd428fad0b74343aa1bf752f8f05a1
folderAsset: yes
timeCreated: 1438002256
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save