mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-03-17 21:50:11 +03:00
1.4.0
- added automatic progress bar's color theme switching based on the background image brightness
This commit is contained in:
parent
c2e364a952
commit
87374c27e2
21 changed files with 134 additions and 19 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
| Game version | Launcher version | Patch version |
|
||||
| :---: | :---: | :---: |
|
||||
| 2.2.0 | 1.3.2 | 2.2.0 stable ✅ |
|
||||
| 2.2.0 | 1.4.0 | 2.2.0 stable ✅ |
|
||||
|
||||
Download from [Releases](https://notabug.org/nobody/an-anime-game-launcher/releases)
|
||||
|
||||
|
@ -82,9 +82,10 @@ npm start
|
|||
* <s>Add outdated files deletion when new game's update releases</s> *(1.1.0)*
|
||||
* <s>Add installed packages deletion</s> *(1.2.0)*
|
||||
* <s>Add voice packs support</s> (Thank @Maroxy for the developments in the previous versions) *(1.3.0)*
|
||||
* Color variants for progress bar's downloading text dependent on the background picture primary color *(partially made in 1.3.2)*
|
||||
* <s>Color variants for progress bar's downloading text dependent on the background picture primary color</s> *(1.4.0)*
|
||||
* Screenshots explorer
|
||||
* Set default wine version to download so the wine install requirement is no longer needed.
|
||||
* Add vkBasalt support and "shaders library
|
||||
* Set default wine version to download so the wine install requirement is no longer needed
|
||||
* Add Patch category in settings menu with
|
||||
- Always participate in patches testing
|
||||
- Applying anti login crash patch
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "an-anime-game-linux-launcher",
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.0",
|
||||
"description": "An Anime Game Linux Launcher",
|
||||
"author": "Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>",
|
||||
"contributors": [
|
||||
|
@ -10,8 +10,9 @@
|
|||
"main": "entry.js",
|
||||
"scripts": {
|
||||
"dev": "tsc && sass src/sass:public/css -s compressed --no-source-map",
|
||||
"clear": "rm -r ./public/js",
|
||||
"start": "npm run dev && electron .",
|
||||
"build": "npm run dev && electron-builder --linux"
|
||||
"build": "npm run clear && npm run dev && electron-builder --linux"
|
||||
},
|
||||
"build": {
|
||||
"productName": "An Anime Game Linux Launcher",
|
||||
|
@ -51,6 +52,7 @@
|
|||
"discord-rpc": "^4.0.1",
|
||||
"electron-store": "^8.0.1",
|
||||
"follow-redirects": "^1.14.5",
|
||||
"get-pixels": "^3.3.3",
|
||||
"semver": "^7.3.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,16 @@
|
|||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="checkbox" id="auto-theme">
|
||||
<span i18id="AutoTheme">Automatic theme switching</span>
|
||||
|
||||
<div class="checkbox-mark">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="45.701px" height="45.7px" viewBox="0 0 45.701 45.7" xml:space="preserve"><g><g><path d="M20.687,38.332c-2.072,2.072-5.434,2.072-7.505,0L1.554,26.704c-2.072-2.071-2.072-5.433,0-7.504 c2.071-2.072,5.433-2.072,7.505,0l6.928,6.927c0.523,0.522,1.372,0.522,1.896,0L36.642,7.368c2.071-2.072,5.433-2.072,7.505,0 c0.995,0.995,1.554,2.345,1.554,3.752c0,1.407-0.559,2.757-1.554,3.752L20.687,38.332z"/></g></g></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div class="settings-item" id="runners">
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Sprache",
|
||||
"Voice": "Sprachpaket",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Einstellungen",
|
||||
"GeneralSettings": "Generell",
|
||||
"WineVersion": "Wine Version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"Downloading": "Downloading",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "言語",
|
||||
"Voice": "ボイスパック",
|
||||
"VoiceNotification": "この機能を使用するには、ゲーム内の新しいボイスパックを手動で選択する必要があります",
|
||||
"AutoTheme": "テーマの自動切り替え",
|
||||
"SettingsTitle": "設定",
|
||||
"GeneralSettings": "一般",
|
||||
"Downloading": "ダウンロード中",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Язык",
|
||||
"Voice": "Озвучка",
|
||||
"VoiceNotification": "Эта настройка требует ручного переключения языка озвучки в настройках игры",
|
||||
"AutoTheme": "Автопереключение темы",
|
||||
"SettingsTitle": "Настройки",
|
||||
"GeneralSettings": "Общее",
|
||||
"WineVersion": "Версии Wine",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "Language",
|
||||
"Voice": "Voice Pack",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "Settings",
|
||||
"GeneralSettings": "General",
|
||||
"WineVersion": "Wine version",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "语言",
|
||||
"Voice": "语音包",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "设置",
|
||||
"GeneralSettings": "一般的",
|
||||
"Downloading": "下载",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Language": "界面語言",
|
||||
"Voice": "語音包",
|
||||
"VoiceNotification": "This feature requires you to manually select the new voice pack in the game",
|
||||
"AutoTheme": "Automatic theme switching",
|
||||
"SettingsTitle": "設定",
|
||||
"GeneralSettings": "一般設定",
|
||||
"Downloading": "下載",
|
||||
|
|
|
@ -2,15 +2,15 @@ import GIJSON from '../types/GIJSON';
|
|||
import { constants } from './constants';
|
||||
import { Tools } from './Tools';
|
||||
|
||||
const store = require('electron-store');
|
||||
const https = require('follow-redirects').https;
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const { spawn, exec } = require('child_process');
|
||||
const dns = require('dns');
|
||||
|
||||
const store = require('electron-store');
|
||||
const https = require('follow-redirects').https;
|
||||
|
||||
const config = new store ({
|
||||
cwd: path.join(os.homedir(), '.local', 'share', 'anime-game-launcher'),
|
||||
defaults: {
|
||||
|
@ -28,7 +28,8 @@ const config = new store ({
|
|||
version: null, // Installed game version
|
||||
patch: null, // Installed patch info ({ version, state } - related game's version and patch's state)
|
||||
runner: null, // Selected runner ({ folder, executable })
|
||||
rpc: false,
|
||||
rpc: false, // Discord RPC
|
||||
autotheme: true, // Automatic theme switcher
|
||||
|
||||
// Version of the game we asked about analytics last time,
|
||||
// or null if user said don't ask him again
|
||||
|
@ -37,7 +38,9 @@ const config = new store ({
|
|||
// Environement variables
|
||||
env: {
|
||||
DXVK_ASYNC: '1',
|
||||
WINEESYNC: '1',
|
||||
WINEESYNC: '1', // ESync
|
||||
|
||||
// FidelityFX Super Resolution
|
||||
WINE_FULLSCREEN_FSR: '1',
|
||||
WINE_FULLSCREEN_FSR_STRENGTH: '3'
|
||||
}
|
||||
|
@ -74,7 +77,7 @@ export class LauncherLib
|
|||
.then(runners => resolve(runners));
|
||||
});*/
|
||||
|
||||
return new Promise(resolve => resolve(JSON.parse(fs.readFileSync(path.join(path.dirname(__dirname), '..', 'runners.json')))));
|
||||
return new Promise(resolve => fs.readFile(path.join(path.dirname(__dirname), '..', 'runners.json'), (err: any, data: string) => resolve(JSON.parse(data))));
|
||||
}
|
||||
|
||||
public static getDXVKs (): Promise<DXVK[]>
|
||||
|
@ -85,7 +88,7 @@ export class LauncherLib
|
|||
.then(dxvks => resolve(dxvks));
|
||||
});*/
|
||||
|
||||
return new Promise(resolve => resolve(JSON.parse(fs.readFileSync(path.join(path.dirname(__dirname), '..', 'dxvks.json')))));
|
||||
return new Promise(resolve => fs.readFile(path.join(path.dirname(__dirname), '..', 'dxvks.json'), (err: any, data: string) => resolve(JSON.parse(data))));
|
||||
}
|
||||
|
||||
public static getConfig (property: string|null = null): any
|
||||
|
|
|
@ -3,6 +3,7 @@ import $ from 'cash-dom';
|
|||
import { constants } from './constants';
|
||||
import { LauncherLib } from './LauncherLib';
|
||||
import { i18n } from './i18n';
|
||||
import { Tools } from './Tools';
|
||||
|
||||
type LauncherState =
|
||||
'patch-unavailable' |
|
||||
|
@ -230,10 +231,37 @@ export class LauncherUI
|
|||
public static updateBackground (): void
|
||||
{
|
||||
LauncherLib.getBackgroundUri().then(uri => {
|
||||
uri = `url(${uri})`;
|
||||
let style = `url(${uri})`;
|
||||
|
||||
if ($('body').css('background-image') != uri)
|
||||
$('body').css('background-image', uri);
|
||||
if ($('body').css('background-image') != style)
|
||||
{
|
||||
$('body').css('background-image', style);
|
||||
|
||||
/**
|
||||
* Calculating background's left-bottom corner mean brightness
|
||||
* to make the progress bar's theme dark or light
|
||||
*/
|
||||
if (LauncherLib.getConfig('autotheme'))
|
||||
{
|
||||
Tools.getImagePixels(uri).then(pixels => {
|
||||
let sector = pixels.filter(pixel => pixel.y < 186 && pixel.x < 720);
|
||||
let meanBrightness = 0;
|
||||
|
||||
sector.forEach(pixel => meanBrightness += pixel.color.r + pixel.color.g + pixel.color.b);
|
||||
|
||||
meanBrightness /= sector.length * 3;
|
||||
|
||||
console.log(`Background's mean brightness is ${meanBrightness}`);
|
||||
|
||||
// Image is dark so we make the progress bar light
|
||||
if (meanBrightness < 160)
|
||||
$('#downloader-panel').removeClass('dark');
|
||||
|
||||
// Otherwise image is bright so the progress bar should be dark
|
||||
else $('#downloader-panel').addClass('dark');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,62 @@
|
|||
const https = require('follow-redirects').https;
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const dns = require('dns');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
type GitTag = { tag: string, commit: string };
|
||||
const https = require('follow-redirects').https;
|
||||
const getPixels = require('get-pixels');
|
||||
|
||||
type GitTag = {
|
||||
tag: string,
|
||||
commit: string
|
||||
};
|
||||
|
||||
type Pixel = {
|
||||
x: number,
|
||||
y: number,
|
||||
color: {
|
||||
r: number,
|
||||
g: number,
|
||||
b: number,
|
||||
a: number|null
|
||||
}
|
||||
};
|
||||
|
||||
export class Tools
|
||||
{
|
||||
public static getImagePixels (path: string): Promise<Pixel[]>
|
||||
{
|
||||
return new Promise(resolve => {
|
||||
getPixels(path, (err: void, pixels: any) => {
|
||||
let response = [];
|
||||
|
||||
let width = pixels.shape[0],
|
||||
height = pixels.shape[1],
|
||||
depth = pixels.shape[2],
|
||||
offset = 0;
|
||||
|
||||
for (let i = 0; i < height; ++i)
|
||||
for (let j = 0; j < width; ++j)
|
||||
{
|
||||
response.push({
|
||||
x: j,
|
||||
y: i,
|
||||
color: {
|
||||
r: pixels.data[offset],
|
||||
g: pixels.data[offset + 1],
|
||||
b: pixels.data[offset + 2],
|
||||
a: depth == 4 ? pixels.data[offset + 3] : null
|
||||
}
|
||||
});
|
||||
|
||||
offset += depth;
|
||||
}
|
||||
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static async getGitTags (uri: string): Promise<GitTag[]>
|
||||
{
|
||||
return new Promise(resolve => {
|
||||
|
|
|
@ -41,8 +41,8 @@ $(() => {
|
|||
if (activeLang != data.value)
|
||||
{
|
||||
LauncherLib.updateConfig('lang.launcher', data.value);
|
||||
|
||||
LauncherLib.updateConfig('background.time', null);
|
||||
|
||||
LauncherUI.updateLang(data.value);
|
||||
|
||||
// Send language update event
|
||||
|
@ -86,6 +86,15 @@ $(() => {
|
|||
ipcRenderer.send('rpc-toggle');
|
||||
});
|
||||
|
||||
/**
|
||||
* Automatic theme switcher
|
||||
*/
|
||||
|
||||
if (LauncherLib.getConfig('autotheme'))
|
||||
$('#auto-theme').addClass('checkbox-active');
|
||||
|
||||
$('#auto-theme').on('classChange', () => LauncherLib.updateConfig('autotheme', $('#auto-theme').hasClass('checkbox-active')));
|
||||
|
||||
/**
|
||||
* Environmental variables manager
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue