mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-20 09:11:56 +03:00
Several changes
- added splash screen - added `Process.kill()` static method
This commit is contained in:
parent
ee58e179c3
commit
faee9c4a35
12 changed files with 151 additions and 5 deletions
|
@ -166,10 +166,10 @@ This is our current roadmap goals. You can find older ones [here](ROADMAP.md)
|
||||||
* <s>Telemetry checking</s>
|
* <s>Telemetry checking</s>
|
||||||
* <s>Tooltips for some options</s>
|
* <s>Tooltips for some options</s>
|
||||||
* <s>Debugger</s>
|
* <s>Debugger</s>
|
||||||
|
* <s>Splash screen</s>
|
||||||
* Game pre-installation
|
* Game pre-installation
|
||||||
* Launcher auto-updates
|
* Launcher auto-updates
|
||||||
* Statistics window
|
* Statistics window
|
||||||
* Splash screen
|
|
||||||
* Theming system
|
* Theming system
|
||||||
* Chengelog window
|
* Chengelog window
|
||||||
* Default runner auto-installation
|
* Default runner auto-installation
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# Splash window
|
||||||
|
splash:
|
||||||
|
title: Loading launcher
|
||||||
|
phrases:
|
||||||
|
- Doing some important stuff...
|
||||||
|
- Bullying Paimon...
|
||||||
|
- Pulling for Yae...
|
||||||
|
|
||||||
|
# Settings window
|
||||||
settings:
|
settings:
|
||||||
# General
|
# General
|
||||||
general:
|
general:
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
# Сплэш хуйня
|
||||||
|
splash:
|
||||||
|
title: Загрузка лаунчера
|
||||||
|
phrases:
|
||||||
|
- Делаем всякие важные штуки...
|
||||||
|
- Издеваемся над Паймон...
|
||||||
|
- Пытаемся получить Яэ...
|
||||||
|
|
||||||
|
# Окно настроек
|
||||||
settings:
|
settings:
|
||||||
# Основное
|
# Основное
|
||||||
general:
|
general:
|
||||||
|
|
16
splash.html
Normal file
16
splash.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" lang="sass" href="/src/sass/splash.sass" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body data-theme="light">
|
||||||
|
<div id="app"></div>
|
||||||
|
|
||||||
|
<script src="neutralino.js"></script>
|
||||||
|
<script type="module" src="/src/pages/splash.ts" lang="ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
BIN
src/assets/webms/loading.webm
Normal file
BIN
src/assets/webms/loading.webm
Normal file
Binary file not shown.
|
@ -11,6 +11,17 @@
|
||||||
import Game from './ts/Game';
|
import Game from './ts/Game';
|
||||||
import Background from './ts/launcher/Background';
|
import Background from './ts/launcher/Background';
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
Neutralino.events.on('ready', () => {
|
||||||
|
Window.open('splash', {
|
||||||
|
title: 'Splash',
|
||||||
|
width: 400,
|
||||||
|
height: 500,
|
||||||
|
borderless: true,
|
||||||
|
exitProcessOnClose: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const launcher = new Launcher(onMount);
|
const launcher = new Launcher(onMount);
|
||||||
|
|
||||||
// Do some stuff when all the content will be loaded
|
// Do some stuff when all the content will be loaded
|
||||||
|
|
12
src/pages/splash.ts
Normal file
12
src/pages/splash.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import '../i18n';
|
||||||
|
import App from '../splash.svelte';
|
||||||
|
|
||||||
|
declare const Neutralino;
|
||||||
|
|
||||||
|
Neutralino.init();
|
||||||
|
|
||||||
|
const app = new App({
|
||||||
|
target: document.getElementById('app')!
|
||||||
|
});
|
||||||
|
|
||||||
|
export default app;
|
27
src/sass/splash.sass
Normal file
27
src/sass/splash.sass
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
@use "sass:map"
|
||||||
|
|
||||||
|
@import "basic"
|
||||||
|
|
||||||
|
@mixin themable($theme-name, $theme-map)
|
||||||
|
body[data-theme=#{$theme-name}]
|
||||||
|
div
|
||||||
|
width: 60%
|
||||||
|
margin: 56px auto 0 auto
|
||||||
|
|
||||||
|
video
|
||||||
|
width: 100%
|
||||||
|
|
||||||
|
h2, p
|
||||||
|
margin: 0
|
||||||
|
text-align: center
|
||||||
|
|
||||||
|
p
|
||||||
|
color: grey
|
||||||
|
font-weight: 600
|
||||||
|
margin-top: 12px
|
||||||
|
|
||||||
|
@import "themes/light"
|
||||||
|
@import "themes/dark"
|
||||||
|
|
||||||
|
@include themable(light, $light)
|
||||||
|
@include themable(dark, $dark)
|
52
src/splash.svelte
Normal file
52
src/splash.svelte
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { _, locale } from 'svelte-i18n';
|
||||||
|
|
||||||
|
import Window from './ts/neutralino/Window';
|
||||||
|
|
||||||
|
import Splash from './assets/webms/loading.webm';
|
||||||
|
|
||||||
|
let phrase = Math.round(Math.random() * 2);
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
Window.current.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
const isLauncherLoaded = () => {
|
||||||
|
// @ts-expect-error
|
||||||
|
Neutralino.storage.getData('launcherLoaded')
|
||||||
|
.then(() => {
|
||||||
|
// @ts-expect-error
|
||||||
|
Neutralino.storage.setData('launcherLoaded', undefined);
|
||||||
|
|
||||||
|
Window.current.hide();
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
Neutralino.app.exit();
|
||||||
|
})
|
||||||
|
.catch(() => setTimeout(isLauncherLoaded, 1000));
|
||||||
|
};
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
Neutralino.events.on('ready', () => setTimeout(isLauncherLoaded, 1000));
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
Neutralino.events.on('windowClose', () => {
|
||||||
|
// @ts-expect-error
|
||||||
|
Neutralino.app.exit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Auto theme switcher
|
||||||
|
// TODO: an option to disable it
|
||||||
|
if (window.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||||
|
document.body.setAttribute('data-theme', 'dark');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if typeof $locale === 'string'}
|
||||||
|
<main>
|
||||||
|
<video src={Splash} loop muted autoplay></video>
|
||||||
|
|
||||||
|
<h2>{$_('splash.title')}</h2>
|
||||||
|
<p>{$_(`splash.phrases.${phrase}`)}</p>
|
||||||
|
</main>
|
||||||
|
{/if}
|
|
@ -7,6 +7,8 @@ import Game from '../Game';
|
||||||
import Patch from '../Patch';
|
import Patch from '../Patch';
|
||||||
import Voice from '../Voice';
|
import Voice from '../Voice';
|
||||||
|
|
||||||
|
declare const Neutralino;
|
||||||
|
|
||||||
export default class State
|
export default class State
|
||||||
{
|
{
|
||||||
public launcher: Launcher;
|
public launcher: Launcher;
|
||||||
|
@ -49,6 +51,8 @@ export default class State
|
||||||
};
|
};
|
||||||
|
|
||||||
this.update().then(() => {
|
this.update().then(() => {
|
||||||
|
Neutralino.storage.setData('launcherLoaded', 'aboba');
|
||||||
|
|
||||||
Window.current.show();
|
Window.current.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,9 +155,7 @@ class Process
|
||||||
*/
|
*/
|
||||||
public kill(forced: boolean = false): Promise<void>
|
public kill(forced: boolean = false): Promise<void>
|
||||||
{
|
{
|
||||||
return new Promise((resolve) => {
|
return Process.kill(this.id, forced);
|
||||||
Neutralino.os.execCommand(`kill ${forced ? '-9' : '-15'} ${this.id}`).then(() => resolve());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,6 +213,13 @@ class Process
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static kill(id: number, forced: boolean = false): Promise<void>
|
||||||
|
{
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
Neutralino.os.execCommand(`kill ${forced ? '-9' : '-15'} ${id}`).then(() => resolve());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace '\a\b' to '\\a\\b'
|
* Replace '\a\b' to '\\a\\b'
|
||||||
* And replace ''' to '\''
|
* And replace ''' to '\''
|
||||||
|
|
|
@ -14,7 +14,8 @@ export default defineConfig({
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: [
|
input: [
|
||||||
'index.html',
|
'index.html',
|
||||||
'settings.html'
|
'settings.html',
|
||||||
|
'splash.html'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue