protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { base.OnMouseLeftButtonUp(e); e.Handled = true; ClickCommand?.Execute(this); }
private void previewControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { previewControl.BorderThickness = normalBorderThickness; if (ClickCreator.OnMouseUp(this)) { ClickCommand?.Execute(e); } }
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { if (_isMouseDown && ClickCommand != null) { ClickCommand.Execute(CommandParameter); } UpdateCursor(); _isMouseDown = false; base.OnMouseLeftButtonUp(e); if (IsMouseCaptured) { ReleaseMouseCapture(); } if (Mouse.Captured != null) { Mouse.Captured.ReleaseMouseCapture(); } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo)) { if (hitInfo.collider.CompareTag("Cube")) { //hitInfo.collider.GetComponent<MeshRenderer>().material.color = new Color(Random.value,Random.value, Random.value); ICommand clickCommand = new ClickCommand(hitInfo.collider.gameObject, new Color(Random.value, Random.value, Random.value)); clickCommand.Execute(); CommandManager.Instance.Add(clickCommand); } } } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hitInfo; Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(rayOrigin, out hitInfo)) { if (hitInfo.collider.CompareTag("Cube")) { Color color = new Color(Random.value, Random.value, Random.value); ICommand click = new ClickCommand(hitInfo.collider.gameObject, color); click.Execute(); CommandManager.Instance.AddCommand(click); } } } }
void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo)) { if (hitInfo.collider.CompareTag("Cube")) { // ClickComandのインスタンを生成し,親であるインターフェースICommand型のclick変数に代入 ICommand click = new ClickCommand(hitInfo.collider.gameObject, new Color(Random.value, Random.value, Random.value)); click.Execute(); // 入力情報を格納 CommandManager.Instance.AddCommand(click); } } } }
public void Transform() { Task.Run(async() => { int count = 1; while (count <= 5) { this.boxView.Opacity = 0.01 * 3 * count++; await Task.Delay(20); } await Task.Delay(100); while (count >= 0) { this.boxView.Opacity = 0.01 * 3 * count--; await Task.Delay(20); } }); ClickCommand?.Execute(null); }
public void FillTemplate(Grid g) { int counter = 0; foreach (var column in this.ColumnConfig) { var cdef2 = new ColumnDefinition() { Width = GridLength.Auto }; g.ColumnDefinitions.Add(cdef2); cdef2.SharedSizeGroup = "COL_" + counter; { var cc = new ContentControl() { [!ContentProperty] = new Binding(column.DataField, BindingMode.Default) }; cc[!ForegroundProperty] = new Binding("Deleted") { Converter = new VisibilityToDeletedColorConverter() }; cc.Classes.Add(column.Class); if (column.Width != GridLength.Auto) { cc.Classes.Add("FixedWidth"); } Grid.SetColumn(cc, counter); g.Children.Add(cc); } counter++; } g.DoubleTapped += (o, e) => { ClickCommand?.Execute(o); }; }
private void Update() { //left click if(Input.GetMouseButtonDown(0)) { //cast a ray Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if(Physics.Raycast(rayOrigin, out hitInfo)) { //detect a cube if (hitInfo.collider.tag == "Cube") { //how we'd do it without Comand Patter: just assign random color //hitInfo.collider.GetComponent<MeshRenderer>().material.color = new Color(Random.value,.Random.value, Random.value); //instead, we execute a click command ICommand click = new ClickCommand(hitInfo.collider.gameObject, new Color(Random.value, Random.value, Random.value)); //prep the command click.Execute(); //actually run the command CommandManager.Instance.AddCommand(click); //add the action to the CommandManager's List of commands } } } }
private void OnMouseDown() { ICommand clickCommand = new ClickCommand(this.gameObject, this.gameObject.GetComponent <SpriteRenderer>().color); clickCommand.Execute(); }
private void _btnOpen_Click(object sender, RoutedEventArgs e) { _poMenu.IsOpen = false; ClickCommand?.Execute(null); }
private void UIElement_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ClickCommand?.Execute(LocationId); }
private void FigureClicked(object sender, MouseButtonEventArgs e) { ClickCommand.Execute(Figure); }
private void Button_Click(object sender, RoutedEventArgs e) { //previewControl.BorderThickness = normalBorderThickness; ClickCommand?.Execute(e); }