コード例 #1
0
    void DoAttm(MeshGroupFrame meshframe, Vector2 anisize, KAnim.Element elem)
    {
        //跳过dummy的绘制
        if (elem.tag.IndexOf("dummy:") == 0)
        {
            return;
        }

        var seed = dataK.seeds[elem.seed];

        TextureBlock?tb = TextureBlockMgr.getTexture(seed.texname.ToLower());
        //Vector2 size = new Vector2(tb.Value.uv.width * tb.Value.tex.width *scaleWorld,
        //         tb.Value.uv.height * tb.Value.tex.height *scaleWorld);

        Vector2 size   = seed.size;
        Vector2 orient = seed.orient;

        Matrix4x4 dest = Matrix4x4.identity;
        //目标位置
        {
            Vector2 t = new Vector2(elem.pos.x - anisize.x / 2, anisize.y - elem.pos.y);

            float rotate = (float)(elem.rotate / Math.PI * 180.0);
            while (rotate < 0)
            {
                rotate += 360;
            }
            while (rotate > 360)
            {
                rotate -= 360;
            }
            if (float.IsNaN(rotate))
            {
                rotate = 0;
            }
            Matrix4x4 move       = Matrix4x4.TRS(t, Quaternion.identity, Vector3.one);
            Matrix4x4 rs         = Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(rotate, new Vector3(0, 0, -1)), elem.scale);
            Matrix4x4 scaleworld = Matrix4x4.Scale(new Vector3(scaleWorld, scaleWorld, scaleWorld));

            dest = scaleworld * move * rs;    // scaleworld* rs *move;
        }
        Color c = Color.white;

        c.a = (float)elem.color.a / 255.0f;
        c.r = (float)elem.color.r / 255.0f;
        c.g = (float)elem.color.g / 255.0f;
        c.b = (float)elem.color.b / 255.0f;
        if (tb != null)
        {
            meshframe.DrawRect(tb.Value, size, orient, dest, c);
        }
        else
        {
            meshframe.DrawRect(TextureBlock.Empty, new Vector2(1, 1), dest, c);
        }
    }
コード例 #2
0
ファイル: AniData.cs プロジェクト: Gaopest/fightclub
        public void Read(System.IO.Stream s)
        {
            elems.Clear();
            byte[] bb = new byte[255];
            s.Read(bb,0,2);
            int length = BitConverter.ToInt16(bb, 0);
            for (int i = 0; i < length; i++)
            {
                Element e = new Element();
                e.Read(s);
                elems.Add(e);
            }

            s.Read(bb, 0, 2);
            length = BitConverter.ToInt16(bb, 0);
            for (int i = 0; i < length; i++)
            {
                var len = s.ReadByte();
                s.Read(bb, 0, len);
                var tag = System.Text.Encoding.UTF8.GetString(bb, 0, len);
                frametags.Add(tag);
            }
        }
コード例 #3
0
ファイル: AniData.cs プロジェクト: Gaopest/fightclub
 public Element Copy()
 {
     Element e = new Element();
     e.seed = seed;
     e.seednow = seednow;
     e.color = color;
     e.coloradd = coloradd;
     e.pos = pos;
     e.scale = scale;
     e.rotate = rotate;
     e.sound = sound;
     e.tag = tag;
     e.seedasdummy = seedasdummy;
     return e;
 }