本文整理汇总了C#中tk2dSprite.MakePixelPerfect方法的典型用法代码示例。如果您正苦于以下问题:C# tk2dSprite.MakePixelPerfect方法的具体用法?C# tk2dSprite.MakePixelPerfect怎么用?C# tk2dSprite.MakePixelPerfect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tk2dSprite
的用法示例。
在下文中一共展示了tk2dSprite.MakePixelPerfect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
Physics.gravity = new Vector3(0f,-gravityForce,0f);
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
//rigidbody.interpolation = RigidbodyInterpolation.Interpolate;
//get Sprite
sprite = GetComponent<tk2dSprite>();
sprite.MakePixelPerfect();
}
示例2: DrawSpriteEditorGUI
//.........这里部分代码省略.........
sprite.EditMode__CreateCollider();
}
int newSpriteId = sprite.spriteId;
if (generatorCache.current)
{
newSpriteId = tk2dEditorUtility.SpriteSelectorPopup("Sprite", sprite.spriteId, generatorCache.current);
if (tk2dPreferences.inst.displayTextureThumbs)
{
if (generatorCache.current.version < 1)
{
GUILayout.Label("No thumbnail data.\nPlease rebuild Sprite Collection.");
}
else
{
var tex = tk2dSpriteThumbnailCache.GetThumbnailTexture(generatorCache.current, sprite.spriteId);
if (tex)
{
float w = tex.width;
float h = tex.height;
float maxSize = 128.0f;
if (w > maxSize)
{
h = h / w * maxSize;
w = maxSize;
}
Rect r = GUILayoutUtility.GetRect(w, h);
GUI.DrawTexture(r, tex, ScaleMode.ScaleToFit);
//GUILayout.Box(tex, GUILayout.Width(w), GUILayout.Height(h));
}
}
}
}
else
{
newSpriteId = EditorGUILayout.IntSlider(sprite.spriteId, 0, sprite.collection.Count - 1);
}
if (newSpriteId != sprite.spriteId)
{
sprite.spriteId = newSpriteId;
sprite.EditMode__CreateCollider();
GUI.changed = true;
}
sprite.color = EditorGUILayout.ColorField("Color", sprite.color);
Vector3 newScale = EditorGUILayout.Vector3Field("Scale", sprite.scale);
if (newScale != sprite.scale)
{
sprite.scale = newScale;
sprite.EditMode__CreateCollider();
}
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("HFlip"))
{
Vector3 s = sprite.scale;
s.x *= -1.0f;
sprite.scale = s;
GUI.changed = true;
}
if (GUILayout.Button("VFlip"))
{
Vector3 s = sprite.scale;
s.y *= -1.0f;
sprite.scale = s;
GUI.changed = true;
}
if (GUILayout.Button("Reset Scale" ))
{
Vector3 s = sprite.scale;
s.x = Mathf.Sign(s.x);
s.y = Mathf.Sign(s.y);
s.z = Mathf.Sign(s.z);
sprite.scale = s;
GUI.changed = true;
}
if ( GUILayout.Button("Make Pixel Perfect", GUILayout.ExpandWidth(true) ))
{
if (tk2dPixelPerfectHelper.inst) tk2dPixelPerfectHelper.inst.Setup();
sprite.MakePixelPerfect();
GUI.changed = true;
}
sprite.pixelPerfect = GUILayout.Toggle(sprite.pixelPerfect, "Always", GUILayout.Width(60.0f));
EditorGUILayout.EndHorizontal();
}
else
{
EditorGUILayout.IntSlider("Need a collection bound", 0, 0, 1);
}
if (GUI.changed)
EditorUtility.SetDirty(sprite);
}