
var fs = require("fs");
var iconv = require('iconv-lite');

return
//读取json文件
var data = iconv.decode(fs.readFileSync("./resource/skin.json"), "utf-8");//GBK
//反序列化
data = JSON.parse(data); //eval(data)

reverseChildren(data);
const outJsonData = JSON.stringify(data, "", "\t");
var endPath = './src/';
var endFile = `export const SkinJson = ${outJsonData}`
fs.writeFileSync(endPath + "SkinJson.ts", endFile);
/**
 * 
 * @param {*} arr
 */
function reverseChildren(arr) {
    arr.children.reverse();
    arr.children.forEach(element => { if (element.children && element.children.length) reverseChildren(element) });
}