Ejemplo n.º 1
0
        /// <summary>
        /// Executes the OnDoubleClick trigger. You can force an execution of this trigger (regardless if it's enabled or not) by calling this method with forcedExecution set to TRUE
        /// </summary>
        /// <param name="forcedExecution">Fires this trigger regardless if it is enabled or not (default:false)</param>
        public void ExecuteDoubleClick(bool forcedExecution = false)
        {
            if (forcedExecution)
            {
                if (debugThis)
                {
                    Debug.Log("DebugMode - UIButton - " + name + " | Executing OnDoubleClick initiated through forcedExecution");
                }
                OnDoubleClick.Invoke();
                return;
            }

            if (useOnDoubleClick)
            {
                if (debugThis)
                {
                    Debug.Log("DebugMode - UIButton - " + name + " | Executing OnDoubleClick");
                }
                if (interactable)
                {
                    OnDoubleClick.Invoke();
                }
                if (!interactable & useOnHoverExit & onHoverExitReady)
                {
                    OnHoverExit.Invoke();
                }
            }
        }
Ejemplo n.º 2
0
        public override void ParseData(string command)
        {
            var jObject = JObject.Parse(command);

            if (jObject["status"] != null)
            {
                Status = jObject["status"].ToString();

                if (Status == "click")
                {
                    OnClick?.Invoke(this, EventArgs.Empty);
                }

                if (Status == "double_click")
                {
                    OnDoubleClick?.Invoke(this, EventArgs.Empty);
                }

                if (Status == "long_click_press")
                {
                    OnLongPress?.Invoke(this, EventArgs.Empty);
                }
            }

            if (jObject["voltage"] != null && float.TryParse(jObject["voltage"].ToString(), out float v))
            {
                Voltage = v / 1000;
            }
        }
 public void DoubleClick()
 {
     if (OnDoubleClick != null)
     {
         OnDoubleClick.Invoke();
     }
 }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.touchCount > 0)
        {
            _touch       = Input.GetTouch(0);
            _touchTimer += Time.deltaTime;
            switch (_touch.phase)
            {
            case TouchPhase.Ended:
                if (_touch.tapCount >= 2)
                {
                    StopAllCoroutines();
                    if (OnDoubleClick != null)
                    {
                        OnDoubleClick.Invoke(_touch);
                        Debug.Log("Working");
                    }
                }
                else if (_touchTimer < LongPressThreshold)
                {
                    StartCoroutine(CheckSingleClick());
                }
                else if (_touchTimer > LongPressThreshold)
                {
                    StopAllCoroutines();
                    OnRelease.Invoke(_touch);
                }

                break;

            case TouchPhase.Moved:
                if (_touchTimer > LongPressThreshold)
                {
                    if (OnLongPressing != null)
                    {
                        OnLongPressing.Invoke(_touch);
                    }
                }
                break;

            case TouchPhase.Stationary:
                if (_touchTimer > LongPressThreshold)
                {
                    if (OnLongPressing != null)
                    {
                        OnLongPressing.Invoke(_touch);
                    }
                }
                break;

            default:
                break;
            }
        }
        else
        {
            _touchTimer = 0;
        }
    }
Ejemplo n.º 5
0
 public virtual void MouseDoubleClick(UIMouseEvent e)
 {
     //Main.NewText("点击");
     OnDoubleClick?.Invoke(e, this);
     if (PropagationRule.HasFlag(PropagationFlags.MouseLeftDouble))
     {
         Parent?.MouseDoubleClick(e);
     }
 }
Ejemplo n.º 6
0
 private void AddListeners()
 {
     if (allowMultipleClicks == false)
     {
         OnClick.AddListener(DisableButton);
         OnDoubleClick.AddListener(DisableButton);
         OnLongClick.AddListener(DisableButton);
     }
 }
Ejemplo n.º 7
0
        public override void OnPointerDown(PointerEventData eventData)
        {
            if (lastClickTime + clickInterval > Time.time)
            {
                OnDoubleClick.Invoke();
            }
            else
            {
                OnClick.Invoke();
            }

            lastClickTime = Time.time;
        }
Ejemplo n.º 8
0
        private void Initialize()
        {
            // possibility to drag by window body (we have no title bar)
            this.MovableByWindowBackground = true;
            // topmost window
            this.Level = NSWindowLevel.Floating;

            // clicks detection/notification
            _clickDetector.OnClick += () =>
            {
                OnClick?.Invoke();
            };
            _clickDetector.OnDoubleClick += () =>
            {
                OnDoubleClick?.Invoke();
            };
        }
Ejemplo n.º 9
0
        void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                float timeDelta = Time.time - lastClickTime;

                if (timeDelta < _doubleClickTime)
                {
                    OnDoubleClick?.Invoke();
                    lastClickTime = 0;
                }
                else
                {
                    lastClickTime = Time.time;
                }
            }
        }
        private void Initialize()
        {
            _timerHideWnd.Elapsed += OnTimerHideWindowEvent;

            this.Window.OnDoubleClick += () => { OnDoubleClick?.Invoke(); };
            this.Window.OnClick       += () => { OnClick?.Invoke(); };

            Window.IsVisible  = false;
            Window.AlphaValue = 0.9f;

            // set background colors
            Window.BackgroundColor = WindowBackgroundColor;

            FirewallStatusLabel.TextColor = TextStatusColor;
            VPNStatusLabel.TextColor      = TextStatusColor;
            PauseTimeLeftLabel.TextColor  = TextStatusColor;

            FirewallLabel.TextColor = TextLabelColor;
            VPNLabel.TextColor      = TextLabelColor;
            ResumeInLabel.TextColor = TextLabelColor;

            NSImage resumeBtnImage = NSImage.ImageNamed("iconPlayWhite");

            resumeBtnImage.Size = new CoreGraphics.CGSize(9, 12);
            ResumeBtn.Image     = resumeBtnImage;
            ResumeBtn.TitleTextAttributedString = AttributedString.Create(" " + __appServices.LocalizedString("Button_Resume"), NSColor.White, null, UIUtils.GetSystemFontOfSize(12f, NSFontWeight.Semibold));
            ResumeBtn.BackgroundColor           = NSColor.Black;
            ResumeBtn.IconLocation = CustomButton.IconLocationEnum.Right;
            ResumeBtn.CornerRadius = 7;

            // locationg UI elements on right place
            // (some elements are located not on rihght places (in order to easiest view in Xcode designer during developing))
            nfloat offset = FirewallLabel.Frame.Y - ResumeInLabel.Frame.Y;

            CoreGraphics.CGRect oldFrame = Window.Frame;
            Window.SetFrame(new CoreGraphics.CGRect(oldFrame.X, oldFrame.Y + offset, oldFrame.Width, oldFrame.Height - offset), false);

            // update data according to ViewModel (on property changed)
            __viewModel = new FloatingOverlayWindowViewModel(__AppState, __service, __appServices, __MainViewModel);
            __viewModel.PropertyChanged += _viewModel_PropertyChanged;
            __viewModel.Initialize();
            __MainViewModel.PropertyChanged += MainViewModel_PropertyChanged;

            EnsureUIConsistent();
        }
Ejemplo n.º 11
0
        private bool CheckDoubleClick()
        {
            if (upTime - lastUpTime > doubleClickIntervalTime)
            {
                clickCount = 1;
                return(false);
            }

            clickCount++;
            if (clickCount >= 2)
            {
                OnDoubleClick.Invoke();
                clickCount = 0;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 12
0
        private async Task InternalClickEvent(MouseEventArgs args)
        {
            clickCount++;

            if (clickCount == 2)
            {
                clickCount = 0;
                OnDoubleClick?.Invoke();
            }
            else
            {
                // TODO: Validate that this will always do what I want it to do
                await Task.Delay(Timeout).ContinueWith((task) =>
                {
                    clickCount = 0;
                    OnClick?.Invoke();
                });
            }
        }
        public static void Clicked()
        {
            _clickCount++;
            if (_timerDoubleClick.IsRunning() && _lastClicked == _hit.Target)
            {
                //2 clic
                if (_clickCount == 2)
                {
                    OnDoubleClick?.Invoke(_hit);
                }
            }
            else
            {
                //first click
                _clickCount = 1;
                OnClick?.Invoke(_hit);
            }
            //N click
            OnClickNTime?.Invoke(_hit, _clickCount);

            _timerDoubleClick.StartChrono(_timingDoubleClick);
            _lastClicked = _hit.Target;
        }
Ejemplo n.º 14
0
 void _update_click(ICogaManager coga)
 {
     if (DoubleClickingEnabled)
     {
         if (has_clicked)
         {
             OnDoubleClick?.Invoke(Parent);
             OnEndClicking?.Invoke(Parent);
             has_clicked        = false;
             double_click_timer = -1f;
         }
         else
         {
             has_clicked        = true;
             double_click_timer = MouseClickDelay;
         }
     }
     else
     {
         OnClick?.Invoke(Parent);
         OnEndClicking?.Invoke(Parent);
         has_clicked = false;
     }
 }
Ejemplo n.º 15
0
    public bool HandleDoubleClick(Actor player)
    {
        if (!player == Player.Instance.Me)
        {
            return(false);
        }

        if (OnDoubleClick != null)
        {
            OnDoubleClick.Invoke();
        }
        else
        {
            if (is_pocketable)
            {
                Player.Instance.Me.Inventory.AddToPockets(this.gameObject);
            }
            else
            {
                Player.Instance.Me.Inventory.AddToInventory(this.gameObject);
            }
        }
        return(true);
    }
Ejemplo n.º 16
0
 private Cursor()
 {
     RootElement.OnClick       += (MouseButton mouseButton, MouseButtonState buttonState, Vector2 screenPosition, Vector3 worldPosition, PhysicalElement clickedElement) => { OnClick?.Invoke(mouseButton, buttonState, screenPosition, worldPosition, clickedElement); };
     RootElement.OnDoubleClick += (MouseButton mouseButton, Vector2 screenPosition, Vector3 worldPosition, PhysicalElement clickedElement) => { OnDoubleClick?.Invoke(mouseButton, screenPosition, worldPosition, clickedElement); };
     RootElement.OnCursorMove  += (Vector2 relativePosition, Vector2 absolutePosition, Vector3 worldPosition) => { OnMove?.Invoke(relativePosition, absolutePosition, worldPosition); };
 }
Ejemplo n.º 17
0
 public virtual void DoubleClick(MouseEventArgs e)
 {
     OnDoubleClick.SafeInvoke(this, TranslateMouseEventArgs(e));
 }
Ejemplo n.º 18
0
 internal void _OnDoubleClick(EventArgs eventArgs)
 {
     OnDoubleClick?.Invoke(this, eventArgs);
     Utils.Call("self.EventStarted = False");
 }
 private void LocalEventHandlerDoubleClicked(object sender, EventArgs e) => OnDoubleClick?.Invoke(this, e);
Ejemplo n.º 20
0
 private void NotifyDoubleClick()
 {
     OnDoubleClick?.Invoke();
 }
Ejemplo n.º 21
0
 private void Ni_DoubleClick(object sender, System.EventArgs e)
 {
     OnDoubleClick?.Invoke(sender, e);
 }
Ejemplo n.º 22
0
 private void OnDoubleClick_Notify(object sender, EventArgs e)
 {
     OnDoubleClick?.Invoke();
 }
 /// <summary>
 /// 双击
 /// </summary>
 /// <param name="id"></param>
 protected override void DoubleClickedItem(int id)
 {
     base.DoubleClickedItem(id);
     OnDoubleClick?.Invoke(id);
     Selection.activeInstanceID = id;
 }