You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
merge: integrate duckietm/Dev (JSON5 + split-aware gamedata loader)
# Conflicts: # packages/session/src/SessionDataManager.ts # yarn.lock
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"@nitrots/communication": "1.0.0",
|
||||
"@nitrots/configuration": "1.0.0",
|
||||
"@nitrots/events": "1.0.0",
|
||||
"@nitrots/utils": "1.0.0",
|
||||
"pixi.js": "^8.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ILocalizationManager } from '@nitrots/api';
|
||||
import { BadgePointLimitsEvent, GetCommunication } from '@nitrots/communication';
|
||||
import { GetConfiguration } from '@nitrots/configuration';
|
||||
import { loadGamedata } from '@nitrots/utils';
|
||||
import { BadgeBaseAndLevel } from './BadgeBaseAndLevel';
|
||||
|
||||
export class LocalizationManager implements ILocalizationManager
|
||||
@@ -25,28 +26,15 @@ export class LocalizationManager implements ILocalizationManager
|
||||
|
||||
url = GetConfiguration().interpolate(url);
|
||||
|
||||
let response: Response;
|
||||
|
||||
try
|
||||
{
|
||||
response = await fetch(url);
|
||||
}
|
||||
catch(fetchErr)
|
||||
{
|
||||
throw new Error(`Could not fetch localization file "${ url }" — check "external.texts.url" in ui-config.json (${ fetchErr.message })`);
|
||||
}
|
||||
|
||||
if(response.status !== 200) throw new Error(`Failed to load localization file "${ url }" — server returned HTTP ${ response.status }. Check "external.texts.url" in ui-config.json`);
|
||||
|
||||
let data: any;
|
||||
|
||||
try
|
||||
{
|
||||
data = await response.json();
|
||||
data = await loadGamedata(url);
|
||||
}
|
||||
catch(parseErr)
|
||||
catch(err)
|
||||
{
|
||||
throw new Error(`Invalid JSON in localization file "${ url }" — the URL may be wrong. Check "external.texts.url" in ui-config.json (${ parseErr.message })`);
|
||||
throw new Error(`Could not load localization file "${ url }" — check "external.texts.url" in ui-config.json (${ err?.message || err })`);
|
||||
}
|
||||
|
||||
this.parseLocalization(data);
|
||||
|
||||
Reference in New Issue
Block a user