private void OnClick(ButtonPlus button) { if (OnClickHandler != null) { OnClickHandler(_data, this); } }
private void MaterialOnClick(ButtonPlus button) { Item item = (Item)button.Data; if (item != null) { ItemManager.Instance.AddItem(item.ID, 1, _managerType); SetScrollView(true); if (item != null) { MaterialList.Remove(item); for (int i = 0; i < MaterialButtons.Length; i++) { if (i < MaterialList.Count) { MaterialButtons[i].SetData(MaterialList[i]); MaterialButtons[i].Image.overrideSprite = Resources.Load <Sprite>("Image/Item/" + MaterialList[i].Icon); } else { MaterialButtons[i].SetData(null); MaterialButtons[i].Image.overrideSprite = null; } } } SetResult(); } }
private void BattleStatusOnClick(ButtonPlus button) { if (button.Data != null) { BattleStatusUI.Open(_statusList); } }
private void OnPress(ButtonPlus button) { if (Image.overrideSprite != null) { Image.transform.position = Input.mousePosition; } }
private void ScreenOnClick(ButtonPlus button) { Vector2 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2Int intPosition = Vector2Int.RoundToInt(worldPosition); intPosition.y -= 1; //地圖座標的偏移值 BattleController.Instance.ScreenOnClick(intPosition); }
// Use this for initialization void Awake() { // GameObject.FindGameObjectWithTag() buttonOkay = GameObject.FindGameObjectWithTag(Tags.ModalOk).GetComponent <ButtonPlus>(); buttonNo = GameObject.FindGameObjectWithTag(Tags.ModalNo).GetComponent <ButtonPlus>(); buttonCancel = GameObject.FindGameObjectWithTag(Tags.ModalCancel).GetComponent <ButtonPlus>(); title = GameObject.FindGameObjectWithTag(Tags.ModalTitle).GetComponent <Text>(); rowManager = GetComponentInChildren <RowManager> (); }
private void OnDown(ButtonPlus button) { if (Image.overrideSprite != null) { Image.transform.SetParent(transform.parent.parent); if (OnDownHandler != null) { OnDownHandler(this); } } }
private void OptionOnCLick(ButtonPlus buttonPlus) { Event.Result result = _event.GetResult((int)buttonPlus.Data); result.Execute(); CommentLabel.text = result.Comment; _isDoNothing = result.isDoNothing; for (int i = 0; i < OptionButtons.Length; i++) { OptionButtons[i].gameObject.SetActive(false); } ConfirmButton.gameObject.SetActive(true); }
private void OnUp(ButtonPlus button) { if (Image.overrideSprite != null) { Image.transform.SetParent(transform); Image.transform.localPosition = Vector3.zero; if (OnUpHandler != null) { OnUpHandler(this); } } }
private void InteractiveOnClick(ButtonPlus button) { button.gameObject.SetActive(false); ExploreController.Instance.Interactive((Vector2Int)button.Data); }
void ReleaseDesignerOutlets() { if (ViewLabel != null) { ViewLabel.Dispose(); ViewLabel = null; } if (ButtonZero != null) { ButtonZero.Dispose(); ButtonZero = null; } if (ButtonOne != null) { ButtonOne.Dispose(); ButtonOne = null; } if (ButtonTwo != null) { ButtonTwo.Dispose(); ButtonTwo = null; } if (ButtonThree != null) { ButtonThree.Dispose(); ButtonThree = null; } if (ButtonFour != null) { ButtonFour.Dispose(); ButtonFour = null; } if (ButtonFive != null) { ButtonFive.Dispose(); ButtonFive = null; } if (ButtonSix != null) { ButtonSix.Dispose(); ButtonSix = null; } if (ButtonSeven != null) { ButtonSeven.Dispose(); ButtonSeven = null; } if (ButtonEight != null) { ButtonEight.Dispose(); ButtonEight = null; } if (ButtonNine != null) { ButtonNine.Dispose(); ButtonNine = null; } if (ButtonPlus != null) { ButtonPlus.Dispose(); ButtonPlus = null; } if (ButtonMinus != null) { ButtonMinus.Dispose(); ButtonMinus = null; } if (ButtonMultiply != null) { ButtonMultiply.Dispose(); ButtonMultiply = null; } if (ButtonDivide != null) { ButtonDivide.Dispose(); ButtonDivide = null; } if (ButtonEquals != null) { ButtonEquals.Dispose(); ButtonEquals = null; } if (ButtonClear != null) { ButtonClear.Dispose(); ButtonClear = null; } }
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ć"); } }