public void init() { //fill the lookups for match cases with external script Emphasisvalues.Add("Moderate", PromptEmphasis.Moderate); Emphasisvalues.Add("None", PromptEmphasis.None); Emphasisvalues.Add("NotSet", PromptEmphasis.NotSet); Emphasisvalues.Add("Reduced", PromptEmphasis.Reduced); Emphasisvalues.Add("Strong", PromptEmphasis.Strong); Ratevalues.Add("ExtraFast", PromptRate.ExtraFast); Ratevalues.Add("ExtraSlow", PromptRate.ExtraSlow); Ratevalues.Add("Fast", PromptRate.Fast); Ratevalues.Add("Medium", PromptRate.Medium); Ratevalues.Add("NotSet", PromptRate.NotSet); Ratevalues.Add("Slow", PromptRate.Slow); //Fill Deepener names Deepener_names.Add("Deepener_1.txt"); Deepener_names.Add("Deepener_2.txt"); string query = "<QueryMulti:<Anchor1>,<Anchor2>,<Anchor3>,<Anchor4>,Name1,Name2,Name3,Name4>>"; //QueryMulti(query); List <String> vnames = new List <String>(); foreach (InstalledVoice voice in reader.GetInstalledVoices()) { VoiceInfo info = voice.VoiceInfo; //Console.WriteLine(" Voice Name: " + info.Name); vnames.Add(info.Name); } string use_name = ""; foreach (string n in vnames) { if (n.Contains("Zira")) { string name = n; use_name = n; break; } } //reader.SelectVoice("IVONA 2 Salli"); //reader.SelectVoice("Microsoft Anna"); //reader.SelectVoice(use_name); QueryMulti selectvoice = new QueryMulti(); string[] voices = vnames.ToArray(); int voice_amount = voices.Length; //voices[3] = voices[6]; //Dialouge output_test = new Dialouge(); // output_test.Yes.Text = "Voice amount"; //output_test.No.Text = voice_amount.ToString(); // output_test.ShowDialog(); switch (voice_amount) { case 1: selectvoice.One.Text = voices[0]; selectvoice.Two.Text = "No Voice"; selectvoice.Two.Visible = false; selectvoice.Three.Text = "No Voice"; selectvoice.Three.Visible = false; selectvoice.Four.Text = "No Voice"; selectvoice.Four.Visible = false; break; case 2: selectvoice.One.Text = voices[0]; selectvoice.Two.Text = voices[1]; selectvoice.Three.Text = "No Voice"; selectvoice.Three.Visible = false; selectvoice.Four.Text = "No Voice"; selectvoice.Four.Visible = false; break; case 3: selectvoice.One.Text = voices[0]; selectvoice.Two.Text = voices[1]; selectvoice.Three.Text = voices[2]; selectvoice.Four.Text = "No Voice"; selectvoice.Four.Visible = false; break; case 4: selectvoice.One.Text = voices[0]; selectvoice.Two.Text = voices[1]; selectvoice.Three.Text = voices[2]; selectvoice.Four.Text = voices[3]; break; default: selectvoice.One.Text = voices[0]; selectvoice.Two.Text = voices[1]; selectvoice.Three.Text = voices[2]; selectvoice.Four.Text = voices[3]; break; } selectvoice.Text = "Select a voice"; selectvoice.ShowDialog(); string voiceselected = selectvoice.returnvalue; switch (voiceselected) { case "One": reader.SelectVoice(voices[0]); Program.voicename = voices[0]; reader.Speak("You've selected " + voices[0]); break; case "Two": reader.SelectVoice(voices[1]); Program.voicename = voices[1]; reader.Speak("You've selected " + voices[1]); break; case "Three": reader.SelectVoice(voices[2]); Program.voicename = voices[2]; reader.Speak("You've selected " + voices[2]); break; case "Four": reader.SelectVoice(voices[3]); Program.voicename = voices[3]; reader.Speak("You've selected " + voices[3]); break; } //reader.SelectVoice("IVONA 2 Emma"); //reader.SelectVoice("Microsoft Anna"); }
public void QueryMulti(string input) { //Example Query //<QueryMulti:<Anchor1>,<Anchor2>,<Anchor3>,<Anchor4>,Name1,Name2,Name3,Name4>> string QueryStart = "<QueryMulti:"; int length = QueryStart.Length; string QueryRaw = input.Substring(length); string[] split = QueryRaw.Split(','); string[] Anchors = new string[4]; string[] DisplayNames = new string[4]; //Extract Display names and Anchor names for (int i = 0; i < 4; i++) { if (i <= 4) { Anchors[i] = split[i].Substring(1, split[i].Length - 2); DisplayNames[i] = split[i + 4]; if (i == 3) { DisplayNames[i] = DisplayNames[i].Substring(0, DisplayNames[i].Length - 2); } } } //Create the new Dialoge String return_option = "error"; QueryMulti multiquery = new QueryMulti(); //Set the display name for the buttons and presto. multiquery.One.Text = DisplayNames[0]; multiquery.Two.Text = DisplayNames[1]; multiquery.Three.Text = DisplayNames[2]; multiquery.Four.Text = DisplayNames[3]; multiquery.ShowDialog(); string returnvalue = multiquery.returnvalue; //Now we check what was clicked //And also create a default anchor to return to. Anchor targetanchor = new Anchor(); switch (returnvalue) { case "One": targetanchor = FetchAnchor(Anchors[0], "QueryGeneric"); break; case "Two": targetanchor = FetchAnchor(Anchors[1], "QueryGeneric"); break; case "Three": targetanchor = FetchAnchor(Anchors[2], "QueryGeneric"); break; case "Four": targetanchor = FetchAnchor(Anchors[3], "QueryGeneric"); break; } Console.WriteLine("Stuff"); //We have found our anchor if (targetanchor.name != "!") { int Anchorlineindex = targetanchor.line_number; //Now we will do the jump index = Anchorlineindex; //Jump performed. } Console.WriteLine("Stuff"); }
public void Player_Move() { QueryMulti Select = new QueryMulti(); int pbx = player.X; int pby = player.Y; int oldx = player.X; int oldy = player.Y; //Get Neighboor states. bool North = mazemap.getroomkeystate(pbx, pby - 1); bool East = mazemap.getroomkeystate(pbx + 1, pby); bool South = mazemap.getroomkeystate(pbx, pby + 1); bool West = mazemap.getroomkeystate(pbx - 1, pby); //Setup Buttons if (North) { Select.One.Text = "Move North"; } else { Select.One.Hide(); } if (East) { Select.Two.Text = "Move East"; } else { Select.Two.Hide(); } if (South) { Select.Three.Text = "Move South"; } else { Select.Three.Hide(); } if (West) { Select.Four.Text = "Move West"; } else { Select.Four.Hide(); } Select.ShowDialog(); switch (Select.returnvalue) { case "One": pby -= 1; break; case "Two": pbx += 1; break; case "Three": pby += 1; break; case "Four": pbx -= 1; break; } //Update player coords. player.X = pbx; player.Y = pby; //Show where the player moved RevealRoomTile(pbx, pby, PalletizedTiles); RevealRoomTile(oldx, oldy, tiles_list); //If the room exists run the session for it. //But not before checking if we're done! :D HOORAY! if (mazemap.Finishroom.X == player.X && mazemap.Finishroom.Y == player.Y) { SpeechScriptInterpreter finished = new SpeechScriptInterpreter(); finished.Init_Voice(Program.voicename); finished.say_default("You have completed the maze. Congragulations!!!!"); this.Close(); } if (mazemap.getroomkeystate(pbx, pby)) { Console.WriteLine("The room at " + pbx + ", " + pby + " was obviously found. DuUUH"); } MazeRoom currentroom = mazemap.GetRoomByIteration(pbx, pby); if (!currentroom.ran_once) { currentroom.ran_once = true; mazemap.rooms[new Vector2 <int, int>(pbx, pby)] = currentroom; RunRoomSession(); } else { Player_Move(); } }