Browse Source

Can filter the list of supported commands by subclassing Flowchart

master
chrisgregan 10 years ago
parent
commit
9304dc54ac
  1. 6
      Assets/Fungus/Flowchart/Editor/BlockEditor.cs
  2. 5
      Assets/Fungus/Flowchart/Editor/FlowchartWindow.cs
  3. 8
      Assets/Fungus/Flowchart/Scripts/Flowchart.cs

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

@ -674,6 +674,12 @@ namespace Fungus
foreach(var keyPair in filteredAttributes)
{
// Skip command type if the Flowchart doesn't support it
if (!flowchart.IsCommandSupported(keyPair.Value))
{
continue;
}
AddCommandOperation commandOperation = new AddCommandOperation();
commandOperation.block = block;

5
Assets/Fungus/Flowchart/Editor/FlowchartWindow.cs

@ -523,6 +523,11 @@ namespace Fungus
Block block = windowBlockMap[windowId];
Flowchart flowchart = block.GetFlowchart();
if (flowchart == null)
{
return;
}
// Select block when node is clicked
if (Event.current.button == 0 &&
Event.current.type == EventType.MouseDown &&

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

@ -838,6 +838,14 @@ namespace Fungus
}
}
/**
* Override this in a Flowchart subclass to filter which commands are shown in the Add Command list.
*/
public virtual bool IsCommandSupported(CommandInfoAttribute commandInfo)
{
return true;
}
public virtual string SubstituteVariables(string text)
{
string subbedText = text;

Loading…
Cancel
Save