Browse Source

VariableField now takes a filter lambda function

master
chrisgregan 11 years ago
parent
commit
9f3f9bae2d
  1. 12
      Assets/Fungus/Editor/FungusScript/SequenceEditor.cs
  2. 1
      Assets/Fungus/Editor/FungusScript/SetVariableEditor.cs
  3. BIN
      Assets/Shuttle/ShuttleGame.unity

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

@ -1,5 +1,6 @@
using UnityEditor;
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
@ -47,7 +48,7 @@ namespace Fungus.Script
return result;
}
static public string VariableField(GUIContent label, FungusScript fungusScript, string variableKey, ref VariableType variableType)
static public string VariableField(GUIContent label, FungusScript fungusScript, string variableKey, ref VariableType variableType, Func<Variable, bool> filter = null)
{
List<string> keys = new List<string>();
keys.Add("<None>");
@ -55,6 +56,15 @@ namespace Fungus.Script
for (int i = 0; i < fungusScript.variables.Count; ++i)
{
Variable v = fungusScript.variables[i];
if (filter != null)
{
if (!filter(v))
{
continue;
}
}
keys.Add(v.key);
if (v.key == variableKey &&
index == 0)

1
Assets/Fungus/Editor/FungusScript/SetVariableEditor.cs

@ -24,6 +24,7 @@ namespace Fungus.Script
fungusScript,
t.variableKey,
ref variableType);
if (variableKey != t.variableKey)
{

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save