Ejemplo n.º 1
0
        protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonUp(e);
            e.Handled = true;

            ClickCommand?.Execute(this);
        }
Ejemplo n.º 2
0
 private void previewControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     previewControl.BorderThickness = normalBorderThickness;
     if (ClickCreator.OnMouseUp(this))
     {
         ClickCommand?.Execute(e);
     }
 }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
    // 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);
                }
            }
        }
    }
Ejemplo n.º 6
0
 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);
             }
         }
     }
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
            };
        }
Ejemplo n.º 9
0
        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
                    }
                }
            }
        }
Ejemplo n.º 10
0
    private void OnMouseDown()
    {
        ICommand clickCommand = new ClickCommand(this.gameObject, this.gameObject.GetComponent <SpriteRenderer>().color);

        clickCommand.Execute();
    }
Ejemplo n.º 11
0
 private void _btnOpen_Click(object sender, RoutedEventArgs e)
 {
     _poMenu.IsOpen = false;
     ClickCommand?.Execute(null);
 }
Ejemplo n.º 12
0
 private void UIElement_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     ClickCommand?.Execute(LocationId);
 }
Ejemplo n.º 13
0
 private void FigureClicked(object sender, MouseButtonEventArgs e)
 {
     ClickCommand.Execute(Figure);
 }
Ejemplo n.º 14
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     //previewControl.BorderThickness = normalBorderThickness;
     ClickCommand?.Execute(e);
 }