[tmlib.js] AssetManager で json 読み込み & type 指定
YFukuyama san の 『tmlib.js AssetManager について』というエントリーを見て
『確かに!!』と思ったので対応してみました.
主に対応したのは下記の点です.
- AssetManager.load で json 形式を読みこめるよう修正
- AssetManager.load で type 指定を可能に
Example
tm.asset.AssetManager.load({
// 普通に読み込む
"image_data": "./kenkyo.jpg",
// type を省略しているので tmss として読み込まれる
"tmss_data": "./crash.tmss",
// tmss だけど type で json を指定しているので json で読み尾込まれる
"json_data00": { url: "./crash.tmss", type: "json" },
// url にオブジェクトを渡しているけど type が json なので File としてかえってくる
"json_data01": { url: {hoge:100, foo:200}, type: "json" },
});
tm.asset.AssetManager.onload = function() {
console.log('読み込み終わったよ♪');
};