private static void ConvertConversations(PixelCrushers.DialogueSystem.ChatMapper.ChatMapperProject chatMapperProject, DialogueDatabase database) { database.conversations = new List<Conversation>(); foreach (var chatMapperConversation in chatMapperProject.Assets.Conversations) { Conversation conversation = new Conversation(chatMapperConversation); SetConversationStartCutsceneToNone(conversation); foreach (DialogueEntry entry in conversation.dialogueEntries) { foreach (Link link in entry.outgoingLinks) { if (link.destinationConversationID == 0) link.destinationConversationID = conversation.id; if (link.originConversationID == 0) link.originConversationID = conversation.id; } } database.conversations.Add(conversation); } }
/// <summary> /// Appends a conversation's dialog table to a saved-game string. To conserve space, this method only /// records each dialogue entry's SimStatus (whether the entry has been offered to the player, or /// been spoken by a character). /// </summary> private static void AppendDialogData(StringBuilder sb, Conversation conversation) { if (conversation == null) return; try { sb.AppendFormat("Conversation[{0}].Dialog = {{ ", conversation.id); foreach (var entry in conversation.dialogueEntries) { var simStatus = Lua.Run(string.Format("return Conversation[" + conversation.id + "].Dialog[" + entry.id + "].SimStatus"), false, false).AsString; sb.AppendFormat("[{0}]={{SimStatus=\"{1}\"}},", new System.Object[] { entry.id, simStatus }); } sb.Append("}; "); } catch (System.Exception e) { Debug.LogError(string.Format("{0}: GetSaveData() failed to get conversation data: {1}", new System.Object[] { DialogueDebug.Prefix, e.Message })); } }
public Conversation(Conversation sourceConversation) : base(sourceConversation as Asset) { this.nodeColor = sourceConversation.nodeColor; this.dialogueEntries = CopyDialogueEntries(sourceConversation.dialogueEntries); }
private void CopyConversation() { int oldID = currentConversation.id; int newID = GetAvailableConversationID(); var copy = new Conversation(currentConversation); copy.id = newID; copy.Title = copy.Title + " Copy"; foreach (var entry in copy.dialogueEntries) { entry.conversationID = newID; foreach (var link in entry.outgoingLinks) { if (link.originConversationID == oldID) link.originConversationID = newID; if (link.destinationConversationID == oldID) link.destinationConversationID = newID; } } database.conversations.Add(copy); SetCurrentConversation(copy); //currentConversation = copy; ActivateNodeEditorMode(); }
private static void SetConversationStartCutsceneToNone(Conversation conversation) { DialogueEntry entry = conversation.GetFirstDialogueEntry(); if (entry == null) { if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Conversation '{1}' doesn't have a START dialogue entry.", new System.Object[] { DialogueDebug.Prefix, conversation.Title })); } else { if (string.IsNullOrEmpty(entry.Sequence)) { if (Field.FieldExists(entry.fields, "Sequence")) { entry.Sequence = "None()"; } else { entry.fields.Add(new Field("Sequence", "None()", FieldType.Text)); } } } }
private void ConvertAudioFilesToSequences(Conversation conversation) { if (conversation == null || conversation.dialogueEntries == null) return; foreach (var entry in conversation.dialogueEntries) { var audioFiles = entry.AudioFiles; if (!(string.IsNullOrEmpty(audioFiles) || string.Equals("[]", audioFiles))) { var audioClipName = audioFiles.Substring(1, audioFiles.IndexOfAny(new char[] { ';', ']' }) - 1); audioClipName = audioClipName.Substring(0, audioClipName.LastIndexOf('.')); audioClipName = audioClipName.Replace("\\", "/"); entry.Sequence = string.Format("AudioWait({0}); {1}", audioClipName, entry.Sequence); } } }
private void ConvertConversations(PixelCrushers.DialogueSystem.ChatMapper.ChatMapperProject chatMapperProject, DialogueDatabase database) { database.conversations = new List<Conversation>(); foreach (var chatMapperConversation in chatMapperProject.Assets.Conversations) { Conversation conversation = new Conversation(chatMapperConversation); SetConversationStartCutsceneToNone(conversation); ConvertAudioFilesToSequences(conversation); database.conversations.Add(conversation); } }
private void SetParticipants(Conversation conversation, Transform actor, Transform conversant) { actorInfo = GetCharacterInfo(conversation.ActorID, actor); conversantInfo = GetCharacterInfo(conversation.ConversantID, conversant); DialogueLua.SetParticipants(actorInfo.Name, conversantInfo.Name); }
public Conversation(Conversation sourceConversation) : base(sourceConversation as Asset) { this.nodeColor = sourceConversation.nodeColor; this.overrideSettings = sourceConversation.overrideSettings; this.dialogueEntries = CopyDialogueEntries(sourceConversation.dialogueEntries); }
/// <summary> /// Gets a dialogue entry by its conversation and dialogue entry IDs. /// </summary> /// <returns>The dialogue entry.</returns> /// <param name="conversationID">Conversation ID.</param> /// <param name="dialogueEntryID">Dialogue entry ID.</param> public DialogueEntry GetDialogueEntry(int conversationID, int dialogueEntryID) { Conversation conversation = GetConversation(conversationID); return((conversation != null) ? conversation.GetDialogueEntry(dialogueEntryID) : null); }
/// <summary> /// Adds a Conversation to the database. /// </summary> /// <param name='conversation'> /// The conversation to add. /// </param> public void AddConversation(Conversation conversation) { conversations.Add(conversation); LinkTools.SortOutgoingLinks(this, conversation); }
private static void MergeConversations(DialogueDatabase destination, DialogueDatabase source, NewIDs newIDs) { foreach (var conversation in source.conversations) { if (newIDs.conversation.ContainsKey(conversation.id)) { Conversation newConversation = new Conversation(conversation); newConversation.id = newIDs.conversation[conversation.id]; ConvertFieldIDs(newConversation.fields, newIDs); foreach (DialogueEntry newEntry in newConversation.dialogueEntries) { newEntry.conversationID = newConversation.id; foreach (var newLink in newEntry.outgoingLinks) { if (newIDs.conversation.ContainsKey(newLink.originConversationID)) newLink.originConversationID = newIDs.conversation[newLink.originConversationID]; if (newIDs.conversation.ContainsKey(newLink.destinationConversationID)) newLink.destinationConversationID = newIDs.conversation[newLink.destinationConversationID]; } } destination.conversations.Add(newConversation); } } }
/// <summary> /// Gets the entrytaglocal string (localized version) of a dialogue entry. /// </summary> /// <param name="conversation">Dialogue entry's conversation.</param> /// <param name="entry">Dialogue entry.</param> /// <param name="entrytagFormat">Entrytag format.</param> /// <returns>Localized entrytag.</returns> public string GetEntrytaglocal(Conversation conversation, DialogueEntry entry, EntrytagFormat entrytagFormat) { return(GetEntrytag(conversation, entry, entrytagFormat) + "_" + Localization.language); }
public Conversation CreateConversation(int id, string title) { Conversation conversation = new Conversation(); conversation.id = id; conversation.fields = CreateFields(conversationFields); conversation.Title = title; return conversation; }