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


C# UISprite.setClippedSize方法代码示例

本文整理汇总了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 );
	}
开发者ID:Raj2509,项目名称:net.kibotu.sandbox.unity.dragnslay,代码行数:48,代码来源:UIScrollableVerticalLayout.cs

示例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 );
	}
开发者ID:n8stowell82,项目名称:UIToolkit,代码行数:47,代码来源:UIScrollableHorizontalLayout.cs

示例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
    }
开发者ID:hybridsteve,项目名称:dicebaseballapp,代码行数:59,代码来源:UIPeaceMakerActor.cs


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