Exemple #1
0
            public void SetButtonState(PointerEventData.InputButton button, PointerEventData.FramePressState stateForMouseButton, PointerEventData data)
            {
                ButtonState buttonState = GetButtonState(button);

                buttonState.eventData.buttonState = stateForMouseButton;
                buttonState.eventData.buttonData  = data;
            }
Exemple #2
0
 private void OnPointerClick(ListViewItem item, int clickCount, PointerEventData.InputButton button)
 {
     if (clickCount > 1)
     {
         JoinClick();
     }
 }
Exemple #3
0
 void MouseDown(PointerEventData.InputButton mb)
 {
     if (mb == PointerEventData.InputButton.Right)
     {
         game.ChangeState(new JumpChooseTarget(unit));
     }
 }
Exemple #4
0
 void MouseDown(PointerEventData.InputButton mb)
 {
     if (mb == PointerEventData.InputButton.Right)
     {
         game.ChangeState(new PlayerGiveOrder(unit));
     }
 }
 public void OnPointerClick(ListViewItem item, int clickCount, PointerEventData.InputButton button)
 {
     if (onPointerClick != null)
     {
         onPointerClick(item, clickCount, button);
     }
 }
Exemple #6
0
    private void DrawAt(Vector2 position, PointerEventData.InputButton button)
    {
        if (this.brush == null)
        {
            return;
        }
        ImagePainter.PointerState pointerState = this.pointerState[button];
        Vector2 vector2_1 = this.rectTransform.Unpivot(position);

        if (pointerState.isDown)
        {
            Vector2 vector2_2  = Vector2.op_Subtraction(pointerState.lastPos, vector2_1);
            Vector2 normalized = ((Vector2) ref vector2_2).get_normalized();
            for (float num = 0.0f; (double)num < (double)((Vector2) ref vector2_2).get_magnitude(); num += Mathf.Max(this.brush.spacing, 1f) * Mathf.Max(this.spacingScale, 0.1f))
            {
                this.onDrawing.Invoke(Vector2.op_Addition(vector2_1, Vector2.op_Multiply(num, normalized)), this.brush);
            }
            pointerState.lastPos = vector2_1;
        }
        else
        {
            this.onDrawing.Invoke(vector2_1, this.brush);
            pointerState.lastPos = vector2_1;
        }
    }
Exemple #7
0
 void UpdateStrokeColor(PointerEventData.InputButton pressedButton)
 {
     spot.materialForRendering.SetInt("_BlendOp",
                                      pressedButton == PointerEventData.InputButton.Left
             ? (int)UnityEngine.Rendering.BlendOp.Add
             : (int)UnityEngine.Rendering.BlendOp.ReverseSubtract);
 }
Exemple #8
0
 public void EntryClick(int index, PointerEventData.InputButton button)
 {
     if (button == PointerEventData.InputButton.Left)
     {
         SkipDialogue();
     }
 }
 public InventoryActionInput(PointerEventData.InputButton button, EventType eventType, KeyCode keyCode, MobileUIActions mobileAction = MobileUIActions.None)
 {
     this.button = button;
     this.keyCode = keyCode;
     this.mobileAction = mobileAction;
     this.eventType = eventType;
 }
 void MouseDown(PointerEventData.InputButton mb)
 {
     if (mb == PointerEventData.InputButton.Right)
     {
         game.ChangeState(new PlayerSelectUnit());
     }
 }
Exemple #11
0
 public InventoryActionInput(PointerEventData.InputButton button, EventType eventType, KeyCode keyCode, MobileUIActions mobileAction = MobileUIActions.None)
 {
     this.button       = button;
     this.keyCode      = keyCode;
     this.mobileAction = mobileAction;
     this.eventType    = eventType;
 }
Exemple #12
0
    private void DrawAt(Vector2 position, PointerEventData.InputButton button)
    {
        if (brush == null)
        {
            return;
        }
        PointerState pointerState = this.pointerState[(int)button];
        Vector2      vector       = UIEx.Unpivot(rectTransform, position);

        if (pointerState.isDown)
        {
            Vector2 vector2    = pointerState.lastPos - vector;
            Vector2 normalized = vector2.normalized;
            for (float num = 0f; num < vector2.magnitude; num += Mathf.Max(brush.spacing, 1f) * Mathf.Max(spacingScale, 0.1f))
            {
                onDrawing.Invoke(vector + num * normalized, brush);
            }
            pointerState.lastPos = vector;
        }
        else
        {
            onDrawing.Invoke(vector, brush);
            pointerState.lastPos = vector;
        }
    }
Exemple #13
0
        private void HandleButtonEvents(OVRInput.Button button, PointerEventData.InputButton mouseButton, ref bool isButtonDown)
        {
            if (button != OVRInput.Button.None && Controller != OVRInput.Controller.None)
            {
                PointerEventData e = new CursorPointerEventData(this, EventSystem.current);



                e.button = mouseButton;

                if (OVRInput.GetDown(button, this.Controller))
                {
                    OnPointerDown(_target, e);

                    isButtonDown = true;
                }

                if (OVRInput.GetUp(button, this.Controller))
                {
                    OnPointerUp(_target, e);

                    if (isButtonDown)
                    {
                        OnPointerClick(_target, e);
                    }

                    isButtonDown = false;
                }
            }
        }
Exemple #14
0
            public void SetButtonState(PointerEventData.InputButton button, PointerEventData.FramePressState stateForMouseButton, PointerEventData data)
            {
                var toModify = GetButtonState(button);

                toModify.eventData.buttonState = stateForMouseButton;
                toModify.eventData.buttonData  = data;
            }
Exemple #15
0
    public void LeftClickUpShouldEndDrag(PointerEventData.InputButton button, bool active, bool expectedIsDragging)
    {
        ScrollRect scrollRect = m_PrefabRoot.GetComponentInChildren <ScrollRect>();

        scrollRect.velocity = Vector2.one;
        Assert.AreNotEqual(Vector2.zero, scrollRect.velocity);

        var startDragEventData = new PointerEventData(m_PrefabRoot.GetComponentInChildren <EventSystem>())
        {
            button = PointerEventData.InputButton.Left
        };

        scrollRect.OnInitializePotentialDrag(startDragEventData);

        FieldInfo field = typeof(ScrollRect).GetField("m_Dragging", BindingFlags.NonPublic | BindingFlags.Instance);

        Assert.IsFalse((bool)field.GetValue(scrollRect));
        scrollRect.OnBeginDrag(startDragEventData);
        Assert.IsTrue((bool)field.GetValue(scrollRect), "Prerequisite: dragging should be true to test if it is set to false later");

        scrollRect.enabled = active;

        var endDragEventData = new PointerEventData(m_PrefabRoot.GetComponentInChildren <EventSystem>())
        {
            button = button
        };

        scrollRect.OnEndDrag(endDragEventData);
        Assert.AreEqual(expectedIsDragging, (bool)field.GetValue(scrollRect));
    }
 public void OnPointerDown(PointerEventData eventData)
 {
     if (ZoningModesC.Contains(selectedClickMode) && !painting)
     {
         InitialVector = eventData.pointerCurrentRaycast.worldPosition;
         InitialButton = eventData.button;
         painting      = true;
         painterEvent  = eventData;
     }
     else if (painting && ZoningModesC.Contains(selectedClickMode))
     {
         resetTextureSquares();
         painting = false;
         drawTexture();
     }
     else
     {
         painting = continuePainting(eventData) && (!painting || ((painterEvent.button) != eventData.button));
         if (!painting)
         {
             return;
         }
         painterEvent = eventData;
         Build(convertToCitySquare(eventData.pointerPressRaycast.worldPosition), eventData.button == PointerEventData.InputButton.Left);
     }
 }
Exemple #17
0
    // Selecting other blocks after an initial block is selected, continues the matching chain
    void OnBlockPointerEnter(BoardBlock boardBlock, PointerEventData.InputButton inputButton)
    {
        BoardPosition boardPos = GetBoardPosition(boardBlock);

        // Only care about going over other tiles if one is selected already
        // Also needs to match the same color
        if (blockState == BlockState.Selecting && potentialLinks.Contains(boardPos))
        {
            // If we're entering the previously recorded tile...
            if (selectedBlocks.Count > 1 && selectedBlocks.IndexOf(boardPos) == selectedBlocks.Count - 2)
            {
                // ...remove it, the player has gone back a step in their line drawing
                selectedBlocks.RemoveAt(selectedBlocks.Count - 1);

                // Calculate next set of potential block links
                potentialLinks = NextPotentialPositions(boardPos);
            }
            // Otherwise add the tile if it isn't already captured
            else if (!selectedBlocks.Contains(boardPos))
            {
                selectedBlocks.Add(boardPos);

                // Calculate next set of potential block links
                potentialLinks = NextPotentialPositions(boardPos);
            }
        }
    }
 private void OnPointerClick(ListViewItem item, int clickCount, PointerEventData.InputButton button)
 {
     if (button == PointerEventData.InputButton.Left)
     {
         OnSelect(item);
     }
 }
 // Token: 0x06000244 RID: 580 RVA: 0x0001E80C File Offset: 0x0001CA0C
 public CusPointerInputModule.ButtonState GetButtonState(PointerEventData.InputButton button, int id = 0)
 {
     CusPointerInputModule.ButtonState buttonState = null;
     for (int i = 0; i < this.m_TrackedButtons.Count; i++)
     {
         if (this.m_TrackedButtons[i].button == button)
         {
             if (id == 0)
             {
                 buttonState = this.m_TrackedButtons[i];
             }
             else
             {
                 id--;
             }
             break;
         }
     }
     if (buttonState == null)
     {
         buttonState = new CusPointerInputModule.ButtonState
         {
             button    = button,
             eventData = new CusPointerInputModule.MouseButtonEventData()
         };
         this.m_TrackedButtons.Add(buttonState);
     }
     return(buttonState);
 }
Exemple #20
0
    public void OnPointerDown(PointerEventData eventData)
    {
        PointerEventData.InputButton button = eventData.button;
        currPosition.gameObject.SetActive(true);

        UpdateVelocity(eventData);
    }
Exemple #21
0
        public void SetButtonState_ChangesButtonStateAsExpected()
        {
            const PointerEventData.InputButton expectedButton = PointerEventData.InputButton.Left;

            _virtualMouse.SetButtonState(expectedButton, true);

            Assert.IsTrue(_virtualMouse.GetVirtualMouseData().ButtonEntries[expectedButton].Pressed);
        }
Exemple #22
0
 private void MouseDown(PointerEventData.InputButton button)
 {
     // on right-click, back out
     if (button == PointerEventData.InputButton.Right)
     {
         game.ChangeState(new Idle());
     }
 }
    /// <summary>
    /// Метод по обработке клика пользователя на ячейку с услугой
    /// </summary>
    /// <param name="containerUi"></param>
    /// <param name="inputButton"></param>
    private void CellViewOnClickOnViewEvent(IContainerUI containerUi, PointerEventData.InputButton inputButton)
    {
        var data = ((IContainerUI <BaseDataForSelectWindow>)containerUi).CurrentData;
        BaseDataForProfileWindow fullInfo = DiplomCore.Instance.MainBD.GetFullInfo(_currentViewType, data.Id); // запрос в БД

        UIInstance.Instance.GetWindow <ProfileWindow>().UpdateDataView(fullInfo);                              // показать окно
        this.HideWindow(null);
    }
Exemple #24
0
 private void SimulateClickUp(PointerEventData.InputButton mouseButton)
 {
     ButtonEventInvoke <IPointerUpHandler>((b, es) =>
                                           b.OnPointerUp(new PointerEventData(es)
     {
         button = mouseButton
     }));
 }
Exemple #25
0
        // Implement interfaces
        public virtual void OnPress(UIItemSlot slot, PointerEventData.InputButton button)
        {
            var info = GetSlotLink(slot);

            if (button == PointerEventData.InputButton.Left && info.container != null)
            {
                inventoryHandler.MoveSelectedItem(info.container, info.index);
            }
        }
Exemple #26
0
 public void EntryClick(int index, PointerEventData.InputButton button)
 {
     if (button == PointerEventData.InputButton.Left && index > -1)
     {
         CharacterStats.hotbar[index] = currentItem;
     }
     Events.onDiscard = false;
     ObjectPooler.op.DeSpawn(gameObject);
 }
Exemple #27
0
        public void ClickDel(UISimpleGameDataButton button, PointerEventData.InputButton buttonEvent)
        {
            var item = button.Data as Entity;

            if (item != null)
            {
                Player.MainInventory.Add(item);
            }
        }
        public void ClickDel(UISimpleGameDataButton button, PointerEventData.InputButton buttonEvent)
        {
            var item = button.Data as Entity;

            if (item != null)
            {
                World.Get <ContainerSystem>().TryAdd(Player.MainInventory, item);
            }
        }
Exemple #29
0
        public void SetButtonState_UpdateClearsState()
        {
            const PointerEventData.InputButton expectedButton = PointerEventData.InputButton.Left;

            _virtualMouse.SetButtonState(expectedButton, true);
            _virtualMouse.TestUpdate(1.0f);

            Assert.IsFalse(_virtualMouse.GetVirtualMouseData().ButtonEntries[expectedButton].Pressed);
        }
        void Perform_Summon(PointerEventData.InputButton input, Vector2Int tileIdx)
        {
            if (!Model.Managers.FieldManager.IsInField(tileIdx))
            {
                return;
            }

            if (input == PointerEventData.InputButton.Left)
            {
                // Debug.Log("vec3" + pos);
                // Debug.Log("vec2" + tileIdx);

                if (DungeonEditor.instance.selectedIndex >= 0)
                {
                    // Debug.Log(DungeonEditor.instance.selectedObject);

                    //유닛 소환
                    if (DungeonEditor.instance.selectedObject is string)
                    {
                        Unit_Serializable u = Common.Data.Load_Unit_Serializable_Data((string)DungeonEditor.instance.selectedObject);
                        Unit unit           = new Unit(u);
                        Common.Command.Summon(unit, tileIdx);
                    }

                    else if (DungeonEditor.instance.selectedObject is Item)
                    {
                        Common.Command.Summon(((Item)DungeonEditor.instance.selectedObject).Clone(), tileIdx);
                    }

                    else if (DungeonEditor.instance.selectedObject is Artifact)
                    {
                        Common.Command.Summon(((Artifact)DungeonEditor.instance.selectedObject).Clone(), tileIdx);
                    }

                    else if (DungeonEditor.instance.selectedObject is Tile)
                    {
                        Vector3Int tilePosition = new Vector3Int(tileIdx.x, tileIdx.y, 0);
                        Tile       newtile      = ((Tile)DungeonEditor.instance.selectedObject).Clone();
                        Tile       oldtile      = Model.Managers.FieldManager.GetTile(tileIdx.x, tileIdx.y);

                        // 이전 타일 연결 관계 유지.
                        newtile.OnTile(oldtile.GetUnit());
                        newtile.SetObtainable(oldtile.GetObtainable());

                        Model.Managers.FieldManager.instance.field[tileIdx.y, tileIdx.x]          = newtile;
                        Model.Managers.FieldManager.instance.field[tileIdx.y, tileIdx.x].position = tileIdx;
                        Model.Managers.FieldManager.instance.tileMap.SetTile(tilePosition, newtile.TileBase);
                    }

                    //Common.Command.Summon((Unit) DungeonEditor.instance.selectedObject, tileIdx);
                }
            }
            else if (input == PointerEventData.InputButton.Right)
            {
                Common.Command.UnSummon(tileIdx);
            }
        }
 // On RMB, 'put the piece back'
 private void MouseDown(PointerEventData.InputButton button)
 {
     switch (button)
     {
     case PointerEventData.InputButton.Right:
         UnmarkPiece(map.mouseCell);
         game.ChangeState(new Idle());
         break;
     }
 }