Beispiel #1
0
        private bool onClickCommand(CommandBase command)
        {
            if (command is ClickCommand)
            {
                ClickCommand clickCommand = command as ClickCommand;

                if (clickCommand.IsValid)
                {
                    bool isPutSuccessful = PutChess(clickCommand.Board_X, clickCommand.Board_Y);

                    //Model.PrintBoard();

                    RoleMgr.ChangeNextRole();

                    int boardScore = DebugEvaluation.GetScore(Model, MyChessType);
                    Console.WriteLine($"ChessType = {MyChessType.ToString()}   Board Score = {boardScore.ToString()}");

                    return(true);
                }
                else
                {
                    Console.WriteLine($"Not valid position");

                    return(false);
                }
            }
            else
            {
                Console.WriteLine("command is not ClickCommand");

                return(false);
            }
        }
 private void UpdateEnabledState()
 {
     this.Enabled =
         (!DisableWhenNoCommand && ClickCommand == null)
         ||
         (ClickCommand != null && ClickCommand.CanExecute(ClickCommandParameter));
 }
Beispiel #3
0
 private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (((FrameworkElement)e.OriginalSource).DataContext is ColorListEntry)
     {
         ClickCommand.Execute(null);
     }
 }
        protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonUp(e);
            e.Handled = true;

            ClickCommand?.Execute(this);
        }
Beispiel #5
0
 private void MainViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(IsBusy))
     {
         ClickCommand.RaiseCanExecuteChanged();
     }
 }
Beispiel #6
0
 private void InvokeClickCommand()
 {
     if (ClickCommand != null)
     {
         ClickCommand.Execute(CommandParameter);
     }
 }
    // Update is called once per frame
    void Update()
    {
        //left click
        //cast a ray
        //detect a cube
        //aasign random color


        if (Input.GetMouseButtonDown(0))
        {
            Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
            //store anything that the ray hits
            RaycastHit hitInfo;
            //check if you hit a cube
            if (Physics.Raycast(rayOrigin, out hitInfo))
            {
                //check the collider of the object
                if (hitInfo.collider.tag == "Cube")
                {
                    //command execution
                    Debug.DrawLine(rayOrigin.origin, hitInfo.point, Color.red, 1f);
                    //Debug.Log(hitInfo.collider.gameObject.name);

                    ICommand click = new ClickCommand(hitInfo.collider.gameObject, new Color(Random.value, Random.value, Random.value));
                    click.Execute();
                    CommandManager._instance.AddCommand(click);
                    //hitInfo.collider.GetComponent<MeshRenderer>().material.color = new Color(Random.value, Random.value, Random.value);
                    //hitInfo.collider.gameObject.GetComponent<MeshRenderer>().material.color = Color.green;
                }
            }
        }
    }
Beispiel #8
0
    private void Update()
    {
        //On click, shoots a raycast at mouse's position
        if (Input.GetMouseButtonDown(0))
        {
            Ray        rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(rayOrigin, out hit))
            {
                if (hit.collider.name == "Cube")
                {
                    Color c = new Color(Random.value, Random.value, Random.value);

                    //Creates a command, with the constructor taking the collider and a color as parameters
                    ICommand click = new ClickCommand(hit.collider.gameObject, c);

                    //Call the Execute method of the interface
                    click.Execute();

                    //Adds the command to the buffer in the CommandManager singleton
                    CommandManager.Instance.AddCommand(click);
                }
            }
        }
    }
Beispiel #9
0
        public override void EnterClick_command([NotNull] CrawlLangParser.Click_commandContext context)
        {
            string       selector     = context.selector().GetText().Trim('\'');
            ClickCommand clickCommand = new ClickCommand(selector, _ExecutionEngine.Click);

            _CurrentBlock.Add(clickCommand);
        }
Beispiel #10
0
 private void Form1_MouseClick(object sender, MouseEventArgs e)
 {
     if (RoleMgr != null)
     {
         ClickCommand clickCommand = new ClickCommand("ClickCommand", e.X, e.Y);
         RoleMgr.onCommand(clickCommand);
     }
 }
Beispiel #11
0
 private void previewControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     previewControl.BorderThickness = normalBorderThickness;
     if (ClickCreator.OnMouseUp(this))
     {
         ClickCommand?.Execute(e);
     }
 }
Beispiel #12
0
        public FluentSessionRecorder DoubleClick(IElement element)
        {
            var command = new ClickCommand(element, MouseClick.Double);

            _performer.Perform(command);

            return(this);
        }
Beispiel #13
0
        public FluentSessionRecorder DoubleClick(string selector)
        {
            var command = new ClickCommand(selector, MouseClick.Double);

            _performer.Perform(command);

            return(this);
        }
Beispiel #14
0
        public void ClickCommand_Returns_Clicked()
        {
            Command command = new ClickCommand(window);

            command.Execute();

            Assert.AreEqual("Clicked", window.DrawnText);
        }
Beispiel #15
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="top">メインウィンドウ表示するTopからの座標</param>
        /// <param name="left">メインウィンドウ表示するLeftからの座標</param>
        public ControlViewModel(double top, double left)
        {
            // これで表示する座標を決める
            Top.Value  = top;
            Left.Value = left;

            _ = ClickCommand.Subscribe(_ => MessageBox.Show($"test{Top.Value},{Left.Value}")).AddTo(Disposable);
        }
        private void AssociatedObject_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            if (ClickCommand == null || !ClickCommand.CanExecute(ClickCommandParameter))
            {
                return;
            }

            ClickCommand.Execute(ClickCommandParameter);
        }
        private async Task ButtonPressed()
        {
            await Animate();

            if (ClickCommand != null && ClickCommand.CanExecute(ClickCommandParameter))
            {
                ClickCommand.Execute(ClickCommandParameter);
            }
        }
Beispiel #18
0
        public void ClickCommand_Execute_And_Then_Undo_Should_Be_Empty()
        {
            Command command = new ClickCommand(window);

            command.Execute();
            Command.Undo();

            Assert.AreEqual("", window.DrawnText);
        }
        private void InitCommand()
        {
            LastPageCommand = new ClickCommand(LastPage);

            NextPageCommand = new ClickCommand(NextPage);

            PrintRangeCommand = new ClickCommand(PrintRange);

            PrintCurrentCommand = new ClickCommand(PrintCurrentPage);

            PrintAllCommand = new ClickCommand(PrintAll);
        }
Beispiel #20
0
        public VideoFeedViewModel(string url, string title, IBitmap image = null)
        {
            _url   = url;
            _title = title;
            _image = image;

            ClickCommand = ReactiveCommand.Create();

            ClickCommand.Subscribe(_ => {
                System.Diagnostics.Process.Start(url);
            });
        }
        public async Task <IActionResult> NetTouch(ClickCommand serveFailCommand, string id)
        {
            var matchService = await _matchListService.GetMatchService(UserId, id);

            await matchService.AddEventAsync(new ServeFailEvent
            {
                OccuredAt  = DateTime.UtcNow,
                Serve      = ServeFailKind.NetTouch,
                ServeSpeed = serveFailCommand.ServeSpeed
            });

            return(RedirectToAction(nameof(Index), new { id }));
        }
        public async Task <IActionResult> PointToSecond(ClickCommand pointCommand, string id)
        {
            var matchService = await _matchListService.GetMatchService(UserId, id);

            await matchService.AddEventAsync(new PointEvent
            {
                OccuredAt   = DateTime.UtcNow,
                PlayerPoint = Player.Second,
                Kind        = pointCommand.Kind
            });

            return(RedirectToAction(nameof(Index), new { id }));
        }
        public MainViewModel()
        {
            ClickCommand = ReactiveCommand.Create();
            ClickCommand.Subscribe(o =>
            {
                // Do Something
            });

            ButtonClickEventCommand = ReactiveCommand.Create();
            ButtonClickEventCommand.Subscribe(o =>
            {
                // Do Something
            });
        }
Beispiel #24
0
        public NewsFeedViewModel(string url, string content, string category, string author, string title)
        {
            _url      = url;
            _content  = content;
            _category = category;
            _author   = author;
            _title    = title;

            ClickCommand = ReactiveCommand.Create();

            ClickCommand.Subscribe(_ => {
                System.Diagnostics.Process.Start(url);
            });
        }
Beispiel #25
0
        public RecentProjectViewModel(string name, string location)
        {
            _name     = name;
            _location = location;

            ClickCommand = ReactiveCommand.Create();

            ClickCommand.Subscribe(_ =>
            {
                var shell = IoC.Get <IShell>();

                shell.OpenSolutionAsync(_location);
            });
        }
        public async Task <IActionResult> Ace(ClickCommand pointCommand, string id)
        {
            var matchService = await _matchListService.GetMatchService(UserId, id);

            var state = await matchService.GetStateAsync();

            await matchService.AddEventAsync(new PointEvent
            {
                OccuredAt   = DateTime.UtcNow,
                PlayerPoint = state.PlayerServes,
                Kind        = PointKind.Ace
            });

            return(RedirectToAction(nameof(Index), new { id }));
        }
Beispiel #27
0
        public RecentProjectViewModel(string name, string location)
        {
            this._name     = name;
            this._location = location;

            ClickCommand = ReactiveCommand.Create();

            ClickCommand.Subscribe(_ => {
                var shell = IoC.Get <IShell>();

                var path = Path.Combine(location, name + ".asln");

                shell.OpenSolution(path);
            });
        }
Beispiel #28
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();
     }
 }
Beispiel #29
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray        rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitInfo;
         if (Physics.Raycast(rayOrigin, out hitInfo))
         {
             if (hitInfo.collider.tag == "Cube")
             {
                 ICommands click = new ClickCommand(hitInfo.collider.gameObject, new Color(Random.value, Random.value, Random.value));
                 click.Execute();
                 CommandManager.Instance.AddBuffer(click);
                 //hitInfo.collider.GetComponent<MeshRenderer>().material.color = new Color(Random.value, Random.value, Random.value);
             }
         }
     }
 }
Beispiel #30
0
        private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);

                if (Physics.Raycast(rayOrigin, out RaycastHit hitInfo))
                {
                    if (hitInfo.collider.CompareTag("Cube"))
                    {
                        ICommand click = new ClickCommand(hitInfo.collider.gameObject,
                                                          new Color(Random.value, Random.value, Random.value));
                        click.Execute();
                        CommandManager.Instance().AddCommand(click);
                    }
                }
            }
        }
			public Button(DependencyMessageBox parent)
			{
				Clicked = new ClickCommand(this, parent);
			}