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