()
| 676 | this.msgElem.innerText = message; |
| 677 | } |
| 678 | downloadStartState() { |
| 679 | return new Promise((resolve, reject) => { |
| 680 | if (typeof this.config.loadState !== "string" && !this.toData(this.config.loadState, true)) { |
| 681 | resolve(); |
| 682 | return; |
| 683 | } |
| 684 | this.textElem.innerText = this.localization("Download Game State"); |
| 685 | |
| 686 | this.downloadFile(this.config.loadState, (progress) => { |
| 687 | this.textElem.innerText = this.localization("Download Game State") + progress; |
| 688 | }, true, { responseType: "arraybuffer", method: "GET" }).then((res) => { |
| 689 | if (res === -1) { |
| 690 | this.startGameError(this.localization("Error downloading game state")); |
| 691 | return; |
| 692 | } |
| 693 | this.on("start", () => { |
| 694 | setTimeout(() => { |
| 695 | this.gameManager.loadState(new Uint8Array(res.data)); |
| 696 | }, 10); |
| 697 | }) |
| 698 | resolve(); |
| 699 | }); |
| 700 | }) |
| 701 | } |
| 702 | downloadGameFile(assetUrl, type, progressMessage, decompressProgressMessage) { |
| 703 | return new Promise(async (resolve, reject) => { |
| 704 | if ((typeof assetUrl !== "string" || !assetUrl.trim()) && !this.toData(assetUrl, true)) { |
no test coverage detected