本文整理汇总了C#中IUIObject.OnInput方法的典型用法代码示例。如果您正苦于以下问题:C# IUIObject.OnInput方法的具体用法?C# IUIObject.OnInput怎么用?C# IUIObject.OnInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUIObject
的用法示例。
在下文中一共展示了IUIObject.OnInput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DispatchHelper
protected void DispatchHelper(ref POINTER_INFO curPtr)
{
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;
}
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 && !blockInput) // Don't change the targetObj if input is blocked
{
// 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:
if (curPtr.evt == POINTER_INFO.INPUT_EVENT.RELEASE)
tempPtr.evt = POINTER_INFO.INPUT_EVENT.RELEASE_OFF;
else
tempPtr.evt = POINTER_INFO.INPUT_EVENT.TAP;
curPtr.targetObj.OnInput(tempPtr);
curPtr.targetObj = tempObj;
}
// See if we need to notify our new target:
if (tempObj != null)
{
// Only pass on a non-tap event
// to a different target from the
// one the pointer already had:
if (curPtr.evt != POINTER_INFO.INPUT_EVENT.TAP && !blockInput)
tempObj.OnInput(curPtr);
}
}
else if (curPtr.targetObj != null)
{
// Tell our target about the event:
if (!blockInput)
curPtr.targetObj.OnInput(curPtr);
}
// See if we hit a non-UI object:
if (tempObj == null)
{
if (informNonUIHit != null)
informNonUIHit(curPtr);
}
}// Notify focus object:
else
{
if (Physics.Raycast(curPtr.ray, out hit, curPtr.rayDepth, curPtr.layerMask))
curPtr.hitInfo = hit;
if (curPtr.targetObj == null)
{
if (informNonUIHit != null)
informNonUIHit(curPtr);
}
else if (!blockInput)
{
curPtr.targetObj.OnInput(curPtr);
}
}
break;
case POINTER_INFO.INPUT_EVENT.NO_CHANGE:
case POINTER_INFO.INPUT_EVENT.MOVE:
tempObj = null;
// See if we need to notify anyone:
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");
//.........这里部分代码省略.........