private void CreateUIOptions() { // Display new options if (m_currentSpeech.ConnectionType == Connection.eConnectionType.Option) { for (int i = 0; i < m_currentSpeech.Connections.Count; i++) { OptionConnection connection = m_currentSpeech.Connections[i] as OptionConnection; if (ConditionsMet(connection)) { UIConversationButton uiOption = CreateButton(); uiOption.SetupButton(UIConversationButton.eButtonType.Option, connection.OptionNode); } } } // Display Continue/End options else { bool notAutoAdvance = !m_currentSpeech.AutomaticallyAdvance; bool allowVisibleOptionWithAuto = (m_currentSpeech.AutomaticallyAdvance && m_currentSpeech.AutoAdvanceShouldDisplayOption); if (notAutoAdvance || allowVisibleOptionWithAuto) { if (m_currentSpeech.ConnectionType == Connection.eConnectionType.Speech) { UIConversationButton uiOption = CreateButton(); SpeechNode next = GetValidSpeechOfNode(m_currentSpeech); // If there was no valid speech node (due to no conditions being met) this becomes a None button type if (next == null) { uiOption.SetupButton(UIConversationButton.eButtonType.End, null, endFont: m_conversation.EndConversationFont); } // Else, valid speech node found else { uiOption.SetupButton(UIConversationButton.eButtonType.Speech, next, continueFont: m_conversation.ContinueFont); } } else if (m_currentSpeech.ConnectionType == Connection.eConnectionType.None) { UIConversationButton uiOption = CreateButton(); uiOption.SetupButton(UIConversationButton.eButtonType.End, null, endFont: m_conversation.EndConversationFont); } } } SetSelectedOption(0); // Set the button sprite and alpha for (int i = 0; i < m_uiOptions.Count; i++) { m_uiOptions[i].SetImage(OptionImage, OptionImageSliced); m_uiOptions[i].SetAlpha(0); m_uiOptions[i].gameObject.SetActive(false); } }
private void ReconstructTree(EditableConversation ec, Conversation conversation, Dictionary <int, SpeechNode> dialogues, Dictionary <int, OptionNode> options) { // Speech nodes List <EditableSpeechNode> editableSpeechNodes = ec.SpeechNodes; for (int i = 0; i < editableSpeechNodes.Count; i++) { EditableSpeechNode editableNode = editableSpeechNodes[i]; SpeechNode speechNode = dialogues[editableNode.ID]; // Connections List <EditableConnection> editableConnections = editableNode.Connections; for (int j = 0; j < editableConnections.Count; j++) { int childID = editableConnections[j].NodeUID; // Construct node->Speech if (editableConnections[j].ConnectionType == EditableConnection.eConnectiontype.Speech) { SpeechConnection connection = new SpeechConnection(dialogues[childID]); CopyConnectionConditions(editableConnections[j], connection); speechNode.Connections.Add(connection); } // Construct node->Option else if (editableConnections[j].ConnectionType == EditableConnection.eConnectiontype.Option) { OptionConnection connection = new OptionConnection(options[childID]); CopyConnectionConditions(editableConnections[j], connection); speechNode.Connections.Add(connection); } } // Root? if (editableNode.EditorInfo.isRoot) { conversation.Root = dialogues[editableNode.ID]; } } // Option nodes List <EditableOptionNode> editableOptionNodes = ec.Options; for (int i = 0; i < editableOptionNodes.Count; i++) { EditableOptionNode editableNode = editableOptionNodes[i]; OptionNode optionNode = options[editableNode.ID]; // Connections List <EditableConnection> editableConnections = editableNode.Connections; for (int j = 0; j < editableConnections.Count; j++) { int childID = editableConnections[j].NodeUID; // Construct node->Speech if (editableConnections[j].ConnectionType == EditableConnection.eConnectiontype.Speech) { SpeechConnection connection = new SpeechConnection(dialogues[childID]); CopyConnectionConditions(editableConnections[j], connection); optionNode.Connections.Add(connection); } } } }