"components":[
{
"class":"AssetReference",
"asset":{
"class":"TextureRegionAsset",
"relativePath":"gfx/opengraph.png"
}
},
{
"class":"Layer"
},
{
"class":"ProtoVisSprite",
"width":5,
"height":5
},
{
"class":"Transform",
"x":0.13817275,
"y":2.8430145,
"scaleX":0.2,
"scaleY":0.2
},
{
"class":"Origin"
},
{
"class":"Tint"
},
{
"class":"Renderable",
"zIndex":2
},
{
"class":"VisID",
"id":"scratch"
}
]
我在解析LibGDX嵌套資產時遇到了一些問題。有誰知道如何使用TextureRegionAsset中的relativePath將資源分配給AssetReference?如何用LibGDX解析這個JSON
我知道我可以去除「類」處理和簡單的解析JSON,但我需要能夠處理這與LibGDX。
理想情況下,我正在尋找解析數據並從JSON創建一個精靈。
謝謝。
我喜歡這個解決方案。有趣的是,它解決了我遇到的其他一些問題。好奇心仍然促使我找到一個100%的LibGDX解決方案,但那只是我下屬:) – farlord
我的錯誤,我只注意到JsonReader和JsonValue都是LibGDX的一部分。再次感謝。 – farlord