Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(examples): the hot-update demo says when it could not reach the update endpoint

esenginef41a0090fa1f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 702e5374d..4935ad48a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@ published separately; it ships inside the editor.
### Fixed
+- The hot-update demo no longer says the remote manifest matches when it could not reach one; offline it says it keeps the local content.
- On vivo's quick game the loading notice comes down once the game starts; it could stay over the running game.
- A quick tap on a slow frame still clicks a button: a finger that landed and lifted between two frames was seen only lifting, so the button never saw a press.
- A tap on vivo's quick game lands where the finger is: the host reports touches in physical pixels, and every tap landed off the screen.
diff --git a/examples/hot-update-demo/src/state.ts b/examples/hot-update-demo/src/state.ts
index cd93a75e8..142d6eed0 100644
--- a/examples/hot-update-demo/src/state.ts
+++ b/examples/hot-update-demo/src/state.ts
@@ -32,6 +32,8 @@ export interface DemoState {
loaded: number;
total: number;
plan: PlanInfo | null;
+ /** The last check reached no manifest, so "up to date" means "nothing newer seen". */
+ checkUnreached: boolean;
packBound: boolean[];
// Scene-authored widget entities, resolved once by the build system.
@@ -61,6 +63,7 @@ export const state: DemoState = {
loaded: 0,
total: 0,
plan: null,
+ checkUnreached: false,
packBound: [],
statusEntity: NONE,
diff --git a/examples/hot-update-demo/src/systems/build.ts b/examples/hot-update-demo/src/systems/build.ts
index f383bb233..b042b9376 100644
--- a/examples/hot-update-demo/src/systems/build.ts
+++ b/examples/hot-update-demo/src/systems/build.ts
@@ -55,6 +55,7 @@ export const buildSystem = defineSystem(
state.message = '正在检查更新…';
state.progress = 0;
state.plan = null;
+ state.checkUnreached = false;
const ep = hotUpdateEndpoint();
try {
const plan = await assets.checkForUpdate({ manifestUrl: ep.manifestUrl, remoteRoot: ep.remoteRoot });
@@ -76,6 +77,7 @@ export const buildSystem = defineSystem(
// configured, where updates/ was never bundled): honestly up to date.
state.phase = 'up-to-date';
state.message = '已是最新版本';
+ state.checkUnreached = true;
}
}
diff --git a/examples/hot-update-demo/src/systems/update.ts b/examples/hot-update-demo/src/systems/update.ts
index 3555c2f84..9d79c16e7 100644
--- a/examples/hot-update-demo/src/systems/update.ts
+++ b/examples/hot-update-demo/src/systems/update.ts
@@ -68,7 +68,7 @@ function planLine(): string {
case 'downloaded':
return `已装载 ${state.packBound.filter(Boolean).length}/${state.packBound.length} 个资源`;
case 'up-to-date':
- return '远程清单与本地内容一致';
+ return state.checkUnreached ? '未连上更新地址,继续使用本地内容' : '远程清单与本地内容一致';
default:
return '点击「检查更新」比对远程内容,或「下载资源包」按需拉取';
}
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 9745cb931..6f3d8723f 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -1094,4 +1094,6 @@ export const NOTED = {
{ note: 'A quick tap on a slow frame still clicks a button: a finger that landed and lifted between two frames was seen only lifting, so the button never saw a press.' },
'fix(minigame): the loading notice comes down on vivo\'s quick game':
{ note: 'On vivo\'s quick game the loading notice comes down once the game starts; it could stay over the running game.' },
+ 'fix(examples): the hot-update demo says when it could not reach the update endpoint':
+ { note: 'The hot-update demo no longer says the remote manifest matches when it could not reach one; offline it says it keeps the local content.' },
};