当前位置: 首页>>代码示例>>C#>>正文


C# EventSystems.PointerEventData类代码示例

本文整理汇总了C#中UnityEngine.EventSystems.PointerEventData的典型用法代码示例。如果您正苦于以下问题:C# PointerEventData类的具体用法?C# PointerEventData怎么用?C# PointerEventData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PointerEventData类属于UnityEngine.EventSystems命名空间,在下文中一共展示了PointerEventData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDrag

 public void OnDrag(PointerEventData eventData)
 {
     Vector3 newPosition;
     newPosition = mainCam.ScreenToWorldPoint(eventData.position);
     newPosition.z = 0f;
     dragObject.transform.position = newPosition;
 }
开发者ID:Schadek,项目名称:SlingShooter,代码行数:7,代码来源:DragBird.cs

示例2: OnEndDrag

        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)
            {

            }
        }
开发者ID:Reaw,项目名称:InventoryLight,代码行数:30,代码来源:ItemData.cs

示例3: OnDrag

	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);


	}
开发者ID:marcochiu2-c,项目名称:MainMenu_uFrame1.6,代码行数:26,代码来源:Draggable.cs

示例4: OnPointerEnter

 public void OnPointerEnter(PointerEventData eventData)
 {
     if(OnPointerEnterButton != null)
     {
         OnPointerEnterButton(this);
     }
 }
开发者ID:Barabicus,项目名称:ATOMFIACHRA,代码行数:7,代码来源:SpellButton.cs

示例5: OnUp

 void OnUp( PointerEventData eventData , GameObject go , string[] args )
 {
     if (enabled)
     {
         UI_TweenScale.Begin(tweenTarget.gameObject , duration , mScale).from = pressed;
     }
 }
开发者ID:dotlive,项目名称:Unity3DuGUI-Toolkit,代码行数:7,代码来源:UI_ButtonScale.cs

示例6: OnEndDrag

    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();
    }
开发者ID:Schadek,项目名称:SlingShooter,代码行数:32,代码来源:DragBird.cs

示例7: OnDrag

 //拖动
 public void OnDrag(PointerEventData evt)
 {
         if (listView != null)
     {
        // listView.OnScroll(evt);
     }
 }
开发者ID:ideadreamDefy,项目名称:Defy,代码行数:8,代码来源:ScrollListener.cs

示例8: OnBeginDrag

 public void OnBeginDrag(PointerEventData eventData)
 {
     if (isSelectable) {
         attackController.SpawnMarker ();
         isDragging = true;
     }
 }
开发者ID:zanefisher,项目名称:castle,代码行数:7,代码来源:flingMenu.cs

示例9: OnPointerDown

	public void OnPointerDown(PointerEventData eventData){
		if(!touched){
			touched = true;
			pointerID = eventData.pointerId;
			origin = eventData.position;
		}
	}
开发者ID:BinaryLeeward,项目名称:demo4Unity,代码行数:7,代码来源:SimpleTouchPad.cs

示例10: OnDrag

    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);
    }
开发者ID:guntarspolis,项目名称:BakalauraDarbsTest,代码行数:28,代码来源:DraggableCard.cs

示例11: Raycast

        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);
                }
            }
        }
开发者ID:602147629,项目名称:Unity-ugui,代码行数:32,代码来源:Physics2DRaycaster.cs

示例12: OnBeginDrag

 public void OnBeginDrag(PointerEventData eventData)
 {
     itemBeingDragged = gameObject;
     startPosition = transform.position;
     startParent = transform.parent;
     GetComponent<CanvasGroup> ().blocksRaycasts = false;
 }
开发者ID:mdefasqu,项目名称:Unity,代码行数:7,代码来源:dragHandeler.cs

示例13: OnPointerEnter

	public void OnPointerEnter(PointerEventData e)
	{
        if (!isActive) return;

        tooltipController.SetTextsActive(title.Length > 0, desc.Length > 0);
		tooltipController.OnActivate(title, desc);
	}
开发者ID:AntlerOwl,项目名称:GGJ-Demons,代码行数:7,代码来源:Tooltip.cs

示例14: OnPointerUp

 public void OnPointerUp(PointerEventData eventData)
 {
     foreach (var dpadAxis in DpadAxis)
     {
         dpadAxis.TryRelease(eventData.pointerId);
     }
 }
开发者ID:melanke,项目名称:First-Mobile-Platform-Unity-Game,代码行数:7,代码来源:Dpad.cs

示例15: OnPointerExit

    public void OnPointerExit(PointerEventData data)
    {
        if (containerImage == null)
            return;

        containerImage.color = normalColor;
    }
开发者ID:globularcluster,项目名称:MotivAcao,代码行数:7,代码来源:DropMeMenu.cs


注:本文中的UnityEngine.EventSystems.PointerEventData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。