⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.java

📁 了不起的动作编辑器.推荐给大家.希望能给大家带来帮助.
💻 JAVA
字号:
import java.io.IOException;
import java.io.*;
/**
 * <p>Title: </p>
 *
 * <p>Description: “.crd”文件读取</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: 北京哈酷那科技有限公司</p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Test {
    int totalLen;
    int len;
    int tileMax;
    int footx, footy, footw, footh;
    int[] tileX, tileY;
    int[] tileW, tileH;
    int[] fRectW, fRectH, fRectX, fRectY;
    int[] footX, footY;
    int[] aRectW, aRectH, aRectX, aRectY;
    public Test() {

    }

    public void readData (String filename) {
        try {
            FileInputStream in = new FileInputStream(filename);
            byte[] b = new byte[4];
            in.read(b, 0, 4);

            totalLen = ((b[0] & 0xff)<<8) | (b[1] & 0xff);
            len = ((b[2] & 0xff)<<8) | (b[3] & 0xff);

            byte[] bb = new byte[len];
            in.read(bb, 0, len);
            in.close();

            tileMax = bb[0];
            footx = bb[1];
            footy = bb[2];
            footw = bb[3];
            footh = bb[4];

            byte[] tileX1 = new byte[tileMax];
            byte[] tileX2 = new byte[tileMax];
            byte[] tileY1 = new byte[tileMax];
            byte[] tileY2 = new byte[tileMax];

            tileX = new int[tileMax];
            tileY = new int[tileMax];
            tileW = new int[tileMax];
            tileH = new int[tileMax];

            fRectX = new int[tileMax];
            fRectY = new int[tileMax];
            fRectW = new int[tileMax];
            fRectH = new int[tileMax];

            footX = new int[tileMax];
            footY = new int[tileMax];

            aRectX = new int[tileMax];
            aRectY = new int[tileMax];
            aRectW = new int[tileMax];
            aRectH = new int[tileMax];

            for (int i=0; i<tileMax; i++) {
                int jj = 5;
                int d = 16;
                tileX1[i] = bb[i*d + jj];
                jj++;
                tileX2[i] = bb[i*d + jj];
                jj++;
                tileX[i] = ((tileX1[i] & 0xff)<<8) | (tileX2[i] & 0xff);
                tileY1[i] = bb[i*d + jj];
                jj++;
                tileY2[i] = bb[i*d + jj];
                jj++;
                tileY[i] = ((tileY1[i] & 0xff)<<8) | (tileY2[i] & 0xff);
                tileW[i] = bb[i*d + jj];
                jj++;
                tileH[i] = bb[i*d + jj];
                jj++;

                fRectX[i] = bb[i*d + jj];
                jj++;
                fRectY[i] = bb[i*d + jj];
                jj++;
                fRectW[i] = bb[i*d + jj];
                jj++;
                fRectH[i] = bb[i*d + jj];
                jj++;

                footX[i] = bb[i*d + jj];
                jj++;
                footY[i] = bb[i*d + jj];
                jj++;

                aRectX[i] = bb[i * 16 + jj];
                jj++;
                aRectY[i] = bb[i * 16 + jj];
                jj++;
                aRectW[i] = bb[i * 16 + jj];
                jj++;
                aRectH[i] = bb[i * 16 + jj];
                jj++;
            }

            System.out.println("totalLen = "+totalLen);
            System.out.println("len = "+len);
            System.out.println("tileMax = "+tileMax);
            System.out.println("footx = "+footx);
            System.out.println("footy = "+footy);
            System.out.println("footw = "+footw);
            System.out.println("footh = "+footh);

            for (int i = 0; i < tileMax; i++) {
                System.out.print(":" + tileX[i] + ",");
                System.out.print(tileY[i] + ",");
                System.out.print(tileW[i] + ",");
                System.out.print(tileH[i] + ",");

                System.out.print(":" + footX[i] + ",");
                System.out.print(footY[i] + ",");
                System.out.print(":" + fRectX[i] + ",");
                System.out.print(fRectY[i] + ",");
                System.out.print(fRectW[i] + ",");
                System.out.print(fRectH[i] + ",");
                System.out.print(":" + aRectX[i] + ",");
                System.out.print(aRectY[i] + ",");
                System.out.print(aRectW[i] + ",");
                System.out.println(aRectH[i] + ",");
            }
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("Error while Reading " + filename);
        }

    }

    public static void main(String[] args) {
        Test test = new Test();

        test.readData("E:/bs.crd");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -