@novely/core 0.36.0-beta.0 → 0.36.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +17 -8
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -1179,6 +1179,11 @@ var Novely = (() => {
|
|
|
1179
1179
|
await Promise.allSettled(list);
|
|
1180
1180
|
ASSETS_TO_PRELOAD.clear();
|
|
1181
1181
|
};
|
|
1182
|
+
const assetsToPreloadAdd = (asset) => {
|
|
1183
|
+
if (!PRELOADED_ASSETS.has(asset)) {
|
|
1184
|
+
ASSETS_TO_PRELOAD.add(asset);
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1182
1187
|
const scriptBase = async (part) => {
|
|
1183
1188
|
Object.assign(story, flattenStory(part));
|
|
1184
1189
|
let loadingIsShown = false;
|
|
@@ -1209,27 +1214,27 @@ var Novely = (() => {
|
|
|
1209
1214
|
const checkAndAddToPreloadingList = (action2, props) => {
|
|
1210
1215
|
if (action2 === "showBackground") {
|
|
1211
1216
|
if (isImageAsset(props[0])) {
|
|
1212
|
-
|
|
1217
|
+
assetsToPreloadAdd(props[0]);
|
|
1213
1218
|
}
|
|
1214
1219
|
if (props[0] && typeof props[0] === "object") {
|
|
1215
1220
|
for (const value of Object.values(props[0])) {
|
|
1216
1221
|
if (!isImageAsset(value))
|
|
1217
1222
|
continue;
|
|
1218
|
-
|
|
1223
|
+
assetsToPreloadAdd(value);
|
|
1219
1224
|
}
|
|
1220
1225
|
}
|
|
1221
1226
|
}
|
|
1222
1227
|
if (isAudioAction(action2) && isString(props[0])) {
|
|
1223
|
-
|
|
1228
|
+
assetsToPreloadAdd(props[0]);
|
|
1224
1229
|
}
|
|
1225
1230
|
if (action2 === "showCharacter" && isString(props[0]) && isString(props[1])) {
|
|
1226
1231
|
const images = characters[props[0]].emotions[props[1]];
|
|
1227
1232
|
if (Array.isArray(images)) {
|
|
1228
1233
|
for (const asset of images) {
|
|
1229
|
-
|
|
1234
|
+
assetsToPreloadAdd(asset);
|
|
1230
1235
|
}
|
|
1231
1236
|
} else {
|
|
1232
|
-
|
|
1237
|
+
assetsToPreloadAdd(images);
|
|
1233
1238
|
}
|
|
1234
1239
|
}
|
|
1235
1240
|
};
|
|
@@ -1611,17 +1616,21 @@ var Novely = (() => {
|
|
|
1611
1616
|
for (const [action3, ...props2] of collection) {
|
|
1612
1617
|
checkAndAddToPreloadingList(action3, props2);
|
|
1613
1618
|
}
|
|
1614
|
-
const { preloadAudioBlocking,
|
|
1619
|
+
const { preloadAudioBlocking, preloadImageBlocking } = renderer.misc;
|
|
1615
1620
|
ASSETS_TO_PRELOAD.forEach(async (asset) => {
|
|
1616
1621
|
ASSETS_TO_PRELOAD.delete(asset);
|
|
1617
1622
|
const type = await getResourseType(request, asset);
|
|
1618
1623
|
switch (type) {
|
|
1619
1624
|
case "audio": {
|
|
1620
|
-
preloadAudioBlocking(asset)
|
|
1625
|
+
preloadAudioBlocking(asset).then(() => {
|
|
1626
|
+
PRELOADED_ASSETS.add(asset);
|
|
1627
|
+
});
|
|
1621
1628
|
break;
|
|
1622
1629
|
}
|
|
1623
1630
|
case "image": {
|
|
1624
|
-
|
|
1631
|
+
preloadImageBlocking(asset).then(() => {
|
|
1632
|
+
PRELOADED_ASSETS.add(asset);
|
|
1633
|
+
});
|
|
1625
1634
|
break;
|
|
1626
1635
|
}
|
|
1627
1636
|
}
|