Skip to content

Commit

Permalink
fix: scenesToJson code generation
Browse files Browse the repository at this point in the history
This commit fixes a major issue, that caused the VN to not build in VNs without sub-scenes, since scenesToJson function wouldn't be coded.
  • Loading branch information
ThePedroo committed Oct 6, 2023
1 parent 8280455 commit e823fb1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
4 changes: 1 addition & 3 deletions android/app/src/main/java/com/perforvnm/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2369,9 +2369,7 @@ val layoutParamsSavesBackground = LayoutParams(
json += scenes.get(i).toString() + ","
}

json = json.dropLast(1) + "]"

return json
return json.dropLast(1) + "]"
}
}

Expand Down
28 changes: 10 additions & 18 deletions src/coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ function init(options) {
__PERFORVNM_MENU__
}__PERFORVNM_SCENES__
private fun scenesToJson(): String {
var json = "["
for (i in 0 until scenesLength) {
json += ${visualNovel.optimizations.hashScenesNames ? 'scenes.get(i).toString() + "' : '"\\"" + scenes.get(i) + "\\"'},"
}
return json.dropLast(1) + "]"
}
}
__PERFORVNM_CLASSES__`, 4
)
Expand Down Expand Up @@ -580,24 +590,6 @@ ${finishScene.join('\n')}\n\n`, 6, 0)

helper.writeFunction(switchesCode)

if (visualNovel.subScenes.length != 0) {
helper.writeFunction(
helper.codePrepare(`
private fun scenesToJson(): String {
var json = "["
for (i in 0 until scenesLength) {
json += ${visualNovel.optimizations.hashScenesNames ? 'scenes.get(i).toString() + "' : '"\\"" + scenes.get(i) + "\\"'},"
}
json = json.dropLast(1) + "]"
return json
}`, 6
)
)
}

helper.replace('__PERFORVNM_SCENES__', '')
helper.replace('__PERFORVNM_MENU__', '// No menu created.')
helper.replace('__PERFORVNM_CLASSES__', '')
Expand Down

0 comments on commit e823fb1

Please sign in to comment.