本文整理汇总了C#中UISprite.setClippedSize方法的典型用法代码示例。如果您正苦于以下问题:C# UISprite.setClippedSize方法的具体用法?C# UISprite.setClippedSize怎么用?C# UISprite.setClippedSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISprite
的用法示例。
在下文中一共展示了UISprite.setClippedSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: clipChild
protected override void clipChild( UISprite child )
{
var topContained = child.position.y < -touchFrame.yMin && child.position.y > -touchFrame.yMax;
var bottomContained = child.position.y - child.height < -touchFrame.yMin && child.position.y - child.height > -touchFrame.yMax;
// first, handle if we are fully visible
if( topContained && bottomContained )
{
// unclip if we are clipped
if( child.clipped )
child.clipped = false;
child.hidden = false;
}
else if( topContained || bottomContained )
{
// wrap the changes in a call to beginUpdates to avoid changing verts more than once
child.beginUpdates();
child.hidden = false;
// are we clipping the top or bottom?
if( topContained ) // clipping the bottom
{
var clippedHeight = child.position.y + touchFrame.yMax;
child.uvFrameClipped = child.uvFrame.rectClippedToBounds( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Bottom, child.manager.textureSize );
child.setClippedSize( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Bottom );
}
else // clipping the top, so we need to adjust the position.y as well
{
var clippedHeight = child.height - child.position.y - touchFrame.yMin;
child.uvFrameClipped = child.uvFrame.rectClippedToBounds( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Top, child.manager.textureSize );
child.setClippedSize( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Top );
}
// commit the changes
child.endUpdates();
}
else
{
// fully outside our bounds
child.hidden = true;
}
// Recurse
recurseAndClipChildren( child );
}
示例2: clipChild
protected override void clipChild( UISprite child )
{
var leftContained = child.position.x >= touchFrame.xMin && child.position.x <= touchFrame.xMax;
var rightContained = child.position.x + child.width >= touchFrame.xMin && child.position.x + child.width <= touchFrame.xMax;
// first, handle if we are fully visible
if( leftContained && rightContained )
{
// unclip if we are clipped
if( child.clipped )
child.clipped = false;
child.hidden = false;
}
else if( leftContained || rightContained )
{
// wrap the changes in a call to beginUpdates to avoid changing verts more than once
child.beginUpdates();
child.hidden = false;
// are we clipping the left or right?
if( leftContained ) // clipping the right
{
var clippedWidth = touchFrame.xMax - child.position.x;
child.uvFrameClipped = child.uvFrame.rectClippedToBounds( clippedWidth / child.scale.x, child.height / child.scale.y, UIClippingPlane.Right, child.manager.textureSize );
child.setClippedSize( clippedWidth / child.scale.x, child.height / child.scale.y, UIClippingPlane.Right );
}
else // clipping the left, so we need to adjust the position.x as well
{
var clippedWidth = child.width + child.position.x - touchFrame.xMin;
child.uvFrameClipped = child.uvFrame.rectClippedToBounds( clippedWidth / child.scale.x, child.height / child.scale.y, UIClippingPlane.Left, child.manager.textureSize );
child.setClippedSize( clippedWidth / child.scale.x, child.height / child.scale.y, UIClippingPlane.Left );
}
// commit the changes
child.endUpdates();
}
else
{
// fully outside our bounds
child.hidden = true;
}
// Recurse
recurseAndClipChildren( child );
}
示例3: clipChild
/// <summary>
/// Clips the actor gradient image.
/// </summary>
/// <param name='child'>
/// Child. The UISprite to clip (should be the gradient)
/// </param>
private void clipChild(UISprite child)
{
var topContained = child.localPosition.y <= -touchFrame.yMin && child.localPosition.y >= -touchFrame.yMax;
var bottomContained = child.localPosition.y - child.height <= -touchFrame.yMin && child.localPosition.y - child.height >= -touchFrame.yMax;
child.clipped = false; //hack this forces the full sprite before clipping it, needed to prevent major change in position from wrecking sprite clipping.
// first, handle if we are fully visible
if( topContained && bottomContained )
{
// unclip if we are clipped
if( child.clipped )
child.clipped = false;
child.hidden = false;
}
else if( topContained || bottomContained )
{
// wrap the changes in a call to beginUpdates to avoid changing verts more than once
child.beginUpdates();
child.hidden = false;
// are we clipping the top or bottom?
if( topContained ) // clipping the bottom
{
var clippedHeight = child.localPosition.y + touchFrame.yMax - 3; //TODO: 3 should be scalable based on hd
child.uvFrameClipped = child.uvFrame.rectClippedToBounds( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Bottom, child.manager.textureSize );
child.setClippedSize( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Bottom );
}
else // clipping the top, so we need to adjust the position.y as well
{
var clippedHeight = child.height - child.localPosition.y - touchFrame.yMin - 3; //TODO: 3 should be scalable based on hd
Debug.Log (clippedHeight);
child.uvFrameClipped = child.uvFrame.rectClippedToBounds( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Top, child.manager.textureSize );
child.setClippedSize( child.width / child.scale.x, clippedHeight / child.scale.y, UIClippingPlane.Top );
}
child.updateTransform ();
child.updateVertPositions ();
// commit the changes
child.endUpdates();
}
else
{
// fully outside bounds
child.hidden = true;
}
// Recurse
//recurseAndClipChildren( child ); //hack actors do not need this
}