/// <summary> /// 为当前动作创建一个副本 /// </summary> /// <param name="pureClone">是否保留关系</param> /// <returns>原动作的深拷贝副本</returns> public SceneAction Clone(bool pureClone) { SceneAction resSa = new SceneAction { ArgsDict = new Dictionary <string, string>() }; foreach (var kv in this.ArgsDict) { resSa.ArgsDict.Add(kv.Key, kv.Value); } resSa.Tag = this.Tag; resSa.Type = this.Type; resSa.ReliedFuncName = this.ReliedFuncName; resSa.IsBelongFunc = this.IsBelongFunc; resSa.NodeName = this.NodeName; if (pureClone) { return(resSa); } resSa.CondPolish = this.CondPolish; resSa.Next = this.Next; resSa.NodeName = this.NodeName; resSa.TrueRouting = new List <SceneAction>(); foreach (var tr in this.TrueRouting) { resSa.TrueRouting.Add(tr); } resSa.FalseRouting = new List <SceneAction>(); foreach (var fr in this.FalseRouting) { resSa.FalseRouting.Add(fr); } return(resSa); }
/// <summary> /// 构造器 /// </summary> public SceneFunction(string callname, string parent, SceneAction sa = null) { this.Ctor = sa; this.Callname = callname; this.ParentSceneName = parent; this.Symbols = new Dictionary <string, object>(); this.LabelDictionary = new Dictionary <string, SceneAction>(); }
/// <summary> /// 构造器 /// </summary> /// <param name="scenario">场景名称</param> /// <param name="mainSa">构造序列</param> /// <param name="funcVec">函数向量</param> /// <param name="labelDict">标签指针字典</param> public Scene(string scenario, SceneAction mainSa, List <SceneFunction> funcVec, Dictionary <string, SceneAction> labelDict) { this.Scenario = scenario; this.Ctor = mainSa; this.FuncContainer = funcVec; this.LabelDictionary = labelDict; this.ParallellerContainer = new List <SceneFunction>(); var paraC = from t in this.FuncContainer where t.Callname.StartsWith("sync_", StringComparison.CurrentCultureIgnoreCase) select t; this.ParallellerContainer.AddRange(paraC); }