/// <summary> /// Called every time a node is saved. /// </summary> /// <param name="node"></param> private void ManageNodeSaving(WireNode node) { if (node is SayReplyWireNode) { SayReplyWireNode replyNode = node as SayReplyWireNode; replyNode.ReplyResourcePath = AssetDatabase.GetAssetPath(replyNode.Reply).Replace("Assets/Resources/", "").Replace(".asset", ""); replyNode.TargetResourcePath = AssetDatabase.GetAssetPath(replyNode.Target).Replace("Assets/Resources/", "").Replace(".asset", ""); } else if (node is SetAnimatorVariableWireNode) { SetAnimatorVariableWireNode setVarNode = node as SetAnimatorVariableWireNode; setVarNode.TargetResourcePath = AssetDatabase.GetAssetPath(setVarNode.TargetActor).Replace("Assets/Resources/", "").Replace(".asset", ""); } else if (node is GetAnimatorVariableWireNode) { GetAnimatorVariableWireNode getVarNode = node as GetAnimatorVariableWireNode; getVarNode.TargetResourcePath = AssetDatabase.GetAssetPath(getVarNode.TargetActor).Replace("Assets/Resources/", "").Replace(".asset", ""); } if (node is ISavable) { (node as ISavable).Save(); } if (OnSaveNode != null) { OnSaveNode.Invoke(node); } }
public static SayReplyNodeDisplayer CreateDisplayerFor(SayReplyWireNode node) { SayReplyNodeDisplayer nodeRenderer = new SayReplyNodeDisplayer(node) { WindowRect = new Rect(node.DisplayerPosition.x, node.DisplayerPosition.y, 270, 100) }; return(nodeRenderer); }
private SayReplyNodeDisplayer(SayReplyWireNode node) : base(node) { ReplyField = new ReplyNodeField(this) { FieldName = "Reply" }; ReplyField.FieldValue = node.Reply; ActorField = new ActorIdentifierNodeField(this) { FieldName = "Target" }; ActorField.FieldValue = node.Target; }
public static SayReplyNodeDisplayer CreateSayReplyNodeDisplayer(Vector2 position) { SayReplyWireNode node = new SayReplyWireNode(DialogEditor.Instance.EditingDialog) { NodeName = "Say reply" }; DialogEditor.InitializeNode(ref node); SayReplyNodeDisplayer nodeRenderer = new SayReplyNodeDisplayer(node) { WindowRect = new Rect(position.x, position.y, 270, 100) }; return(nodeRenderer); }
public virtual InterpretationResult InterpretNextNode() { InterpretationResult result = new InterpretationResult() { ResultType = InterpretationResultType.UNDEFINED }; if (lastNodeWasChoice) { (currentExecNode as ChooseReplyWireNode).ChosenOutput = ChosenReply; } lastNodeWasChoice = false; if (atBeginning) // If at beginning, start by getting the node connected to the beginning node { currentExecNode = Dialog.GetBeginning(); result.ResultType = InterpretationResultType.FLOW_NODE; // The dialog beginning is a flow node atBeginning = false; } else { currentExecNode = currentExecNode.GetNextExecutionNode(); } if (currentExecNode == null) { EndOfDialog = true; result.ResultType = InterpretationResultType.END_OF_DIALOG; } if (currentExecNode is IDelayable) { result.Delay = (currentExecNode as IDelayable).GetDelay(); } if (currentExecNode is IProcessable) { (currentExecNode as IProcessable).Process(); } // The next node can only be an execution node if (currentExecNode is SayReplyWireNode) { result.ResultType = InterpretationResultType.SAY_REPLICA; result.Reply = (currentExecNode as SayReplyWireNode).Reply; result.Target = (currentExecNode as SayReplyWireNode).Target; } else if (currentExecNode is BranchWireNode || currentExecNode is ReunionWireNode || currentExecNode is SetVariableValWireNode || currentExecNode is SetTriggerParamValueWireNode || currentExecNode is TriggerScriptWireNode) { result.ResultType = InterpretationResultType.FLOW_NODE; } else if (currentExecNode is ChooseReplyWireNode) { result.ResultType = InterpretationResultType.CHOICE; result.Choice = new Choice(); (currentExecNode as ChooseReplyWireNode).Outputs.ForEach(output => { SayReplyWireNode owner = output.GetConnectedPin().GetOwner() as SayReplyWireNode; if (owner != null) { result.Choice.Choices.Add(owner.Reply); } }); lastNodeWasChoice = true; } return(result); }
public static SayReplyNodeDisplayer CreateDisplayer(this SayReplyWireNode node) { return(SayReplyNodeDisplayer.CreateDisplayerFor(node)); }