Example #1
0
 /// <summary>
 /// 取消主、子任务间的链接
 /// </summary>
 /// <param name="subTask">子任务</param>
 /// <param name="mainTask">主任务</param>
 private void _CancelMainTask(GKToySubTask subTask, GKToyTask mainTask)
 {
     mainTask.subTasks.Remove(subTask.id);
     subTask.ChangeTaskID(subTask.id);
     foreach (Link link in subTask.links)
     {
         if (CurRenderData.nodeLst.ContainsKey(link.next) && ((GKToyNode)CurRenderData.nodeLst[link.next]).className.Contains("GKToyTaskEditor.GKToySubTask"))
         {
             _CancelMainTask(((GKToySubTask)CurRenderData.nodeLst[link.next]), mainTask);
         }
     }
 }
Example #2
0
 /// <summary>
 /// 给子任务设置主任务节点
 /// </summary>
 /// <param name="subTask">子任务节点</param>
 /// <param name="mainTask">主任务节点,留空则最后一个节点</param>
 /// <returns>子任务编号</returns>
 private void _SetMainTask(GKToySubTask subTask, GKToyTask mainTask)
 {
     if (null != mainTask)
     {
         subTask.subId        = mainTask.subTasks.Count + 1;
         subTask.mainTask     = mainTask.id;
         subTask.initTargetId = mainTask.LiteralId * 10000 + subTask.type * 1000 + subTask.subId;
         subTask.ChangeTaskID(subTask.initTargetId);
         mainTask.subTasks.Add(subTask.id);
     }
     else
     {
         subTask.subId = -1;
     }
     foreach (Link link in subTask.links)
     {
         if (CurRenderData.nodeLst.ContainsKey(link.next) && ((GKToyNode)CurRenderData.nodeLst[link.next]).className.Contains("GKToyTaskEditor.GKToySubTask"))
         {
             _SetMainTask(((GKToySubTask)CurRenderData.nodeLst[link.next]), mainTask);
         }
     }
 }
Example #3
0
 protected override void _CreateNode(GKToyNode node)
 {
     base._CreateNode(node);
     if ("GKToyTaskEditor.GKToyTask" == node.className)
     {
         GKToyTask taskNode = (GKToyTask)node;
         taskNode.initTaskId      = CurRenderData.curLiteralId++;
         taskNode.TaskID          = taskNode.initTaskId;
         taskNode.AcceptDfgObject = _CreateDialogueData(string.Format("{0}/TaskDfg/", ToyMakerBase._defaultOverlordPath), taskNode.TaskID.Value, "AcceptDfg");
         taskNode.SubmitDfgObject = _CreateDialogueData(string.Format("{0}/TaskDfg/", ToyMakerBase._defaultOverlordPath), taskNode.TaskID.Value, "SubmitDfg");
         AssetDatabase.Refresh();
     }
     else if (node.className.Contains("GKToyTaskEditor.GKToySubTask"))
     {
         GKToySubTask taskNode = (GKToySubTask)node;
         if ("GKToyTaskEditor.GKToySubTaskInteract" == node.className)
         {
             ((GKToySubTaskInteract)taskNode).InteractDfgObject = _CreateDialogueData(string.Format("{0}/TaskDfg/", ToyMakerBase._defaultOverlordPath), taskNode.TargetID.Value, "Interact");
             AssetDatabase.Refresh();
         }
     }
 }