Пример #1
0
 public ConversationLink(Conversation conversation, FlowChartLink link)
 {
     Conversation = conversation;
     Link         = link;
 }
Пример #2
0
 public ConversationLink(Conversation conversation, int fromNodeID, int toNodeID)
     : this(conversation, new FlowChartLink(fromNodeID, toNodeID))
 {
 }
Пример #3
0
        private static void PrintNode(Conversation conversation, FlowChartLink parentLink, bool playAudio)
        {
            FlowChartNode node            = conversation.Nodes[parentLink.ToNodeID];
            var           dialogueNode    = node as DialogueNode;
            bool          keepParentBrief = (parentLink.PointsToGhost && dialogueNode != null && dialogueNode.IsQuestionNode);
            FlowChartNode briefNode       = (keepParentBrief ? conversation.Nodes[parentLink.FromNodeID] : node);

            Console.WriteLine("{0}", briefNode.GetBrief());

            FileInfo audioFile = ResourceLocator.FindVocalization(conversation.Tag, briefNode.NodeID);

            if (audioFile != null)
            {
                Console.Write("[audio] ");
            }

            StringTable.Entry text = conversation.FindText(briefNode.NodeID);
            if (text != null)
            {
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("{0}", text.Format());
                Console.ForegroundColor = ConsoleColor.Gray;
            }
            Console.WriteLine("\n\n");

            if (node.Links.Count + node.ChildIDs.Count == 0)
            {
                if (node is TriggerConversationNode)
                {
                    Console.WriteLine("(End. Hit BACKSPACE to rewind or ENTER to load target conversation)");
                }
                else if (node.ContainerNodeID != -1)
                {
                    Console.WriteLine("(Hit BACKSPACE to rewind into container node)");
                }
                else
                {
                    Console.WriteLine("(End. Hit BACKSPACE to rewind)");
                }
            }
            else
            {
                for (int i = 0; i < node.Links.Count + node.ChildIDs.Count; i++)
                {
                    FlowChartNode targetNode;
                    bool          pointsToGhost = false;

                    if (i < node.Links.Count)
                    {
                        FlowChartLink link = node.Links[i];
                        pointsToGhost = link.PointsToGhost;
                        targetNode    = conversation.FindNode(link.ToNodeID);
                        Console.Write("({0}) {1} -> {2}", i + 1, link.GetBrief(), targetNode.GetBrief());
                    }
                    else
                    {
                        targetNode = conversation.FindNode(node.ChildIDs[i - node.Links.Count]);
                        Console.Write("({0}) [ child ] -> {1}", i + 1, targetNode.GetBrief());
                    }

                    if (targetNode is PlayerResponseNode && targetNode.Links.Count == 1)
                    {
                        Console.WriteLine(" -> {0}", conversation.FindNode(targetNode.Links[0].ToNodeID).GetBrief());
                    }
                    else
                    {
                        Console.WriteLine();
                    }

                    string condition = targetNode.Conditionals.Format();
                    if (condition.Length > 0)
                    {
                        Console.WriteLine("  if : {0}", condition);
                    }
                    foreach (var script in targetNode.OnEnterScripts)
                    {
                        Console.WriteLine("  on enter  : {0}", script.Format());
                    }
                    foreach (var script in targetNode.OnExitScripts)
                    {
                        Console.WriteLine("  on exit   : {0}", script.Format());
                    }
                    foreach (var script in targetNode.OnUpdateScripts)
                    {
                        Console.WriteLine("  on update : {0}", script.Format());
                    }

                    if (!pointsToGhost)
                    {
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    if (node.Links.Count + node.ChildIDs.Count == 1)
                    {
                        Console.WriteLine("[continue]");
                    }
                    else
                    {
                        if (ResourceLocator.FindVocalization(conversation.Tag, targetNode.NodeID) != null)
                        {
                            Console.Write("[audio] ");
                        }
                        text = conversation.FindText(targetNode.NodeID);
                        Console.WriteLine(text.Format());
                    }
                    if (!pointsToGhost)
                    {
                        Console.ForegroundColor = ConsoleColor.Gray;
                    }
                    Console.WriteLine("\n");
                }
            }

            if ((audioFile != null) && playAudio && (briefNode == node))
            {
                AudioServer.Play(audioFile);
            }
        }