本文整理匯總了Java中com.badlogic.gdx.utils.Json.addClassTag方法的典型用法代碼示例。如果您正苦於以下問題:Java Json.addClassTag方法的具體用法?Java Json.addClassTag怎麽用?Java Json.addClassTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.utils.Json
的用法示例。
在下文中一共展示了Json.addClassTag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadLevelPack
import com.badlogic.gdx.utils.Json; //導入方法依賴的package包/類
private static LevelPack loadLevelPack(String serialisableLevelPackPath)
{
Json json = new Json();
json.addClassTag("SerialisableLevel", SerialisableLevel.class);
FileHandle serialisableLevelPackFileHandle =
Gdx.files.internal("level/" + serialisableLevelPackPath);
FileHandle levelPackRoot = serialisableLevelPackFileHandle.parent();
String serialisableLevelPackString = serialisableLevelPackFileHandle.readString();
SerialisableLevelPack serialisableLevelPack = json.fromJson(
SerialisableLevelPack.class,
serialisableLevelPackString);
LevelPack levelPack = new LevelPack(
serialisableLevelPack.name,
serialisableLevelPack.free,
serialisableLevelPack.googleSku);
for (String serialisableLevelPath : serialisableLevelPack.serialisableLevelPaths)
{
String serialisableLevelString =
levelPackRoot.child(serialisableLevelPath).readString();
SerialisableLevel serialisableLevel =
json.fromJson(SerialisableLevel.class, serialisableLevelString);
serialisableLevel.id = serialisableLevelPack.name + "/" + serialisableLevelPath;
levelPack.getSerialisableLevels().add(serialisableLevel);
}
return levelPack;
}
示例2: getTutorialSerialisableLevel
import com.badlogic.gdx.utils.Json; //導入方法依賴的package包/類
public static SerialisableLevel getTutorialSerialisableLevel()
{
if (tutorialSerialisableLevel == null)
{
Json json = new Json();
json.addClassTag("SerialisableLevel", SerialisableLevel.class);
String tutorialSerialisableLevelString =
Gdx.files.internal("tutorial/level.json").readString();
tutorialSerialisableLevel =
json.fromJson(SerialisableLevel.class, tutorialSerialisableLevelString);
}
return tutorialSerialisableLevel;
}