예제 #1
0
 //starting event should stop map controller from moving
 //combat should also stop map movement
 public void StartEvent(EventDialogue e)
 {
     currentEvent = e;
     gameObject.SetActive(true);
     characterSelection.Init(state.ally);
     text.ClearDialogue();
     foreach (string s in currentEvent.dialogueText)
     {
         text.CreateDialogue(s);
     }
     foreach (EventChoice c in currentEvent.choices)
     {
         text.CreateChoice(c);
     }
     text.NextLine();
 }
예제 #2
0
    void OnGUI()
    {
        currObject = (GameObject)EditorGUILayout.ObjectField("Game Object to Save/Load Tree", currObject, typeof(GameObject), true);
        if (currObject != null)
        {
            currDialogue = currObject.GetComponent <DialogueList>();
        }
        if (windowsToAttach.Count == 2)
        {
            attachedWindows.Add(windowsToAttach[0]);
            attachedWindows.Add(windowsToAttach[1]);
            windowsToAttach = new List <int>();
        }

        if (attachedWindows.Count >= 2)
        {
            for (int i = 0; i < attachedWindows.Count; i += 2)
            {
                DrawNodeCurve(windows[attachedWindows[i]], windows[attachedWindows[i + 1]]);
            }
        }

        BeginWindows();

        if (GUILayout.Button("Create Node"))
        {
            windows.Add(new Rect(100, 100, 200, 200));
            dialogues.Add("Insert dialogue here");
        }

        for (int i = 0; i < windows.Count; i++)
        {
            windows[i] = GUI.Window(i, windows[i], DrawNodeWindow, "Window " + i);
        }

        if (GUILayout.Button("Save Dialogue List"))
        {
            currDialogue.SaveDialogueList();
            Debug.Log("Saved current dialogue");
        }

        if (GUILayout.Button("Clear Dialogue List"))
        {
            List <string> currD = currDialogue.ClearDialogue();
            currDialogue.SaveDialogueList();
            Debug.Log("cleared: " + currD);
        }

        if (GUILayout.Button("Load Dialogue"))
        {
            //DialogueManager diaManager = GameObject.FindObjectOfType<DialogueManager>();
            currDialogue = currObject.GetComponent <DialogueList>();
            Dictionary <int, List <string> > loadedDict = currDialogue.LoadDialogueList();
            List <string> loadedDialogue = loadedDict[currDialogue.getID()];
            if (loadedDialogue == null || loadedDialogue.Count <= 0)
            {
                Debug.LogError("Cannot load dialogue. Either null or 0");
            }
            //print dialogue
            for (int i = 0; i < loadedDialogue.Count; i++)
            {
                Debug.Log(loadedDialogue[i]);
            }
        }

        EndWindows();
    }