mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +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 * as Utils from "./utils";
|
||||
import {initTouchControls} from "./touch-controls";
|
||||
import {ButtonKey, initTouchControls} from "./touch-controls";
|
||||
import pad_generic from "./configs/pad_generic";
|
||||
import pad_unlicensedSNES from "./configs/pad_unlicensedSNES";
|
||||
import pad_xbox360 from "./configs/pad_xbox360";
|
||||
@ -357,7 +357,7 @@ export class InputsController {
|
||||
[Button.SPEED_UP]: [keyCodes.PLUS],
|
||||
[Button.SLOW_DOWN]: [keyCodes.MINUS]
|
||||
};
|
||||
const mobileKeyConfig = {};
|
||||
const mobileKeyConfig = new Map<string, ButtonKey>();
|
||||
for (const b of Utils.getEnumValues(Button)) {
|
||||
const keys: Phaser.Input.Keyboard.Key[] = [];
|
||||
if (keyConfig.hasOwnProperty(b)) {
|
||||
|
@ -80,25 +80,29 @@ export interface Localizable {
|
||||
|
||||
const alternativeFonts = {
|
||||
"ko": [
|
||||
new FontFace("emerald", "url(./fonts/PokePT_Wansung.ttf)")
|
||||
new FontFace("emerald", "url(./fonts/PokePT_Wansung.ttf)"),
|
||||
],
|
||||
};
|
||||
|
||||
function loadFont(language: string) {
|
||||
const altFontLanguages = Object.keys(alternativeFonts);
|
||||
if (!alternativeFonts[language]) {
|
||||
language = language.split(/[-_/]/)[0];
|
||||
}
|
||||
if (alternativeFonts[language]) {
|
||||
alternativeFonts[language].forEach(f => {
|
||||
document.fonts.add(f);
|
||||
alternativeFonts[language].forEach((fontFace: FontFace) => {
|
||||
document.fonts.add(fontFace);
|
||||
});
|
||||
|
||||
const altFontLanguages = Object.keys(alternativeFonts);
|
||||
altFontLanguages.splice(altFontLanguages.indexOf(language), 0);
|
||||
}
|
||||
altFontLanguages.forEach(f=> {
|
||||
if (f && f.status === "loaded") {
|
||||
document.fonts.delete(f);
|
||||
}
|
||||
|
||||
(Object.values(alternativeFonts)).forEach(fontFaces => {
|
||||
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.
|
||||
declare module "i18next" {
|
||||
interface CustomTypeOptions {
|
||||
defaultNS: "menu"; // Even if we don't use it, i18next requires a valid default namespace
|
||||
resources: {
|
||||
menu: SimpleTranslationEntries;
|
||||
menuUiHandler: SimpleTranslationEntries;
|
||||
|
@ -1,9 +1,9 @@
|
||||
interface ButtonKey {
|
||||
export interface ButtonKey {
|
||||
onDown: (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 keysDown = new Map();
|
||||
|
Loading…
Reference in New Issue
Block a user