LibGdx定义的皮肤错误

时间:2018-01-14 16:32:53

标签: libgdx

我不熟悉在LibGdx中使用Skin元素。我的目标是通过更改每个元素的默认字体类型来执行简单的Skin用法。但是,它一直给我错误。

我的主要代码:

public class SettingWindow{        
    Skin skin;

    public SettingWindow(){
        skin = new Skin(Gdx.files.internal("UISkin.json"));
    }
}

我的json代码:

{  com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: windowText.fnt }}

我的错误:

 `Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error reading file: UISkin.json
    at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:97)
    at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:74)
    at Scene.TimerSettingWindow.<init>(TimerSettingWindow.java:40)
    at Scene.Hud.<init>(Hud.java:62)
    at Screens.MainScreen.<init>(MainScreen.java:42)
    at com.aipetgame.AiPetGame.create(AiPetGame.java:19)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: UISkin.json
    at com.badlogic.gdx.utils.Json.fromJson(Json.java:683)
    at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:95)
    ... 7 more           
Caused by: com.badlogic.gdx.utils.SerializationException: Error parsing file: UISkin.json
    at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:77)
    at com.badlogic.gdx.utils.Json.fromJson(Json.java:681)
    ... 8 more           
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: UISkin.json (Internal)
    at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
    at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:163)
    at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:75)
    ... 9 more  `

我将所有内容存储在android / assets文件夹中。请帮忙..

(我试图按照本教程https://www.youtube.com/watch?v=ELkqiMpvMLA

0 个答案:

没有答案