2021-12-29 15:18:48 +03:00
|
|
|
<script context="module" lang="ts">
|
|
|
|
declare const Neutralino;
|
|
|
|
</script>
|
2021-12-29 15:59:55 +03:00
|
|
|
|
2021-12-26 19:25:57 +03:00
|
|
|
<script lang="ts">
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
|
|
|
import Window from './ts/neutralino/Window';
|
|
|
|
|
|
|
|
import Launcher from './ts/Launcher';
|
|
|
|
import constants from './ts/Constants';
|
|
|
|
import Game from './ts/Game';
|
|
|
|
import Background from './ts/launcher/Background';
|
|
|
|
|
2021-12-29 19:04:30 +03:00
|
|
|
import Gear from './assets/images/gear.png';
|
|
|
|
import GearActive from './assets/images/gear-active.png';
|
|
|
|
import Download from './assets/images/cloud-download.png';
|
2022-01-03 19:51:32 +03:00
|
|
|
import DiscordRPC from './ts/core/DiscordRPC';
|
2021-12-29 19:04:30 +03:00
|
|
|
|
2021-12-29 15:02:12 +03:00
|
|
|
Neutralino.events.on('ready', () => {
|
|
|
|
Window.open('splash', {
|
|
|
|
title: 'Splash',
|
2021-12-29 19:04:30 +03:00
|
|
|
width: 300,
|
|
|
|
height: 400,
|
2021-12-29 15:02:12 +03:00
|
|
|
borderless: true,
|
|
|
|
exitProcessOnClose: false
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-12-30 14:55:04 +03:00
|
|
|
constants.paths.launcherDir.then((dir) => {
|
|
|
|
Neutralino.filesystem.getStats(dir)
|
|
|
|
.catch(() => Neutralino.filesystem.createDirectory(dir));
|
|
|
|
});
|
|
|
|
|
2021-12-26 19:25:57 +03:00
|
|
|
const launcher = new Launcher(onMount);
|
|
|
|
|
|
|
|
// Do some stuff when all the content will be loaded
|
|
|
|
onMount(() => {
|
|
|
|
/**
|
|
|
|
* Update launcher's title
|
|
|
|
*/
|
|
|
|
Game.latest.then((game) => {
|
|
|
|
Window.current.setTitle(`${constants.placeholders.uppercase.full} Linux Launcher - ${game.version}`);
|
|
|
|
});
|
|
|
|
|
2022-01-03 19:51:32 +03:00
|
|
|
/*const rpc = new DiscordRPC({
|
|
|
|
id: '901534333360304168',
|
|
|
|
details: 'Aboba',
|
|
|
|
state: 'Amogus',
|
|
|
|
icon: {
|
|
|
|
large: 'kleegame'
|
|
|
|
},
|
|
|
|
time: {
|
|
|
|
start: Math.round(Date.now() / 1000)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
rpc.stop(true);
|
|
|
|
}, 10000);*/
|
|
|
|
|
2021-12-26 19:25:57 +03:00
|
|
|
/**
|
|
|
|
* Add some events to some elements
|
|
|
|
*/
|
|
|
|
const settingsButton = document.getElementById('settings');
|
|
|
|
|
|
|
|
settingsButton!.onclick = () => launcher.showSettings();
|
|
|
|
|
|
|
|
settingsButton!.onmouseenter = () => {
|
|
|
|
settingsButton?.classList.add('hovered');
|
|
|
|
};
|
|
|
|
|
|
|
|
settingsButton!.onmouseleave = () => {
|
|
|
|
settingsButton?.classList.remove('hovered');
|
|
|
|
};
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<main>
|
|
|
|
{#await Background.get() then uri}
|
2021-12-29 15:59:55 +03:00
|
|
|
<img class="background" src="{uri}" alt="">
|
2021-12-26 19:25:57 +03:00
|
|
|
{/await}
|
|
|
|
|
|
|
|
<div class="downloader-panel" data-theme="light">
|
|
|
|
<div class="downloader-label">
|
|
|
|
<span id="downloaded"></span>
|
|
|
|
<span id="speed"></span>
|
|
|
|
<span id="eta"></span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="progress-bar">
|
|
|
|
<div class="progress"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="launcher-content">
|
|
|
|
{#await launcher.getSocial() then uri}
|
2021-12-29 02:21:34 +03:00
|
|
|
<iframe title="Launcher-iframe" src="{uri}" scrolling="no" style="position: absolute; border: 0; top: 0; left: 0;" width="100%" height="100%"></iframe>
|
2021-12-26 19:25:57 +03:00
|
|
|
{/await}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="settings">
|
2021-12-29 02:21:34 +03:00
|
|
|
<img src={Gear} class="unactive" alt="Settings">
|
2021-12-26 19:25:57 +03:00
|
|
|
|
2021-12-29 02:21:34 +03:00
|
|
|
<img src={GearActive} class="active" alt="Settings">
|
2021-12-26 19:25:57 +03:00
|
|
|
</div>
|
|
|
|
|
2021-12-29 19:04:30 +03:00
|
|
|
<button class="button hint--left hint--small" aria-label="Pre-download the game" id="predownload">
|
|
|
|
<img src={Download} alt="Download" />
|
|
|
|
</button>
|
|
|
|
|
2021-12-30 16:04:09 +03:00
|
|
|
<button class="button hint--top hint--large" aria-label="" id="launch">Launch</button>
|
2021-12-26 19:25:57 +03:00
|
|
|
</main>
|