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


C# UISprite.updateVertPositions方法代码示例

本文整理汇总了C#中UISprite.updateVertPositions方法的典型用法代码示例。如果您正苦于以下问题:C# UISprite.updateVertPositions方法的具体用法?C# UISprite.updateVertPositions怎么用?C# UISprite.updateVertPositions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UISprite的用法示例。


在下文中一共展示了UISprite.updateVertPositions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

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