所以我试图将代码拼接在一起(不完全是编程天才)来修饰我的开源游戏Destination Sol的版本。加载新游戏后,我收到致命错误:
SerializationException:解析文件时出错:res / configs / planets.json(文件基本上将盟友和敌人放在行星上并设置它们)
com.badlogic.gdx.utils.SerializationException: Error parsing file: res/configs/planets.json
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:77)
at org.destinationsol.game.planet.PlanetConfigs.<init>(PlanetConfigs.java:48)
at org.destinationsol.game.planet.PlanetManager.<init>(PlanetManager.java:53)
at org.destinationsol.game.SolGame.<init>(SolGame.java:121)
at org.destinationsol.SolApplication.startNewGame(SolApplication.java:171)
at org.destinationsol.menu.LoadingScreen.updateCustom(LoadingScreen.java:46)
at org.destinationsol.ui.SolInputManager.update(SolInputManager.java:220)
at org.destinationsol.SolApplication.update(SolApplication.java:132)
at org.destinationsol.SolApplication.safeUpdate(SolApplication.java:111)
at org.destinationsol.SolApplication.render(SolApplication.java:91)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.SerializationException: Error parsing JSON on line 206 near:
blaster|waveGun:0.1 a1|a2:.5 s1|s2:.5",
density: 0.1,
},
],
groundEnemies: [
{
hull: techieSmall,
items: "fixedPlasmaGun fixedPlasmaGun|fixedBlaster:.5 a2:.5 s3|s4",
money: 120,
density: 0.25,
}
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:548)
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:55)
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:75)
... 11 more
我希望有人比我更了解.json文件可以告诉我我做错了什么。另外,这里是整个planets.json供参考:
{
rocky: {
easyOnly: true,
minGrav: 0.4,
maxGrav: 0.6,
groundTexs: "grounds/rocky",
decoTexs: "deco/rocky",
cloudTexs: "skies/cloud",
rowCount: 4,
smoothLandscape: true,
sky: {
dawnColor: "hsb 0 50 100",
dayColor: "hsb 216 40 100",
},
deco: {
grass: {
density: 0.3,
szMin: 0.1,
szMax: 0.2,
orig: "0 0.5",
allowFlip: true,
},
tree: {
density: 0.4,
szMin: 0.7,
szMax: 0.8,
orig: "0 0.5",
allowFlip: true,
},
},
highOrbitEnemies: [
{
hull: pirateOrbiter,
items: "plasmaGun|blaster s1:.24",
money: 40,
density: 0.03,
}
],
lowOrbitEnemies: [
{
hull: pirateOrbiter,
items: "bombGun s1:.24",
money: 50,
density: 0.1,
},
],
groundEnemies: [
{
hull: piratePlanetTurret,
items: "plasmaGun|blaster s1:.36",
money: 110,
density: 0.45,
},
{
hull: pirateSmall,
items: "blaster|gun s1|s2:.5",
money: 60,
density: 0.15,
},
],
station: {
hull: drome,
items: "gun|shotGun s2 rep:1:4",
},
trading: {
items: "rep plasmaClip shotGun shellClip mineClip bombGun bombClip missileClip s2 unShieldCharge",
ships: "pirateSmall pirateOrbiter pirateMedium",
mercenaries: [
{
hull: pirateSmall,
items: "blaster|gun s1 rep:1:3",
money: 100,
},
],
},
},
desert: {
minGrav: 0.6,
maxGrav: 0.8,
groundTexs: "grounds/desert",
decoTexs: "deco/desert",
cloudTexs: "skies/cloud",
rowCount: 3,
smoothLandscape: true,
sky: {
dawnColor: "hsb 130 50 100",
dayColor: "hsb 200 40 100",
},
deco: {
tree: {
density: 0.25,
szMin: 0.5,
szMax: 0.7,
orig: "0 0.5",
allowFlip: true,
},
remnant: {
density: 0.05,
szMin: 1,
szMax: 1.1,
orig: "0 0.3",
allowFlip: true,
},
cactus: {
density: 0.5,
szMin: 0.2,
szMax: 0.4,
orig: "0 0.5",
allowFlip: true,
},
},
highOrbitEnemies: [
{
hull: desertOrbiter,
items: "fixedGun a1:.25",
money: 150,
density: 0.03,
}
],
lowOrbitEnemies: [
{
hull: desertOrbiter,
items: "fixedBombGun a1:.25",
money: 100,
density: 0.1,
},
],
groundEnemies: [
{
hull: desertPlanetTurret,
items: "gun a1|a2:.5",
money: 80,
density: 0.45,
},
{
hull: desertSmall,
items: "fixedGun fixedGun:.3 a2:.75",
money: 80,
density: 0.15,
},
],
station: {
hull: drome,
items: "shotGun s3 a3 rep:1:4",
},
trading: {
items: "rep teleportCharge fixedGun bulletClip railClip cannon slugClip bombClip a3",
ships: "desertOrbiter desertSmall desertMedium",
mercenaries: [
{
hull: desertOrbiter,
items: "fixedBombGun a1:.25 rep:1:3",
money: 150,
},
],
},
},
frozen: {
hardOnly: true,
minGrav: 0.8,
maxGrav: 1.2,
rowCount: 4,
smoothLandscape: true,
groundTexs: "grounds/frozen",
decoTexs: "deco/frozen",
cloudTexs: "skies/cloud",
sky: {
dawnColor: "hsb 50 50 100",
dayColor: "hsb 125 40 100",
},
deco: {
tree: {
density: 0.4,
szMin: 0.7,
szMax: 0.8,
orig: "0 0.5",
allowFlip: true,
},
},
highOrbitEnemies: [
{
hull: techieOrbiter,
items: "fixedPlasmaGun|fixedBlaster fixedPlasmaGun|fixedBlaster|fixedEmGun:.5 a2:.75 s4",
money: 140,
density: 0.06,
}
highOrbitAllies: [
{
hull: imperialBig,
items: "fixedGun fixedShotGun a2|a3|a4 s2|s3|s4”,
density: 0.01,
},
{
hull: imperialSmall,
items: "blaster|waveGun:0.1 a1|a2:.5 s1|s2:.5", (<== The line that is causing an error)
density: 0.1,
},
],
groundEnemies: [
{
hull: techieSmall,
items: "fixedPlasmaGun fixedPlasmaGun|fixedBlaster:.5 a2:.5 s3|s4",
money: 120,
density: 0.25,
},
{
hull: techiePlanetTurret,
items: "waveGun emGun:.6 a3 s4",
money: 180,
density: 0.45,
},
],
groundAllies: [
{
hull: imperialSmall,
items: “shotGun a1:.5 s1:.5",
density: 0.5,
},
{
hull: imperialMedium,
items: "fixedGun a2|a4:.5 s2|s3:.75",
density: 0.15,
},
]
station: {
hull: drome,
items: "gun|shotGun|waveGun| a4 s4 rep:1:30”,
},
trading: {
items: "rep ",
ships: "imperialSmall imperialMedium imperialBig techieSmall techieOrbiter",
mercenaries: [
{
hull: imperialSmall,
items: "blaster|gun|waveGun a1:0.5 s1 rep:1:8",
money: 75,
},
{
hull: imperialMedium,
items: "fixedGun|fixedShotGun|fixedPlasmaGun a1|a2 s1|s2 rep:1:12",
money: 150
},
{
hull: imperialBig,
items: "fixedGun|fixedShotGun|fixedPlasmaGun fixedGun|fixedShotGun|fixedPlasmaGun:0.5 a2|a3|a4 s2|s3|s4 rep:1:48”,
money: 300,
},
{
hull: techieOrbiter,
items: "fixedGun|fixedPlasmaGun|fixedBlaster fixedGun|fixedPlasmaGun|fixedBlaster|fixedEmGun:.5 a2|a3|a4 s2|s3|s4 rep:1:48”,
money: 300,
},
],
},
},
}