Each touch event creates one of these containing all the relevant information.
Inheritance: BaseEventData
示例#1
1
 public void OnDrag(PointerEventData eventData)
 {
     Vector3 newPosition;
     newPosition = mainCam.ScreenToWorldPoint(eventData.position);
     newPosition.z = 0f;
     dragObject.transform.position = newPosition;
 }
        protected override void OnUserDrop(UnityEngine.EventSystems.PointerEventData eventData)
        {
            // 获取拖拽中的物品
            Consumables consumablesPrepareToLoad = GetDraggedItem(eventData) as Consumables;

            // 没有拖拽中的物品或者物品类型不是装备直接返回
            if (consumablesPrepareToLoad == null || consumablesPrepareToLoad.itemType != ItemType.Consumables)
            {
                SetDropResult(eventData, false);
                tintImage.enabled = false;
                return;
            }

            Consumables consumablesPrepareToUnload = Player.mainPlayer.allConsumablesInBag [consumablesIndexInPanel];

            int indexOfConsumablesPrepareToLoad   = GetConsumablesIndexInBag(consumablesPrepareToLoad);
            int indexOfConsumablesPrepareToUnload = consumablesIndexInPanel;

            Player.mainPlayer.allConsumablesInBag [indexOfConsumablesPrepareToLoad]   = consumablesPrepareToUnload;
            Player.mainPlayer.allConsumablesInBag [indexOfConsumablesPrepareToUnload] = consumablesPrepareToLoad;

            explorePlayerUICtr.SetUpBottomConsumablesButtons();
            explorePlayerUICtr.SetUpConsumablesInBagPlane();


            SetDropResult(eventData, true);

            tintImage.enabled = false;
        }
示例#3
0
        public override void OnPointerExit(UnityEngine.EventSystems.PointerEventData eventData)
        {
            base.OnPointerExit(eventData);
            UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null);
            if (OnHoverEndAction != null)
            {
                OnHoverEndAction.Invoke();
            }

            if (FadeOnHover != null)
            {
                if (m_fadeOnHoverTweener != null)
                {
                    m_fadeOnHoverTweener.Kill();
                }

                m_fadeOnHoverTweener = FadeOnHover.DOFade(0, 0.2f)
                                       .OnComplete(() => { FadeOnHover.gameObject.SetActive(false); });
            }

            if (HoverEffect != null)
            {
                HoverEffect.SetActive(false);
            }
        }
示例#4
0
        public override void OnPointerEnter(UnityEngine.EventSystems.PointerEventData eventData)
        {
            base.OnPointerEnter(eventData);
            if (OnHoverBeginAction != null)
            {
                OnHoverBeginAction.Invoke();
            }

            if (FadeOnHover != null)
            {
                if (m_fadeOnHoverTweener != null)
                {
                    m_fadeOnHoverTweener.Kill();
                }

                FadeOnHover.gameObject.SetActive(true);
                m_fadeOnHoverTweener = FadeOnHover.DOFade(1, 0.2f);
            }

            if (HoverEffect != null)
            {
                HoverEffect.SetActive(true);
            }
            //AudioModule.Instance.PlayOnHoverBeginSound();
        }
 void IPointerClickHandler.OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (isInteractive)
     {
         print("pointerClick");
     }
 }
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData even)
 {
     if (even.button == PointerEventData.InputButton.Left)
     {
         PanelManager.instance.SetContentType(gameObject.name);
     }
 }
示例#7
0
 public void OnPointerExit(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (exitNotificationEvent != null)
     {
         exitNotificationEvent(eventData);
     }
 }
示例#8
0
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (clickNotificationEvent != null)
     {
         clickNotificationEvent(eventData);
     }
 }
示例#9
0
    public override void OnDrag(UnityEngine.EventSystems.PointerEventData eventData)
    {
        Vector2 localPoint;

        if (eventData.button != PointerEventData.InputButton.Left || !this.IsActive() || !RectTransformUtility.ScreenPointToLocalPointInRectangle(this.viewRect, eventData.position, eventData.pressEventCamera, out localPoint))
        {
            return;
        }

        var pointerPos = localPoint;

        Vector2 offsetPos = pointerPos - _beginPos;

        _changePostion = offsetPos.normalized;

        if (offsetPos.magnitude > mRadius)
        {
            offsetPos  = _changePostion * mRadius;
            pointerPos = _beginPos + offsetPos;
        }
        SetContentAnchoredPosition(pointerPos);


        float angle = Vector2.Angle(Vector2.up, _changePostion);

        if (_changePostion.x > 0)
        {
            angle = -angle;
        }
        _rotateAngle.z           = angle;
        content.localEulerAngles = _rotateAngle;
    }
    /// <summary>
    /// Begin drag event
    /// </summary>
    public override void OnBeginDrag(UnityEngine.EventSystems.PointerEventData eventData)
    {
        _DragDelta = Vector2.zero;

        if (!horizontal && Math.Abs(eventData.delta.x) > Math.Abs(eventData.delta.y))
        {
            routeToParent = true;
        }
        else if (!vertical && Math.Abs(eventData.delta.x) < Math.Abs(eventData.delta.y))
        {
            routeToParent = true;
        }
        else
        {
            routeToParent = false;
        }

        if (routeToParent)
        {
            DoForParents <IBeginDragHandler>((parent) => { parent.OnBeginDrag(eventData); });
        }
        else
        {
            base.OnBeginDrag(eventData);
        }

        if (onScrollStart != null)
        {
            onScrollStart.Invoke();
        }
    }
示例#11
0
 public override void OnEndDrag(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (routeToParent)
     {
         DoParentEventSystemHandler <IEndDragHandler>((parent) =>
         {
             parent.OnEndDrag(eventData);
         });
     }
     else
     {
         DoEventSystemHandler <IEndDragHandler>(transform, (parent) =>
         {
             if (parent == this)
             {
                 base.OnEndDrag(eventData);
             }
             else
             {
                 parent.OnEndDrag(eventData);
             }
         });
     }
     routeToParent = false;
 }
 public override void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (canDo)
     {
         base.OnPointerClick(eventData);//InterfaceManager.Instance.RequestDisplay(displayType, (displayType==BaseDisplay.DISPLAY_TYPES.TEXT)?(knotData):(data as object));
     }
 }
示例#13
0
 public void OnDrop(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (onDrop != null)
     {
         onDrop(eventData);
     }
 }
示例#14
0
 public void OnEndDrag(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (onEndDrag != null)
     {
         onEndDrag(eventData);
     }
 }
示例#15
0
    public override void Raycast(UnityEngine.EventSystems.PointerEventData eventData, List <UnityEngine.EventSystems.RaycastResult> resultAppendList)
    {
        float      dist = 10.0f;
        RaycastHit hit  = new RaycastHit();

        if (pointerEnabled)
        {
            if (!Physics.Raycast(activeController.position, activeController.forward, out hit, dist, uiMask))
            {
                if (ObjectSelection.instance && ObjectSelection.instance.selectionEnabled)
                {
                    Physics.Raycast(activeController.position, activeController.forward, out hit, dist, currentLayerMask);
                }
            }
        }
        PointerVisualizer.instance.SetPointer(hit);
        if (hit.collider != null && Controller.instance.pointerMode == PointerMode.SELECT)
        {
            RaycastResult result = new RaycastResult {
                gameObject    = hit.collider.gameObject,
                module        = this,
                distance      = hit.distance,
                index         = resultAppendList.Count,
                worldPosition = hit.point,
                worldNormal   = hit.normal,
            };
            resultAppendList.Add(result);
        }
    }
示例#16
0
 public override void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (!_handled)
     {
         base.OnPointerClick(eventData);
     }
 }
示例#17
0
        public override void OnBeginDrag(UnityEngine.EventSystems.PointerEventData eventData)
        {
            if (IsAllowedClickButton)
            {
                if (!horizontal && Math.Abs(eventData.delta.x) > Math.Abs(eventData.delta.y))
                {
                    routeToParent = true;
                }
                else if (!vertical && Math.Abs(eventData.delta.x) < Math.Abs(eventData.delta.y))
                {
                    routeToParent = true;
                }
                else
                {
                    routeToParent = false;
                }

                if (routeToParent)
                {
                    DoForParents <IBeginDragHandler>((parent) => { parent.OnBeginDrag(eventData); });
                }
                else
                {
                    OnPressDown?.Invoke(this, eventData.pointerId);
                    base.OnBeginDrag(eventData);
                }
            }
        }
示例#18
0
 public void OnDrag(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (m_Canvas != null)
     {
         this.transform.localPosition = JerryUtil.PosScreen2Canvas(m_Canvas, JerryUtil.GetClickPos(), this.transform);
     }
 }
示例#19
0
        public void OnEndDrag(PointerEventData eventData)
        {
            try
            {
                if (inv.DragAndDropEnabled)
                {
                    GetComponent<CanvasGroup>().blocksRaycasts = true;
                    transform.GetComponent<RectTransform>().anchoredPosition3D = startPosition;

                    bool foundParent = false;
                    for (int i = 0; i < inv.SlotList.Count; i++)
                    {
                        if (transform.parent == inv.SlotList[i])
                        {
                            foundParent = true;
                        }
                    }
                    if (foundParent == false)
                    {
                        transform.SetParent(startParent);
                        transform.GetComponent<RectTransform>().anchoredPosition3D = startPosition;
                    }

                }
            }
            catch (Exception ex)
            {

            }
        }
 public void OnPointerDown(PointerEventData eventData)
 {
     isNextTowerSelectionCanceled = false;
     if (OnMouseDown != null){
         OnMouseDown();
     }
 }
示例#21
0
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Right)
     {
         MouseClick();
     }
 }
示例#22
0
	public void OnEndDrag(PointerEventData eventData)
	{
		//removed because I needed to change the transform from dropzone using the doStuff() function.
		/*Debug.Log("End dragging");
		this.transform.SetParent(currentParent);
		GetComponent<CanvasGroup>().blocksRaycasts = true;*/
	}
示例#23
0
 public void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (onDown != null)
     {
         onDown(eventData);
     }
 }
示例#24
0
 //拖动
 public void OnDrag(PointerEventData evt)
 {
         if (listView != null)
     {
        // listView.OnScroll(evt);
     }
 }
示例#25
0
	public void OnPointerDown(PointerEventData eventData){
		if(!touched){
			touched = true;
			pointerID = eventData.pointerId;
			origin = eventData.position;
		}
	}
示例#26
0
    private bool pressingButtonToSplit; //bool for pressing a item to split it

    #endregion Fields

    #region Methods

    //splitting the item now
    public void OnPointerDown(PointerEventData data)
    {
        inv = transform.parent.parent.parent.GetComponent<Inventory>();
        if (transform.parent.parent.parent.GetComponent<Hotbar>() == null && data.button == PointerEventData.InputButton.Left && pressingButtonToSplit && inv.stackable && (inv.ItemsInInventory.Count < (inv.height * inv.width))) //if you press leftclick and and keycode
        {
            ItemOnObject itemOnObject = GetComponent<ItemOnObject>();                                                   //we take the ItemOnObject script of the item in the slot

            if (itemOnObject.item.itemValue > 1)                                                                         //we split the item only when we have more than 1 in the stack
            {
                int splitPart = itemOnObject.item.itemValue;                                                           //we take the value and store it in there
                itemOnObject.item.itemValue = (int)itemOnObject.item.itemValue / 2;                                     //calculate the new value for the splitted item
                splitPart = splitPart - itemOnObject.item.itemValue;                                                   //take the different

                inv.addItemToInventory(itemOnObject.item.itemID, splitPart);                                            //and add a new item to the inventory
                inv.stackableSettings();

                if (GetComponent<ConsumeItem>().duplication != null)
                {
                    GameObject dup = GetComponent<ConsumeItem>().duplication;
                    dup.GetComponent<ItemOnObject>().item.itemValue = itemOnObject.item.itemValue;
                    dup.GetComponent<SplitItem>().inv.stackableSettings();
                }
                inv.updateItemList();

            }
        }
    }
示例#27
0
 public void OnEndDrag(PointerEventData eventData)
 {
     if (isSelectable) {
         Vector3 pointerPos = eventData.pointerCurrentRaycast.worldPosition;
         attackController.FlingMarker (pointerPos);
     }
 }
 /// <summary>
 /// Raises the end drag event.
 /// </summary>
 /// <param name="eventData">Event data.</param>
 public void OnEndDrag(PointerEventData eventData)
 {
     float ratio = Handle.anchoredPosition.x / (SwitchContainer.rect.width - Handle.rect.width);
     Parent.SetSwitchedOn (ratio >= 0.5f);
     dragging = false;
     Animate ();
 }
示例#29
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        if (eventData.pointerDrag == null)                                  // if not dragging you can't do anything so return immediately
            return;

        //Debug.Log("On Pointer Enter called");
    }
示例#30
0
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (onClick != null)
     {
         onClick(eventData);
     }
 }
	public void OnDrag(PointerEventData eventData) {
		//Debug.Log ("OnDrag");
		
		this.transform.position = eventData.position;

		if(placeholder.transform.parent != placeholderParent)
			placeholder.transform.SetParent(placeholderParent);

		int newSiblingIndex = placeholderParent.childCount;

		for(int i=0; i < placeholderParent.childCount; i++) {
			if(this.transform.position.x < placeholderParent.GetChild(i).position.x) {

				newSiblingIndex = i;

				if(placeholder.transform.GetSiblingIndex() < newSiblingIndex)
					newSiblingIndex--;

				break;
			}
		}

		placeholder.transform.SetSiblingIndex(newSiblingIndex);


	}
示例#32
0
 public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Right)
     {
         Debug.Log("右键点击");
     }
 }
示例#33
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        if (!DraggingEnabled())
        {
            return;
        }

        if (dragInProgress && !IsInStack(gameObject))
        {
            var hoveredObject = gameObject;
            if (hoveredObject != null)
            {
                var isInStack = IsInStack(hoveredObject);
                var isBridgeTile = IsValidBridge(hoveredObject);
                var isNeighbour = IsNeighbour(hoveredObject);

                if ((!isInStack || isBridgeTile) && isNeighbour)
                {
                    PushToStack(hoveredObject);
                }

                chain.ForEach(x => x.GetComponent<ConnectTiles>().ChainWillBeAdded = true);
            }
            else
            {
                chain.ForEach(x => x.GetComponent<ConnectTiles>().ChainWillBeAdded = false);
            }
        }
    }
示例#34
0
        /// <summary>
        /// Begin drag event
        /// </summary>
        public override void OnBeginDrag(UnityEngine.EventSystems.PointerEventData eventData)
        {
            print("Begin");
            if (!horizontal && Math.Abs(eventData.delta.x) > Math.Abs(eventData.delta.y))
            {
                routeToParent = true;
            }
            else if (!vertical && Math.Abs(eventData.delta.x) < Math.Abs(eventData.delta.y))
            {
                routeToParent = true;
            }
            else
            {
                routeToParent = false;
            }

            if (routeToParent)
            {
                DoForParents <IBeginDragHandler>((parent) => { parent.OnBeginDrag(eventData); });
            }
            else
            {
                base.OnBeginDrag(eventData);
            }
        }
示例#35
0
 public void OnPointerDown(UnityEngine.EventSystems.PointerEventData data)
 {
     if (this.owner == PiceOwner.Side)
     {
         Puzzle.instance.side.scrollView.OnTouch();
     }
 }
示例#36
0
    public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
    {
        // Get the currently loaded DICOM:
        DICOM dicom = DICOMLoader.instance.currentDICOM;

        if (dicom != null)
        {
            // The world position which was clicked:
            Vector3 worldPos = eventData.pointerCurrentRaycast.worldPosition;
            // Transform the position to the patient coordinate system (i.e. in mm)
            Vector3 localPos = transform.InverseTransformPoint(worldPos);

            Debug.Log("Clicked: " + worldPos + " (local: " + localPos + ")");

            // Now we can either transform the position to a continuous pixel position...
            // (to do so, we use the series Info associated with the DICOM:
            Vector3 pixel = dicom.seriesInfo.transformPatientPosToPixel(localPos);
            Debug.Log("Pixel: " + pixel.x + "," + pixel.y + " on layer " + pixel.z);

            // ... or we can transform it to a discrete pixel position:
            Vector3 pixelRounded = dicom.seriesInfo.transformPatientPosToDiscretePixel(localPos);
            Debug.Log("Rounded: " + pixelRounded.x + "," + pixelRounded.y + " on layer " + pixelRounded.z);
        }
        else
        {
            Debug.Log("No DICOM loaded.");
        }
    }
示例#37
0
	public void OnPointerUp(PointerEventData eventData){
		if(pointerID == eventData.pointerId){
			touched = false;
			direction = Vector2.zero;
			smoothDirection = Vector2.zero;
		}
	}
示例#38
0
    public void OnPointerExit(PointerEventData data)
    {
        if (containerImage == null)
            return;

        containerImage.color = normalColor;
    }
示例#39
0
	public void OnBeginDrag (PointerEventData eventData)
	{
		//Debug.Log("begin dragging");
		currentParent = this.transform.parent;
		this.transform.SetParent(transferTransform);
		GetComponent<CanvasGroup>().blocksRaycasts = false;
	}
 public void OnPointerUp(PointerEventData eventData)
 {
     foreach (var dpadAxis in DpadAxis)
     {
         dpadAxis.TryRelease(eventData.pointerId);
     }
 }
示例#41
0
    public virtual void OnEndDrag(UnityEngine.EventSystems.PointerEventData eventData)
    {
        Debug.Log("end drag");
        if (eventData.button != PointerEventData.InputButton.Left)
        {
            return;
        }

        _isDraging = false;
        endPoint   = eventData.position;
        Debug.Log(endPoint.x + "  " + endPoint.y);
        if (endPoint.x < startPoint.x)
        {
            Debug.Log("down");
        }
        if (endPoint.x > startPoint.x)
        {
            Debug.Log("up");
        }
        if (endPoint.y < startPoint.y)
        {
            Debug.Log("right");
        }
        if (endPoint.y > startPoint.y)
        {
            Debug.Log("left");
        }
//		Debug.Log ("end drag");
    }
示例#42
0
	public void OnPointerEnter(PointerEventData e)
	{
        if (!isActive) return;

        tooltipController.SetTextsActive(title.Length > 0, desc.Length > 0);
		tooltipController.OnActivate(title, desc);
	}
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (m_button.interactable)
     {
         m_rawImage.texture = renderTexture;
     }
 }
示例#44
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     itemBeingDragged = gameObject;
     startPosition = transform.position;
     startParent = transform.parent;
     GetComponent<CanvasGroup> ().blocksRaycasts = false;
 }
示例#45
0
    public void OnDrop(PointerEventData eventData)
    {
        if(!item) //Se o slot estiver vazio
        {
            if(!slotDescarte)
            {
                DragHandler.itemSendoArrastado.transform.SetParent(transform, false);

                //Se for slot de combinacao, adiciona ao vetor de ervilhas na pos especifica
                if(this.slotComb)
                    geneComb.vetorErvilhas[numSlotComb - 1] = DragHandler.itemSendoArrastado;

                if(!DragHandler.podeGerar)
                    Spawner.acabeiMover = true;

                //Se o slot do pai FOR de combinacao, apaga o antigo e sobrescreve o novo
                else
                {
                    geneComb.vetorErvilhas[numSlotComb - 1] = DragHandler.itemSendoArrastado;
                    geneComb.vetorErvilhas[numSlotCombPai - 1] = null;
                }
            }
            else
            {
                if(DragHandler.podeGerar)
                    Destroy(DragHandler.itemSendoArrastado);
            }
        }
    }
示例#46
0
        public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
        {
            if (eventCamera == null)
                return;

            var ray = eventCamera.ScreenPointToRay(eventData.position);

            float dist = eventCamera.farClipPlane - eventCamera.nearClipPlane;

            var hits = Physics2D.RaycastAll(ray.origin, ray.direction, dist, finalEventMask);

            if (hits.Length != 0)
            {
                eventData.worldPosition = hits[0].point;
                eventData.worldNormal = hits[0].normal;
                for (int b = 0, bmax = hits.Length; b < bmax; ++b)
                {
                    SpriteRenderer sr = hits[b].collider.gameObject.GetComponent<SpriteRenderer>();

                    var result = new RaycastResult
                    {
                        gameObject = hits[b].collider.gameObject,
                        module = this,
                        distance = Vector3.Distance(eventCamera.transform.position, hits[b].transform.position),
                        index = resultAppendList.Count,
                        sortingLayer =  sr != null ? sr.sortingLayerID : 0,
                        sortingOrder = sr != null ? sr.sortingOrder : 0
                    };
                    resultAppendList.Add(result);
                }
            }
        }
示例#47
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     if (isSelectable) {
         attackController.SpawnMarker ();
         isDragging = true;
     }
 }
    public void OnDrag(PointerEventData eventData)
    {
        if (!cardIsMine) return;

        this.transform.position = eventData.position;

        if (placeholder.transform.parent != placeholderParent)
        {
            placeholder.transform.SetParent(placeholderParent);
        }

        int newSiblingIndex = placeholderParent.childCount;
        for(int i = 0; i < placeholderParent.childCount; i++)
        {
            if(this.transform.position.x < placeholderParent.GetChild(i).position.x)
            {
                newSiblingIndex = i;
                if(placeholder.transform.GetSiblingIndex() < newSiblingIndex)
                {
                    newSiblingIndex--;
                }

                break;
            }
        }

        placeholder.transform.SetSiblingIndex(newSiblingIndex);
    }
示例#49
0
    public override void OnBeginDrag(UnityEngine.EventSystems.PointerEventData eventData)
    {
        if (!horizontal && Math.Abs(eventData.delta.x) > Math.Abs(eventData.delta.y))
        {
            routeToParent = true;
        }
        else if (!vertical && Math.Abs(eventData.delta.x) < Math.Abs(eventData.delta.y))
        {
            routeToParent = true;
        }
        else
        {
            routeToParent = false;
        }

        if (routeToParent)
        {
            if (parentScrollRect != null)
            {
                ((IBeginDragHandler)parentScrollRect).OnBeginDrag(eventData);
            }
        }
        else
        {
            base.OnBeginDrag(eventData);
        }
    }
示例#50
0
    /// <summary>
    /// Called when the pointer clicks on the terrain.
    /// </summary>
    /// <param name="eventData">Event data.</param>
    public void OnPointerClick(PointerEventData eventData)
    {
        if (eventData.button != PointerEventData.InputButton.Left)
        {
            return;
        }

        //Get info about clicked point.
        Vector3 clicked_point = eventData.pointerCurrentRaycast.worldPosition;
        TerrainGenerator generator = GetComponent<TerrainGenerator> ();
        Point heightmapPos = generator.GetHeightmapPosFromWorldPos (clicked_point);
        BiomeMapPixel biomeData = generator.BiomeMap.GetPixelAtPoint(heightmapPos);

        //Place location marker.
        if (m_positionMarker != null)
        {
            Destroy(m_positionMarker);
        }
        Vector3 camera_direction = transform.position - Camera.main.transform.position;
        camera_direction.y = 0;
        Quaternion look_rotation = Quaternion.LookRotation(camera_direction, Vector3.up);
        m_positionMarker = Instantiate(m_positionMarkerPrefab, clicked_point, look_rotation) as GameObject;

        //Animate it into position.
        m_positionMarker.transform.localScale = new Vector3(1, 0, 0);
        LeanTween.scaleY(m_positionMarker, 1, 0.5f).setEase(LeanTweenType.easeOutElastic);
        LeanTween.scaleZ(m_positionMarker, 1, 1f).setEase(LeanTweenType.easeOutElastic);

        //Update location text
        m_locationText.text = heightmapPos + Environment.NewLine + biomeData;
    }
 /// <summary>
 /// Raises the drag event.
 /// </summary>
 /// <param name="eventData">Event data.</param>
 public void OnDrag(PointerEventData eventData)
 {
     float xMax = SwitchContainer.rect.width - Handle.rect.width;
     Vector3 displacement = originalPosition + eventData.position - eventData.pressPosition;
     Handle.anchoredPosition = new Vector2 (Mathf.Clamp (displacement.x, 0, xMax), Handle.anchoredPosition.y);
     Fill.offsetMax = new Vector2 (Handle.anchoredPosition.x + 1, Fill.offsetMax.y);
 }
示例#52
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if(OnPointerEnterButton != null)
     {
         OnPointerEnterButton(this);
     }
 }
示例#53
0
    public void OnPointerClick( PointerEventData eventData )
    {
        if ( oneClick )
        {
            if ( (Time.time - timerForDoubleClick) > delay )
                oneClick = false;
        }

        if (eventData.button == PointerEventData.InputButton.Left && !oneClick)
        {
            oneClick = true;
            timerForDoubleClick = Time.time;
        //			Debug.Log("Left click");
        } else
        {
        //			Debug.Log("Open folder");

            // I need to save the current directory, to be able to re-fill the box and go back to it, by hitting an up arrow
            instance = this;

            subFolderList = this.GetSubFolderList( subFolderList );

        //			string test = BoxTab.instance.modifier + subFolderList;

            BoxTab.instance.ClearBox();
            BoxTab.instance.PopulateBox( BoxTab.instance.modifier + subFolderList );
            BoxTab.instance.AddPlusButton( BoxTab.instance.modifier );

            this.AddUpArrow();

            oneClick = false;

        }
    }
 void OnUp( PointerEventData eventData , GameObject go , string[] args )
 {
     if (enabled)
     {
         UI_TweenScale.Begin(tweenTarget.gameObject , duration , mScale).from = pressed;
     }
 }
 void OnDown( PointerEventData eventData , GameObject go , string[] args )
 {
     if (enabled)
     {
         UI_TweenScale.Begin(tweenTarget.gameObject , duration , pressed);
     }
 }
示例#56
0
    public void OnEndDrag(PointerEventData eventData)
    {
        DroppingBirds sling = null;

        //We could look up hovered[0] for the sling, the loop is just a safety measure in case something obstructs the sling
        foreach (GameObject i in eventData.hovered)
        {
            if (i.name == "Sling")
            {
                sling = i.GetComponent<DroppingBirds>();
            }
        }
        //if (eventData.pointerEnter && eventData.pointerEnter.CompareTag("SlingCanvas"))
        //{
        //    sling = eventData.pointerEnter.GetComponent<DroppingBirds>();
        //}

        //If no sling was found in the hovered objects, delete the dragged bird sprite and end the function
        if (!sling)
        {
            Instantiate(explosion, dragObject.transform.position + explosionOffset, Quaternion.identity);
            Destroy(dragObject);
            return;
        }

        //We add one bird of type X to the slingshot. After that we destroy the dragged sprite.
        sling.birdList.Add(info.GetComponent<Bird>().prefab);
        Destroy(dragObject);

        //Now we update the canvas attached to the sling
        sling.UpdateCanvas();
    }
示例#57
0
 public void OnEndDrag(UnityEngine.EventSystems.PointerEventData eventData)
 {
     isDrag = false;
     if (hDragStart != null)
     {
         hDrageEnd.call(eventData);
     }
 }
示例#58
0
 public void OnPointerHover(UnityEngine.EventSystems.PointerEventData eventData)
 {
     //Debug.Log ("Hover");
     if (hoverNotificationEvent != null)
     {
         hoverNotificationEvent(eventData);
     }
 }
示例#59
0
 public void OnBeginDrag(UnityEngine.EventSystems.PointerEventData eventData)
 {
     isDrag = true;
     if (hDragStart != null)
     {
         hDragStart.call(eventData);
     }
 }
示例#60
0
 public void OnPointerDown(UnityEngine.EventSystems.PointerEventData eventData)
 {
     this.DisplayContainer.gameObject.SetActive(false);
     if (OnClosing != null)
     {
         OnClosing();
     }
 }