Ejemplo n.º 1
0
    public void showFrame(int index)
    {
        if (frames.Count == 0)
        {
            GetComponent <Renderer>().material = null;
            return;
        }
        //index--;
        TPFameInfo frame = frames[index];


        meshTexture.atlas   = frame.atlasPath;
        meshTexture.texture = frame.textureName;

        GetComponent <Renderer>().material = GetMaterial(frame.atlasPath);

        meshTexture.applayUV();

        TPAtlasTexture texture = GetAtlasTExture(index);
        Vector3        size    = new Vector3();

        size.x = texture.spriteSourceSize.w;
        size.y = texture.spriteSourceSize.h;
        size.z = size.x;

        transform.localScale = size / texture.scale;

        Vector3 pos = new Vector3();

        pos.x = texture.spriteSourceSize.x - texture.sourceSize.w * anim.pivotCenterX;
        pos.y = -texture.spriteSourceSize.y + texture.sourceSize.h * anim.pivotCenterY;
        pos.z = 0;

        transform.localPosition = pos / texture.scale;

        if (meshTexture.originalMesh.name.Equals("TPPlaneCentred"))
        {
            Vector3 p = transform.localPosition;
            p.y -= transform.localScale.y / 2f;
            p.x += transform.localScale.x / 2f;
            transform.localPosition = p;
        }

        if (index == 0)
        {
            _textureName = texture.nameNoExtention;
        }

        if (opacity != 1f)
        {
            materialColor.a = opacity;
            color           = materialColor;
        }
    }
Ejemplo n.º 2
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    public override void addFrame(TPFameInfo frame)
    {
        if (frames.Count > 0)
        {
            frames[0] = frame;
        }
        else
        {
            frames.Add(frame);
        }
    }
Ejemplo n.º 3
0
    public override void ShowFrame(int index)
    {
        if (frames.Count == 0)
        {
            GetComponent <Renderer>().material = null;
            return;
        }

        TPFameInfo frame = frames[index];


        meshTexture.atlas   = frame.atlasPath;
        meshTexture.texture = frame.textureName;

        GetComponent <Renderer>().material = TPUtils.GetAtlasMaterial(frame.atlasPath);

        meshTexture.applayUV();
    }
Ejemplo n.º 4
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    public virtual void addFrame(TPFameInfo frame)
    {
        frames.Add(frame);
    }
Ejemplo n.º 5
0
    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    //--------------------------------------
    //  PRIVATE METHODS
    //--------------------------------------



    private TPAtlasTexture GetAtlasTExture(int index)
    {
        TPFameInfo frame = frames[index];

        return(TPackManager.getAtlas(frame.atlasPath).getTexture(frame.textureName));
    }