Beispiel #1
0
    /// <summary>
    /// 根据图片宽高 返回图片最大尺寸
    /// </summary>
    /// <param name="size"></param>
    /// <returns></returns>
    static int GetTextureMaxSize(IEditorSprite texture)
    {
        Texture2D tex   = texture.Tex;
        int       width = tex.width;
        int       hight = tex.height;
        int       size  = width >= hight ? width : hight;

        if (size >= 2048)
        {
            return(2048);
        }

        List <int> data = new List <int>()
        {
            32, 64, 128, 256, 512, 1024, 2048
        };

        if (data.Exists(delegate(int i) { return(i == size); }))
        {
            return(data.Find(delegate(int i) { return i == size; }));
        }

        for (int i = 0; i < data.Count; i++)
        {
            if (size < data[i])
            {
                return(data[i]);
            }
        }
        return(size);
    }
Beispiel #2
0
 public TextureHandle(string path)
 {
     texture = new EditorSprite(path);
 }
 public CharacterTexture(string path)
 {
     texture = new EditorSprite(path);
 }