diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 4b1dfc414f..8c004a52d0 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -3565,3 +3565,4 @@ _room: yourDeviceNotSupported_title: "お使いのデバイスはMisskeyRoomをサポートしていません。" yourDeviceNotSupported_description: "MisskeyRoomを動作させるには、WebGPUをサポートするデバイスが必要です。" failedToInitialize: "初期化に失敗しました" + crushed_description: "バグ、またはデバイスのリソース不足の可能性が考えられます。" diff --git a/packages/frontend/src/world/room/controller.ts b/packages/frontend/src/world/room/controller.ts index a7f5177bca..3f7e4fb992 100644 --- a/packages/frontend/src/world/room/controller.ts +++ b/packages/frontend/src/world/room/controller.ts @@ -12,6 +12,8 @@ import type { ShallowRef } from 'vue'; import type { RoomState } from './engine.js'; import type { ObjectDef, RoomStateObject } from './object.js'; import * as sound from '@/utility/sound.js'; +import * as os from '@/os.js'; +import { i18n } from '@/i18n.js'; export type RoomControllerOptions = { workerMode?: boolean; @@ -83,6 +85,13 @@ export class RoomController { const babylonEngine = new BABYLON.WebGPUEngine(canvas, { doNotHandleContextLost: true, powerPreference: 'high-performance' }); babylonEngine.compatibilityMode = false; babylonEngine.enableOfflineSupport = false; + babylonEngine.onContextLostObservable.add(() => { + os.alert({ + type: 'error', + title: i18n.ts.somethingHappened, + text: i18n.ts._room.crushed_description, + }); + }); await babylonEngine.initAsync(); if (this.options.resolution === 2) babylonEngine.setHardwareScalingLevel(0.5); if (this.options.resolution === 0.5) babylonEngine.setHardwareScalingLevel(2); diff --git a/packages/i18n/src/autogen/locale.ts b/packages/i18n/src/autogen/locale.ts index a3399d272e..eead62fdc5 100644 --- a/packages/i18n/src/autogen/locale.ts +++ b/packages/i18n/src/autogen/locale.ts @@ -13303,5 +13303,9 @@ export interface Locale extends ILocale { * 初期化に失敗しました */ "failedToInitialize": string; + /** + * バグ、またはデバイスのリソース不足の可能性が考えられます。 + */ + "crushed_description": string; }; }