void Update()
    {
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL
        if (Input.GetMouseButton(0))
        {
            onClickDown.Invoke(Input.mousePosition);
        }
#elif UNITY_IPHONE || UNITY_ANDROID
        if (Input.touchCount > 0)
        {
            Touch touch = Input.GetTouch(0);
            onClickDown.Invoke(touch.position);
        }
#endif
    }
示例#2
0
 private void OnClickListener()
 {
     if (validated)
     {
         OnClick.Invoke(Configuration);
     }
 }
示例#3
0
        /// <summary>
        /// Получает данные о щелчке мыши и обрабатывает их
        /// </summary>
        /// <param name="Click">Параметры щелчка мыши</param>
        internal void OnClick(MouseClick Click)
        {
            switch (Click)
            {
            case MouseClick.LeftButton:

                if (locked)
                {
                    return;
                }

                changies = ChangiesStatus(Click);

                Blocked = !Blocked;

                BlockSwitch();

                break;

            case MouseClick.RightButton:

                changies = ChangiesStatus(Click);

                Marked = !Marked;

                MarkSwitch();

                break;
            }

            OnClickEvent?.Invoke(this, changies);
        }
示例#4
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (toggle && toggle.IsInteractable() && !isSelect)
     {
         onClick?.Invoke();
     }
 }
示例#5
0
        public void ClickDown(object sender, MouseButtonEventArgs e)
        {
            if (e == null || e.LeftButton == MouseButtonState.Pressed)
            {
                if (CheckLicense && Client.License == null)
                {
                    // Common.ShowToast("需要先授权才能执行本操作", Color.FromRgb(255, 36, 50), "off");
                    return;
                }


                foreach (var myTabItem in ItemList)
                {
                    myTabItem.IsSelected          = Equals(myTabItem, this);
                    myTabItem.MyCanvas.Background = myTabItem.IsSelected
                        ? FindResource("BlueLine") as SolidColorBrush
                        : new SolidColorBrush(Colors.Transparent);
                }

                if (IsSelected)
                {
                    OnClickEvent?.Invoke(this, PageName, IsDarkStyle);
                }
            }
        }
示例#6
0
文件: Widget.cs 项目: vfrz/OtterUI
 /// <summary>
 /// Call this to manually simulate a click on a widget from within your code.
 /// </summary>
 public void Click()
 {
     hasClicked   = true;
     clickCounter = 0;
     isActive     = true;
     OnClickEvent.Invoke(this, null);
 }
示例#7
0
    private IEnumerator InvokeClick(PointerEventData data)
    {
        yield return(new WaitForEndOfFrame());

        float time = 0;

        // 毎フレームごとに時間が過ぎていないかチェックする
        // WaitForSeconds だとなんか微妙な挙動だった
        while (time < SingleClickDelaySecond)
        {
            time += Time.deltaTime;
            yield return(null);
        }

        switch (tapCount)
        {
        case 1:
            Debug.Log("Invoke Single Click");
            OnSingleClick.Invoke(data);
            break;

        case 2:
            Debug.Log("Invoke Double Click");
            OnDoubleClick.Invoke(data);
            break;

        default:
            Debug.Log("Ignore Invoke Clicke count(" + tapCount + ")");
            break;
        }
        tapCount = 0;
    }
        protected override void Awake()
        {
            Interactable = Button.interactable;

            button.onClick.AddListener(() =>
            {
                if (isShowRewardVideo)
                {
                    return;
                }
                isShowRewardVideo = true;
                MyAdManager.Instance.ShowRewardVideo(key, () =>
                {
                    isShowRewardVideo = false;
                    if (OnClickEvent != null)
                    {
                        OnClickEvent.Invoke();
                    }
                }, () =>
                {
                    isShowRewardVideo = false;
                    OnFailed.SafeInvoke();
                });
            });

            scaleCurve = MyAnimationCurves.Instance.GetAnimationCurve(MyAnimationCurveType.Notification);
        }
示例#9
0
        public void Update(GameTime gameTime)
        {
            MouseState newMouseState = Mouse.GetState();

            if (Rect.Contains(newMouseState.X, newMouseState.Y))
            {
                ButtonMode = "hover";

                if (!hover)
                {
                    SndHover.Play();
                }

                hover = true;

                if (newMouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released)
                {
                    ButtonMode = "click";
                    OnClickEvent?.Invoke();
                }
            }
            else
            {
                hover      = false;
                ButtonMode = "normal";
            }

            oldMouseState = newMouseState;
        }
示例#10
0
 private void InvokeOnClickDelegate()
 {
     if (onClick != null && onClick.GetInvocationList().Length != 0)
     {
         onClick.Invoke();
     }
 }
示例#11
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         m_worldPoint = m_mainCamera.ScreenToWorldPoint(Input.mousePosition);
         onClick.Invoke(m_worldPoint);
     }
 }
示例#12
0
        private void Click()
        {
            if (OnClickEvent == null)
            {
                return;
            }

            OnClickEvent.Invoke(_type);
        }
示例#13
0
 public virtual T OnClickFunc(IPlayContext context = null)
 {
     OnClickEvent?.Invoke();
     if (ClickFuncReturn != null)
     {
         return(ClickFuncReturn.Invoke(context));
     }
     return(default(T));
 }
示例#14
0
 private void setValue(int value)
 {
     if (value > 0 && value >= increments)
     {
         this.value     = value;
         increment.text = value.ToString();
         onValueChanged.Invoke(this.value);
     }
 }
        public void OnPointerClicked(MixedRealityPointerEventData eventData)
        {
            var msg = Input;

            if (IsBackspace)
            {
                msg = BACKSPACE;
            }

            OnClick?.Invoke(msg);
        }
示例#16
0
        public void OnPointerUp(PointerEventData eventData)
        {
            if (d_down_basedata != d_baseData)
            {
                return;
            }

            if (d_down_basedata != null)
            {
                OnClick.Invoke(d_down_basedata.node);
            }
        }
示例#17
0
        virtual protected void Operation()
        {
            if (group != null)
            {
                group.SetSelect(this);
            }
            else
            {
                IsSelect = !IsSelect;
            }


            m_OnClick.Invoke(this);
        }
示例#18
0
 private void OnReceiveClick(Client sender, string eventName, params object[] arguments)
 {
     if (eventName.Equals("onClientClick"))
     {
         NetHandle handle = (NetHandle)arguments[0];
         OnClickEvent?.Invoke(sender, handle);
     }
     if (eventName.Equals("onClientClickWorld"))
     {
         Dictionary <string, dynamic> obj = JsonConvert.DeserializeObject <Dictionary <string, dynamic> >((string)arguments[0]);
         OnClickWorldEvent?.Invoke(sender, new WorldObject(
                                       new Vector3((float)obj.Get("positionX"), (float)obj.Get("positionY"), (float)obj.Get("positionZ")),
                                       (int)obj.Get("hash")
                                       ));
     }
 }
        public void OnPointerUp(PointerEventData eventData)
        {
            if (!Tools.ScreenPointToWorldPointInRectangle(d_symbolText.rectTransform, eventData.position, d_symbolText.canvas.worldCamera, out localPosition))
            {
                return;
            }

            //localPosition *= d_symbolText.pixelsPerUnit;
            var up_node = d_symbolText.renderCache.Get(localPosition);

            if (d_down_basedata != up_node)
            {
                return;
            }

            OnClick?.Invoke(d_down_basedata?.node);
        }
示例#20
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, maxRaycastDepth))
            {
                if (hit.transform.gameObject.layer == attackLayer)
                {
                    OnTargetClick?.Invoke(hit.transform.gameObject);
                    return;
                }

                OnClick?.Invoke(hit.point);
            }
        }
    }
示例#21
0
        public override void Update()
        {
            UpdateState();

            if (_isPressed)
            {
                Sprite.Color = ClickedColor;
                if (!_isPressedLastFrame)
                {
                    OnClickEvent?.Invoke();
                }
            }
            else if (_isHovered)
            {
                Sprite.Color = HoveredColor;
            }
            else
            {
                Sprite.Color = ButtonColor;
            }
        }
示例#22
0
        internal override void OnUpdate()
        {
            Vector2f mousePosition = Input.TackInput.MousePosition();

            if (mousePosition.X >= Bounds.X && mousePosition.X <= (Bounds.X + Bounds.Width))
            {
                if (mousePosition.Y >= Bounds.Y && mousePosition.Y <= (Bounds.Y + Bounds.Height))
                {
                    m_hovering = true;

                    if (TackInput.MouseButtonDown(MouseButtonKey.Left))
                    {
                        m_pressing = true;

                        if (OnClickEvent != null)
                        {
                            if (OnClickEvent.GetInvocationList().Length > 0)
                            {
                                OnClickEvent.Invoke(this, EventArgs.Empty);
                            }
                        }
                    }
                }
                else
                {
                    m_hovering = false;
                }
            }
            else
            {
                m_hovering = false;
            }

            if (TackInput.MouseButtonUp(MouseButtonKey.Left))
            {
                m_pressing = false;
            }
        }
示例#23
0
 public virtual void OnClick()
 {
     OnClickEvent?.Invoke(this);
 }
示例#24
0
 public virtual void OnClick()
 {
     gameObject.OnClick();
     OnClickEvent?.Invoke(this, null);
 }
示例#25
0
 protected virtual void ClickEvent(EventArgs e)
 {
     OnClickEvent?.Invoke(this, e);
 }
示例#26
0
 public void OnPointerClick(PointerEventData eventData)
 {
     OnClickEvent?.Invoke();
 }
示例#27
0
 public void OnClick(Expression <Func <TModel, object> > expression)
 {
     OnClickEvent?.Invoke(expression);
 }
示例#28
0
 public void OnMouseClickHandler()
 {
     OnClickEvent?.Invoke(this);
 }
 private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
 {
     OnClickEvent?.Invoke();
 }
        private void doMouseMove(Point p, bool click)
        {
            if (output.LineCount <= 0)
            {
                return;
            }

            EnsureCache();

            // Estimate the line number according to cursor position
            int lineNum = (int)Math.Ceiling(p.Y / output.TextArea.TextView.Options.LineHeight);

            if (lineNum <= 0 || lineNum > output.LineCount)
            {
                if (lastHighlightedLine != -1)
                {
                    var offset = visualLineInfoCache[lastHighlightedLine].Offset;
                    output.TextArea.Document.Remove(offset, 1 + (lastClicked ? 1 : 0));
                    lastHighlightedLine = -1;
                    lastClicked         = false;
                }
                return;
            }

            // Calculated if the line is actually selected.
            var  visualLine     = visualLineInfoCache[lineNum];
            bool validSelection = visualLine.Length != 1 && visualLine.XStart <= p.X && p.X <= visualLine.XEnd;

            // If (1) anything is highlighted and (2) the current line is not to be highlighted,
            // remove the old highlight mark
            if (lastHighlightedLine != -1 && (lastHighlightedLine != lineNum || !validSelection))
            {
                var offset = visualLineInfoCache[lastHighlightedLine].Offset;
                output.TextArea.Document.Remove(offset, 1 + (lastClicked ? 1 : 0));
                lastHighlightedLine = -1;
                lastClicked         = false;
            }

            Mouse.OverrideCursor = validSelection ? Cursors.Hand : Cursors.Arrow;

            if (!validSelection)
            {
                return;                         // if nothing is selected, do nothing
            }
            if (lineNum != lastHighlightedLine) // need to highlight
            {
                output.TextArea.Document.Insert(visualLine.Offset, "\u2000");
            }
            lastHighlightedLine = lineNum;

            bool nowClicked = click;

            if (lastClicked && !nowClicked) // unclick
            {
                output.TextArea.Document.Remove(visualLine.Offset, 1);
            }
            else if (!lastClicked && nowClicked)   //click
            {
                OnClickEvent?.Invoke(this, new OnClickEventArg(
                                         output.TextArea.Document.GetText(visualLine.Offset + 1, visualLine.Length - 1),
                                         lineNum));
                output.TextArea.Document.Insert(visualLine.Offset, "\u200B");
            }

            lastClicked = nowClicked;
        }