我明白了:
线程"LWJGL应用程序“中的异常-- com.badlogic.gdx.utils.SerializationException:错误读取文件:ui/肤.json
我正试图为我的scene2D ui加载一个皮肤,完全失败了。
无论如何,当我转到类时,这个错误会在load方法中抛出,所以这是一个加载问题,对吗?
还有,为什么它不装载?
@Override
public void show() {
// Creates our atlas from our png file containing all the sprites
atlas = new TextureAtlas("ui/atlas.atlas");
// Create a stage, everything goes on the stage
stage = new Stage();
// A skin for the stage
skin = new Skin(Gdx.files.internal("ui/skin.json"), atlas);文件在那里,准确命名,项目清理,刷新和重新导入。甚至试着把它移到资产文件夹。不断地抛出一个错误。
这是我的json文件:
{
"com.badlogic.gdx.graphics.Color": {
"white": { "r": 1, "g": 1, "b": 1, "a": 1 },
"black": { "r": 0, "g": 0, "b": 0, "a": 1 },
"red": { "r": 1, "g": 0, "b": 0, "a": 1 },
"green": { "r": 0, "g": 1, "b": 0, "a": 1 },
"blue": { "r": 0, "g": 0, "b": 1, "a": 1 }
},
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
"fontSFNightly": { "file": "fonts/fontSFNightly.fnt" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
"heading": { "font": "fontSFNightly", "fontColor": "white" }
},
"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
"mainMenu": { "up": "button.up", "down": "button.down", "pressedOffsetX": 1, "pressedOffsetY": -1 }
}
}非常直截了当地说,下面是德美特迷的视频,这样我就可以了解更多关于程序结构的内容了,这开始让我很紧张。
发布于 2013-09-24 07:08:30
我设法修好了。
结果,从JSON文件读取字体对象时出现了一些问题,我使用了来自1001fonts.com的第三方字体,我不知道为什么它不会加载。
我把它改成了标准的windows ariel字体,现在我想弄清楚为什么定制的字体不能工作。
因此,这个问题在技术上是固定的。
https://stackoverflow.com/questions/18969026
复制相似问题