FunWaitNode.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Collections.Generic;
  2. using IwbZero.Expr;
  3. using WeEngine.Enum;
  4. namespace WeEngine.Functions
  5. {
  6. /// <summary>
  7. /// 等待节点
  8. /// </summary>
  9. public class FunWaitNode : RunTimeBase, IFunction
  10. {
  11. public string Invoke(ExprObject exprObj)
  12. {
  13. ExprObject child = exprObj.GetChild(0), child2 = exprObj.GetChild(2), child3 = exprObj.GetChild(4);
  14. GetPackage(child.Expr);
  15. if (child3==null)
  16. {
  17. return "FALSE";
  18. }
  19. var waitNode = Rp.GetNodeByPath(child3.Expr);
  20. if (waitNode == null)
  21. {
  22. return "FALSE";
  23. }
  24. if (waitNode.NodeState == NodeState.RunEnd || waitNode.NodeState == NodeState.Complete)
  25. {
  26. var child4 = exprObj.GetChild(6);
  27. return child4 != null ? ExprModule.Evaluate(child4.Expr) : "TRUE";
  28. }
  29. var node = Rp.GetNodeByPath(child2.Expr);
  30. if (Rp.WaitForRunNode.ContainsKey(waitNode.Id))
  31. {
  32. Rp.WaitForRunNode[waitNode.Id].Add(node.Id);
  33. }
  34. else
  35. {
  36. Rp.WaitForRunNode[waitNode.Id] = new List<string>() {node.Id};
  37. }
  38. return "FALSE";
  39. }
  40. }
  41. }