- added analytics window
- added Proton 6.20 GE 1 to the runners list
- all common components moved to the separate files
- changed Launch button's shadow
This commit is contained in:
Observer KRypt0n_ 2021-10-28 15:24:55 +02:00
parent 261a229bc5
commit 21d00e11e5
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
31 changed files with 577 additions and 269 deletions

2
.gitignore vendored
View file

@ -5,5 +5,7 @@ yarn.lock
wineprefix-installation.log
public/css/index.css
public/css/settings.css
public/css/analytics.css
public/css/components.css
public/js
repository-pics/logo.xcf

View file

@ -9,10 +9,9 @@ const {
const path = require('path');
const Store = require('electron-store');
Store.initRenderer();
require('electron-store').initRenderer();
let mainWindow;
let mainWindow, analyticsWindow;
ipcMain.handle('hide-window', () => mainWindow.hide());
ipcMain.handle('show-window', () => mainWindow.show());
@ -25,7 +24,7 @@ ipcMain.on('notification', (event, args) => {
});
ipcMain.handle('open-settings', () => {
const settingsWindow = new BrowserWindow({
const settingsWindow = new BrowserWindow ({
width: 900,
height: 600,
webPreferences: {
@ -41,9 +40,31 @@ ipcMain.handle('open-settings', () => {
});
settingsWindow.loadFile(path.join(__dirname, 'public', 'html', 'settings.html'));
settingsWindow.once('ready-to-show', () => settingsWindow.show());
settingsWindow.once('ready-to-show', settingsWindow.show);
});
ipcMain.handle('open-analytics-participation', () => {
analyticsWindow = new BrowserWindow ({
width: 700,
height: 500,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
},
icon: path.join(__dirname, 'public', 'images', 'icon64.png'),
autoHideMenuBar: true,
resizable: false,
parent: mainWindow,
modal: true,
show: false
});
analyticsWindow.loadFile(path.join(__dirname, 'public', 'html', 'analytics.html'));
analyticsWindow.once('ready-to-show', analyticsWindow.show);
});
ipcMain.handle('hide-analytics-participation', () => analyticsWindow.close());
function createWindow ()
{
// https://www.electronjs.org/docs/latest/api/browser-window/#class-browserwindow

View file

@ -1,6 +1,6 @@
{
"name": "an-anime-game-linux-launcher",
"version": "0.7.0",
"version": "0.8.0",
"description": "An Anime Game Linux Launcher",
"author": "Nikita Podvirnyy <suimin.tu.mu.ga.mi@gmail.com>",
"contributors": [

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- CSS styles -->
<link rel="stylesheet" href="../css/components.css">
<link rel="stylesheet" href="../css/analytics.css">
<link rel="stylesheet" href="../css/hint.min.css">
<!-- JS scripts -->
<script>require('../js/lib/components.js');</script>
<script>require('../js/analytics.js');</script>
<title i18id="AnalyticsTitle">Yanfei's commission...</title>
</head>
<body>
<div class="header">
<img src="../images/yanfei.png">
<h2 i18id="ParticipateInAnalytics">Participate in anonymous data collection</h2>
</div>
<p i18id="AnalyticsText1">To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates</p>
<p i18id="AnalyticsText2">The IP address will be hashed for security purpose</p>
<div class="footer">
<div class="hint--top hint--large" data-hint="Allow Yanfei to store the country your IP address registered in to make statistics more detailed. No other data than the country will be stored">
<div class="checkbox checkbox-active selectable-checkbox" id="share-country">
<span i18id="AnalyticsShareCountry">Share country</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>
</div>
<div class="actions">
<button class="button button-primary" id="participate" i18id="Participate">Participate</button>
<div class="actions-right">
<button class="button" id="skip" i18id="Skip">Skip</button>
<button class="button" id="skip-and-ignore" i18id="SkipAndDontAsk">Skip and don't ask again</button>
</div>
</div>
</div>
</body>
</html>

View file

@ -6,9 +6,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- CSS styles -->
<link rel="stylesheet" href="../css/components.css">
<link rel="stylesheet" href="../css/settings.css">
<!-- JS scripts -->
<script>require('../js/lib/components.js');</script>
<script>require('../js/settings.js');</script>
<title i18id="SettingsTitle"></title>
@ -58,7 +60,7 @@
</div>
<div class="selected-item">
<span>English</span>
<span>English (US)</span>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 330.002 330.002" xml:space="preserve"><path id="XMLID_226_" d="M233.252,155.997L120.752,6.001c-4.972-6.628-14.372-7.97-21-3c-6.628,4.971-7.971,14.373-3,21 l105.75,140.997L96.752,306.001c-4.971,6.627-3.627,16.03,3,21c2.698,2.024,5.856,3.001,8.988,3.001 c4.561,0,9.065-2.072,12.012-6.001l112.5-150.004C237.252,168.664,237.252,161.33,233.252,155.997z"/></svg>
</div>

BIN
public/images/yanfei.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch nicht verfügbar",
"PatchRequiredHint": "Diese Spielversion hat noch kein anti-cheat patch, Bitte warten sie ein paar Tage bevor sie es erneut versuchen",
"TestPatch": "Test Patch anwenden",
"TestPatchHint": "Diese Spielversion hat ein anti-cheat patch aber es befindet sich noch in der Testphase. Sie können noch ein paar Tage warten bis es Stabil ist oder auf eigenen Risiko den Testpatch anwenden"
"TestPatchHint": "Diese Spielversion hat ein anti-cheat patch aber es befindet sich noch in der Testphase. Sie können noch ein paar Tage warten bis es Stabil ist oder auf eigenen Risiko den Testpatch anwenden",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "要パッチ",
"PatchRequiredHint": "このゲームバージョンにはアンチチートパッチがありません。数日待ってから再度お試しください",
"TestPatch": "テストパッチの適用",
"TestPatchHint": "このゲームバージョンにはアンチチートパッチがありますが、テスト段階にあります。安定するまで数日お待ちいただくか、ご自身の責任で適用してください"
"TestPatchHint": "このゲームバージョンにはアンチチートパッチがありますが、テスト段階にあります。安定するまで数日お待ちいただくか、ご自身の責任で適用してください",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Необходим патч",
"PatchRequiredHint": "Эта версия игры не имеет патча античита. Пожалуйста, подождите несколько дней и попробуйте снова",
"TestPatch": "Применить тестовый патч",
"TestPatchHint": "Эта версия игры имеет лишь тестовый патч античита. Вы можете подождать пару дней до того, как он станет стабильным, либо применить его на свой страх и риск"
"TestPatchHint": "Эта версия игры имеет лишь тестовый патч античита. Вы можете подождать пару дней до того, как он станет стабильным, либо применить его на свой страх и риск",
"AnalyticsTitle": "Просьба Янь Фэй...",
"ParticipateInAnalytics": "Примите участие в анонимном сборе данных",
"AnalyticsText1": "Чтобы посчитать число активных игроков на Linux, Янь Фэй просит их поделиться IP адресом после каждого обновления игры",
"AnalyticsText2": "IP адрес будет хэширован для обеспечения его безопасности",
"AnalyticsShareCountry": "Поделиться названием страны",
"Participate": "Участвовать",
"Skip": "Пропустить",
"SkipAndDontAsk": "Пропустить и не спрашивать"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "Patch required",
"PatchRequiredHint": "This game version doesn't have an anti-cheat patch. Please, wait a few days and try again",
"TestPatch": "Apply test patch",
"TestPatchHint": "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"
"TestPatchHint": "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",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "需要补丁",
"PatchRequiredHint": "此游戏版本没有防作弊补丁。请等待几天,然后重试",
"TestPatch": "应用测试补丁",
"TestPatchHint": "此游戏版本有防作弊补丁,但处于测试阶段。您可以等待几天直到它稳定或自担风险应用它"
"TestPatchHint": "此游戏版本有防作弊补丁,但处于测试阶段。您可以等待几天直到它稳定或自担风险应用它",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -15,5 +15,13 @@
"PatchRequired": "需要補丁",
"PatchRequiredHint": "此遊戲版本沒有防作弊補丁。請等待幾天,然後重試",
"TestPatch": "應用測試補丁",
"TestPatchHint": "該遊戲版本有一個反作弊補丁,但處於測試階段。您可以等待幾天直到它穩定或自擔風險應用它"
"TestPatchHint": "該遊戲版本有一個反作弊補丁,但處於測試階段。您可以等待幾天直到它穩定或自擔風險應用它",
"AnalyticsTitle": "Yanfei's commission...",
"ParticipateInAnalytics": "Participate in anonymous data collection",
"AnalyticsText1": "To count the active user base for Linux, Yanfei would like to collect your IP address everytime the game updates",
"AnalyticsText2": "The IP address will be hashed for security purpose",
"AnalyticsShareCountry": "Share country",
"Participate": "Participate",
"Skip": "Skip",
"SkipAndDontAsk": "Skip and don't ask again"
}

View file

@ -70,6 +70,15 @@
{
"title": "Proton-GE",
"runners": [
{
"name": "Proton-6.20-GE-1",
"version": "6.20-GE-1",
"uri": "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/6.20-GE-1/Proton-6.20-GE-1.tar.gz",
"archive": "tar",
"folder": "Proton-6.20-GE-1",
"makeFolder": false,
"executable": "files/bin/wine64"
},
{
"name": "Proton-6.19-GE-2",
"version": "6.19-GE-2",

37
src/sass/analytics.sass Normal file
View file

@ -0,0 +1,37 @@
body
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
padding: 32px 64px
.header
display: inline-flex
img
width: 96px
height: 96px
margin-right: 32px
.footer
position: absolute
bottom: 0
margin-bottom: 32px
width: calc(100% - 128px)
> div
width: 100%
div.checkbox
font-size: medium
.actions
display: inline-flex
margin-top: 48px
.actions-right
margin-left: auto
.button:not(:last-child)
margin-right: 12px

220
src/sass/components.sass Normal file
View file

@ -0,0 +1,220 @@
$light: #f1f4f9
$light2: #eff2ff
$primary: #657ef8
$secondary: #e1e7ff
/* List of buttons */
.list-item
display: flex
align-items: center
height: 52px
margin-bottom: 8px
padding: 0 12px
border-radius: 12px
background-color: $light
font-size: 18px
cursor: pointer
&:hover
background-color: $light2
> div
width: auto
height: 52px
min-width: 52px
margin-left: auto
display: flex
align-items: center
> img
width: 16px
height: 16px
margin: auto
.list-item-active
background-color: $primary !important
color: white !important
.list-item-disabled
background-color: $light !important
color: #abadbd !important
cursor: default !important
img
filter: invert(70%) sepia(13%) saturate(241%) hue-rotate(196deg) brightness(97%) contrast(91%)
/* Checkbox */
.checkbox
display: inline-flex
align-items: center
font-size: larger
width: calc(100% - 24px)
height: 48px
padding: 0 12px
border-radius: 12px
.checkbox-mark
display: flex
background-color: $light2
border-radius: 16px
margin-left: auto
padding: 8px 16px
cursor: pointer
&:hover
background-color: $primary
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
svg
height: 12px
width: 12px
.checkbox-active
.checkbox-mark
background-color: $primary
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
.selectable-checkbox
cursor: pointer
&:hover
background-color: $light2
.checkbox-active:is(.selectable-checkbox)
background-color: $light2
/* Select box */
.select
display: inline-flex
align-items: center
font-size: larger
width: calc(100% - 24px)
height: 48px
padding: 0 12px
border-radius: 12px
.select-options
position: absolute
display: none
height: 230px
overflow: auto
background-color: white
border-radius: 12px
box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2)
padding: 8px 12px
transform: translateY(calc(50% + 32px)) translateX(208px)
cursor: pointer
ul
list-style: none
padding: 0
margin: 0
li
color: #8592a3
font-size: smaller
border-radius: 8px
padding: 8px
&:hover
background-color: $light2
color: $primary
li:not(last-child)
margin-bottom: 4px
li.selected
background-color: $light2
color: $primary
.selected-item
display: flex
align-items: baseline
font-size: initial
background-color: $light2
border-radius: 16px
margin-left: auto
padding: 8px 16px
cursor: pointer
&:hover
background-color: $primary
color: white
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
svg
height: 12px
width: 12px
margin-left: 8px
transform: rotate(90deg)
.select-active
.selected-item
color: white
background-color: $primary
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
.select-options
display: block
/* Buttons */
.button
background-color: $light
border-radius: 16px
border: none
cursor: pointer
font-size: 16px
padding: 8px 20px
&:hover
background-color: $secondary
.button-primary
background-color: $secondary
&:hover
background-color: $primary
color: white

View file

@ -20,7 +20,7 @@ body
.button:hover:not([disabled])
background-color: #fac60b
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, .3)
box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2)
.button:disabled
background-color: rgba(0, 0, 0, .35)

View file

@ -55,196 +55,3 @@ body
.settings-item:last-child
margin-bottom: 24px
.list-item
display: flex
align-items: center
height: 52px
margin-bottom: 8px
padding: 0 12px
border-radius: 12px
background-color: #f1f4f9
font-size: 18px
cursor: pointer
&:hover
background-color: #eff2ff
> div
width: auto
height: 52px
min-width: 52px
margin-left: auto
display: flex
align-items: center
> img
width: 16px
height: 16px
margin: auto
.list-item-active
background-color: #657ef8 !important
color: white !important
.list-item-disabled
background-color: #f1f4f9 !important
color: #abadbd !important
cursor: default !important
img
filter: invert(70%) sepia(13%) saturate(241%) hue-rotate(196deg) brightness(97%) contrast(91%)
.dropdown-menu
display: flex
align-items: center
height: 52px
margin-bottom: 8px
padding: 0 12px
border-radius: 12px
background-color: #f1f4f9
font-size: 18px
cursor: pointer
.checkbox
display: inline-flex
align-items: center
font-size: larger
width: calc(100% - 24px)
height: 48px
padding: 0 12px
border-radius: 12px
.checkbox-mark
display: flex
background-color: #e1e7ff
border-radius: 16px
margin-left: auto
padding: 8px 16px
cursor: pointer
&:hover
background-color: #657ef8
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
svg
height: 12px
width: 12px
.checkbox-active
.checkbox-mark
background-color: #657ef8
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
.select
display: inline-flex
align-items: center
font-size: larger
width: calc(100% - 24px)
height: 48px
padding: 0 12px
border-radius: 12px
.select-options
position: absolute
display: none
height: 230px
overflow: auto
background-color: white
border-radius: 12px
box-shadow: 0 1px 8px 0 rgba(0, 0, 0, .2)
padding: 8px 12px
transform: translateY(calc(50% + 32px)) translateX(208px)
cursor: pointer
ul
list-style: none
padding: 0
margin: 0
li
color: #8592a3
font-size: smaller
border-radius: 8px
padding: 8px
&:hover
background-color: #e1e7ff
color: #657ef8
li:not(last-child)
margin-bottom: 4px
li.selected
background-color: #e1e7ff
color: #657ef8
.selected-item
display: flex
align-items: baseline
font-size: initial
background-color: #e1e7ff
border-radius: 16px
margin-left: auto
padding: 8px 16px
cursor: pointer
&:hover
background-color: #657ef8
color: white
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
svg
height: 12px
width: 12px
margin-left: 8px
transform: rotate(90deg)
.select-active
.selected-item
color: white
background-color: #657ef8
svg
filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(219deg) brightness(102%) contrast(104%)
.select-options
display: block

29
src/ts/analytics.ts Normal file
View file

@ -0,0 +1,29 @@
const { ipcRenderer } = require('electron');
import $ from 'cash-dom';
import { Genshinlib } from './lib/Genshinlib';
import { LauncherUI } from './lib/LauncherUI';
$(() => {
LauncherUI.updateLang(Genshinlib.getConfig('lang.launcher'));
$('#participate').on('click', async () => {
await fetch(`https://an-anime-game-launcher.000webhostapp.com${ !$('#share-country').hasClass('checkbox-active') ? '/?hide-geo' : '' }`);
Genshinlib.updateConfig('analytics', Genshinlib.version);
ipcRenderer.invoke('hide-analytics-participation');
});
$('#skip').on('click', () => {
Genshinlib.updateConfig('analytics', Genshinlib.version);
ipcRenderer.invoke('hide-analytics-participation');
});
$('#skip-and-ignore').on('click', () => {
Genshinlib.updateConfig('analytics', null);
ipcRenderer.invoke('hide-analytics-participation');
});
});

View file

@ -96,6 +96,9 @@ $(() => {
});
});
if (Genshinlib.getConfig('analytics') !== null && Genshinlib.getConfig('analytics') !== Genshinlib.version)
ipcRenderer.invoke('open-analytics-participation');
Genshinlib.getData().then(data => {
// Update available
if (Genshinlib.version != data.game.latest.version)

View file

@ -23,7 +23,8 @@ const config = new store ({
version: null,
patch: null,
runner: null,
rpc: false
rpc: false,
analytics: '0'
}
});
@ -97,7 +98,7 @@ export class Genshinlib
return config.get(property);
}
public static updateConfig (property: string, value: string|boolean|null|number): Genshinlib
public static updateConfig (property: string, value: string|boolean|null|number)
{
return config.set(property, value);
}
@ -257,10 +258,10 @@ export class Genshinlib
public static patchGame (version: string, onFinish: () => void, onData: (data: string) => void)
{
Tools.downloadFile(this.patchUri, path.join(this.launcherDir, 'krock.zip'), (current: number, total: number, difference: number) => null).then(() => {
Tools.unzip(path.join(this.launcherDir, 'krock.zip'), this.launcherDir, (current: number, total: number, difference: number) => null).then(() => {
Tools.downloadFile(this.patchUri, path.join(this.launcherDir, 'patch.zip'), (current: number, total: number, difference: number) => null).then(() => {
Tools.unzip(path.join(this.launcherDir, 'patch.zip'), this.launcherDir, (current: number, total: number, difference: number) => null).then(() => {
// Delete zip file and assign patch directory.
fs.unlinkSync(path.join(this.launcherDir, 'krock.zip'));
fs.unlinkSync(path.join(this.launcherDir, 'patch.zip'));
let patchDir: string = path.join(this.tmpPatchDir, version.replace(/\./g, ''));

View file

@ -161,7 +161,12 @@ export class LauncherUI
public static updateBackground (): void
{
Genshinlib.getBackgroundUri().then(uri => $('body').css('background-image', `url(${uri})`));
Genshinlib.getBackgroundUri().then(uri => {
uri = `url(${uri})`;
if ($('body').css('background-image') != uri)
$('body').css('background-image', uri);
});
}
public static updateSocial (): void
@ -186,4 +191,4 @@ export class LauncherUI
element.innerText = this.i18n.translate(element.getAttribute('i18id')!);
});
}
}
}

53
src/ts/lib/components.ts Normal file
View file

@ -0,0 +1,53 @@
import $ from 'cash-dom';
$(() => {
$('.checkbox-mark').on('click', (e) => {
let item = $(e.target);
while (!item.hasClass('checkbox'))
item = item.parent();
if (!item.hasClass('selectable-checkbox'))
item.toggleClass('checkbox-active').trigger('classChange');
});
$('.selectable-checkbox').on('click', (e) => {
let item = $(e.target);
while (!item.hasClass('checkbox'))
item = item.parent();
item.toggleClass('checkbox-active').trigger('classChange');
});
$('.selected-item').on('click', (e) => {
let item = $(e.target);
while (!item.hasClass('select'))
item = item.parent();
item.toggleClass('select-active').trigger('classChange');
});
$('.select-options li').on('click', (e) => {
let item = $(e.target), li = $(e.target);
if (!item.hasClass('selected'))
{
while (!item.hasClass('select'))
item = item.parent();
item.find('.select-options li').removeClass('selected');
li.addClass('selected');
item.removeClass('select-active');
item.find('.selected-item span').text(li.text());
item.trigger('selectionChanged', {
caption: li.text(),
value: li.attr('value')
});
}
});
});

View file

@ -12,10 +12,6 @@ $(() => {
// Make sure settings is shown in correct language.
LauncherUI.updateLang(Genshinlib.getConfig('lang.launcher') ?? 'en-us');
$('*[i18id]').each((i, element) => {
element.innerText = LauncherUI.i18n.translate(element.getAttribute('i18id')?.toString()!);
});
$('.menu-item').on('click', (e) => {
$('.settings')[0]!.scrollTop = document.getElementById(e.target.getAttribute('anchor'))!.offsetTop - 16;
@ -30,46 +26,6 @@ $(() => {
$(`.menu-item[anchor=${anchor}]`).addClass('menu-item-active');
});
$('.checkbox-mark').on('click', (e) => {
let item = $(e.target);
while (!item.hasClass('checkbox'))
item = item.parent();
item.toggleClass('checkbox-active').trigger('classChange');
});
$('.selected-item').on('click', (e) => {
let item = $(e.target);
while (!item.hasClass('select'))
item = item.parent();
item.toggleClass('select-active').trigger('classChange');
});
$('.select-options li').on('click', (e) => {
let item = $(e.target), li = $(e.target);
if (!item.hasClass('selected'))
{
while (!item.hasClass('select'))
item = item.parent();
item.find('.select-options li').removeClass('selected');
li.addClass('selected');
item.removeClass('select-active');
item.find('.selected-item span').text(li.text());
item.trigger('selectionChanged', {
caption: li.text(),
value: li.attr('value')
});
}
});
$('#language').on('selectionChanged', (e, data: any) => {
let activeLang = Genshinlib.getConfig('lang.launcher');
@ -86,7 +42,7 @@ $(() => {
});
// Select the saved options in launcher.json on load
$(`#voice-list option[value="${Genshinlib.getConfig('lang.voice')}"]`).prop('selected', true);
// $(`#voice-list option[value="${Genshinlib.getConfig('lang.voice')}"]`).prop('selected', true);
$(`#language li[value=${Genshinlib.getConfig('lang.launcher')}]`).addClass('selected');
$('#language .selected-item span').text($(`#language li[value=${Genshinlib.getConfig('lang.launcher')}]`).text());
@ -100,7 +56,7 @@ $(() => {
ipcRenderer.send('rpc-toggle');
});
$('#voice-list').on('change', (e) => {
/*$('#voice-list').on('change', (e) => {
let activeVP = Genshinlib.getConfig('voice');
if (activeVP != e.target.value)
@ -114,7 +70,7 @@ $(() => {
}
else console.log('VP can\' be changed to the already set language');
});
});*/
let activeRunner = Genshinlib.getConfig('runner');