private void RoundStart() { if (round == 1) { ButtonA.GetComponentInChildren <TextMeshProUGUI>().text = "Red"; ButtonB.GetComponentInChildren <TextMeshProUGUI>().text = "Black"; } else if (round == 2) { ButtonA.GetComponentInChildren <TextMeshProUGUI>().text = "High"; ButtonB.GetComponentInChildren <TextMeshProUGUI>().text = "Low"; } else if (round == 3) { ButtonA.GetComponentInChildren <TextMeshProUGUI>().text = "Outside"; ButtonB.GetComponentInChildren <TextMeshProUGUI>().text = "Inbetween"; } else if (round == 4) { ExtraButtons.SetActive(true); ButtonA.GetComponentInChildren <TextMeshProUGUI>().text = "Clover"; ButtonB.GetComponentInChildren <TextMeshProUGUI>().text = "Diamond"; ButtonC.GetComponentInChildren <TextMeshProUGUI>().text = "Spade"; ButtonD.GetComponentInChildren <TextMeshProUGUI>().text = "Heart"; } }
// Start is called before the first frame update void Start() { A = GameObject.Find("A"); ButtonA = A.GetComponent <Button>(); B = GameObject.Find("B"); ButtonB = B.GetComponent <Button>(); C = GameObject.Find("C"); ButtonC = C.GetComponent <Button>(); D = GameObject.Find("D"); ButtonD = D.GetComponent <Button>(); head = this.transform.GetChild(0).gameObject; text = this.transform.GetChild(1).gameObject; meshH = head.GetComponent <TextMeshProUGUI>(); mesh = text.GetComponent <TextMeshProUGUI>(); mesh.text = "Question 1) What is the first step in sending data through a UDP connection for the CLIENT?"; ButtonA.GetComponentInChildren <Text>().text = "Close the socket"; ButtonB.GetComponentInChildren <Text>().text = "Receive the data"; ButtonC.GetComponentInChildren <Text>().text = "Bind the socket"; ButtonD.GetComponentInChildren <Text>().text = "Create a socket"; }
private void ResetFlagi() { if (flagaWykonania == true) { ButtonC.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); flagaWykonania = false; } }
void Start() { m_ButtonScriptA = m_Button_A.GetComponent <ButtonA>(); m_ButtonScriptB = m_Button_B.GetComponent <ButtonB>(); m_ButtonScriptC = m_Button_C.GetComponent <ButtonC>(); m_ButtonScriptD = m_Button_D.GetComponent <ButtonD>(); m_ButtonScriptE = m_Button_E.GetComponent <ButtonE>(); m_ButtonScriptF = m_Button_F.GetComponent <ButtonF>(); }
/// <summary> /// Update certain colors which correspond to the C button. /// </summary> void UpdateColorsUsingCButton() { // Update text button icon. ButtonIconC = ButtonC; // Update pause menu cursor colors (yellow). MenuCInner1 = ButtonC; MenuCInner2 = ButtonC.Brighten(0.4f); MenuCOuter1 = Color.Black; MenuCOuter2 = ButtonC.Darken(0.2f); // Update note button C colors. NoteC1 = ButtonC; NoteC2 = ButtonC.Brighten(0.4f); NoteCShadow1 = Color.FromArgb(0x0A, 0x0A, 0x0A); NoteCShadow2 = ButtonC.Darken(0.2f); // Update pause menu title icon. PauseTitleC = ButtonC; }
public ConverterDigits() { TBLayout.SuspendLayout(); Controls.Add(TBLayout); Controls.Add(TextArea); Controls.Add(TextLine); Name = "ConverterDigits"; Button7.AddColor1(); Button7.Click += new EventHandler(InsertText); Button8.AddColor1(); Button8.Click += new EventHandler(InsertText); Button9.AddColor1(); Button9.Click += new EventHandler(InsertText); ButtonBackspace.AddColor1(); ButtonBackspace.Click += new EventHandler(Backspace); ButtonC.AddColor1(); ButtonC.Click += new EventHandler(InsertText); ButtonD.AddColor1(); ButtonD.Click += new EventHandler(InsertText); ButtonDelete.AddColor1(); ButtonDelete.Click += new EventHandler(Delete); ButtonEnter.AddColor1(); ButtonEnter.Click += new EventHandler(GetAnswer); ButtonI.AddColor1(); ButtonI.Click += new EventHandler(InsertText); ButtonL.AddColor1(); ButtonL.Click += new EventHandler(InsertText); ButtonM.AddColor1(); ButtonM.Click += new EventHandler(InsertText); ButtonV.AddColor1(); ButtonV.Click += new EventHandler(InsertText); ButtonX.AddColor1(); ButtonX.Click += new EventHandler(InsertText); Button0.AddColor1(); Button0.Click += new EventHandler(InsertText); Button1.AddColor1(); Button1.Click += new EventHandler(InsertText); Button2.AddColor1(); Button2.Click += new EventHandler(InsertText); Button3.AddColor1(); Button3.Click += new EventHandler(InsertText); Button4.AddColor1(); Button4.Click += new EventHandler(InsertText); Button5.AddColor1(); Button5.Click += new EventHandler(InsertText); Button6.AddColor1(); Button6.Click += new EventHandler(InsertText); TextArea.AddColor1(); TextLine.AddColor1(); TBLayout.Controls.AddRange(new Control[] { Button7, Button8, Button9, ButtonD, ButtonEnter, Button4, Button5, Button6, ButtonC, ButtonBackspace, Button1, Button2, Button3, ButtonL, ButtonDelete, Button0, ButtonI, ButtonV, ButtonX, ButtonM }); ResumeLayout(false); PerformLayout(); TBLayout.ResumeLayout(false); }
public void Sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { string txt = e.Result.Text; float confidence = e.Result.Confidence; if (confidence >= 0.4) { int first = Convert.ToInt32(e.Result.Semantics["first"].Value); //int second = Convert.ToInt32(e.Result.Semantics["second"].Value); //string operation = e.Result.Semantics["operation"].Value.ToString(); switch (first) { case 1: Button1.Dispatcher.Invoke(new Action(() => { Button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button1.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 2: Button2.Dispatcher.Invoke(new Action(() => { Button2.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button2.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 3: Button3.Dispatcher.Invoke(new Action(() => { Button3.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button3.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 4: Button4.Dispatcher.Invoke(new Action(() => { Button4.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button4.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 5: Button5.Dispatcher.Invoke(new Action(() => { Button5.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button5.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 6: Button6.Dispatcher.Invoke(new Action(() => { Button6.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button6.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 7: Button7.Dispatcher.Invoke(new Action(() => { Button7.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button7.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 8: Button8.Dispatcher.Invoke(new Action(() => { Button8.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button8.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 9: Button9.Dispatcher.Invoke(new Action(() => { Button9.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button9.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 0: Button0.Dispatcher.Invoke(new Action(() => { Button0.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); Button0.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 10: ButtonRowne.Dispatcher.Invoke(new Action(() => { ButtonRowne.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonRowne.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 11: ButtonPlus.Dispatcher.Invoke(new Action(() => { ButtonPlus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonPlus.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 12: ButtonMinus.Dispatcher.Invoke(new Action(() => { ButtonMinus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonMinus.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 13: ButtonRazy.Dispatcher.Invoke(new Action(() => { ButtonRazy.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonRazy.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 14: ButtonPrzez.Dispatcher.Invoke(new Action(() => { ButtonPrzez.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonPrzez.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; case 15: ButtonC.Dispatcher.Invoke(new Action(() => { ButtonC.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 221, 221, 221)); ButtonC.Background = brush; ColorAnimation anima = new ColorAnimation(Colors.Blue, new Duration(TimeSpan.FromSeconds(0.5))); anima.AutoReverse = true; brush.BeginAnimation(SolidColorBrush.ColorProperty, anima); })); break; default: break; } //if (operation == "plus") //{ // ButtonPlus.Dispatcher.Invoke(new Action(() => // { // ButtonPlus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //else if (operation == "minus") //{ // ButtonMinus.Dispatcher.Invoke(new Action(() => // { // ButtonMinus.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //else if (operation == "razy") //{ // ButtonRazy.Dispatcher.Invoke(new Action(() => // { // ButtonRazy.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //else if (operation == "przez") //{ // ButtonPrzez.Dispatcher.Invoke(new Action(() => // { // ButtonPrzez.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); //} //switch (second) //{ // case 1: // Button1.Dispatcher.Invoke(new Action(() => // { // Button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 2: // Button2.Dispatcher.Invoke(new Action(() => // { // Button2.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 3: // Button3.Dispatcher.Invoke(new Action(() => // { // Button3.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 4: // Button4.Dispatcher.Invoke(new Action(() => // { // Button4.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 5: // Button5.Dispatcher.Invoke(new Action(() => // { // Button5.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 6: // Button6.Dispatcher.Invoke(new Action(() => // { // Button6.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 7: // Button7.Dispatcher.Invoke(new Action(() => // { // Button7.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 8: // Button8.Dispatcher.Invoke(new Action(() => // { // Button8.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 9: // Button9.Dispatcher.Invoke(new Action(() => // { // Button9.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // case 0: // Button0.Dispatcher.Invoke(new Action(() => // { // Button0.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // })); // break; // default: // break; //} //ButtonRowne.Dispatcher.Invoke(new Action(() => //{ // ButtonRowne.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); //})); } else { ss.Speak("Proszę powtórzyć"); } }