Browse Source

Add Block and command switching during playback

master
Inari Zushi 9 years ago committed by lmb
parent
commit
313b286b01
  1. 23
      Assets/Fungus/Flowchart/Editor/BlockEditor.cs

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

@ -774,7 +774,7 @@ namespace Fungus
showCut = true; showCut = true;
showCopy = true; showCopy = true;
showDelete = true; showDelete = true;
if (flowchart.selectedCommands.Count == 1) if (flowchart.selectedCommands.Count == 1 && Application.isPlaying)
{ {
showPlay = true; showPlay = true;
} }
@ -836,7 +836,7 @@ namespace Fungus
commandMenu.AddDisabledItem(new GUIContent("Play from Selected Command")); commandMenu.AddDisabledItem(new GUIContent("Play from Selected Command"));
} }
commandMenu.AddSeparator(""); commandMenu.AddSeparator("");
commandMenu.AddItem (new GUIContent ("Select All"), false, SelectAll); commandMenu.AddItem (new GUIContent ("Select All"), false, SelectAll);
commandMenu.AddItem (new GUIContent ("Select None"), false, SelectNone); commandMenu.AddItem (new GUIContent ("Select None"), false, SelectNone);
@ -1024,10 +1024,23 @@ namespace Fungus
protected void PlayCommand() protected void PlayCommand()
{ {
Block block = target as Block; Block targetBlock = target as Block;
Flowchart flowchart = block.GetFlowchart(); Flowchart flowchart = targetBlock.GetFlowchart();
Command command = flowchart.selectedCommands[0]; Command command = flowchart.selectedCommands[0];
//block.Execute(null, command.commandIndex); targetBlock.jumpToCommandIndex = command.commandIndex;
if (!targetBlock.IsExecuting())
{
Block[] blocks = flowchart.GetComponentsInChildren<Block>(true);
foreach (Block b in blocks)
{
if (b.IsExecuting())
{
b.Stop();
}
}
flowchart.ExecuteBlock(targetBlock.blockName);
}
} }
protected void SelectPrevious() protected void SelectPrevious()

Loading…
Cancel
Save