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


C# tk2dSprite.MakePixelPerfect方法代码示例

本文整理汇总了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();
 }
开发者ID:ninjasky3,项目名称:jumpplatformer,代码行数:9,代码来源:PlayerMove.cs

示例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);
    }
开发者ID:CodeStrumpet,项目名称:Elemental,代码行数:101,代码来源:tk2dSpriteEditor.cs


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