Browse Source

Added null pointer checks and fixed sequence name picking

master
chrisgregan 11 years ago
parent
commit
2b6fe13072
  1. BIN
      Assets/Example/Scenes/Example.unity
  2. 4
      Assets/Fungus/FungusScript/Editor/CommandEditor.cs
  3. 11
      Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs
  4. 8
      Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs
  5. 4
      Assets/Fungus/FungusScript/Editor/SequenceEditor.cs
  6. 7
      Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs

BIN
Assets/Example/Scenes/Example.unity

Binary file not shown.

4
Assets/Fungus/FungusScript/Editor/CommandEditor.cs

@ -45,6 +45,10 @@ namespace Fungus
}
FungusScript fungusScript = t.GetFungusScript();
if (fungusScript == null)
{
return;
}
CommandInfoAttribute commandInfoAttr = CommandEditor.GetCommandInfo(t.GetType());
if (commandInfoAttr == null)

11
Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs

@ -127,6 +127,11 @@ namespace Fungus
{
Command command = this[index].objectReferenceValue as Command;
if (command == null)
{
return;
}
CommandInfoAttribute commandInfoAttr = CommandEditor.GetCommandInfo(command.GetType());
if (commandInfoAttr == null)
{
@ -134,7 +139,11 @@ namespace Fungus
}
FungusScript fungusScript = command.GetFungusScript();
if (fungusScript == null)
{
return;
}
bool error = false;
string summary = command.GetSummary().Replace("\n", "").Replace("\r", "");
if (summary.Length > 80)

8
Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs

@ -62,7 +62,13 @@ namespace Fungus
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null)
{
GUILayout.Label("No Fungus Script object selected");
GUILayout.Label("No Fungus Script scene object selected");
return;
}
if (PrefabUtility.GetPrefabType(fungusScript) == PrefabType.Prefab)
{
GUILayout.Label("No Fungus Script scene object selected (selected object is a prefab)");
return;
}

4
Assets/Fungus/FungusScript/Editor/SequenceEditor.cs

@ -183,7 +183,7 @@ namespace Fungus
Sequence[] sequences = fungusScript.GetComponentsInChildren<Sequence>();
for (int i = 0; i < sequences.Length; ++i)
{
sequenceNames.Add(new GUIContent(sequences[i].name));
sequenceNames.Add(new GUIContent(sequences[i].sequenceName));
if (sequence == sequences[i])
{
@ -221,7 +221,7 @@ namespace Fungus
Sequence[] sequences = fungusScript.GetComponentsInChildren<Sequence>();
for (int i = 0; i < sequences.Length; ++i)
{
sequenceNames.Add(new GUIContent(sequences[i].name));
sequenceNames.Add(new GUIContent(sequences[i].sequenceName));
if (sequence == sequences[i])
{

7
Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs

@ -85,7 +85,12 @@ namespace Fungus
public void DrawItem(Rect position, int index)
{
Variable variable = this[index].objectReferenceValue as Variable;
if (variable == null)
{
return;
}
float width1 = 100;
float width3 = 50;
float width2 = Mathf.Max(position.width - width1 - width3, 60);

Loading…
Cancel
Save