本文整理汇总了C#中IUIObject.GetControl方法的典型用法代码示例。如果您正苦于以下问题:C# IUIObject.GetControl方法的具体用法?C# IUIObject.GetControl怎么用?C# IUIObject.GetControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUIObject
的用法示例。
在下文中一共展示了IUIObject.GetControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DispatchHelper
protected void DispatchHelper(ref POINTER_INFO curPtr, int camIndex)
{
// Only check for out-of-viewport input if such is possible
// (i.e. if we aren't on a hardware device where it is
// impossible to have input outside the viewport)
#if UNITY_EDITOR || !(UNITY_IPHONE || UNITY_ANDROID)
// See if the input should be ignored:
if(inputOutsideViewport != OUTSIDE_VIEWPORT.Process_All && curPtr.type != POINTER_INFO.POINTER_TYPE.RAY)
{
// If the input is outside our viewport:
if (!curPtr.camera.pixelRect.Contains(curPtr.devicePos))
{
// See how we should handle it:
if (inputOutsideViewport == OUTSIDE_VIEWPORT.Ignore)
return;
// Otherwise, see if the pointer has a target:
if (curPtr.targetObj == null)
return; // Ignore new input
tempPtr.Copy(curPtr);
if (curPtr.active)
{
tempPtr.evt = POINTER_INFO.INPUT_EVENT.RELEASE_OFF;
curPtr.targetObj.OnInput(tempPtr);
}
else
{
tempPtr.evt = POINTER_INFO.INPUT_EVENT.MOVE_OFF;
tempPtr.targetObj.OnInput(tempPtr);
}
// See if we need to cancel a drag-and-drop:
if (curPtr.targetObj.IsDragging)
{
// Act like the object was dropped:
curPtr.targetObj.OnEZDragDrop_Internal(new EZDragDropParams(EZDragDropEvent.Dropped, curPtr.targetObj, curPtr));
}
// Lose the target:
curPtr.targetObj = null;
return;
}
}
#endif
// First see if this is an object being dragged:
// See if we need to cancel a drag-and-drop:
if (curPtr.targetObj != null && curPtr.targetObj.IsDragging)
{
DoDragUpdate(curPtr);
}
else
{
switch (curPtr.evt)
{
case POINTER_INFO.INPUT_EVENT.DRAG:
case POINTER_INFO.INPUT_EVENT.RELEASE:
case POINTER_INFO.INPUT_EVENT.TAP:
// See if a tap or release took place outside of
// the targetObj:
if (curPtr.evt == POINTER_INFO.INPUT_EVENT.RELEASE ||
curPtr.evt == POINTER_INFO.INPUT_EVENT.TAP)
{
tempObj = null;
if (Physics.Raycast(curPtr.ray, out hit, curPtr.rayDepth, curPtr.layerMask))
{
#if INTOLERANT_GET_COMPONENT
tempObj = (IUIObject)hit.collider.gameObject.GetComponent(typeof(IUIObject));
#else
// Else, get the component in a tolerant way:
tempObj = (IUIObject)hit.collider.gameObject.GetComponent("IUIObject");
#endif
curPtr.hitInfo = hit;
if(tempObj != null)
tempObj = tempObj.GetControl(ref curPtr);
// See if we hit a non-UI object:
if (tempObj == null)
{
AddNonUIHit(curPtr.id, camIndex);
}
}
else
curPtr.hitInfo = default(RaycastHit);
// If the hit object (or lack thereof) is not
// the same as the current target:
if (tempObj != curPtr.targetObj)
{
// If we have someone to notify of a release-off:
if (curPtr.targetObj != null)
{
// Notify the targetObj of the event:
tempPtr.Copy(curPtr);
// Pass on a RELEASE_OFF if it was a RELEASE event,
// else, pass on the TAP:
//.........这里部分代码省略.........