public List <VMPieMenuInteraction> GetPieMenu(VM vm,VMEntity caller)
{
var pie = new List <VMPieMenuInteraction>();
if (TreeTable == null)
{
return(pie);
}
for (int i = 0; i < TreeTable.Interactions.Length; i++)
{
var action = TreeTable.Interactions[i];
var actionStrings = new List <VMPieMenuInteraction>();
bool CanRun = false;
if (action.TestFunction != 0 && (((TTABFlags)action.Flags & TTABFlags.Debug) != TTABFlags.Debug))
{
caller.ObjectData[(int)VMStackObjectVariable.HideInteraction] = 0;
var Behavior = GetBHAVWithOwner(action.TestFunction,vm.Context);
CanRun = (VMThread.EvaluateCheck(vm.Context,caller,new VMQueuedAction()
{
Callee = this,
CodeOwner = Behavior.owner,
StackObject = this,
Routine = vm.Assemble(Behavior.bhav),
},actionStrings) == VMPrimitiveExitCode.RETURN_TRUE);
if (caller.ObjectData[(int)VMStackObjectVariable.HideInteraction] == 1)
{
CanRun = false;
}
}
else
{
CanRun = true;
}
if (CanRun)
{
if (actionStrings.Count > 0)
{
foreach (var actionS in actionStrings)
{
actionS.ID = (byte)action.TTAIndex;
pie.Add(actionS);
}
}
else
{
if (TreeTableStrings != null)
{
pie.Add(new VMPieMenuInteraction()
{
Name = TreeTableStrings.GetString((int)action.TTAIndex),
ID = (byte)action.TTAIndex
});
}
}
}
}
return(pie);
}