示例#1
0
    /*public override void ClickNothing (MouseClickEvent e) {
     *      if (Selected) {
     *              StartMove (e.point);
     *      }
     * }*/

    public override void ClickOther(MouseClickEvent e)
    {
        if (e.selectable is DestinationPoint)
        {
            StartMove(e.transform.position);
        }
    }
示例#2
0
    void Awake()
    {
        OnMouseClickEvent     = new MouseClickEvent();
        OnEnvChangeShapeEvent = new EnvChangeShapeEvent();

        OnStaticCaseItemEvent   = new StaticCaseItemEvent();
        OnRightButtonClickEvent = new RightButtonClickEvent();

        OnDoorEvent = new DoorEvent();
        OnCaseEvent = new CaseEvent();

        OnNextQuestEvent = new NextQuestEvent();
        //OnDialogEvent = new QuestDialogEvent();
        OnUseOnPlayerEvent = new UseOnPlayerEvent();
        OnStartDialogEvent = new StartDialogEvent();

        OnTerminalOpen  = new TerminalEvent();
        OnTerminalClose = new TerminalEvent();

        OnChangeSpriteEvent = new ChangeSpriteEvent();

        OnNewTicEvent     = new NewTicEvent();
        OnAddBuffEvent    = new AddBuffEvent();
        OnRemoveBuffEvent = new RemoveBuffEvent();
    }
示例#3
0
        public void MouseClick(Vector2Int position, MouseButton button)
        {
            var x           = position.x - X - ParentX;
            var y           = position.y - Y - ParentY;
            var totalMS     = (float)Service.Get <UltimaGame>().TotalMS;
            var doubleClick = false;

            if (_maxTimeForDoubleClick != 0f)
            {
                if (totalMS <= _maxTimeForDoubleClick)
                {
                    _maxTimeForDoubleClick = 0f;
                    doubleClick            = true;
                }
            }
            else
            {
                _maxTimeForDoubleClick = totalMS + UltimaGameSettings.UserInterface.Mouse.DoubleClickMS;
            }
            if (button == MouseButton.Right && !IsUncloseableWithRMB)
            {
                CloseWithRightMouseButton();
                return;
            }
            if (doubleClick)
            {
                OnMouseDoubleClick(x, y, button);
                MouseDoubleClickEvent?.Invoke(this, x, y, button);
            }
            else
            {
                OnMouseClick(x, y, button);
                MouseClickEvent?.Invoke(this, x, y, button);
            }
        }
示例#4
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            MouseClickEvent clickEvent = MouseUtil.GetMousePositionInWorld();
            if (clickEvent.hitGameObject.tag == "Intractable")
            {
                target = clickEvent.hitGameObject;
                target.GetComponent <Collider>().enabled = false;
                Debug.Log("Picked Up " + target.name);
            }
        }
        if (Input.GetMouseButtonUp(0))
        {
            if (target)
            {
                MouseClickEvent clickEvent = MouseUtil.GetMousePositionInWorld();
                target.transform.position = clickEvent.point;
                target.GetComponent <Collider>().enabled = true;
                Debug.Log("Dropped " + target.name);
                target = null;
            }
        }

        if (target != null)
        {
            MouseClickEvent clickEvent = MouseUtil.GetMousePositionInWorld();
            target.transform.position = clickEvent.point + new Vector3(0, 0.2f, 0);
        }
    }
示例#5
0
        protected void ExecuteMouseClick(MouseClickEvent evt)
        {
            MouseClickHandler dlgt = MouseClicked;

            if (dlgt != null)
            {
                dlgt(evt.Buttons);
            }
        }
示例#6
0
 private void GetInput(InputCallbackEvent icei)
 {
     if (icei.lmbClickPressed)
     {
         //Call the mouse click event for the player
         MouseClickEvent mcei = new MouseClickEvent();
         mcei.clickPos = GetGlobalMousePosition();
         mcei.FireEvent();
     }
 }
示例#7
0
 /// <summary>
 ///		Process a <see cref="Shared.Events.EngineActions.MouseClickEvent"/>
 /// </summary>
 /// <param name="mouseClickEvent"></param>
 public void ProcessMouseClickEvent(MouseClickEvent mouseClickEvent)
 {
     MouseClickEvent(new CefMouseEvent
     {
         X = mouseClickEvent.MouseX,
         Y = mouseClickEvent.MouseY
     }, mouseClickEvent.MouseClickCount,
                     (CefMouseButtonType)mouseClickEvent.MouseClickType,
                     mouseClickEvent.MouseEventType == MouseEventType.Up);
 }
示例#8
0
        public static IntPtr CallbackFunction(Int32 code, IntPtr wParam, IntPtr lParam)
        {
            WM t = (WM)wParam;

            if (t == WM.MOUSEWHEEL || t == WM.RBUTTONDOWN || t == WM.RBUTTONUP || t == WM.LBUTTONDOWN || t == WM.LBUTTONUP || t == WM.XBUTTONUP || t == WM.XBUTTONDOWN || t == WM.MOUSEMOVE)
            {
                //Task.Run(async () => { await Task.Run(() => { AppManager.GetAppManager().CheckIfSessionChanged(); }); });
                var mngr = GetMouseManager();
                if (AppManager.GetAppManager().IsBusy == true)
                {
                    return(NativeMethods.CallNextHookEx(IntPtr.Zero, code, wParam, lParam));
                }
                AppManager.GetAppManager().CheckIfSessionChanged();
                MSLLHOOKSTRUCT  butonData       = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));
                MouseClickEvent mouseClickEvent = new MouseClickEvent();
                mouseClickEvent.EventTime = butonData.time;
                if (t == WM.RBUTTONDOWN || t == WM.RBUTTONUP)
                {
                    mouseClickEvent.MouseButton.Data = MouseButtonList.RightButton;
                    if (t == WM.RBUTTONDOWN)
                    {
                        mouseClickEvent.Type = KeystrokeType.KeyDown;
                        //Console.WriteLine("Down");
                    }
                    else
                    {
                        TimeManager.GetTimeManager().CreateNewAction();
                        mouseClickEvent.Type = KeystrokeType.KeyUp;
                        //Console.WriteLine("Up");
                    }
                }
                else if (t == WM.LBUTTONDOWN || t == WM.LBUTTONUP)
                {
                    mouseClickEvent.MouseButton.Data = MouseButtonList.LeftButton;
                    if (t == WM.LBUTTONDOWN)
                    {
                        mouseClickEvent.Type = KeystrokeType.KeyDown;
                        //Console.WriteLine("Down");
                    }
                    else
                    {
                        TimeManager.GetTimeManager().CreateNewAction();
                        mouseClickEvent.Type = KeystrokeType.KeyUp;
                        //Console.WriteLine("Up");
                    }
                }
                else
                {
                    return(NativeMethods.CallNextHookEx(IntPtr.Zero, code, wParam, lParam));
                }

                mngr.InsertMouseClickEvent(mouseClickEvent);
            }
            return(NativeMethods.CallNextHookEx(IntPtr.Zero, code, wParam, lParam));
        }
示例#9
0
 /// <summary>
 /// Register a method to hook up to Mouse Hold events and the Mouse Buttons to listen for
 /// </summary>
 /// <param name="mouseClickEvent">
 /// Method to call when the Mouse Hold event occurs
 /// </param>
 /// <param name="buttons">
 /// The Mouse Buttons to listen for (pass in multiple buttons separated by commas)
 /// </param>
 public void RegisterMouseButtonsHold(MouseClickEvent mouseClickEvent, params MouseButton[] buttons)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (MouseButton button in buttons)
     {
         RegisterMouseButtonHold(mouseClickEvent, button);
     }
 }
 /// <summary>
 /// Register a method to hook up to MouseDown events and the Mouse Buttons to listen for
 /// </summary>
 /// <param name="mouseClickEvent"></param>
 /// Method to call when the Mouse down event occurs
 /// <param name="buttons">
 /// The Mouse Buttons to listen for (pass in multiple buttons separated by commas)
 /// </param>
 public void RegisterMouseButtonsDown(MouseClickEvent mouseClickEvent, params MouseButton[] buttons)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (MouseButton button in buttons)
     {
         RegisterMouseButtonDown(mouseClickEvent, button);
     }
 }
 /// <summary>
 /// De-register methods from the event for the passed Mouse Buttons
 /// </summary>
 /// <param name="mouseClickEvent"></param>
 /// <param name="buttons"></param>
 public void DeRegisterMouseButtonsUp(MouseClickEvent mouseClickEvent, params MouseButton[] buttons)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (MouseButton button in buttons)
     {
         DeRegisterMouseButtonUp(mouseClickEvent, button);
     }
 }
示例#12
0
 /// <summary>
 /// De-register methods from the event for the passed Mouse Buttons
 /// </summary>
 /// <param name="mouseClickEvent"></param>
 /// <param name="buttons"></param>
 public void DeRegisterMouseButtonsDown(MouseClickEvent mouseClickEvent, params MouseButton[] buttons)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (MouseButton button in buttons)
     {
         DeRegisterMouseButtonDown(mouseClickEvent, button);
     }
 }
示例#13
0
 /// <summary>
 ///     Return true if an mouse click event is in the array of expected events.
 ///     This method itslef defines the logic to determine if two mouse click events are equal.
 /// </summary>
 /// <param name="event">an event that is expected to be in the array of expected events</param>
 /// <param name="expectedEvents">an array of expected events</param>
 /// <returns>true if an event is indeed in the array of expected events.</returns>
 private bool IsMouseClickEventFound(MouseClickEvent @event, MouseClickEvent[] expectedEvents)
 {
     foreach (MouseClickEvent e in expectedEvents)
     {
         if (@event.MouseAction.Equals(e.MouseAction) && @event.MousePosition.Equals(e.MousePosition) && @event.HWnd.Equals(e.HWnd))
         {
             return(true);
         }
     }
     return(false);
 }
示例#14
0
    private void MouseHold(MouseButton button)
    {
        MouseClickEvent mouseClickEvent = null;

        if (mouseHoldEvents.TryGetValue(button, out mouseClickEvent))
        {
            if (mouseClickEvent != null)
            {
                mouseClickEvent(button);
            }
        }
    }
示例#15
0
 private void RegisterMouseButtonHold(MouseClickEvent mouseClickEvent, MouseButton button)
 {
     if (mouseHoldEvents.ContainsKey(button))
     {
         mouseHoldEvents[button] += mouseClickEvent;
     }
     else
     {
         AddButtonToCheck(button);
         mouseHoldEvents.Add(button, mouseClickEvent);
     }
 }
示例#16
0
        // 鼠标点击地图控件事件
        private void mapControl_MouseClick(object sender, MouseEventArgs e)
        {
            if (MapFrame.GMap.Common.Utils.bPublishEvent == false)
            {
                return;
            }

            var p = FromLocalToLngLat(e.X, e.Y);
            MFMouseEventArgs args = new MFMouseEventArgs(p, e.Button, e.X, e.Y);

            if (MouseClickEvent != null)
            {
                MouseClickEvent.Invoke(this, args);
            }
        }
示例#17
0
    public static MouseClickEvent GetMousePositionInWorld(float maxDistance, LayerMask layerMask)
    {
        MouseClickEvent mouseClickEvent = new MouseClickEvent();
        Ray             ray             = Camera.main.ScreenPointToRay(Input.mousePosition);

        RaycastHit hitData;

        if (Physics.Raycast(ray, out hitData, MAX_DISTANCE, layerMask))
        {
            mouseClickEvent.point         = hitData.point;
            mouseClickEvent.hitGameObject = hitData.collider.gameObject;
        }

        return(mouseClickEvent);
    }
示例#18
0
 private void DeRegisterMouseButtonHold(MouseClickEvent mouseClickEvent, MouseButton button)
 {
     if (mouseHoldEvents.ContainsKey(button))
     {
         mouseHoldEvents[button] -= mouseClickEvent;
         if (mouseHoldEvents[button] == null)
         {
             mouseHoldEvents.Remove(button);
         }
         CheckAndRemoveButton(button);
     }
     else
     {
         Debug.Log(button + "button is not registered");
     }
 }
示例#19
0
        /// <summary>
        /// 鼠标钩子回调函数
        /// </summary>
        /// <param name="nCode"></param>
        /// <param name="wParam"></param>
        /// <param name="lParam"></param>
        /// <returns></returns>
        private int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)
        {
            try
            {
                if (nCode < 0)
                {
                    return(WinUserApi.CallNextHookEx(hHook, nCode, wParam, lParam));
                }
                else
                {
                    WinUserApi.POINT point = new WinUserApi.POINT();
                    WinUserApi.GetCursorPos(out point);


                    {
                        switch ((uint)wParam)
                        {
                        case WinUserApi.WM_LBUTTONDOWN:
                            MouseEventArgs LMouseClickEventArgs = new MouseEventArgs(MouseButtons.Left, 1, point.x, point.y, 0);
                            MouseClickEvent?.Invoke(this, LMouseClickEventArgs);
                            break;

                        case WinUserApi.WM_RBUTTONDOWN:
                            MouseEventArgs RMouseClickEventArgs = new MouseEventArgs(MouseButtons.Right, 1, point.x, point.y, 0);
                            MouseClickEvent?.Invoke(this, RMouseClickEventArgs);
                            break;

                        case WinUserApi.WM_RBUTTONDBLCLK:
                            MouseEventArgs RBDBLMouseClickEventArgs = new MouseEventArgs(MouseButtons.Right, 2, point.x, point.y, 0);
                            MouseClickEvent?.Invoke(this, RBDBLMouseClickEventArgs);
                            break;

                        case WinUserApi.WM_MOUSEMOVE:
                            MouseEventArgs MouseMoveEventArgs = new MouseEventArgs(MouseButtons.None, 0, point.x, point.y, 0);
                            MouseMoveEvent?.Invoke(this, MouseMoveEventArgs);
                            break;
                        }
                    }
                    return(WinUserApi.CallNextHookEx(hHook, nCode, wParam, lParam));
                }
            }
            catch { }

            return(0);
        }
示例#20
0
        private void _mouseHook_Click(object sender, MouseClickEvent e)
        {
            string textToAdd = string.Empty;

            switch (e.ButtonState)
            {
            case MouseButtonState.Down:
                mouseClickDown++;
                break;

            case MouseButtonState.Up:
                mouseClickUp++;
                break;
            }
            textToAdd += string.Format("Clicked {0} {1} ({2})", e.Buttons, e.ButtonState, e.ClickType);
            AppendText("{0}{1}", textToAdd, Environment.NewLine);
            RefreshUI();
        }
示例#21
0
 public virtual void OnMouseClickEvent(MouseClickEvent e)
 {
     if (e.transform.tag == myTag)
     {
         if (e.transform == MyTransform)
         {
             ClickThis(e);
         }
         else
         {
             ClickOther(e);
         }
     }
     else
     {
         ClickNothing(e);
     }
 }
示例#22
0
    void Update()
    {
        // Check for movement inputs.
        if (Input.GetMouseButtonDown(1) && !EventSystem.current.IsPointerOverGameObject())
        {
            MouseClickEvent mouseClick = MouseUtil.GetMousePositionInWorld();
            targetPosition = mouseClick.point;
            SetMovementMarker(targetPosition);

            if (mouseClick.hitGameObject.tag == "Intractable")
            {
                // End old interaction
                if (interactedObject != null)
                {
                    interactedObject.EndInteraction();
                }

                // Interact with object
                interactedObject = mouseClick.hitGameObject.gameObject.GetComponent <Interactable>();
                interactedObject.SetInteraction(agentController);
            }
            else
            {
                agentController.MoveToPosition(targetPosition);
                if (interactedObject)
                {
                    // Stop focusing on an Item.
                    interactedObject.EndInteraction();
                }
            }
            UIEventHandler.ContainerClosed();
            UIEventHandler.DialogInterrupted();
        }

        if (agentController.HasReachedDestination())
        {
            RemoveMovementMarker();
        }
        else
        {
            SetMovementMarker(agentController.GetAgentDestination());
        }
    }
示例#23
0
    private void CheckTileClicked(MouseClickEvent mcei)
    {
        //Devide the mouse click loction with the tile size to get the correct click position on your map, assuming the tilemap is set to 0,0 position
        Vector2 mapPos = mcei.clickPos / 32;
        //Grab the players position to determin if the player is close enough to break the tile
        Vector2 playerPos = GetNode <KinematicBody2D>("../Player").GlobalPosition;
        //Fire the tile destroy event to add ammo to the player
        TileDestroyEvent tdei = new TileDestroyEvent();

        if (tileMap.GetCellv(mapPos) == (int)TileType.WALL_BREAKABLE && mcei.clickPos.DistanceTo(playerPos) < 150)
        {
            //Replace the tile instabce with the floor
            tileMap.SetCellv(mapPos, (int)TileType.FLOOR);
            //Set the tile destroyed event to true
            tdei.tileDestroyed = true;
            //Update the map once a tile has been changed
            tileMap.UpdateBitmaskRegion(mapPos - Vector2.One, mapPos + Vector2.One);
        }
        tdei.FireEvent();
    }
示例#24
0
        public FlatToolBarButton(FlatButtonType t, int index, MouseClickEvent e, string title, FlatToolBarPanel p)
        {
            style       = t;
            this.title  = title;
            ev          = e;
            state       = FlatButtonState.Basic;
            image_index = index;
            parent      = p;
            switch (t)
            {
            case FlatButtonType.Control:
                throw new ArgumentException("wrong type: control");

            case FlatButtonType.Line: width = FlatToolBarPanel.LineWidth; break;

            case FlatButtonType.Radio:
            case FlatButtonType.RadioDown:
            case FlatButtonType.Simple:
                width = 23; break;
            }
        }
示例#25
0
    public static Tween TweenText(TextMeshProUGUI textMesh, string textToSet, float charsPerSecond, Action doOnComplete)
    {
        int charIndex = 0, textLength = textToSet.Length;

        if (!scribbleSFX)
        {
            scribbleSFX      = AudioManager.PlaySFX(SFXType.SCRIBBLE, false);
            scribbleSFX.loop = true;
        }
        scribbleSFX.time = UnityEngine.Random.Range(0, scribbleSFX.clip.length);
        scribbleSFX.PlayDelayed(0.33f);

        //textMesh.text = textToSet;
        //for (int c = 0; c < textLength; c++) textMesh.textInfo.characterInfo[c].isVisible = false;
        //textMesh.ForceMeshUpdate();
        //return DOTween.To(() => charIndex, c => textMesh.textInfo.characterInfo[c].isVisible = true, textLength, textLength / charsPerSecond);

        textMesh.text = string.Empty;
        bool  doUpdateText = true;
        Tween retval       = DOTween.To(() => charIndex, c => {
            //if (textToSet[c] == '<') doUpdateText = false;
            //if (textToSet[c] == '>') doUpdateText = true;
            if (doUpdateText)
            {
                textMesh.text = textToSet.Substring(0, c);
            }
        }, textLength, textLength / charsPerSecond)
                             .SetEase(Ease.Linear)
                             .OnComplete(() => doOnComplete.Invoke());

        doOnComplete += () => {
            scribbleSFX.Stop();
            OnMouseClick -= retval.Complete;
            textMesh.text = textToSet;             // Inn-sewer-ants
        };

        OnMouseClick += retval.Complete;
        return(retval);
    }
示例#26
0
        public void MouseClick(Point position, MouseButton button)
        {
            int   x       = position.X - X - ParentX;
            int   y       = position.Y - Y - ParentY;
            float totalMS = (float)Service.Get <UltimaGame>().TotalMS;

            bool doubleClick = false;

            if (m_MaxTimeForDoubleClick != 0f)
            {
                if (totalMS <= m_MaxTimeForDoubleClick)
                {
                    m_MaxTimeForDoubleClick = 0f;
                    doubleClick             = true;
                }
            }
            else
            {
                m_MaxTimeForDoubleClick = totalMS + Settings.UserInterface.Mouse.DoubleClickMS;
            }

            if (button == MouseButton.Right && !IsUncloseableWithRMB)
            {
                CloseWithRightMouseButton();
                return;
            }

            if (doubleClick)
            {
                OnMouseDoubleClick(x, y, button);
                MouseDoubleClickEvent?.Invoke(this, x, y, button);
            }
            else
            {
                OnMouseClick(x, y, button);
                MouseClickEvent?.Invoke(this, x, y, button);
            }
        }
示例#27
0
        private static IntPtr MouseProc(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                _mouseParam = (Win32Api.MOUSEHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(Win32Api.MOUSEHOOKSTRUCT));
                var mouseMessage = (Win32Api.MouseMessages)wParam;

                if (UseGlobal)
                {
                    if (mouseMessage == Win32Api.MouseMessages.WM_LBUTTONDOWN || mouseMessage == Win32Api.MouseMessages.WM_LBUTTONUP)
                    {
                        MouseClickEvent?.Invoke(_mouseParam.pt, mouseMessage);

                        if (mouseMessage == Win32Api.MouseMessages.WM_LBUTTONDOWN && IsHookingArea())
                        {
                            return((IntPtr)1);
                        }
                    }
                }
            }

            return(Win32Api.CallNextHookEx(_mouseId, nCode, wParam, lParam));
        }
示例#28
0
    //Grab mouse clikced signal from the input manager, might need to assign input manager tot a node 2D in the main scnene itself
    public override void _Ready()
    {
        //random.Seed = 21;
        random.Randomize();
        //Create ne reference for the Simplex noise to be used for map generation
        noise = new OpenSimplexNoise();
        //Generate a random noise patern by using a randomized seed
        noise.Seed    = (int)random.Randi();
        noise.Octaves = 1;
        noise.Period  = 12;
        //noise.Persistence = 0.7f;

        MouseClickEvent.RegisterListener(CheckTileClicked);
        MapInfoRequestEvent.RegisterListener(GetMapInfo);

        //Set the tile map data size
        tileDataMap = new Tile[(int)mapSize.x, (int)mapSize.y];
        //Grab a refference to the tile map node
        tileMap = GetNode <TileMap>("Nav2D/TileMap");
        //Initialize the tile data for every entry in the array
        InitMap();
        //Init test of the tile map generation
        GenerateMap();
    }
示例#29
0
 public FlatToolBarButton AddButton( FlatButtonType t, int imageindex, string title, MouseClickEvent ev )
 {
     FlatToolBarButton b = new FlatToolBarButton( t, imageindex, ev, title, this );
     buttons.Add( b );
     ChangedPosition();
     parent.Invalidate();
     return b;
 }
示例#30
0
 public FlatToolBarButton( FlatButtonType t, int index, MouseClickEvent e, string title, FlatToolBarPanel p )
 {
     style = t;
     this.title = title;
     ev = e;
     state = FlatButtonState.Basic;
     image_index = index;
     parent = p;
     switch( t ) {
         case FlatButtonType.Control:
             throw new ArgumentException( "wrong type: control" );
         case FlatButtonType.Line: width = FlatToolBarPanel.LineWidth; break;
         case FlatButtonType.Radio: case FlatButtonType.RadioDown: case FlatButtonType.Simple:
             width = 23;break;
     }
 }
示例#31
0
 void OnMouseDown()
 {
     MouseClickEvent?.Invoke(this.cell);
 }
示例#32
0
 protected void ExecuteMouseClick(MouseClickEvent evt)
 {
   MouseClickHandler dlgt = MouseClicked;
   if (dlgt != null)
     dlgt(evt.Buttons);
 }
示例#33
0
 public override void _ExitTree()
 {
     MouseClickEvent.UnregisterListener(CheckTileClicked);
     MapInfoRequestEvent.UnregisterListener(GetMapInfo);
 }
 private void DeRegisterMouseButtonUp(MouseClickEvent mouseClickEvent, MouseButton button)
 {
     if (mouseUpEvents.ContainsKey(button))
     {
         mouseUpEvents[button] -= mouseClickEvent;
         if (mouseUpEvents[button] == null)
         {
             mouseUpEvents.Remove(button);
         }
         CheckAndRemoveButton(button);
     }
     else
     {
         Debug.Log(button + "button is not registered");
     }
 }
示例#35
0
 add => AddHandler(MouseClickEvent, value);
示例#36
0
 remove => RemoveHandler(MouseClickEvent, value);
 private void RegisterMouseButtonUp(MouseClickEvent mouseClickEvent, MouseButton button)
 {
     if (mouseUpEvents.ContainsKey(button))
     {
         mouseUpEvents[button] += mouseClickEvent;
     }
     else
     {
         AddButtonToCheck(button);
         mouseUpEvents.Add(button, mouseClickEvent);
     }
 }