//fill Queue with all dialogues public void StartDialog(MyDialogue dialogue) { //Debug.Log("Starting Conversation with " + dialogue.npcName); npcNameText.text = dialogue.npcName; sentences.Clear(); foreach (string sentence in dialogue.sentences) { sentences.Enqueue(sentence); } }
private void OnGenerateListOfUnusedDialogues(MyGuiControlButton sender) { //get List<MyDialogueSentence> sentences = new List<MyDialogueSentence>(); foreach (MyDialogueEnum dialogueEnum in Enum.GetValues(typeof(MyDialogueEnum))) { MyDialogue dialogue = MyDialogueConstants.GetDialogue(dialogueEnum); foreach (MyDialogueSentence sentence in dialogue.Sentences) { if (sentence.Text != MyDialoguesWrapperEnum.Dlg_DialoguePlaceholder) sentences.Add(sentence); } } //sort sentences.Sort(DialogueSentencesComparer); HashSet<MySoundCuesEnum> soundCues = new HashSet<MySoundCuesEnum>(); foreach (MySoundCuesEnum soundEnum in Enum.GetValues(typeof(MySoundCuesEnum))) { if (Enum.GetName(typeof(MySoundCuesEnum), soundEnum).StartsWith("Dlg_")) soundCues.Add(soundEnum); } HashSet<MyDialoguesWrapperEnum> dialogueTexts = new HashSet<MyDialoguesWrapperEnum>(); foreach (MyDialoguesWrapperEnum textEnum in Enum.GetValues(typeof(MyDialoguesWrapperEnum))) { dialogueTexts.Add(textEnum); } //Remove used foreach (MyDialogueSentence sentence in sentences) { if (sentence.Cue.HasValue) soundCues.Remove(sentence.Cue.Value); dialogueTexts.Remove(sentence.Text); } //print var dialoguesPath = Path.Combine(MyFileSystemUtils.GetApplicationUserDataFolder(), "UnusedDialogues.txt"); using (var output = new StreamWriter(File.Open(dialoguesPath, FileMode.Create))) { StringBuilder line = new StringBuilder(); line.Append("Unused cues: "); output.WriteLine(line); foreach (MySoundCuesEnum soundCue in soundCues) { line.Clear(); line.Append("MySoundCuesEnum." + Enum.GetName(typeof(MySoundCuesEnum), soundCue)); output.WriteLine(line); } line.Clear(); line.AppendLine(); output.WriteLine(line); line.Clear(); line.Append("Unused texts: "); output.WriteLine(line); foreach (MyDialoguesWrapperEnum textEnum in dialogueTexts) { line.Clear(); line.Append("MyDialoguesWrapperEnum." + Enum.GetName(typeof(MyDialoguesWrapperEnum), textEnum)); line.Append(":"); line.Append(MyDialoguesWrapper.Get(textEnum).ToString()); output.WriteLine(line); } output.Flush(); output.Close(); } }
private void OnGenerateListOfDialogues(MyGuiControlButton sender) { /* List<string> dialoguesString = new List<string>(); foreach (MyDialoguesWrapperEnum textEnum in Enum.GetValues(typeof(MyDialoguesWrapperEnum))) { dialoguesString.Add(textEnum.ToString()); } dialoguesString.Sort(); var dialoguesPath = Path.Combine(MyFileSystemUtils.GetApplicationUserDataFolder(), "Dialogues.txt"); using (var output = new StreamWriter(File.Open(dialoguesPath, FileMode.Create))) { StringBuilder line = new StringBuilder(); foreach (string str in dialoguesString) { foreach (MyDialoguesWrapperEnum textEnum in Enum.GetValues(typeof(MyDialoguesWrapperEnum))) { if (textEnum.ToString() == str) { line.Clear(); foreach (MyDialogueEnum dialogueEnum in Enum.GetValues(typeof(MyDialogueEnum))) { MyDialogue dialogue = MyDialogueConstants.GetDialogue(dialogueEnum); foreach (MyDialogueSentence sentence in dialogue.Sentences) { if (sentence.Text == textEnum) { line.Append(sentence.Actor.ToString() + " (" + MyDialoguesWrapper.Get(textEnum).ToString() + ")"); break; } } } output.WriteLine(line); break; } } } output.Flush(); output.Close(); } */ //get List<MyDialogueSentence> sentences = new List<MyDialogueSentence>(); foreach (MyDialogueEnum dialogueEnum in Enum.GetValues(typeof(MyDialogueEnum))) { MyDialogue dialogue = MyDialogueConstants.GetDialogue(dialogueEnum); foreach(MyDialogueSentence sentence in dialogue.Sentences){ if(sentence.Text!=MyDialoguesWrapperEnum.Dlg_DialoguePlaceholder) sentences.Add(sentence); } } //sort sentences.Sort(DialogueSentencesComparer); //print var dialoguesPath = Path.Combine(MyFileSystemUtils.GetApplicationUserDataFolder(), "Dialogues.txt"); using (var output = new StreamWriter(File.Open(dialoguesPath, FileMode.Create))) { StringBuilder line = new StringBuilder(); foreach(MyDialogueSentence sentence in sentences) { line.Clear(); if (sentence.Cue.HasValue) { line.Append("MySoundCuesEnum." + Enum.GetName(typeof(MySoundCuesEnum), sentence.Cue.Value)); } else { line.Append("[NULL]"); } line.Append(" ("); line.Append(MyTextsWrapper.Get(MyActorConstants.GetActorProperties(sentence.Actor).DisplayName).ToString()); line.Append("): "); line.Append(MyDialoguesWrapper.Get(sentence.Text).ToString()); output.WriteLine(line); } output.Flush(); output.Close(); } }