Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c0d7d7ce4f | |||
| a7a4bce19f |
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "oflauncher",
|
"name": "oflauncher",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "oflauncher",
|
"name": "oflauncher",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oflauncher",
|
"name": "oflauncher",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"description": "Launcher Minecraft custom pour le modpack ATM10 (1.21.1 / NeoForge)",
|
"description": "Launcher Minecraft custom pour le modpack ATM10 (1.21.1 / NeoForge)",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "OFLauncher",
|
"author": "OFLauncher",
|
||||||
|
|||||||
+8
-1
@@ -3,7 +3,7 @@ import { join } from 'path'
|
|||||||
import { setMainWindow } from './events'
|
import { setMainWindow } from './events'
|
||||||
import { IPC, type UserSettings, type PlayOptions } from '../shared/ipc'
|
import { IPC, type UserSettings, type PlayOptions } from '../shared/ipc'
|
||||||
import { login, logout, restoreSession, getCurrent } from './auth'
|
import { login, logout, restoreSession, getCurrent } from './auth'
|
||||||
import { play, stopGame } from './play'
|
import { play, stopGame, isGameRunning } from './play'
|
||||||
import { getPackMetaCached } from './modpack'
|
import { getPackMetaCached } from './modpack'
|
||||||
import { getSettings, setSettings } from './settings'
|
import { getSettings, setSettings } from './settings'
|
||||||
import { paths } from './paths'
|
import { paths } from './paths'
|
||||||
@@ -35,6 +35,13 @@ function createWindow(): BrowserWindow {
|
|||||||
|
|
||||||
win.on('ready-to-show', () => win.show())
|
win.on('ready-to-show', () => win.show())
|
||||||
|
|
||||||
|
win.on('close', (e) => {
|
||||||
|
if (isGameRunning()) {
|
||||||
|
e.preventDefault()
|
||||||
|
win.hide()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Liens externes -> navigateur système.
|
// Liens externes -> navigateur système.
|
||||||
win.webContents.setWindowOpenHandler(({ url }) => {
|
win.webContents.setWindowOpenHandler(({ url }) => {
|
||||||
void shell.openExternal(url)
|
void shell.openExternal(url)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { ChildProcess } from 'child_process'
|
import type { ChildProcess } from 'child_process'
|
||||||
|
import { app, BrowserWindow } from 'electron'
|
||||||
import { getCurrent } from './auth'
|
import { getCurrent } from './auth'
|
||||||
import { fetchPackMeta } from './modpack'
|
import { fetchPackMeta } from './modpack'
|
||||||
import { ensureJava } from './java'
|
import { ensureJava } from './java'
|
||||||
@@ -47,6 +48,10 @@ export async function play(opts?: PlayOptions): Promise<void> {
|
|||||||
gameProcess = proc
|
gameProcess = proc
|
||||||
proc.on('close', () => {
|
proc.on('close', () => {
|
||||||
gameProcess = null
|
gameProcess = null
|
||||||
|
const allHidden = BrowserWindow.getAllWindows().every((w) => !w.isVisible())
|
||||||
|
if (allHidden) {
|
||||||
|
app.quit()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit.progress({ phase: 'error', message: (e as Error).message, progress: undefined })
|
emit.progress({ phase: 'error', message: (e as Error).message, progress: undefined })
|
||||||
@@ -60,3 +65,7 @@ export function stopGame(): boolean {
|
|||||||
gameProcess.kill()
|
gameProcess.kill()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isGameRunning(): boolean {
|
||||||
|
return gameProcess !== null
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user