예제 #1
0
 // edit here when dialogue data changes
 private void SaveEditorDialogueData(NodeGraphModel model_data)
 {
     // save dialogue data
     m_dialogueAsset.m_assetData += model_data.GetDialogueData().Count + "`";
     foreach (KeyValuePair <int, DialogueData> pair in model_data.GetDialogueData())
     {
         DialogueData dialogue = pair.Value;
         m_dialogueAsset.m_assetData += dialogue.node_id + "`";
         m_dialogueAsset.m_assetData += dialogue.characterName + "`";
         m_dialogueAsset.m_assetData += dialogue.dialogueText + "`";
         m_dialogueAsset.m_assetData += dialogue.previewDialogueText + "`";
         m_dialogueAsset.m_assetData += dialogue.m_isStartNode + "`";
     }
 }
예제 #2
0
    private void PopulateDialogueList(NodeGraphModel model_data)
    {
        m_dialogueAsset.m_dialogueData = new Dictionary <int, DialogueData>();

        foreach (KeyValuePair <int, DialogueData> dialogue_pair in model_data.GetDialogueData())
        {
            List <NextDialogueDataContent> nextData = new List <NextDialogueDataContent>();
            DialogueData dialogue = dialogue_pair.Value;
            // populating next branch ids
            dialogue.m_isBranching      = model_data.GetNodeFromID(dialogue.node_id).m_outputPlugs.Count > 1;
            dialogue.m_nextDialogueData = new List <int>();
            foreach (KeyValuePair <int, Connection> connection_pair in model_data.GetConnections())
            {
                Connection connection = connection_pair.Value;
                if (connection.m_outputNodeId == dialogue.node_id)
                {
                    // adding branching indices
                    DialogueData            next_data       = model_data.GetDataFromNodeID(connection.m_inputNodeId);
                    NextDialogueDataContent nextDataContent = new NextDialogueDataContent();

                    if (next_data.branchingIndex == -1)
                    {
                        Plug outputplug_index = model_data.GetNodeFromID(connection.m_outputNodeId).m_outputPlugs[connection.m_outputPlugId];
                        Debug.Log(outputplug_index.m_plugIndex);
                        next_data.branchingIndex = outputplug_index.m_plugIndex;
                    }

                    nextDataContent.branchingIndex = next_data.branchingIndex;
                    nextDataContent.nextNodeIndex  = connection.m_inputNodeId;
                    nextData.Add(nextDataContent);
                }
            }

            nextData.Sort(delegate(NextDialogueDataContent c1, NextDialogueDataContent c2) { return(c1.branchingIndex.CompareTo(c2.branchingIndex)); });
            foreach (NextDialogueDataContent next_data in nextData)
            {
                dialogue.m_nextDialogueData.Add(next_data.nextNodeIndex);
            }

            // sort the next dialogue data by index;
            m_dialogueAsset.m_dialogueData.Add(dialogue.node_id, dialogue);
        }
    }
예제 #3
0
    private void PopulateDialogueList(NodeGraphModel model_data)
    {
        m_dialogueAsset.m_dialogueData = new Dictionary <int, DialogueData>();

        foreach (KeyValuePair <int, DialogueData> dialogue_pair in model_data.GetDialogueData())
        {
            DialogueData dialogue = dialogue_pair.Value;
            // populating next branch ids
            dialogue.m_isBranching      = model_data.GetNodeFromID(dialogue.node_id).m_outputPlugs.Count > 1;
            dialogue.m_nextDialogueData = new List <int>();
            foreach (KeyValuePair <int, Connection> connection_pair in model_data.GetConnections())
            {
                Connection connection = connection_pair.Value;
                if (connection.m_outputNodeId == dialogue.node_id)
                {
                    dialogue.m_nextDialogueData.Add(connection.m_inputNodeId);
                }
            }
            m_dialogueAsset.m_dialogueData.Add(dialogue.node_id, dialogue);
        }
    }