feat(launcher): add WTOffline logo application and installer icons

This commit is contained in:
N0VAN0M4LY committed 2026-11-30 19:38:32 +08:00
1 parent cae69a6446
commit c65308c477
6 files changed
+49 -3

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

@@ -1,6 +1,7 @@
import { join } from 'node:path';
import { app, BrowserWindow, Menu, shell, Tray } from 'electron';
import { app, BrowserWindow, Menu, nativeImage, shell, Tray } from 'electron';
import { getSettings } from './config/settings-store.ts';
import { bundledResourcePaths } from './resources/resource-paths.ts';
/**
* The launcher's single window: a fixed size without the system frame, like the game's own
@@ -25,7 +26,9 @@ export function beginWindowQuit(): void {
async function hideToTray(window: BrowserWindow): Promise<void> {
if (!tray) {
tray = new Tray(await app.getFileIcon(process.execPath, { size: 'small' }));
const customIcon = nativeImage.createFromPath(bundledResourcePaths().appIcon);
const icon = customIcon.isEmpty() ? await app.getFileIcon(process.execPath, { size: 'small' }) : customIcon;
tray = new Tray(icon);
tray.setToolTip(app.getName());
tray.setContextMenu(Menu.buildFromTemplate([{ role: 'quit' }]));
tray.on('click', () => showMainWindow());
@@ -34,6 +37,7 @@ async function hideToTray(window: BrowserWindow): Promise<void> {
}
export function createMainWindow(): BrowserWindow {
const appIcon = nativeImage.createFromPath(bundledResourcePaths().appIcon);
const window = new BrowserWindow({
width: CONTENT_WIDTH,
height: CONTENT_HEIGHT,
@@ -44,6 +48,7 @@ export function createMainWindow(): BrowserWindow {
frame: false,
backgroundColor: BACKGROUND,
show: false,
...(!appIcon.isEmpty() ? { icon: appIcon } : {}),
webPreferences: {
preload: join(import.meta.dirname, '../preload/index.cjs'),
sandbox: true,
@@ -15,6 +15,8 @@ export interface ResourcePaths {
readonly patches: string;
/** wto_ws.dll, built by native/wto-net/build.ps1. */
readonly networkHookLibrary: string;
/** Multi-resolution Windows icon for the window and system tray. */
readonly appIcon: string;
}
export function resourcePaths(): ResourcePaths {
@@ -29,6 +31,7 @@ export function bundledResourcePaths(): ResourcePaths {
return {
patches: join(process.resourcesPath, 'patches'),
networkHookLibrary: join(process.resourcesPath, 'native', 'wto_ws.dll'),
appIcon: join(process.resourcesPath, 'icon.ico'),
};
}
// The app path is apps/launcher; the repository is two levels up.
@@ -36,6 +39,7 @@ export function bundledResourcePaths(): ResourcePaths {
return {
patches: join(repository, 'patches'),
networkHookLibrary: join(repository, 'build', 'native', 'wto_ws.dll'),
appIcon: join(repository, 'apps', 'launcher', 'resources', 'icon.ico'),
};
}
+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256" role="img" aria-labelledby="title description">
<title id="title">WTOffline</title>
<desc id="description">Square WTOffline application icon with red WT monogram above light OFFLINE wordmark on a chamfered charcoal plate.</desc>
<path fill="#13191b" d="M40 10h178l28 28v180l-28 28H10V40z"/>
<path fill="#20282c" d="M10 156h202l34-34v96l-28 28H10z"/>
<path fill="none" stroke="#48545a" stroke-width="4" d="M40 10h178l28 28v180l-28 28H10V40z"/>
<path fill="#e53935" d="M40 10h86l-10 9H44L19 44v68l-9 10V40z"/>
<g fill="#ef4942" transform="translate(-31.5 34) scale(0.76 1.08)">
<path d="M79 27h26l13 50 17-36h21l17 36 13-50h27l-23 78h-25l-20-35-21 35h-24z"/>
<path d="M226 27h115l-8 21h-37v57h-27V48h-51z"/>
</g>
<g fill="#e8eef1" transform="translate(30.5 174) scale(0.60)">
<path fill-rule="evenodd" d="M6 0h29l6 6v30l-6 6H6l-6-6V6zm5 10v22h19V10z"/>
<path transform="translate(52)" d="M0 0h39l-5 10H11v7h20v10H11v15H0z"/>
<path transform="translate(102)" d="M0 0h39l-5 10H11v7h20v10H11v15H0z"/>
<path transform="translate(152)" d="M0 0h11v32h26l-5 10H0z"/>
<path transform="translate(200)" d="M0 0h21v9h-5v24h5v9H0v-9h5V9H0z"/>
<path transform="translate(232)" d="M0 0h10l22 24V0h11v42H33L11 18v24H0z"/>
<path transform="translate(286)" d="M0 0h39v10H11v6h20v10H11v6h28v10H0z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

+14 -1
View File
@@ -64,6 +64,10 @@ async function stageInstaller(stage: string, manifest: LauncherManifest): Promis
const resources = join(stage, 'installer-resources');
await mkdir(join(resources, 'native'), { recursive: true });
await mkdir(join(stage, 'build'), { recursive: true });
await cp(join(launcher, 'resources', 'icon.ico'), join(stage, 'build', 'icon.ico'));
await cp(join(launcher, 'resources', 'icon.ico'), join(resources, 'icon.ico'));
await cp(join(launcher, 'resources', 'icon.png'), join(resources, 'icon.png'));
await cp(join(repository, 'LICENSE'), join(resources, 'LICENSE-WTOffline'));
await cp(join(native, 'wto_ws.dll'), join(resources, 'native', 'wto_ws.dll'));
for (const folder of ['exe', 'gui', 'native', 'versions']) {
@@ -140,10 +144,19 @@ async function main(): Promise<void> {
{ from: 'installer-modules', to: 'node_modules', filter: ['**/*'] },
],
win: {
icon: join(stage, 'build', 'icon.ico'),
artifactName,
signExecutable: false,
},
nsis: { oneClick: false, perMachine: false, allowToChangeInstallationDirectory: true, runAfterFinish: false },
nsis: {
oneClick: false,
perMachine: false,
allowToChangeInstallationDirectory: true,
runAfterFinish: false,
installerIcon: join(stage, 'build', 'icon.ico'),
uninstallerIcon: join(stage, 'build', 'icon.ico'),
installerHeaderIcon: join(stage, 'build', 'icon.ico'),
},
},
});
for (const artifact of artifacts) console.info(artifact);