Cocos Creator Editor 读取一个.plist文件


var fs=require('fs');
var xml2js = require('xml2js');

let strUrl="db://assets/textures/aa.plist";
let plistString=fs.readFileSync(Editor.url(strUrl, 'utf8'),'utf8');
let parseString=xml2js.parseString;
parseString(plistString,function(err,result){
	if(result.plist.dict){
		Editor.log(result.plist.dict[0]);
	}
});

readFileSync()说明:http://nodejs.cn/api/fs.html#fs_fs_readfilesync_path_options
xml2js 文档:https://www.npmjs.com/package/xml2js


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM