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); }
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); }
/// <summary> /// 继续对话 /// </summary> public void ContinueDialogue() { currentContent = DialogueCommand.GetNextContent(); if (currentContent == null) { Debug.Log("聊天结束"); } StartCoroutine(PrintImformation(currentContent)); }
/// <summary> /// 初始化对话命令的预制体 /// </summary> private void InitializeDialogueCommandPrefab() { if (dialogueCommandPrefab == null) { Entities.ForEach((DialogueCommand dialogueCommand) => { dialogueCommandPrefab = dialogueCommand; dialogueCommand.gameObject.SetActive(false); }); } }
//工作函数 /// <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("捕获语料库预制体成功,生成最终对话命令"); }); }
// 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; } } }
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()); }
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--; } } }
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] }); } } }
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()) }
/// <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); }