mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-18 08:12:16 +03:00
Several changes
- updated dependencies - added proper shaders menu section - made `Locales.bind()` method to bind some callback to locale changing event - with change above, made proper translations for button on the main window
This commit is contained in:
parent
4c16ce1de3
commit
50830b530b
19 changed files with 422 additions and 83 deletions
|
@ -16,13 +16,13 @@
|
|||
"yaml": "^1.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@neutralinojs/neu": "^8.1.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.33",
|
||||
"@neutralinojs/neu": "^9.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.34",
|
||||
"@tsconfig/svelte": "^3.0.0",
|
||||
"@types/js-md5": "^0.4.3",
|
||||
"neutralino-appimage-bundler": "^1.3.1",
|
||||
"sass": "^1.45.2",
|
||||
"svelte": "^3.44.3",
|
||||
"sass": "^1.47.0",
|
||||
"svelte": "^3.45.0",
|
||||
"svelte-check": "^2.2.11",
|
||||
"svelte-preprocess": "^4.10.1",
|
||||
"tslib": "^2.3.1",
|
||||
|
|
|
@ -6,9 +6,37 @@ splash:
|
|||
- Paimon am ärgern...
|
||||
- Versuche Yae zu ziehen...
|
||||
|
||||
# Launcher Fenster
|
||||
# Launcher window
|
||||
launcher:
|
||||
predownload: Update vorinstallieren
|
||||
states:
|
||||
# When the game should be installed or updated
|
||||
installation:
|
||||
install_wine: Install Wine
|
||||
install_dxvk: Install DXVK
|
||||
install: Install
|
||||
update: Update
|
||||
|
||||
# When the game should be patched
|
||||
patching:
|
||||
# Patch unavailable
|
||||
unavailable:
|
||||
title: Patch unavailable
|
||||
hint: This game version has no anti-cheat patch.
|
||||
Please, wait a few days before there will be a test or stable version
|
||||
|
||||
# Patch is in testing
|
||||
test:
|
||||
title: Apply test patch
|
||||
hint: This game version has an experimental anti-cheat patch.
|
||||
You can wait a few days until it is stable or apply it at your own risk
|
||||
|
||||
# Patch is stable
|
||||
stable: Apply patch
|
||||
|
||||
# When the game is ready for playing
|
||||
ready:
|
||||
launch: Launch
|
||||
predownload: Pre-download update
|
||||
|
||||
# Einstellungs Fenster
|
||||
settings:
|
||||
|
@ -134,4 +162,7 @@ settings:
|
|||
tooltip: Benutze die Home/POS1 taste um die Shader in-spiel zu togglen
|
||||
items:
|
||||
none: None
|
||||
custom: Custom
|
||||
custom: Custom
|
||||
|
||||
author: 'Autor: {author}'
|
||||
no_images: Keine Bilder verfügbar
|
|
@ -8,7 +8,35 @@ splash:
|
|||
|
||||
# Launcher window
|
||||
launcher:
|
||||
predownload: Pre-download update
|
||||
states:
|
||||
# When the game should be installed or updated
|
||||
installation:
|
||||
install_wine: Install Wine
|
||||
install_dxvk: Install DXVK
|
||||
install: Install
|
||||
update: Update
|
||||
|
||||
# When the game should be patched
|
||||
patching:
|
||||
# Patch unavailable
|
||||
unavailable:
|
||||
title: Patch unavailable
|
||||
hint: This game version has no anti-cheat patch.
|
||||
Please, wait a few days before there will be a test or stable version
|
||||
|
||||
# Patch is in testing
|
||||
test:
|
||||
title: Apply test patch
|
||||
hint: This game version has an experimental anti-cheat patch.
|
||||
You can wait a few days until it is stable or apply it at your own risk
|
||||
|
||||
# Patch is stable
|
||||
stable: Apply patch
|
||||
|
||||
# When the game is ready for playing
|
||||
ready:
|
||||
launch: Launch
|
||||
predownload: Pre-download update
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
@ -133,4 +161,7 @@ settings:
|
|||
tooltip: Use Home button to toggle shaders in the game
|
||||
items:
|
||||
none: None
|
||||
custom: Custom
|
||||
custom: Custom
|
||||
|
||||
author: 'Author: {author}'
|
||||
no_images: No images added
|
|
@ -8,7 +8,35 @@ splash:
|
|||
|
||||
# Launcher window
|
||||
launcher:
|
||||
predownload: Pre-download update
|
||||
states:
|
||||
# When the game should be installed or updated
|
||||
installation:
|
||||
install_wine: Install Wine
|
||||
install_dxvk: Install DXVK
|
||||
install: Install
|
||||
update: Update
|
||||
|
||||
# When the game should be patched
|
||||
patching:
|
||||
# Patch unavailable
|
||||
unavailable:
|
||||
title: Patch unavailable
|
||||
hint: This game version has no anti-cheat patch.
|
||||
Please, wait a few days before there will be a test or stable version
|
||||
|
||||
# Patch is in testing
|
||||
test:
|
||||
title: Apply test patch
|
||||
hint: This game version has an experimental anti-cheat patch.
|
||||
You can wait a few days until it is stable or apply it at your own risk
|
||||
|
||||
# Patch is stable
|
||||
stable: Apply patch
|
||||
|
||||
# When the game is ready for playing
|
||||
ready:
|
||||
launch: Launch
|
||||
predownload: Pre-download update
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
@ -133,4 +161,7 @@ settings:
|
|||
tooltip: Use Home button to toggle shaders in the game
|
||||
items:
|
||||
none: None
|
||||
custom: Custom
|
||||
custom: Custom
|
||||
|
||||
author: 'Author: {author}'
|
||||
no_images: No images added
|
|
@ -8,7 +8,36 @@ splash:
|
|||
|
||||
# Launcher window
|
||||
launcher:
|
||||
predownload: Pre-téléchargement de mise à jour
|
||||
states:
|
||||
# When the game should be installed or updated
|
||||
installation:
|
||||
install_wine: Installer Wine
|
||||
install_dxvk: Installer DXVK
|
||||
install: Installer
|
||||
update: Mise à jour
|
||||
|
||||
# When the game should be patched
|
||||
patching:
|
||||
# Patch unavailable
|
||||
unavailable:
|
||||
title: Patch non disponible
|
||||
hint: Cette version du jeu n'a pas de patch contre l'anti triche,
|
||||
merci de bien vouloir patienter quelques jours puis réessayez
|
||||
|
||||
# Patch is in testing
|
||||
test:
|
||||
title: Appliquer le patch en teste
|
||||
hint: Cette version du jeu a un patch contre l'anti triche,
|
||||
mais celui-ci est en période de teste.
|
||||
Vous pouvez patienter ou bien l'utilisé à vos risques et périls.
|
||||
|
||||
# Patch is stable
|
||||
stable: Appliquer le patch
|
||||
|
||||
# When the game is ready for playing
|
||||
ready:
|
||||
launch: Lancer
|
||||
predownload: Pre-téléchargement de mise à jour
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
@ -139,4 +168,7 @@ settings:
|
|||
ou désactiver les effets visuels
|
||||
items:
|
||||
none: None
|
||||
custom: Custom
|
||||
custom: Custom
|
||||
|
||||
author: 'Auteur: {author}'
|
||||
no_images: Aucune image ajoutée
|
|
@ -8,7 +8,35 @@ splash:
|
|||
|
||||
# Launcher window
|
||||
launcher:
|
||||
predownload: Pre-scarica l'aggiornamento
|
||||
states:
|
||||
# When the game should be installed or updated
|
||||
installation:
|
||||
install_wine: Install Wine
|
||||
install_dxvk: Install DXVK
|
||||
install: Install
|
||||
update: Update
|
||||
|
||||
# When the game should be patched
|
||||
patching:
|
||||
# Patch unavailable
|
||||
unavailable:
|
||||
title: Patch unavailable
|
||||
hint: This game version has no anti-cheat patch.
|
||||
Please, wait a few days before there will be a test or stable version
|
||||
|
||||
# Patch is in testing
|
||||
test:
|
||||
title: Apply test patch
|
||||
hint: This game version has an experimental anti-cheat patch.
|
||||
You can wait a few days until it is stable or apply it at your own risk
|
||||
|
||||
# Patch is stable
|
||||
stable: Apply patch
|
||||
|
||||
# When the game is ready for playing
|
||||
ready:
|
||||
launch: Launch
|
||||
predownload: Pre-download update
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
@ -131,4 +159,7 @@ settings:
|
|||
tooltip: Usa il bottone Home per attivare/disattivare le shaders in gioco
|
||||
items:
|
||||
none: None
|
||||
custom: Custom
|
||||
custom: Custom
|
||||
|
||||
author: 'Author: {author}'
|
||||
no_images: No images added
|
|
@ -6,9 +6,37 @@ splash:
|
|||
- Издеваемся над Паймон...
|
||||
- Пытаемся получить Яэ...
|
||||
|
||||
# Окна лаунчера
|
||||
# Окно лаунчера
|
||||
launcher:
|
||||
predownload: Предзагрузить обновление
|
||||
states:
|
||||
# Когда игра должна быть установлена или обновлена
|
||||
installation:
|
||||
install_wine: Установить Wine
|
||||
install_dxvk: Установить DXVK
|
||||
install: Установить
|
||||
update: Обновить
|
||||
|
||||
# Когда игра должна быть пропатчена
|
||||
patching:
|
||||
# Патч недоступен
|
||||
unavailable:
|
||||
title: Патч недоступен
|
||||
hint: Эта версия игры не имеет патча анти-чита.
|
||||
Пожалуйста, подождите несколько дней пока не будет выпущена тестовая или стабильная версия
|
||||
|
||||
# Патч тестируется
|
||||
test:
|
||||
title: Применить тестовый патч
|
||||
hint: Эта версия игры имеет экспериментальный патч анти-чита.
|
||||
Вы можете подождать пару дней пока не выйдет стабильная версия, или применить этот патч на свой страх и риск
|
||||
|
||||
# Патч стабилен
|
||||
stable: Применить патч
|
||||
|
||||
# Когда всё готово
|
||||
ready:
|
||||
launch: Запустить
|
||||
predownload: Предзагрузить обновление
|
||||
|
||||
# Окно настроек
|
||||
settings:
|
||||
|
@ -132,4 +160,7 @@ settings:
|
|||
tooltip: Используйте кнопку Home чтобы переключать шейдеры в игре
|
||||
items:
|
||||
none: Отключены
|
||||
custom: Кастомные
|
||||
custom: Кастомные
|
||||
|
||||
author: 'Автор: {author}'
|
||||
no_images: Нет добавленных изображений
|
|
@ -8,7 +8,35 @@ splash:
|
|||
|
||||
# Launcher window
|
||||
launcher:
|
||||
predownload: Pre-download update
|
||||
states:
|
||||
# When the game should be installed or updated
|
||||
installation:
|
||||
install_wine: Install Wine
|
||||
install_dxvk: Install DXVK
|
||||
install: Install
|
||||
update: Update
|
||||
|
||||
# When the game should be patched
|
||||
patching:
|
||||
# Patch unavailable
|
||||
unavailable:
|
||||
title: Patch unavailable
|
||||
hint: This game version has no anti-cheat patch.
|
||||
Please, wait a few days before there will be a test or stable version
|
||||
|
||||
# Patch is in testing
|
||||
test:
|
||||
title: Apply test patch
|
||||
hint: This game version has an experimental anti-cheat patch.
|
||||
You can wait a few days until it is stable or apply it at your own risk
|
||||
|
||||
# Patch is stable
|
||||
stable: Apply patch
|
||||
|
||||
# When the game is ready for playing
|
||||
ready:
|
||||
launch: Launch
|
||||
predownload: Pre-download update
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
@ -133,4 +161,7 @@ settings:
|
|||
tooltip: Use Home button to toggle shaders in the game
|
||||
items:
|
||||
none: None
|
||||
custom: Custom
|
||||
custom: Custom
|
||||
|
||||
author: 'Author: {author}'
|
||||
no_images: No images added
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 MiB |
|
@ -4,7 +4,7 @@ uri: https://notabug.org/notahuman/presets/raw/master/Resin-Impact/vkBasalt.conf
|
|||
images:
|
||||
- file: preview.png
|
||||
caption:
|
||||
en-us: Characters' faces
|
||||
en-us: Character's faces
|
||||
de-de: Gesichter der Charaktere
|
||||
ja-jp: キャラクターの顔
|
||||
ko-kr: 캐릭터의 얼굴
|
||||
|
|
BIN
src/assets/shaders/notahuman/preview.png
Normal file
BIN
src/assets/shaders/notahuman/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 MiB |
|
@ -1,8 +1,8 @@
|
|||
<script lang="ts">
|
||||
import { _ } from 'svelte-i18n';
|
||||
import { _, locale } from 'svelte-i18n';
|
||||
|
||||
import type { Shader } from '../ts/types/Shaders';
|
||||
import Shaders from '../ts/core/Shaders';
|
||||
import Shaders from '../ts/launcher/Shaders';
|
||||
|
||||
import SelectionBox from './SelectionBox.svelte';
|
||||
|
||||
|
@ -21,9 +21,39 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<SelectionBox
|
||||
lang="settings.shaders.items.shaders.title"
|
||||
tooltip="settings.shaders.items.shaders.tooltip"
|
||||
prop="shaders"
|
||||
items={shadersOptions}
|
||||
/>
|
||||
<div>
|
||||
<SelectionBox
|
||||
lang="settings.shaders.items.shaders.title"
|
||||
tooltip="settings.shaders.items.shaders.tooltip"
|
||||
prop="shaders"
|
||||
items={shadersOptions}
|
||||
/>
|
||||
|
||||
{#each shaders as shader}
|
||||
<h3>{shader.name}</h3>
|
||||
|
||||
<p>{$_('settings.shaders.items.author', { values: { author: shader.author } })}</p>
|
||||
|
||||
{#if !shader.images}
|
||||
<p>{$_('settings.shaders.items.no_images')}</p>
|
||||
{:else}
|
||||
{#each shader.images as image}
|
||||
{#await Shaders.getPicture(shader.folder, image.file) then picture}
|
||||
<img class="shader-image" src={picture} alt="" />
|
||||
|
||||
<p class="shader-image-title">{$locale && image.caption[$locale] ? image.caption[$locale] : image.caption['en-us']}</p>
|
||||
{/await}
|
||||
{/each}
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style lang="sass">
|
||||
.shader-image
|
||||
width: 100%
|
||||
|
||||
.shader-image-title
|
||||
text-align: center
|
||||
|
||||
margin-top: 8px
|
||||
</style>
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
|
||||
<main>
|
||||
{#await Background.get() then uri}
|
||||
<img class="background" src="{uri}" alt="">
|
||||
<img class="background" src={uri} alt="">
|
||||
{/await}
|
||||
|
||||
<div class="downloader-panel" data-theme="light">
|
||||
|
@ -142,7 +142,7 @@
|
|||
|
||||
<div id="launcher-content">
|
||||
{#await launcher.getSocial() then uri}
|
||||
<iframe title="Launcher-iframe" src="{uri}" scrolling="no" style="position: absolute; border: 0; top: 0; left: 0;" width="100%" height="100%"></iframe>
|
||||
<iframe id="social-iframe" src={uri} title="" scrolling="no" style="position: absolute; border: 0; top: 0; left: 0;" width="100%" height="100%"></iframe>
|
||||
{/await}
|
||||
</div>
|
||||
|
||||
|
@ -152,7 +152,7 @@
|
|||
<img src={GearActive} class="active" alt="Settings">
|
||||
</div>
|
||||
|
||||
<button class="button hint--left hint--small" aria-label="{typeof $locale === 'string' ? $_('launcher.predownload') : ''}" id="predownload">
|
||||
<button class="button hint--left hint--small" aria-label="{typeof $locale === 'string' ? $_('launcher.states.ready.predownload') : ''}" id="predownload">
|
||||
<img src={Download} alt="Download" />
|
||||
</button>
|
||||
|
||||
|
|
|
@ -176,6 +176,8 @@
|
|||
await Window.current.show();
|
||||
await Window.current.center(900, 600);
|
||||
|
||||
// This thing will fix window resizing
|
||||
// in several cases (wayland + gnome + custom theme)
|
||||
const resizer = () => {
|
||||
if (window.innerWidth < 700)
|
||||
setTimeout(resizer, 10);
|
||||
|
@ -222,7 +224,14 @@
|
|||
lang="settings.general.items.lang.launcher.title"
|
||||
prop="lang.launcher"
|
||||
items={launcherLocales}
|
||||
valueChanged={(value) => $locale = value}
|
||||
valueChanged={(value) => {
|
||||
$locale = value;
|
||||
|
||||
IPC.write({
|
||||
type: 'change-locale',
|
||||
locale: value
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
<DropdownCheckboxes
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { locale } from 'svelte-i18n';
|
||||
|
||||
import Window from './neutralino/Window';
|
||||
import Process from './neutralino/Process';
|
||||
import Tray from './neutralino/Tray';
|
||||
|
@ -11,6 +13,7 @@ import Locales from './core/Locales';
|
|||
|
||||
import ProgressBar from './launcher/ProgressBar';
|
||||
import State from './launcher/State';
|
||||
import Background from './launcher/Background';
|
||||
|
||||
export default class Launcher
|
||||
{
|
||||
|
@ -61,8 +64,19 @@ export default class Launcher
|
|||
|
||||
IPC.read().then((records) => {
|
||||
records.forEach((record) => {
|
||||
if (record.data.type !== undefined && record.data.type === 'log')
|
||||
Debug.merge(record.pop().data.records);
|
||||
if (record.data.type !== undefined)
|
||||
{
|
||||
if (record.data.type === 'log')
|
||||
Debug.merge(record.pop().data.records);
|
||||
|
||||
else if (record.data.type === 'change-locale')
|
||||
{
|
||||
locale.set(record.pop().data.locale);
|
||||
|
||||
Background.get().then((uri) => document.getElementsByClassName('background')[0]!.setAttribute('src', uri));
|
||||
this.getSocial().then((uri) => document.getElementById('social-iframe')!.setAttribute('src', uri));
|
||||
}
|
||||
}
|
||||
|
||||
else if (record.data === 'voice-update-required')
|
||||
{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { dictionary, locale } from 'svelte-i18n';
|
||||
|
||||
import YAML from 'yaml';
|
||||
|
||||
import constants from '../Constants';
|
||||
|
@ -80,6 +82,38 @@ export default class Locales
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind some callback to be called every time
|
||||
* the locale will be changed
|
||||
*/
|
||||
public static bind(localizer: (message: string|object) => void, localeName: string)
|
||||
{
|
||||
let currentLocale, currentDictionary;
|
||||
|
||||
const updateLocalizer = () => {
|
||||
let message = currentDictionary[currentLocale] ?? currentDictionary['en-us'];
|
||||
|
||||
for (const path of localeName.split('.'))
|
||||
message = message[path];
|
||||
|
||||
localizer(message);
|
||||
};
|
||||
|
||||
locale.subscribe((locale) => {
|
||||
currentLocale = locale;
|
||||
|
||||
if (currentDictionary)
|
||||
updateLocalizer();
|
||||
});
|
||||
|
||||
dictionary.subscribe((dictionary) => {
|
||||
currentDictionary = dictionary;
|
||||
|
||||
if (currentLocale)
|
||||
updateLocalizer();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified language supported
|
||||
* by the game's API
|
||||
|
|
|
@ -4,12 +4,26 @@ import type { Shader } from '../types/Shaders';
|
|||
|
||||
import Configs from '../Configs';
|
||||
import constants from '../Constants';
|
||||
import promisify from './promisify';
|
||||
import promisify from '../core/promisify';
|
||||
|
||||
declare const Neutralino;
|
||||
|
||||
export default class Shaders
|
||||
{
|
||||
// Required due to the Neutralino restrictions
|
||||
protected static readonly shaders = {
|
||||
'notahuman': {
|
||||
config: this.get('notahuman'),
|
||||
images: {
|
||||
'preview.png': import('../../assets/shaders/notahuman/preview.png')
|
||||
}
|
||||
},
|
||||
'yagocl': {
|
||||
config: this.get('yagocl'),
|
||||
images: {}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get or set shaders to the config file
|
||||
*/
|
||||
|
@ -38,36 +52,14 @@ export default class Shaders
|
|||
public static list(): Promise<Shader[]>
|
||||
{
|
||||
return new Promise((resolve) => {
|
||||
Neutralino.filesystem.readDirectory(constants.paths.shadersDir)
|
||||
.then((dirs) => {
|
||||
let callbacks: any[] = [];
|
||||
const pipeline = promisify({
|
||||
callbacks: Object.values(this.shaders).map((value) => value.config),
|
||||
callAtOnce: true
|
||||
});
|
||||
|
||||
dirs.forEach((dir) => {
|
||||
if (dir.entry != '.' && dir.entry != '..')
|
||||
{
|
||||
callbacks.push((): Promise<Shader|null> => {
|
||||
return new Promise((resolve) => {
|
||||
Neutralino.filesystem.readFile(`${constants.paths.shadersDir}/${dir.entry}/shaders.yaml`)
|
||||
.then((shaders) => resolve({
|
||||
...YAML.parse(shaders),
|
||||
folder: dir.entry
|
||||
}))
|
||||
.catch(() => resolve(null));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const pipeline = promisify({
|
||||
callbacks,
|
||||
callAtOnce: true
|
||||
});
|
||||
|
||||
pipeline.then((output: object) => {
|
||||
resolve(Object.values(output).filter((shader) => shader !== null));
|
||||
});
|
||||
})
|
||||
.catch(() => resolve([]));
|
||||
pipeline.then((output: object) => {
|
||||
resolve(Object.values(output));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -79,9 +71,27 @@ export default class Shaders
|
|||
return new Promise((resolve) => {
|
||||
Neutralino.filesystem.readFile(`${constants.paths.shadersDir}/${folder}/shaders.yaml`)
|
||||
.then((shaders) => {
|
||||
resolve(YAML.parse(shaders));
|
||||
resolve({
|
||||
...YAML.parse(shaders),
|
||||
folder: folder
|
||||
});
|
||||
})
|
||||
.catch(() => resolve(null));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get path to the shader picture
|
||||
*
|
||||
* Required due to the Neutralino restrictions
|
||||
*/
|
||||
public static getPicture(folder: string, file: string): Promise<string|null>
|
||||
{
|
||||
return new Promise((resolve) => {
|
||||
if (this.shaders[folder] === undefined || this.shaders[folder].images[file] === undefined)
|
||||
resolve(null);
|
||||
|
||||
else this.shaders[folder].images[file].then((image) => resolve(image.default));
|
||||
})
|
||||
}
|
||||
};
|
|
@ -1,3 +1,6 @@
|
|||
import { get as svelteget } from 'svelte/store';
|
||||
import { dictionary, locale } from 'svelte-i18n';
|
||||
|
||||
import type Launcher from '../Launcher';
|
||||
import type { LauncherState } from '../types/Launcher';
|
||||
|
||||
|
@ -7,9 +10,10 @@ import Game from '../Game';
|
|||
import Patch from '../Patch';
|
||||
import Voice from '../Voice';
|
||||
import Runners from '../core/Runners';
|
||||
import { DebugThread } from '../core/Debug';
|
||||
import Debug, { DebugThread } from '../core/Debug';
|
||||
import DXVK from '../core/DXVK';
|
||||
import IPC from '../core/IPC';
|
||||
import Locales from '../core/Locales';
|
||||
|
||||
export default class State
|
||||
{
|
||||
|
@ -89,6 +93,8 @@ export default class State
|
|||
await Window.current.show();
|
||||
await Window.current.center(1280, 700);
|
||||
|
||||
// This thing will fix window resizing
|
||||
// in several cases (wayland + gnome + custom theme)
|
||||
const resizer = () => {
|
||||
if (window.innerWidth < 1000)
|
||||
setTimeout(resizer, 10);
|
||||
|
@ -105,6 +111,8 @@ export default class State
|
|||
|
||||
setTimeout(resizer, 10);
|
||||
});
|
||||
|
||||
Locales.bind((message) => this.updateLocales(message as object), 'launcher.states');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,63 +136,79 @@ export default class State
|
|||
this.launchButton.classList.remove('button-blue');
|
||||
this.launchButton.setAttribute('aria-label', '');
|
||||
|
||||
switch(state)
|
||||
const currentDictionary = svelteget(dictionary);
|
||||
const currentLocale = svelteget(locale);
|
||||
|
||||
this.updateLocales((currentDictionary[currentLocale ?? 'en-us'] ?? currentDictionary['en-us'])['launcher']!['states'] as object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update components texts
|
||||
*/
|
||||
public updateLocales(dictionary: object)
|
||||
{
|
||||
Debug.log({
|
||||
function: 'State.updateLocales',
|
||||
message: `Updated locales: ${JSON.stringify(dictionary)}`
|
||||
});
|
||||
|
||||
switch(this._state)
|
||||
{
|
||||
case 'runner-installation-required':
|
||||
this.launchButton.textContent = 'Install wine';
|
||||
this.launchButton.textContent = dictionary['installation']['install_wine'];
|
||||
|
||||
break;
|
||||
|
||||
case 'dxvk-installation-required':
|
||||
this.launchButton.textContent = 'Install DXVK';
|
||||
this.launchButton.textContent = dictionary['installation']['install_dxvk'];
|
||||
|
||||
break;
|
||||
|
||||
case 'game-launch-available':
|
||||
this.launchButton.textContent = 'Launch';
|
||||
this.launchButton.textContent = dictionary['ready']['launch'];
|
||||
|
||||
break;
|
||||
|
||||
case 'game-pre-installation-available':
|
||||
case 'game-voice-pre-installation-available':
|
||||
this.launchButton.textContent = 'Launch';
|
||||
|
||||
this.predownloadButton.style['display'] = 'block';
|
||||
|
||||
this.launchButton.textContent = dictionary['ready']['launch'];
|
||||
|
||||
break;
|
||||
|
||||
case 'game-installation-available':
|
||||
this.launchButton.textContent = 'Install';
|
||||
this.launchButton.textContent = dictionary['installation']['install'];
|
||||
|
||||
break;
|
||||
|
||||
case 'game-update-available':
|
||||
case 'game-voice-update-required':
|
||||
this.launchButton.textContent = 'Update';
|
||||
this.launchButton.textContent = dictionary['installation']['update'];
|
||||
|
||||
break;
|
||||
|
||||
case 'patch-available':
|
||||
this.launchButton.textContent = 'Apply patch';
|
||||
this.launchButton.textContent = dictionary['patching']['stable'];
|
||||
|
||||
break;
|
||||
|
||||
case 'test-patch-available':
|
||||
this.launchButton.textContent = 'Apply test patch';
|
||||
|
||||
this.launchButton.classList.add('button-blue');
|
||||
|
||||
this.launchButton.setAttribute('aria-label', 'This game version has an anti-cheat patch, but it is in the testing phase. You can wait a few days until it is stable or apply it at your own risk');
|
||||
this.launchButton.textContent = dictionary['patching']['test']['title'];
|
||||
|
||||
this.launchButton.setAttribute('aria-label', dictionary['patching']['test']['hint']);
|
||||
|
||||
break;
|
||||
|
||||
case 'patch-unavailable':
|
||||
this.launchButton.textContent = 'Patch unavailable';
|
||||
|
||||
this.launchButton.classList.add('button-blue');
|
||||
this.launchButton.setAttribute('disabled', '');
|
||||
|
||||
this.launchButton.setAttribute('aria-label', 'This game version has no anti-cheat patch. Please, wait a few days before there will be a test or stable version');
|
||||
this.launchButton.textContent = dictionary['patching']['unavailable']['title'];
|
||||
|
||||
this.launchButton.setAttribute('aria-label', dictionary['patching']['unavailable']['hint']);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
2
src/ts/types/Shaders.d.ts
vendored
2
src/ts/types/Shaders.d.ts
vendored
|
@ -5,7 +5,7 @@ type Shader = {
|
|||
uri?: string;
|
||||
images?: {
|
||||
file: string;
|
||||
captions?: string[];
|
||||
caption: object;
|
||||
}[];
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue