示例#1
0
    void OnGUI()
    {
        play.draw(new Rect(0, 0, play.width * 0.5f, play.height * 0.5f));

        play.draw(new Rect(0, 75, play.width, play.height));

        GUI.DrawTexture(new Rect(0, 225, unityTexture.width, unityTexture.height), unityTexture);


        TPAtlasTexture tex = TPackManager.getAtlas(Atlases.EXAMPLE).getPngTexture("f_share");

        tex.draw(new Rect(200, 0, 122, 42));


        TPackManager.getAtlas(Atlases.EXAMPLE).draw(new Rect(200, 100, 122, 42), "t_share.png");
    }
示例#2
0
    //--------------------------------------
    // PUBLIC METHODS
    //--------------------------------------

    public static Rect RenderNode(int index, TPAtlas antlas, string name)
    {
        Vector2 itemPos = new Vector2();

        itemPos.y = 25f;

        if (index + 1 > colItemsCount)
        {
            itemPos.y += Mathf.FloorToInt(index / colItemsCount) * TexturePackerStyles.TEXTURE_RECT_SIZE * 1.7f;
            index      = index % colItemsCount;
        }

        itemPos.x = itemsSpace / 2f + (index) * (itemsSpace + box_size);



        GUILayout.BeginArea(new Rect(itemPos.x, itemPos.y, box_size, box_size * 2f), ""); {
            if (TexturePackerAtlasEditor.selection.Contains(name))
            {
                drawColordeBox(box_size, box_size, Color.green);

                /*	GUILayout.BeginArea (new Rect (box_padding, box_padding  , TexturePackerStyles.TEXTURE_RECT_SIZE, TexturePackerStyles.TEXTURE_RECT_SIZE), ""); {
                 *              drawColordeBox (TexturePackerStyles.TEXTURE_RECT_SIZE, TexturePackerStyles.TEXTURE_RECT_SIZE);
                 *      } GUILayout.EndArea ();
                 */
            }
            else
            {
                drawColordeBox(box_size, box_size);
            }


            TPAtlasTexture tx = antlas.getTexture(name);
            tx.draw(getSize(tx), true);


            string texNmae = string.Empty;

            if (TPEditorData.isExtensionsEnabled)
            {
                texNmae = tx.name;
            }
            else
            {
                texNmae = tx.nameNoExtention;
            }


            string imageInfo = texNmae + "\n(" + tx.width + "x" + tx.height + ")";
            GUILayout.Label(imageInfo, TexturePackerStyles.imageLableStyle, TexturePackerStyles.FixedWidthHeight(110f, 40f));
        } GUILayout.EndArea();



        return(new Rect(itemPos.x, itemPos.y, box_size, box_size));
    }