本文整理汇总了C#中UISprite.MakePixelPerfect方法的典型用法代码示例。如果您正苦于以下问题:C# UISprite.MakePixelPerfect方法的具体用法?C# UISprite.MakePixelPerfect怎么用?C# UISprite.MakePixelPerfect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISprite
的用法示例。
在下文中一共展示了UISprite.MakePixelPerfect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetStarImage
private void SetStarImage(StarType starType, UISprite spStar)
{
string starSpriteName = "fb_xing_yidengdao";
switch(starType)
{
case StarType.StarType1:
{
starSpriteName = "zs";
spStar.atlas = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
spStar.spriteName = starSpriteName;
spStar.MakePixelPerfect();
}break;
case StarType.StarType2:
{
starSpriteName = "hg_h";
spStar.atlas = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
spStar.spriteName = starSpriteName;
spStar.MakePixelPerfect();
}break;
case StarType.StarType3:
{
starSpriteName = "hg";
spStar.atlas = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
spStar.spriteName = starSpriteName;
spStar.MakePixelPerfect();
}break;
}
}
示例2: OnDrawProperties
/// <summary>
/// Draw the atlas and sprite selection fields.
/// </summary>
protected override bool OnDrawProperties()
{
mSprite = mWidget as UISprite;
ComponentSelector.Draw<UIAtlas>(mSprite.atlas, OnSelectAtlas);
if (mSprite.atlas == null) return false;
string spriteName = SpriteField(mSprite.atlas, mSprite.spriteName);
if (mSprite.spriteName != spriteName)
{
Undo.RegisterUndo(mSprite, "Sprite Change");
mSprite.spriteName = spriteName;
mSprite.MakePixelPerfect();
EditorUtility.SetDirty(mSprite.gameObject);
}
return true;
}
示例3: PositionSprite
// Used to position the sprite correctly within the item boundaries. In
// general this does two things: centers the sprite vertically and adjusts
// for the sprite padding. Not sure why the latter should be necessary, but...
// it seems to be.
Vector3 PositionSprite(Vector3 pos, UISprite sprite, float itemHeight, float scaleX, float scaleY)
{
pos.y -= (itemHeight - scaleY) * 0.5f; // <-- Center sprite vertically.
/* Seems this is no longer needed in NGUI 3.0...
*
UIAtlas.Sprite sp = sprite.GetAtlasSprite();
float spX = sp.inner.xMin - sp.outer.xMin + sp.paddingLeft * scaleX;
float spY = sp.inner.yMin - sp.outer.yMin + sp.paddingTop * scaleY;
pos.x -= spX;
pos.y += spY;
/**/
sprite.cachedTransform.localPosition = pos;
sprite.MakePixelPerfect();
return pos;
}
示例4: Start
/// <summary>
/// Called on during creation
/// </summary>
public virtual void Start()
{
sprite = this.gameObject.GetComponent<UISprite>();
sprite.MakePixelPerfect();
}
示例5: AwakeImpl
protected override void AwakeImpl()
{
base.AwakeImpl();
if ( m_widget != null )
{
sprite = m_widget.GetComponent<UISprite>();
if ( sprite != null )
{
sprite.spriteName = m_spriteName;
sprite.color = m_spriteColor;
if ( m_AutoSize )
{
sprite.MakePixelPerfect();
}
}
}
}