Esempio n. 1
0
 public DialogueOption(string text, DialogueNode dest, DialogueCommand command, DialogueTree dialogueTree)
 {
     this.text    = text;
     this.dest    = dest;
     this.command = command;
     origin       = dialogueTree.CurrentNode;
     dialogueTree.AddOption(this);
 }
Esempio n. 2
0
 public DialogueOption(string text, DialogueNode dest, DialogueTree dialogueTree)
 {
     this.text = text;
     this.dest = dest;
     command   = new DialogueCommand(null, DialogOrder.none);
     origin    = dialogueTree.CurrentNode;
     dialogueTree.AddOption(this);
 }
Esempio n. 3
0
    /// <summary>
    /// 继续对话
    /// </summary>
    public void ContinueDialogue()
    {
        currentContent = DialogueCommand.GetNextContent();

        if (currentContent == null)
        {
            Debug.Log("聊天结束");
        }

        StartCoroutine(PrintImformation(currentContent));
    }
Esempio n. 4
0
 /// <summary>
 /// 初始化对话命令的预制体
 /// </summary>
 private void InitializeDialogueCommandPrefab()
 {
     if (dialogueCommandPrefab == null)
     {
         Entities.ForEach((DialogueCommand dialogueCommand) =>
         {
             dialogueCommandPrefab = dialogueCommand;
             dialogueCommand.gameObject.SetActive(false);
         });
     }
 }
Esempio n. 5
0
 //工作函数
 /// <summary>
 /// 捕获语料库命令生成最终对话命令
 /// </summary>
 private void CorpusJob()
 {
     Entities.ForEach((CorpusCommand corpusCommand) =>
     {
         DialogueCommand dialogueCommand = Object.Instantiate(dialogueCommandPrefab);
         dialogueCommand.origin          = corpusCommand.origin;
         dialogueCommand.target          = corpusCommand.target;
         dialogueCommand.content         = GetProperSentence(corpusCommand.tags);
         dialogueCommand.gameObject.SetActive(true);
         Object.Destroy(corpusCommand.gameObject);
         Debug.Log("捕获语料库预制体成功,生成最终对话命令");
     });
 }
Esempio n. 6
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (!DialogueUI.activeSelf)
         {
             DialogueUI.SetActive(true);
             DialogueCommand.play(1, 1);
         }
         else
         {
             DialgueInfo.DialgueInfos.IsNext = true;
         }
     }
 }
Esempio n. 7
0
    private TextAnimInfo[] SeparateOutTextAnimInfo(List <DialogueCommand> commands)
    {
        List <TextAnimInfo>    tempResult        = new List <TextAnimInfo>();
        List <DialogueCommand> animStartCommands = new List <DialogueCommand>();
        List <DialogueCommand> animEndCommands   = new List <DialogueCommand>();

        for (int i = 0; i < commands.Count; i++)
        {
            DialogueCommand command = commands[i];
            if (command.type == DialogueCommandType.AnimStart)
            {
                animStartCommands.Add(command);
                commands.RemoveAt(i);
                i--;
            }
            else if (command.type == DialogueCommandType.AnimEnd)
            {
                animEndCommands.Add(command);
                commands.RemoveAt(i);
                i--;
            }
        }
        if (animStartCommands.Count != animEndCommands.Count)
        {
            Debug.LogError("Unequal number of start and end animation commands. Start Commands: " + animStartCommands.Count + " End Commands: " + animEndCommands.Count);
        }
        else
        {
            for (int i = 0; i < animStartCommands.Count; i++)
            {
                DialogueCommand startCommand = animStartCommands[i];
                DialogueCommand endCommand   = animEndCommands[i];
                tempResult.Add(new TextAnimInfo {
                    startIndex = startCommand.position,
                    endIndex   = endCommand.position,
                    type       = startCommand.textAnimValue
                });
            }
        }
        return(tempResult.ToArray());
    }
Esempio n. 8
0
    private void ExecuteCommandsForCurrentIndex(List <DialogueCommand> commands, int visableCharacterIndex, ref float secondsPerCharacter, ref float timeOfLastCharacter)
    {
        for (int i = 0; i < commands.Count; i++)
        {
            DialogueCommand command = commands[i];
            if (command.position == visableCharacterIndex)
            {
                switch (command.type)
                {
                case DialogueCommandType.Pause:
                    timeOfLastCharacter = Time.unscaledTime + command.floatValue;
                    break;

                case DialogueCommandType.TextSpeedChange:
                    secondsPerCharacter = 1f / command.floatValue;
                    break;
                }
                commands.RemoveAt(i);
                i--;
            }
        }
    }
Esempio n. 9
0
    static void BroadcastDialogueCmd(this string strippedLine, out bool wait)
    {
        wait = false;
        string[] segments = strippedLine.Split(CommandArgSeperator);
        if (segments.CollectionIsNotNullOrEmpty())
        {
            if (segments[0].Equals("GET"))
            {
                wait = true;
            }

            if (segments[0].Equals("SET"))
            {
                DialogueCommand.BroadcastEvent(strippedLine, new DialogueCommandArgs
                {
                    obj     = segments[1],
                    setting = segments[2],
                    value   = segments[3]
                });
            }
        }
    }
Esempio n. 10
0
    public void CreateCommand()
    {
        DialogueCommand cmd = Object.Instantiate(dialogueCommandPrefab);

        cmd.gameObject.SetActive(true);
    }
 /// <summary>
 // This method is executed when using this.Publish(new DialogueCommand())
 /// </summary>
 public virtual void DialogueCommandHandler(DialogueCommand data) {
     // Process the commands information.  Also, you can publish new events by using the line below.
     // this.Publish(new AnotherEvent())
 }
Esempio n. 12
0
 /// <summary>
 /// 是否有下一句对话,有就返回true,没有显示false
 /// </summary>
 public bool HaveNextStatement()
 {
     return(DialogueCommand.HaveNextContent());
 }
	public void ShowDialogue(DialogueCommand DialogueData){
		//var uiItem = Instantiate (RPGPrefab) as GameObject;

		DialogueManager.StartConversation(DialogueData.ConversationName);
	}
    public override void DialogueCommandHandler(DialogueCommand data) {
        base.DialogueCommandHandler(data);
        // Process the commands information.  Also, you can publish new events by using the line below.
        // this.Publish(new AnotherEvent())
		ShowDialogue(data);
    }