fix: sync mobile renderer startup hardening
This commit is contained in:
parent
9d29354c08
commit
3bceb60f15
32
index.html
32
index.html
@ -8,6 +8,38 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="game"></div>
|
||||
<script>
|
||||
(() => {
|
||||
const showBootError = (message) => {
|
||||
if (document.getElementById('boot-error')) return;
|
||||
const box = document.createElement('div');
|
||||
box.id = 'boot-error';
|
||||
box.style.cssText = [
|
||||
'position:fixed',
|
||||
'inset:0',
|
||||
'z-index:9999',
|
||||
'display:flex',
|
||||
'align-items:center',
|
||||
'justify-content:center',
|
||||
'padding:24px',
|
||||
'box-sizing:border-box',
|
||||
'background:#10251d',
|
||||
'color:#f4ead2',
|
||||
'font:16px/1.45 system-ui,sans-serif',
|
||||
'text-align:center'
|
||||
].join(';');
|
||||
box.textContent = 'Squirrel Forest could not start. ' + message;
|
||||
document.body.appendChild(box);
|
||||
};
|
||||
|
||||
window.addEventListener('error', (event) => {
|
||||
showBootError(event.message || 'A browser error occurred.');
|
||||
});
|
||||
window.addEventListener('unhandledrejection', (event) => {
|
||||
showBootError(String(event.reason || 'A startup promise failed.'));
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
10
src/main.js
10
src/main.js
@ -136,11 +136,11 @@ class ForestScene extends Phaser.Scene {
|
||||
g.clear();
|
||||
g.fillStyle(0x35684b, 1);
|
||||
for (let i = 0; i < 5; i++) {
|
||||
g.fillEllipse(17 + i * 2, 22 - i * 4, 9, 25, -0.7 + i * 0.25);
|
||||
g.fillEllipse(17 + i * 2, 22 - i * 4, 9, 25);
|
||||
}
|
||||
g.fillStyle(0x6aa56d, 1);
|
||||
for (let i = 0; i < 4; i++) {
|
||||
g.fillEllipse(12 + i * 6, 25 - (i % 2) * 6, 7, 19, 0.6 - i * 0.25);
|
||||
g.fillEllipse(12 + i * 6, 25 - (i % 2) * 6, 7, 19);
|
||||
}
|
||||
g.generateTexture('fern', 42, 44);
|
||||
|
||||
@ -178,8 +178,8 @@ class ForestScene extends Phaser.Scene {
|
||||
|
||||
g.clear();
|
||||
g.fillStyle(0xb4d9f2, 0.9);
|
||||
g.fillEllipse(8, 8, 12, 7, -0.45);
|
||||
g.fillEllipse(16, 8, 12, 7, 0.45);
|
||||
g.fillEllipse(8, 8, 12, 7);
|
||||
g.fillEllipse(16, 8, 12, 7);
|
||||
g.fillStyle(0x3b3130, 1);
|
||||
g.fillEllipse(12, 9, 4, 10);
|
||||
g.generateTexture('butterfly', 24, 18);
|
||||
@ -582,7 +582,7 @@ class ForestScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
const config = {
|
||||
type: Phaser.AUTO,
|
||||
type: Phaser.CANVAS,
|
||||
parent: 'game',
|
||||
width: 1280,
|
||||
height: 720,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user