本文整理汇总了C#中UISprite.updateTransform方法的典型用法代码示例。如果您正苦于以下问题:C# UISprite.updateTransform方法的具体用法?C# UISprite.updateTransform怎么用?C# UISprite.updateTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISprite
的用法示例。
在下文中一共展示了UISprite.updateTransform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: showSprite
public void showSprite(UISprite sprite)
{
if( !sprite.___hidden )
return;
sprite.___hidden = false;
// Update the vertices. This will end up caling updatePositions() to set the vertsChanged flag
sprite.updateTransform();
}
示例2: 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
}