public void OnGUI() { GUILayout.Label("Dialogue Creator", EditorStyles.largeLabel); if (GUILayout.Button("New Dialogue")) { dialogueCollection = new DialogueCollection(); } if (GUILayout.Button("Save data")) { SaveDialogue(); } if (GUILayout.Button("Load data")) { LoadDialogue(); } if (dialogueCollection != null) { SerializedObject serializedObject = new SerializedObject(this); SerializedProperty serializedProperty = serializedObject.FindProperty("dialogueCollection"); EditorGUILayout.PropertyField(serializedProperty, true); serializedObject.ApplyModifiedProperties(); } }
// Use this for initialization public void Generate() { string file = Path.Combine(Application.streamingAssetsPath, "test.json"); // string file = "Assets/StreamingAssets/test.json"; dialogues = new DialogueCollection(1); entry.ResetValues(); LoadDialogue(file); GenerateDialogueEntry(); }
void setUP() { //load Quests database questContainer = loadQuest(); Debug.Log(questContainer.currentQuest); //load dialogue database dialogueCollection = loadDialogue(); Debug.Log(dialogueCollection.dialogueArray[0]); //call the spawner to create the npcs for the begining of the game NPCsCaching(questContainer.questCollection[0].stateArray[0].LinkedActor); }
void LoadDialogue(string filename) { if (File.Exists(filename)) { string dataAsJson = File.ReadAllText(filename); dialogues = JsonUtility.FromJson <DialogueCollection>(dataAsJson); Debug.Log("Number of dialogues: " + dialogues.dialogues.Length); } else { Debug.LogError("Could not open file: " + filename); } }
public void LoadDialogue() { string filePath = EditorUtility.OpenFilePanel( "Load Dialogue File", Application.dataPath + dialoguePath, "json"); if (string.IsNullOrEmpty(filePath)) { return; } if (File.Exists(filePath)) { string jsonString = File.ReadAllText(filePath); dialogueCollection = JsonUtility.FromJson <DialogueCollection>(jsonString); } else { dialogueCollection = new DialogueCollection(); } }
public static DialogueNode[] Import(TextAsset json) { DialogueCollection collection = JsonUtility.FromJson <DialogueCollection>(json.text); return(collection.dialogueNodes); }
public EventDialogue() { QuestManager questManager = GameObject.Find("QuestTable").GetComponent <QuestManager>(); _dialogueCollection = questManager.dialogueCollection; }