mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-12-01 19:26:16 +00:00
Fix i18next and mobile errors (#1601)
This commit is contained in:
parent
fcc98d372d
commit
060ffc6716
@ -1,6 +1,6 @@
|
|||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import * as Utils from "./utils";
|
import * as Utils from "./utils";
|
||||||
import {initTouchControls} from "./touch-controls";
|
import {ButtonKey, initTouchControls} from "./touch-controls";
|
||||||
import pad_generic from "./configs/pad_generic";
|
import pad_generic from "./configs/pad_generic";
|
||||||
import pad_unlicensedSNES from "./configs/pad_unlicensedSNES";
|
import pad_unlicensedSNES from "./configs/pad_unlicensedSNES";
|
||||||
import pad_xbox360 from "./configs/pad_xbox360";
|
import pad_xbox360 from "./configs/pad_xbox360";
|
||||||
@ -357,7 +357,7 @@ export class InputsController {
|
|||||||
[Button.SPEED_UP]: [keyCodes.PLUS],
|
[Button.SPEED_UP]: [keyCodes.PLUS],
|
||||||
[Button.SLOW_DOWN]: [keyCodes.MINUS]
|
[Button.SLOW_DOWN]: [keyCodes.MINUS]
|
||||||
};
|
};
|
||||||
const mobileKeyConfig = {};
|
const mobileKeyConfig = new Map<string, ButtonKey>();
|
||||||
for (const b of Utils.getEnumValues(Button)) {
|
for (const b of Utils.getEnumValues(Button)) {
|
||||||
const keys: Phaser.Input.Keyboard.Key[] = [];
|
const keys: Phaser.Input.Keyboard.Key[] = [];
|
||||||
if (keyConfig.hasOwnProperty(b)) {
|
if (keyConfig.hasOwnProperty(b)) {
|
||||||
|
@ -80,25 +80,29 @@ export interface Localizable {
|
|||||||
|
|
||||||
const alternativeFonts = {
|
const alternativeFonts = {
|
||||||
"ko": [
|
"ko": [
|
||||||
new FontFace("emerald", "url(./fonts/PokePT_Wansung.ttf)")
|
new FontFace("emerald", "url(./fonts/PokePT_Wansung.ttf)"),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
function loadFont(language: string) {
|
function loadFont(language: string) {
|
||||||
const altFontLanguages = Object.keys(alternativeFonts);
|
|
||||||
if (!alternativeFonts[language]) {
|
if (!alternativeFonts[language]) {
|
||||||
language = language.split(/[-_/]/)[0];
|
language = language.split(/[-_/]/)[0];
|
||||||
}
|
}
|
||||||
if (alternativeFonts[language]) {
|
if (alternativeFonts[language]) {
|
||||||
alternativeFonts[language].forEach(f => {
|
alternativeFonts[language].forEach((fontFace: FontFace) => {
|
||||||
document.fonts.add(f);
|
document.fonts.add(fontFace);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const altFontLanguages = Object.keys(alternativeFonts);
|
||||||
altFontLanguages.splice(altFontLanguages.indexOf(language), 0);
|
altFontLanguages.splice(altFontLanguages.indexOf(language), 0);
|
||||||
}
|
}
|
||||||
altFontLanguages.forEach(f=> {
|
|
||||||
if (f && f.status === "loaded") {
|
(Object.values(alternativeFonts)).forEach(fontFaces => {
|
||||||
document.fonts.delete(f);
|
fontFaces.forEach(fontFace => {
|
||||||
}
|
if (fontFace && fontFace.status === "loaded") {
|
||||||
|
document.fonts.delete(fontFace);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +183,7 @@ export function initI18n(): void {
|
|||||||
// Module declared to make referencing keys in the localization files type-safe.
|
// Module declared to make referencing keys in the localization files type-safe.
|
||||||
declare module "i18next" {
|
declare module "i18next" {
|
||||||
interface CustomTypeOptions {
|
interface CustomTypeOptions {
|
||||||
|
defaultNS: "menu"; // Even if we don't use it, i18next requires a valid default namespace
|
||||||
resources: {
|
resources: {
|
||||||
menu: SimpleTranslationEntries;
|
menu: SimpleTranslationEntries;
|
||||||
menuUiHandler: SimpleTranslationEntries;
|
menuUiHandler: SimpleTranslationEntries;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
interface ButtonKey {
|
export interface ButtonKey {
|
||||||
onDown: (opt: object) => void;
|
onDown: (opt: object) => void;
|
||||||
onUp: (opt: object) => void;
|
onUp: (opt: object) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ButtonMap = Map<string, ButtonKey>;
|
export type ButtonMap = Map<string, ButtonKey>;
|
||||||
|
|
||||||
export const keys = new Map();
|
export const keys = new Map();
|
||||||
export const keysDown = new Map();
|
export const keysDown = new Map();
|
||||||
|
Loading…
Reference in New Issue
Block a user