Ejemplo n.º 1
0
 public void OnUiWidthChange()
 {
     if (UiWidth != ViewRect.rect.width)
     {
         UiWidth = ViewRect.rect.width;
         float Ratio = UiWidth / 500f;
         PlayBtn.GetComponent <RectTransform>().sizeDelta                       = new Vector2(60 * Ratio, 30);
         PlayBtn.GetComponent <RectTransform>().anchoredPosition                = new Vector2(10 * Ratio, 0);
         PauseBtn.GetComponent <RectTransform>().sizeDelta                      = new Vector2(60 * Ratio, 30);
         PauseBtn.GetComponent <RectTransform>().anchoredPosition               = new Vector2(80 * Ratio, 0);
         StopBtn.GetComponent <RectTransform>().sizeDelta                       = new Vector2(60 * Ratio, 30);
         StopBtn.GetComponent <RectTransform>().anchoredPosition                = new Vector2(150 * Ratio, 0);
         SwitchModeBtn.GetComponent <RectTransform>().sizeDelta                 = new Vector2(120 * Ratio, 30);
         SwitchModeBtn.GetComponent <RectTransform>().anchoredPosition          = new Vector2(220 * Ratio, 0);
         CurrentModeText.GetComponent <RectTransform>().sizeDelta               = new Vector2(90 * Ratio, 30);
         CurrentModeText.GetComponent <RectTransform>().anchoredPosition        = new Vector2(340 * Ratio, 0);
         ResetBtn.GetComponent <RectTransform>().sizeDelta                      = new Vector2(50 * Ratio, 30);
         ResetBtn.GetComponent <RectTransform>().anchoredPosition               = new Vector2(480 * Ratio, 0);
         FixTimeBtn.GetComponent <RectTransform>().sizeDelta                    = new Vector2(100 * Ratio, 30);
         FixTimeBtn.GetComponent <RectTransform>().anchoredPosition             = new Vector2(210 * Ratio, 0);
         OffsetLabel.GetComponent <RectTransform>().sizeDelta                   = new Vector2(60 * Ratio, 30);
         OffsetLabel.GetComponent <RectTransform>().anchoredPosition            = new Vector2(315 * Ratio, 0);
         OffsetInputField.GetComponent <RectTransform>().sizeDelta              = new Vector2(100 * Ratio, 30);
         OffsetInputField.GetComponent <RectTransform>().anchoredPosition       = new Vector2(380 * Ratio, 0);
         PreciseControllerLabel.GetComponent <RectTransform>().sizeDelta        = new Vector2(190 * Ratio, 30);
         PreciseControllerLabel.GetComponent <RectTransform>().anchoredPosition = new Vector2(10 * Ratio, 0);
     }
 }
Ejemplo n.º 2
0
 // 游戏的几种状态
 public void Success()
 {
     Time.timeScale = 0f;
     RestartBtn.SetActive(true);
     PauseBtn.SetActive(false);
     JoyStickBtn.SetActive(false);
     SuccessText.SetActive(true);
 }
Ejemplo n.º 3
0
 public void GamePause()
 {
     Time.timeScale = 0f;
     PauseBtn.SetActive(false);
     ContinueBtn.SetActive(true);
     RestartBtn.SetActive(true);
     JoyStickBtn.SetActive(false);
     ArchiveBtn.SetActive(false);
 }
Ejemplo n.º 4
0
 public void GameOver()
 {
     Time.timeScale = 0f;
     GameOverText.SetActive(true);
     RestartBtn.SetActive(true);
     ArchiveBtn.SetActive(true);
     PauseBtn.SetActive(false);
     JoyStickBtn.SetActive(false);
 }
Ejemplo n.º 5
0
 public void GameContinue()
 {
     Time.timeScale = 1f;
     PauseBtn.SetActive(true);
     ContinueBtn.SetActive(false);
     JoyStickBtn.SetActive(true);
     RestartBtn.SetActive(false);
     ArchiveBtn.SetActive(false);
     GameOverText.SetActive(false);
     StartBtn.SetActive(false);
 }
        private void canvas_Paint(object sender, PaintEventArgs e)
        {
            if (qAgent != null)
            {
                displayBox.Text = qAgent.draw_world(e.Graphics);

                switch (qAgent.simspeed)
                {
                case 0:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Slow";
                    break;

                case 1:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Normal";
                    break;

                case 2:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Fast";
                    break;

                case 3:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Very Fast";
                    break;
                }
            }

            canvas.Update();
            // refresh charts
            if (chkCharts.Checked)
            {
                updateCharts();
            }

            // pause process if duration reached
            if (needToStart && duration != 0 && qAgent != null && qAgent.getTickCount() >= duration)
            {
                PauseBtn.PerformClick();
            }
        }
Ejemplo n.º 7
0
        private void engine_Recognized(object sender, SpeechRecognizedEventArgs e)
        {
            string speech = e.Result.Text;

            switch (speech)
            {
            case "start reading":
                CopyScreenBtn.PerformClick();
                StartBtn.PerformClick();
                break;

            case "read the result":
            case "read the resuls":
            case "whats the result":
            case "whats the results":
                GetResult();
                break;

            case "search":
                SearchBtn.PerformClick();
                break;

            case "pause":
                PauseBtn.PerformClick();
                break;

            case "resume":
                PauseBtn.PerformClick();
                break;

            case "back":
                BackBtn.PerformClick();
                break;

            case "next":
                ForwardBtn.PerformClick();
                break;

            case "stop":
                StopBtn.PerformClick();
                break;

            case "close website search":
                Decca.Speak("Closing Website Reader");
                CloseBtn.PerformClick();
                break;

            case "hide website reader":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Minimized;
                TopMost         = false;
                break;

            case "show website reader":
            case "show website reader again":
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Normal;
                TopMost         = true;
                break;

            default:
                break;
            }
            if (speech == "find")
            {
                string Speech = e.Result.Text;
                Qevent = Speech;
                Speech = string.Empty;
                Decca.SpeakAsync("what do you want to search");
                speech = string.Empty;

                Process_OutputDataReceived();
            }
        }
Ejemplo n.º 8
0
        private void Mainevent_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //System Username
            string Name = Environment.UserName;
            //Recognized Spoken words result is e.Result.Text
            string speech = e.Result.Text;

            //Debug_Livetxt.Text += "You said : " + e.Result.Text + "\n";
            //Switch to e.Result.Text
            switch (speech)
            {
            //Greetings
            case "hello":
                Jarvis.SpeakAsync("hello " + Name);
                System.DateTime timenow = System.DateTime.Now;
                if (timenow.Hour >= 5 && timenow.Hour < 12)
                {
                    Jarvis.SpeakAsync("Goodmorning " + Name);
                }
                if (timenow.Hour >= 12 && timenow.Hour < 18)
                {
                    Jarvis.SpeakAsync("Good afternoon " + Name);
                }
                if (timenow.Hour >= 18 && timenow.Hour < 24)
                {
                    Jarvis.SpeakAsync("Good evening " + Name);
                }
                if (timenow.Hour < 5)
                {
                    Jarvis.SpeakAsync("Hello " + Name + ", you are still awake you should go to sleep, it's getting late");
                }
                break;

            case "what time is it":
                System.DateTime now  = System.DateTime.Now;
                string          time = now.GetDateTimeFormats('t')[0];
                Jarvis.SpeakAsync(time);
                break;

            case "what day is it":
                string day = "Today is," + System.DateTime.Now.ToString("dddd");
                Jarvis.SpeakAsync(day);
                break;

            case "what is the date":
            case "what is todays date":
                string date = "The date is, " + System.DateTime.Now.ToString("dd MMM");
                Jarvis.SpeakAsync(date);
                date = "" + System.DateTime.Today.ToString(" yyyy");
                Jarvis.SpeakAsync(date);
                break;

            case "who are you":
                Jarvis.SpeakAsync("i am your personal assistant");
                Jarvis.SpeakAsync("i can read email, weather report, i can search web for you, anything that you need like a personal assistant do, you can ask me question i will reply to you");
                break;

            case "what is my name":
                Jarvis.SpeakAsync(Name);
                break;

            case "get all emails":
            case "get all inbox emails":
                EmailBtn.PerformClick();
                AllEmails();
                break;

            case "check for new emails":
                EmailBtn.PerformClick();
                QEvent = "Checkfornewemails";
                Jarvis.SpeakAsyncCancelAll();
                EmailNum = 0;
                CheckEmails();
                break;

            case "read the email":
                Jarvis.SpeakAsyncCancelAll();
                try
                {
                    Jarvis.SpeakAsync(MsgList[EmailNum]);
                }
                catch
                {
                    Jarvis.SpeakAsync("There are no emails to read");
                }
                break;

            case "next email":
                Jarvis.SpeakAsyncCancelAll();
                try
                {
                    EmailNum += 1;
                    Jarvis.SpeakAsync(MsgList[EmailNum]);
                }
                catch
                {
                    EmailNum -= 1;
                    Jarvis.SpeakAsync("There are no further emails");
                }
                break;

            case "previous email":
                Jarvis.SpeakAsyncCancelAll();
                try
                {
                    EmailNum -= 1;
                    Jarvis.SpeakAsync(MsgList[EmailNum]);
                }
                catch
                {
                    EmailNum += 1;
                    Jarvis.SpeakAsync("There are no previous emails");
                }
                break;

            //This is for text reader
            case "start reading":
                //ReadBtn.PerformClick();
                if (tabControl1.SelectedIndex == 1)
                {
                    Jarvis.SpeakAsync(Readtxt.Text);
                }
                if (tabControl1.SelectedIndex == 3)
                {
                    Jarvis.SpeakAsync(convertedtxt.Text);
                }
                break;

            case "pause":
                //PauseBtn.PerformClick();
                if (tabControl1.SelectedIndex == 1)
                {
                    if (Jarvis.State == SynthesizerState.Speaking)
                    {
                        Jarvis.Pause();
                    }
                }
                if (tabControl1.SelectedIndex == 3)
                {
                    if (Jarvis.State == SynthesizerState.Speaking)
                    {
                        Jarvis.Pause();
                    }
                }
                break;

            case "resume":
                PauseBtn.PerformClick();
                if (tabControl1.SelectedIndex == 1)
                {
                    if (Jarvis.State == SynthesizerState.Speaking)
                    {
                        Jarvis.Resume();
                    }
                }
                if (tabControl1.SelectedIndex == 3)
                {
                    if (Jarvis.State == SynthesizerState.Speaking)
                    {
                        Jarvis.Resume();
                    }
                }
                break;

            case "stop":
                StopBtn.PerformClick();
                break;

            case "open text file":
                Open_FileBtn.PerformClick();
                break;

            //---untill here--- //
            case "change voice speed to minis two":
                Jarvis.Rate = -2;
                break;

            case "change voice speed to minis four":
                Jarvis.Rate = -4;
                break;

            case "change voice speed to minis six":
                Jarvis.Rate = -6;
                break;

            case "change voice speed to minis eight":
                Jarvis.Rate = -8;
                break;

            case "change voice speed to minis ten":
                Jarvis.Rate = -10;
                break;

            case "change voice speed back to normal":
                Jarvis.Rate = 0;
                break;

            case "change voice speed to two":
                Jarvis.Rate = 2;
                break;

            case "change voice speed to four":
                Jarvis.Rate = 4;
                break;

            case "change voice speed to six":
                Jarvis.Rate = 6;
                break;

            case "change voice speed to eight":
                Jarvis.Rate = 8;
                break;

            case "change voice speed to ten":
                Jarvis.Rate = 10;
                break;

            //For Media Player
            case "i want to add music":
            case "i want to add video":
                Jarvis.Speak("choose, music file from your drives");
                Add_Music.PerformClick();
                break;

            case "play music":
            case "play video":
                PlayBtn.PerformClick();
                break;

            case "stop media player":
                MediaStopBtn.PerformClick();
                break;

            case "fast forward":
                FastfarwardBtn.PerformClick();
                break;

            case "fast reverse":
                FastReverseBtn.PerformClick();
                break;

            case "media player resume":
                PlayBtn.PerformClick();
                break;

            case "media player pause":
                PlayBtn.PerformClick();
                break;

            case "media player previous":
                PreviousBtn.PerformClick();
                break;

            case "media player next":
                NextBtn.PerformClick();
                break;

            case "activate full screen mode":
                FullScreen.PerformClick();
                break;

            case "exit full screen":
                FullScreen.PerformClick();
                break;

            case "mute volume":
            case "volume down":
                Unmute_Volum.PerformClick();
                break;

            case "unmute volume":
            case "volume up":
                Unmute_Volum.PerformClick();
                break;

            //This is for news reader
            case "get bing news":
                GetBingNews();
                break;

            //Untill here //
            //Weather grammar
            case "get weather report":
                Jarvis.SpeakAsync("ok, " + Name + " here is the weather report");
                GetWeather();
                break;
            }
        }
Ejemplo n.º 9
0
        private void Speechreco_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            string speech = e.Result.Text;

            try
            {
                switch (speech)
                {
                ///basic commands
                case "hello":
                case "hello martha":
                case "martha hello":
                    martha.Speak("hello sir");
                    break;

                case "how are you":
                case "martha how are you":
                case "how are you martha":
                    martha.Speak("Iam fine sir");
                    break;

                case "what is your name":
                    martha.Speak("my name is martha iam an ai");
                    break;

                case "what is your gender":
                    martha.Speak("i dont have a gender but my voice seems to be male");
                    break;

                case "are you there":
                case "martha are you there":
                case "are you there martha":
                    martha.Speak("yes sir always ready");
                    break;

                case "exit":
                case "sleep":
                case "goodbye":
                case "goodbye martha":
                case "martha goodbye":
                case "martha bye":
                    martha.Speak("good bye sir have a nice day");
                    Application.Exit();
                    break;

                ///opening commands
                case "open google":
                case "martha open google":
                case "open google martha":
                    martha.Speak("opening google");
                    martha.Speak("loading");
                    Process.Start("chrome.exe", "http://www.google.com");
                    break;

                case "icognito":
                case "martha turn icognito":
                case "turn icognito":
                    SendKeys.Send("^+n");
                    break;

                case "open youtube":
                case "martha open youtube":
                case "open youtube martha":
                    martha.Speak("opening youtube");
                    martha.Speak("loading sir");
                    Process.Start("chrome.exe", "http://www.youtube.com");
                    break;

                case "open facebook":
                case "martha open facebook":
                case "open facebook martha":
                    martha.Speak("opening facebook");
                    martha.Speak("loading");
                    Process.Start("chrome.exe", "http://www.facebook.com");
                    break;

                case "open instagram":
                case "martha open instagram":
                case "open instagram martha":
                    martha.Speak("opening instagram");
                    martha.Speak("loading sir");
                    Process.Start("chrome.exe", "http://www.instagram.com");
                    break;

                case "open whatsapp":
                case "martha open whatsapp":
                case "open  whatsapp martha":
                    martha.Speak("opening whatsapp");
                    martha.Speak("loading");
                    Process.Start("chrome.exe", "http://www.whatsapp.com");
                    break;

                case "open amzon":
                case "martha open amazon":
                    martha.Speak("opening amazon");
                    martha.Speak("loading");
                    martha.Speak("happy shoppoing sir");
                    Process.Start("chrome.exe", "http://www.amazon.in");
                    break;

                case "open flipkart":
                case "martha open flipkart":
                    martha.Speak("opening flipkart");
                    martha.Speak("loading");
                    martha.Speak("happy shopping sir");
                    Process.Start("chrome.exe", "http://www.flipkart.com");
                    break;

                case "open notepad":
                case "martha open notepad":
                    martha.Speak("opening notepad");
                    Process.Start("notepad.exe");
                    break;

                case "open wordpad":
                case "martha open wordpad":
                    martha.Speak("opening wordpad");
                    Process.Start("wordpad.exe");
                    break;

                case "open cmd":
                case "martha open commandpromt":
                    martha.Speak("opening commandpromt");
                    Process.Start("cmd.exe");
                    break;


                ///date and time
                case "what time is it":
                case "martha what is the time":
                    martha.Speak(DateTime.Now.ToString("h:mm:tt"));
                    break;

                case "what is the date":
                case "martha what is the date":
                    martha.Speak(DateTime.Now.ToString("MM/dd/yyyy"));
                    break;



                ///battery status


                ///cricket updates
                case "get cricket updates":
                    martha.Speak("getting cricket updates");
                    Process.Start("chrome.exe", "http://www.cricbuzz.com");
                    break;

                ///Media player commands
                case "open playlist":
                    martha.Speak("opening playlist");
                    martha.Speak("sir please select songs from your drives");
                    Add_Music.PerformClick();
                    break;

                case "play songs":
                    martha.Speak("playing songs");
                    PlayBtn.PerformClick();
                    break;

                case "pause song":
                    martha.Speak("pausing the song");
                    PlayBtn.PerformClick();
                    break;

                case "resume song":
                    martha.Speak("resuimg the song");
                    PlayBtn.PerformClick();
                    break;

                case "stop song":
                    martha.Speak("stoping the song");
                    MediaStopBtn.PerformClick();
                    break;

                case "play next song":
                    martha.Speak("playing next song");
                    NextBtn.PerformClick();
                    break;

                case "play previous song":
                    martha.Speak("playing previous song");
                    PreviousBtn.PerformClick();
                    break;

                case "forward song":
                    martha.Speak("forwarding the song");
                    FastForwardBtn.PerformClick();
                    break;

                case "rewind song":
                    martha.Speak("rewinding the song");
                    FastRewindBtn.PerformClick();
                    break;

                case "go fullscreen":
                    martha.Speak("going full screen");
                    Full_Screen.PerformClick();
                    break;

                ///text reader
                case "open text files":
                    OpenBtn.PerformClick();
                    break;

                case "read":
                    ReadBtn.PerformClick();
                    break;

                case "pause":
                    PauseBtn.PerformClick();
                    break;

                case "resume":
                    PauseBtn.PerformClick();
                    break;

                case "stop":
                    martha.SpeakAsyncCancelAll();
                    break;

                ///Gmail Reader
                case "get emails":
                case "get all emails":
                case "get all inbox emails":
                    GmailReaderBtn.PerformClick();
                    AllEmails();
                    break;

                case "check for new emails":
                    username = textBox1.Text;
                    password = textBox2.Text;
                    QEvent   = "Checkfornewemails";
                    martha.SpeakAsyncCancelAll();
                    Emailnum = 0;
                    CheckEmails();
                    break;

                case "read email":
                    GmailReaderBtn.PerformClick();
                    martha.SpeakAsyncCancelAll();
                    try
                    {
                        martha.SpeakAsync(MsgList[Emailnum]);
                    }
                    catch
                    {
                        martha.SpeakAsync("there are no emails");
                    }
                    break;

                case "next email":
                    GmailReaderBtn.PerformClick();
                    martha.SpeakAsyncCancelAll();
                    try
                    {
                        Emailnum += 1;
                        martha.SpeakAsync(MsgList[Emailnum]);
                    }
                    catch
                    {
                        Emailnum -= 1;
                        martha.SpeakAsync("there are no further emails");
                    }
                    break;

                case "previous email":
                    GmailReaderBtn.PerformClick();
                    martha.SpeakAsyncCancelAll();
                    try
                    {
                        Emailnum -= 1;
                        martha.SpeakAsync(MsgList[Emailnum]);
                    }
                    catch
                    {
                        Emailnum += 1;
                        martha.SpeakAsync("there are no previous emails");
                    }
                    break;

                case "stop reading gmails":
                {
                    martha.SpeakAsyncCancelAll();
                    break;
                }

                ///pronounciation
                case "pronounce":
                {
                    PronounceBtn.PerformClick();
                    break;
                }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("MessageBox:martha is in pause state trun it to speaking state");
            }
        }