mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-18 08:12:16 +03:00
1.2.0
- added downloaded runners / dxvks deletion button
This commit is contained in:
parent
64766ecc60
commit
d32ef6a5d2
5 changed files with 115 additions and 26 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
| Game version | Launcher version | Patch version |
|
||||
| :---: | :---: | :---: |
|
||||
| 2.2.0 | 1.1.0 | 2.2.0 stable ✅ |
|
||||
| 2.2.0 | 1.2.0 | 2.2.0 stable ✅ |
|
||||
|
||||
Download from [Releases](https://notabug.org/nobody/an-anime-game-launcher/releases)
|
||||
|
||||
|
@ -80,7 +80,8 @@ npm start
|
|||
|
||||
* <s>Add runners environmental variables manager</s> *(1.1.0)*
|
||||
* <s>Add outdated files deletion when new game's update releases</s> *(1.1.0)*
|
||||
* Add installed packages deletion
|
||||
* <s>Add installed packages deletion</s> *(1.2.0)*
|
||||
* Screenshots explorer
|
||||
* Set default wine version to download so the wine install requirement is no longer needed.
|
||||
* Add voice packs support
|
||||
* Add Patch category in settings menu with
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "an-anime-game-linux-launcher",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"description": "An Anime Game Linux Launcher",
|
||||
"author": "Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>",
|
||||
"contributors": [
|
||||
|
@ -39,12 +39,12 @@
|
|||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/semver": "^7.3.9",
|
||||
"@types/discord-rpc": "^4.0.0",
|
||||
"@types/semver": "^7.3.9",
|
||||
"electron": "^14.0.0",
|
||||
"electron-builder": "^22.13.1",
|
||||
"sass": "^1.41.0",
|
||||
"typescript": "^4.4.3"
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"cash-dom": "^8.1.0",
|
||||
|
|
BIN
public/images/delete.png
Normal file
BIN
public/images/delete.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -105,16 +105,27 @@ $secondary: #e1e7ff
|
|||
display: flex
|
||||
align-items: center
|
||||
|
||||
> img
|
||||
img
|
||||
width: 16px
|
||||
height: 16px
|
||||
|
||||
margin: auto
|
||||
|
||||
img.item-delete
|
||||
// filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(93deg) brightness(103%) contrast(103%)
|
||||
|
||||
width: 20px
|
||||
height: 20px
|
||||
|
||||
display: none
|
||||
|
||||
.list-item-active
|
||||
background-color: $primary !important
|
||||
color: white !important
|
||||
|
||||
img.item-delete
|
||||
display: none !important
|
||||
|
||||
.list-item-disabled
|
||||
background-color: $light !important
|
||||
color: #abadbd !important
|
||||
|
@ -124,6 +135,18 @@ $secondary: #e1e7ff
|
|||
img
|
||||
filter: invert(70%) sepia(13%) saturate(241%) hue-rotate(196deg) brightness(97%) contrast(91%)
|
||||
|
||||
.list-item-downloading
|
||||
img
|
||||
display: none !important
|
||||
|
||||
.list-item-downloaded
|
||||
> div
|
||||
img.item-download
|
||||
display: none
|
||||
|
||||
img.item-delete
|
||||
display: block
|
||||
|
||||
/* Checkbox */
|
||||
|
||||
.checkbox
|
||||
|
|
|
@ -114,26 +114,36 @@ $(() => {
|
|||
$(`<h3>${category.title}</h3>`).appendTo('#runners-list');
|
||||
|
||||
category.runners.forEach(runner => {
|
||||
let item = $(`<div class="list-item">${runner.name}<div><img src="../images/download.png"></div></div>`).appendTo('#runners-list');
|
||||
let item = $(`<div class="list-item">
|
||||
${runner.name}
|
||||
<div>
|
||||
<span></span>
|
||||
<img class="item-delete" src="../images/delete.png">
|
||||
<img class="item-download" src="../images/download.png">
|
||||
</div>
|
||||
</div>`).appendTo('#runners-list');
|
||||
|
||||
if (fs.existsSync(path.join(constants.runnersDir, runner.folder)))
|
||||
{
|
||||
item.find('div').css('display', 'none');
|
||||
// item.find('div').css('display', 'none');
|
||||
item.addClass('list-item-downloaded');
|
||||
|
||||
// I think we shouldn't set runner as active if it is not installed
|
||||
if (runner.name == activeRunner?.name)
|
||||
item.addClass('list-item-active');
|
||||
}
|
||||
|
||||
item.find('div').on('click', () => {
|
||||
item.find('img.item-download').on('click', () => {
|
||||
if (!item.hasClass('list-item-disabled'))
|
||||
{
|
||||
item.addClass('list-item-disabled');
|
||||
item.addClass('list-item-downloading');
|
||||
|
||||
let div = item.find('div');
|
||||
let div = item.find('div'),
|
||||
span = div.find('span');
|
||||
|
||||
Tools.downloadFile(runner.uri, path.join(constants.launcherDir, runner.name), (current: number, total: number, difference: number) => {
|
||||
div.text(`${ Math.round(current / total * 100) }%`);
|
||||
span.text(`${ Math.round(current / total * 100) }%`);
|
||||
}).then(() => {
|
||||
let unpacker = runner.archive === 'tar' ?
|
||||
Tools.untar : Tools.unzip;
|
||||
|
@ -144,25 +154,43 @@ $(() => {
|
|||
path.join(constants.runnersDir, runner.folder) :
|
||||
constants.runnersDir,
|
||||
(current: number, total: number, difference: number) => {
|
||||
div.text(`${ Math.round(current / total * 100) }%`);
|
||||
span.text(`${ Math.round(current / total * 100) }%`);
|
||||
}
|
||||
).then(() => {
|
||||
fs.unlinkSync(path.join(constants.launcherDir, runner.name));
|
||||
|
||||
span.text('');
|
||||
|
||||
item.removeClass('list-item-disabled');
|
||||
div.css('display', 'none');
|
||||
item.removeClass('list-item-downloading');
|
||||
|
||||
item.addClass('list-item-downloaded');
|
||||
// div.css('display', 'none');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
item.find('img.item-delete').on('click', () => {
|
||||
if (!item.hasClass('list-item-disabled'))
|
||||
{
|
||||
item.addClass('list-item-disabled');
|
||||
|
||||
fs.rmdirSync(path.join(constants.runnersDir, runner.folder), { recursive: true });
|
||||
|
||||
item.removeClass('list-item-disabled');
|
||||
item.removeClass('list-item-downloaded');
|
||||
}
|
||||
});
|
||||
|
||||
item.on('click', () => {
|
||||
if (!item.hasClass('list-item-disabled'))
|
||||
{
|
||||
while (!item.hasClass('list-item'))
|
||||
item = item.parent();
|
||||
|
||||
if (item.find('div').css('display') === 'none')
|
||||
// if (item.find('div').css('display') === 'none')
|
||||
if (item.hasClass('list-item-downloaded'))
|
||||
{
|
||||
LauncherLib.updateConfig('runner.name', runner.name);
|
||||
LauncherLib.updateConfig('runner.folder', runner.folder);
|
||||
|
@ -181,54 +209,83 @@ $(() => {
|
|||
|
||||
LauncherLib.getDXVKs().then(dxvks => {
|
||||
dxvks.forEach(dxvk => {
|
||||
let item = $(`<div class="list-item">${dxvk.version}<div><img src="../images/download.png"></div></div>`).appendTo('#dxvk-list');
|
||||
let item = $(`<div class="list-item">
|
||||
${dxvk.version}
|
||||
<div>
|
||||
<span></span>
|
||||
<img class="item-delete" src="../images/delete.png">
|
||||
<img class="item-download" src="../images/download.png">
|
||||
</div>
|
||||
</div>`).appendTo('#dxvk-list');
|
||||
|
||||
if (fs.existsSync(path.join(constants.dxvksDir, 'dxvk-' + dxvk.version)))
|
||||
{
|
||||
item.find('div').css('display', 'none');
|
||||
// item.find('div').css('display', 'none');
|
||||
item.addClass('list-item-downloaded');
|
||||
|
||||
// I think we shouldn't set DXVK as active if it is not installed
|
||||
if (dxvk.version == activeDXVK)
|
||||
item.addClass('list-item-active');
|
||||
}
|
||||
|
||||
item.find('div').on('click', () => {
|
||||
item.find('img.item-download').on('click', () => {
|
||||
if (!item.hasClass('list-item-disabled'))
|
||||
{
|
||||
item.addClass('list-item-disabled');
|
||||
item.addClass('list-item-downloading');
|
||||
|
||||
let div = item.find('div');
|
||||
let div = item.find('div'),
|
||||
span = div.find('span');
|
||||
|
||||
Tools.downloadFile(dxvk.uri, path.join(constants.launcherDir, 'dxvk-' + dxvk.version), (current: number, total: number, difference: number) => {
|
||||
div.text(`${ Math.round(current / total * 100) }%`);
|
||||
span.text(`${ Math.round(current / total * 100) }%`);
|
||||
}).then(() => {
|
||||
Tools.untar(
|
||||
path.join(constants.launcherDir, 'dxvk-' + dxvk.version),
|
||||
constants.dxvksDir,
|
||||
(current: number, total: number, difference: number) => {
|
||||
div.text(`${ Math.round(current / total * 100) }%`);
|
||||
span.text(`${ Math.round(current / total * 100) }%`);
|
||||
}
|
||||
).then(() => {
|
||||
fs.unlinkSync(path.join(constants.launcherDir, 'dxvk-' + dxvk.version));
|
||||
|
||||
span.text('');
|
||||
|
||||
item.removeClass('list-item-disabled');
|
||||
div.css('display', 'none');
|
||||
item.removeClass('list-item-downloading');
|
||||
|
||||
item.addClass('list-item-downloaded');
|
||||
// div.css('display', 'none');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
item.find('img.item-delete').on('click', () => {
|
||||
if (!item.hasClass('list-item-disabled'))
|
||||
{
|
||||
item.addClass('list-item-disabled');
|
||||
|
||||
fs.rmdirSync(path.join(constants.dxvksDir, 'dxvk-' + dxvk.version), { recursive: true });
|
||||
|
||||
item.removeClass('list-item-disabled');
|
||||
item.removeClass('list-item-downloaded');
|
||||
}
|
||||
});
|
||||
|
||||
item.on('click', () => {
|
||||
if (!item.hasClass('list-item-disabled'))
|
||||
{
|
||||
while (!item.hasClass('list-item'))
|
||||
item = item.parent();
|
||||
|
||||
if (item.find('div').css('display') === 'none')
|
||||
// if (item.find('div').css('display') === 'none')
|
||||
if (item.hasClass('list-item-downloaded'))
|
||||
{
|
||||
item.find('div')
|
||||
.css('display', 'flex')
|
||||
.text('Applying...');
|
||||
item.addClass('list-item-disabled');
|
||||
item.addClass('list-item-downloading');
|
||||
|
||||
item.find('div > span').text('Applying...');
|
||||
|
||||
let installer = exec('./setup_dxvk.sh install', {
|
||||
cwd: path.join(constants.dxvksDir, 'dxvk-' + dxvk.version),
|
||||
|
@ -240,10 +297,18 @@ $(() => {
|
|||
|
||||
installer.on('close', () => {
|
||||
LauncherLib.updateConfig('dxvk', dxvk.version);
|
||||
|
||||
item.find('div > span').text('');
|
||||
|
||||
$('#dxvk-list > .list-item').removeClass('list-item-active');
|
||||
|
||||
item.removeClass('list-item-disabled');
|
||||
item.removeClass('list-item-downloading');
|
||||
|
||||
item.addClass('list-item-active');
|
||||
item.find('div').css('display', 'none');
|
||||
item.addClass('list-item-downloaded');
|
||||
|
||||
// item.find('div').css('display', 'none');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue