MCPcopy
hub / github.com/4ian/GDevelop / _doLoadResources

Method _doLoadResources

GDJS/Runtime/ResourceLoader.ts:1106–1135  ·  view source on GitHub ↗
(
      loadingState: LoadingTaskState,
      onProgress?: (count: number, total: number) => Promise<void>
    )

Source from the content-addressed store, hash-verified

1104 }
1105
1106 private async _doLoadResources(
1107 loadingState: LoadingTaskState,
1108 onProgress?: (count: number, total: number) => Promise<void>
1109 ): Promise<void> {
1110 let loadedCount = 0;
1111 await ResourceLoader.processAndRetryIfNeededWithPromisePool(
1112 loadingState.resourceNames,
1113 this.isLoadingInForeground
1114 ? ResourceLoader.maxForegroundConcurrency
1115 : ResourceLoader.maxBackgroundConcurrency,
1116 ResourceLoader.maxAttempt,
1117 async (resourceName) => {
1118 const resource = this.resourceLoader._resources.get(resourceName);
1119 if (!resource) {
1120 logger.warn('Unable to find resource "' + resourceName + '".');
1121 return;
1122 }
1123 await this.resourceLoader._loadResource(resource);
1124 if (this.shouldProcessResources) {
1125 await this.resourceLoader._processResource(resource);
1126 }
1127 loadedCount++;
1128 this.currentTaskProgress =
1129 loadedCount / loadingState.resourceNames.length;
1130 onProgress &&
1131 (await onProgress(loadedCount, loadingState.resourceNames.length));
1132 }
1133 );
1134 loadingState.status = this.shouldProcessResources ? 'ready' : 'loaded';
1135 }
1136
1137 /**
1138 * Process resources that are needed right away.

Callers 1

Calls 5

_loadResourceMethod · 0.80
_processResourceMethod · 0.80
getMethod · 0.65
warnMethod · 0.45

Tested by

no test coverage detected