public List <Dialogue> GetDialogueOptionsFor(Dialogue dialogue) { var connections = ConnectionList.Where(c => c.Source.IdRef == dialogue.Id).Select(l => l.Target.IdRef).ToList(); var dialogues = DialogueList.Where(d => connections.Contains(d.Id)).ToList(); return(dialogues); }
// Creates the Dictionary dialogue which stores information of what the npc says. // Use this for initialization void Awake() { if (control == null) { DontDestroyOnLoad(gameObject); control = this; } else if (control != this) { Destroy(gameObject); } // Getting inventory for saving; ItemSave = new Dictionary <string, Item>(); AddItemSave(); //add scene by index AddScene(LoadThisScene); //enables the dialogue canvas. dia = gameObject.GetComponent <DialogueList>(); sceneName = new List <string> (); sceneNumber = new List <int> (); finishButton = GameObject.Find("FinishButton").GetComponent <Button> (); finishText = GameObject.Find("FinishText").GetComponent <Text> (); // connecting gameObjects to the gamecontroller. CS = FindObjectOfType <CorridorSaver> (); ChatText = (Text)GameObject.Find("TextDialogue").GetComponent <Text> (); /*option1 = (Button)GameObject.Find ("ButtonSel1").GetComponent <Button> (); * option2 = (Button)GameObject.Find ("ButtonSel2").GetComponent <Button> (); * option3 = (Button)GameObject.Find ("ButtonSel3").GetComponent <Button> (); * choice1 = (Text)GameObject.Find ("TextSel1").GetComponent <Text> (); * choice2 = (Text)GameObject.Find ("TextSel2").GetComponent <Text> (); * choice3 = (Text)GameObject.Find ("TextSel3").GetComponent <Text> ();*/ currentRoom = (Text)GameObject.Find("TextCurrentRoom").GetComponent <Text> (); currentKarma = (Text)GameObject.Find("TextKarma").GetComponent <Text> (); //find the pictures for collection items collpic1 = GameObject.Find("CollImage1"); collpic2 = GameObject.Find("CollImage2"); collpic3 = GameObject.Find("CollImage3"); collpic4 = GameObject.Find("CollImage4"); collpic5 = GameObject.Find("CollImage5"); collpic6 = GameObject.Find("CollImage6"); collpic7 = GameObject.Find("CollImage7"); collpic8 = GameObject.Find("CollImage8"); collpic9 = GameObject.Find("CollImage9"); collpic10 = GameObject.Find("CollImage10"); collpic1.SetActive(false); collpic2.SetActive(false); collpic3.SetActive(false); collpic4.SetActive(false); collpic5.SetActive(false); collpic6.SetActive(false); collpic7.SetActive(false); collpic8.SetActive(false); collpic9.SetActive(false); collpic10.SetActive(false); }
// Use this for initialization void Start() { GC = FindObjectOfType <GameController> (); npc = FindObjectOfType <NPCController> (); player = FindObjectOfType <PlayerData> (); inventory = FindObjectOfType <Inventory> (); dia = FindObjectOfType <DialogueList> (); moveJoystick = FindObjectOfType <JoyStick> (); }
public void StartDialogue(DialogueList dialogueList) { nameText.text = dialogueList.name; sentences.Clear(); foreach (string sentence in dialogueList.sentences) { sentences.Enqueue(sentence); } DisplayNextSentence(); }
//checks character stats / items //determines outcome //prints out outcome to dialogue list //calls event outcome public EventOutcome Outcome(Unit actor, Item usage, DialogueList output) { output.CreateDialogue(choiceAction); if (CheckSuccess(actor, usage)) { return(successOutcome); } else { return(failureOutcome); } }
public Dialogue GetResponseFor(string dialogueId) { var connection = ConnectionList.FirstOrDefault(c => c.Source.IdRef == dialogueId); if (connection == null) { return(null); } var response = DialogueList.FirstOrDefault(d => connection.Target.IdRef == d.Id); return(response); }
private void Awake() { SpeakerName = GameObject.FindGameObjectWithTag("SpeakerName").GetComponent <Text>(); SpeakerText = GameObject.FindGameObjectWithTag("SpeechText").GetComponent <Text>(); SpeakerImage = GameObject.FindGameObjectWithTag("SpeakerImage").GetComponent <Image>(); BackgroundImage = GameObject.FindGameObjectWithTag("Background").GetComponent <Image>(); Data = Service.LoadSave(); _currentSpeech = Data.currentSpeech; LastCurrentSpeech = _currentSpeech - 1; _dialogues = Service.LoadDialogueList(); }
// Use this for initialization void Start() { GC = FindObjectOfType <GameController> (); npc = FindObjectOfType <NPCController> (); player = FindObjectOfType <PlayerData> (); inventory = FindObjectOfType <Inventory> (); dia = FindObjectOfType <DialogueList> (); moveJoystick = FindObjectOfType <JoyStick> (); OIP = FindObjectOfType <OnItemPickup> (); doThingText = GameObject.Find("DoThingText").GetComponent <Text> (); doThingButton = GameObject.Find("DoThingButton").GetComponent <Button> (); doThingCanvas = GameObject.Find("DoThingsCanvas").GetComponent <Canvas> (); finishCanvas = GameObject.Find("FinishCanvas").GetComponent <Canvas> (); anim = GetComponentInChildren <Animator>(); }
// Creates the Dictionary dialogue which stores information of what the npc says. // Use this for initialization void Awake() { if (control == null) { DontDestroyOnLoad(gameObject); control = this; } else if (control != this) { Destroy(gameObject); } // Getting inventory for saving; ItemSave = new Dictionary <string, Item>(); AddItemSave(); //add scene by index AddScene(1); //enables the dialogue canvas. dia = gameObject.GetComponent <DialogueList>(); sceneName = new List <string> (); // connecting gameObjects to the gamecontroller. ChatText = (Text)GameObject.Find("TextDialogue").GetComponent <Text> (); /*option1 = (Button)GameObject.Find ("ButtonSel1").GetComponent <Button> (); * option2 = (Button)GameObject.Find ("ButtonSel2").GetComponent <Button> (); * option3 = (Button)GameObject.Find ("ButtonSel3").GetComponent <Button> (); * choice1 = (Text)GameObject.Find ("TextSel1").GetComponent <Text> (); * choice2 = (Text)GameObject.Find ("TextSel2").GetComponent <Text> (); * choice3 = (Text)GameObject.Find ("TextSel3").GetComponent <Text> ();*/ //connects dialogue done DD = FindObjectOfType <DialogueDone> (); Scene[] currentScenes = SceneManager.GetAllScenes(); foreach (Scene sc in currentScenes) { Debug.Log(sc.name); if (sc.name != "PersistentCanvas") { sceneName.Add(sc.name); } } }
// Use this for initialization void Start() { sceneBounds = transform.Find("sceneBounds").GetComponent <BoxCollider2D>(); myCamera = Camera.main.transform.GetComponent <CameraControls>(); if (_hasDialogue) { dialogueJSON = Resources.Load(Path.Combine("Dialogue JSON", _dialogueFile)) as TextAsset; myDialogue = new DialogueList(); string json = dialogueJSON.text; myDialogue = JsonUtility.FromJson <DialogueList>(json); foreach (Dialogue element in myDialogue.dialogues) { Debug.Log(element.name + ": " + element.line); } } mainObject = GameObject.Find("Main").transform; player = GameObject.Find("player").GetComponent <Player>(); dialogueGO = GameObject.Find("Dialogue").transform.Find("Text").GetComponent <Text>(); dialogueGroup = GameObject.Find("Dialogue").GetComponent <CanvasGroup>(); playedFromStart = _playOnStart; }
void Start() { gController = FindObjectOfType <GameController> (); dia = FindObjectOfType <DialogueList> (); }
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(); }
public void AddDialogBox(DialogueBox DB) { DialogueList.Add(DB); }
public string GetDialogueText(string dialogueId) { return(DialogueList.FirstOrDefault(d => d.Id == dialogueId)?.DisplayText); }
void Start() { DoneDialogue = new Dictionary <string, List <string> > (); DL = FindObjectOfType <DialogueList> (); }
// Start is called before the first frame update void Awake() { string s = dialogueFile.ToString(); dialogues = JsonUtility.FromJson <DialogueList>(s); }