From 93fa6c7f3ad937d31eba7256ca27e1c7e579086b Mon Sep 17 00:00:00 2001 From: TheUltimateHacker Date: Mon, 16 Mar 2015 16:20:39 -0400 Subject: [PATCH] Speech Synth System added for future AI Character Added a new Speech Synth system using the .NET Framework's Speech Synth API. To utilize this system, I've added 3 new functions in Helper.vb called speak(Text As String), speakInfoBox(Title As String, Text As String) and speakOnTerminal(Text As String) as well as 2 new Terminal cmdlets, one called speak 'Text in Single Quotes' and speak_Infobox 'Title' 'Text'. These two commands should not be bundled with the full release of 0.0.9. I've also fixed a bug with the Advanced App Launcher, where the AAL would not close unless you clicked "Applications" or clicked an option in the AAL. Now, clicking the Desktop Panel and Desktop will close the AAL. I have yet to figure out the Skin Loader AAL loading issue (Can't run Skin Loader from the AAL), but that'll be my next bugfix. --- ShiftOS/Helper.vb | 27 ++++++++++++++++++++++++++- ShiftOS/ShiftOS.vbproj | 1 + ShiftOS/ShiftOSDesktop.Designer.vb | 10 +++++----- ShiftOS/ShiftOSDesktop.resx | 3 --- ShiftOS/ShiftOSDesktop.vb | 4 ++++ ShiftOS/Terminal.vb | 14 +++++++++++++- 6 files changed, 49 insertions(+), 10 deletions(-) diff --git a/ShiftOS/Helper.vb b/ShiftOS/Helper.vb index 19a1b2e..f2be24a 100644 --- a/ShiftOS/Helper.vb +++ b/ShiftOS/Helper.vb @@ -1,4 +1,6 @@ -Module Helper +Imports System.Speech.Synthesis + +Module Helper Dim path As String = ShiftOSDesktop.ShiftOSPath Public Sub addCP(points As Integer) 'Add some CP ShiftOSDesktop.codepoints = ShiftOSDesktop.codepoints + points @@ -13,4 +15,27 @@ Public Sub playSound(path As String, playMode As AudioPlayMode) My.Computer.Audio.Play(path, playMode) End Sub + + Public Sub speak(text As String) + Dim speaker As New Speech.Synthesis.SpeechSynthesizer + speaker.Speak(text) + End Sub + Public Sub SpeakOnTerminal(text As String) + Dim txt As TextBox = Terminal.txtterm + If Terminal.Visible = False Then + Terminal.Show() + txt.Text = "" + End If + txt.Text = txt.Text + vbNewLine + text + Dim speaker As New SpeechSynthesizer + speaker.Speak(text) + End Sub + + 'Misc. Features that aren't practical, but fun to mess around with in the game engine + Public Sub speakInfoBox(title As String, text As String) + infobox.showinfo(title, text) + Dim speaker As New SpeechSynthesizer + speaker.Speak(title & "..." & text) + infobox.Close() + End Sub End Module diff --git a/ShiftOS/ShiftOS.vbproj b/ShiftOS/ShiftOS.vbproj index 4b87850..078e9ef 100644 --- a/ShiftOS/ShiftOS.vbproj +++ b/ShiftOS/ShiftOS.vbproj @@ -92,6 +92,7 @@ + diff --git a/ShiftOS/ShiftOSDesktop.Designer.vb b/ShiftOS/ShiftOSDesktop.Designer.vb index a1fd4cf..b7b0c9f 100644 --- a/ShiftOS/ShiftOSDesktop.Designer.vb +++ b/ShiftOS/ShiftOSDesktop.Designer.vb @@ -2122,7 +2122,7 @@ Partial Class ShiftOSDesktop ' Me.UtilitiesToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TerminalToolStripMenuItem1, Me.FileSkimmerToolStripMenuItem1, Me.SystemInformationToolStripMenuItem}) Me.UtilitiesToolStripMenuItem.Name = "UtilitiesToolStripMenuItem" - Me.UtilitiesToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.UtilitiesToolStripMenuItem.Size = New System.Drawing.Size(135, 22) Me.UtilitiesToolStripMenuItem.Text = "Utilities" ' 'TerminalToolStripMenuItem1 @@ -2147,7 +2147,7 @@ Partial Class ShiftOSDesktop ' Me.SettingsToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ShifterToolStripMenuItem1, Me.SkinLoaderToolStripMenuItem1, Me.SkinShifterToolStripMenuItem1, Me.IconManagerToolStripMenuItem1, Me.NameChangerToolStripMenuItem1}) Me.SettingsToolStripMenuItem.Name = "SettingsToolStripMenuItem" - Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(135, 22) Me.SettingsToolStripMenuItem.Text = "Settings" ' 'ShifterToolStripMenuItem1 @@ -2184,7 +2184,7 @@ Partial Class ShiftOSDesktop ' Me.InternetToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ShiftnetToolStripMenuItem1, Me.ShiftoriumToolStripMenuItem1, Me.WebBrowserToolStripMenuItem1, Me.DownloadManagerToolStripMenuItem1, Me.InstallerToolStripMenuItem1, Me.BitnoteDiggerToolStripMenuItem1, Me.BitnoteWalletToolStripMenuItem1, Me.FloodGateManagerToolStripMenuItem, Me.VirusScannerToolStripMenuItem1}) Me.InternetToolStripMenuItem.Name = "InternetToolStripMenuItem" - Me.InternetToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.InternetToolStripMenuItem.Size = New System.Drawing.Size(135, 22) Me.InternetToolStripMenuItem.Text = "Internet" ' 'ShiftnetToolStripMenuItem1 @@ -2245,7 +2245,7 @@ Partial Class ShiftOSDesktop ' Me.GamesToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DodgeToolStripMenuItem1, Me.SnakeyToolStripMenuItem1, Me.PongToolStripMenuItem1, Me.KnowledgeInputToolStripMenuItem1, Me.LabyrinthToolStripMenuItem}) Me.GamesToolStripMenuItem.Name = "GamesToolStripMenuItem" - Me.GamesToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.GamesToolStripMenuItem.Size = New System.Drawing.Size(135, 22) Me.GamesToolStripMenuItem.Text = "Games" ' 'DodgeToolStripMenuItem1 @@ -2282,7 +2282,7 @@ Partial Class ShiftOSDesktop ' Me.AccessoriesToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ArtpadToolStripMenuItem1, Me.TextpadToolStripMenuItem1, Me.OrcWriteToolStripMenuItem1, Me.AudioPlayerToolStripMenuItem1, Me.VideoPlayerToolStripMenuItem1, Me.ClockToolStripMenuItem1, Me.CalculatorToolStripMenuItem1}) Me.AccessoriesToolStripMenuItem.Name = "AccessoriesToolStripMenuItem" - Me.AccessoriesToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.AccessoriesToolStripMenuItem.Size = New System.Drawing.Size(135, 22) Me.AccessoriesToolStripMenuItem.Text = "Accessories" ' 'ArtpadToolStripMenuItem1 diff --git a/ShiftOS/ShiftOSDesktop.resx b/ShiftOS/ShiftOSDesktop.resx index 286b65c..f8fcdc0 100644 --- a/ShiftOS/ShiftOSDesktop.resx +++ b/ShiftOS/ShiftOSDesktop.resx @@ -120,9 +120,6 @@ 190, 17 - - 190, 17 - 337, 17 diff --git a/ShiftOS/ShiftOSDesktop.vb b/ShiftOS/ShiftOSDesktop.vb index 0e9be0f..17667bd 100644 --- a/ShiftOS/ShiftOSDesktop.vb +++ b/ShiftOS/ShiftOSDesktop.vb @@ -5233,4 +5233,8 @@ refreshIcons() 'End If End Sub + + Private Sub StartFixer(sender As Object, e As MouseEventArgs) Handles desktopicons.MouseDown, pnlpanelbuttonholder.MouseDown + If pnladvapplauncher.Visible = True Then pnladvapplauncher.Visible = False + End Sub End Class \ No newline at end of file diff --git a/ShiftOS/Terminal.vb b/ShiftOS/Terminal.vb index 03fcd85..d748bce 100644 --- a/ShiftOS/Terminal.vb +++ b/ShiftOS/Terminal.vb @@ -581,7 +581,19 @@ Public Class Terminal End Sub Private Sub DoCommand() - + If command Like "speak_infobox '*' '*'" Then + Dim findwords() As String = command.Split("'") + Helper.speakInfoBox(findwords(1), findwords(3)) + End If + If command Like "speak '*'" Then + Dim findwords() As String = command.Split("'") + If Not findwords(1) = "" Then + Helper.speak(findwords(1)) + Else + Helper.speak("I'm sorry, but you didn't enter anything for me to speak.") + End If + further = False + End If If command Like "alias *" Then CreatingAlias1 = False CreatingAlias2 = False