pre-release & release game version [to check]

This commit is contained in:
AMIAY
2026-01-23 17:54:57 +01:00
parent 08c2218cf8
commit 3983fdb1bc
19 changed files with 888 additions and 302 deletions

View File

@@ -123,6 +123,26 @@
value="Player" />
</div>
<div class="form-group">
<label class="form-label" data-i18n="install.gameBranch">Game Version</label>
<div class="radio-group">
<label class="radio-label">
<input type="radio" name="installBranch" value="release" class="custom-radio" checked>
<span class="radio-text">
<i class="fas fa-check-circle mr-2"></i>
<span data-i18n="install.releaseVersion">Release (Stable)</span>
</span>
</label>
<label class="radio-label">
<input type="radio" name="installBranch" value="pre-release" class="custom-radio">
<span class="radio-text">
<i class="fas fa-flask mr-2"></i>
<span data-i18n="install.preReleaseVersion">Pre-Release (Experimental)</span>
</span>
</label>
</div>
</div>
<div class="form-group">
<label class="checkbox-group">
<input type="checkbox" id="installCustomCheck" class="custom-checkbox">
@@ -337,9 +357,29 @@
</div>
</button>
</div>
</div>
<div class="settings-option">
<div class="settings-input-group">
<label class="settings-input-label" data-i18n="settings.gameBranch">Game Branch</label>
<div class="segmented-control">
<input type="radio" id="branch-release" name="gameBranch" value="release" checked>
<label for="branch-release" data-i18n="settings.branchRelease">Release</label>
<input type="radio" id="branch-pre-release" name="gameBranch" value="pre-release">
<label for="branch-pre-release" data-i18n="settings.branchPreRelease">Pre-Release</label>
</div>
<p class="settings-hint">
<i class="fas fa-info-circle"></i>
<span data-i18n="settings.branchHint">Switch between stable release and experimental pre-release versions</span>
</p>
<p class="settings-hint" style="color: #f39c12;">
<i class="fas fa-exclamation-triangle"></i>
<span data-i18n="settings.branchWarning">Changing branch will download and install a different game version</span>
</p>
</div>
</div>
<div class="settings-option">
<label class="settings-input-label" data-i18n="settings.gpuPreference">GPU
Preference</label>
<div class="segmented-control">

View File

@@ -60,6 +60,18 @@ export async function installGame() {
const playerName = (installPlayerName ? installPlayerName.value.trim() : '') || 'Player';
const installPath = installPathInput ? installPathInput.value.trim() : '';
// Récupérer la branche sélectionnée
const selectedBranchRadio = document.querySelector('input[name="installBranch"]:checked');
const selectedBranch = selectedBranchRadio ? selectedBranchRadio.value : 'release';
console.log(`[Install] Installing game with branch: ${selectedBranch}`);
// Sauvegarder la branche sélectionnée dans le config
if (window.electronAPI && window.electronAPI.saveVersionBranch) {
await window.electronAPI.saveVersionBranch(selectedBranch);
console.log(`[Install] Branch saved to config: ${selectedBranch}`);
}
if (window.LauncherUI) window.LauncherUI.showProgress();
isDownloading = true;
if (installBtn) {
@@ -69,7 +81,7 @@ export async function installGame() {
try {
if (window.electronAPI && window.electronAPI.installGame) {
const result = await window.electronAPI.installGame(playerName, '', installPath);
const result = await window.electronAPI.installGame(playerName, '', installPath, selectedBranch);
if (result.success) {
const successMsg = window.i18n ? window.i18n.t('progress.installationComplete') : 'Installation completed successfully!';

View File

@@ -3,11 +3,12 @@ let customJavaCheck;
let customJavaOptions;
let customJavaPath;
let browseJavaBtn;
let settingsPlayerName;
let discordRPCCheck;
let closeLauncherCheck;
let gpuPreferenceRadios;
let settingsPlayerName;
let discordRPCCheck;
let closeLauncherCheck;
let gpuPreferenceRadios;
let gameBranchRadios;
// UUID Management elements
let currentUuidDisplay;
@@ -161,11 +162,12 @@ function setupSettingsElements() {
customJavaOptions = document.getElementById('customJavaOptions');
customJavaPath = document.getElementById('customJavaPath');
browseJavaBtn = document.getElementById('browseJavaBtn');
settingsPlayerName = document.getElementById('settingsPlayerName');
discordRPCCheck = document.getElementById('discordRPCCheck');
closeLauncherCheck = document.getElementById('closeLauncherCheck');
gpuPreferenceRadios = document.querySelectorAll('input[name="gpuPreference"]');
settingsPlayerName = document.getElementById('settingsPlayerName');
discordRPCCheck = document.getElementById('discordRPCCheck');
closeLauncherCheck = document.getElementById('closeLauncherCheck');
gpuPreferenceRadios = document.querySelectorAll('input[name="gpuPreference"]');
gameBranchRadios = document.querySelectorAll('input[name="gameBranch"]');
// UUID Management elements
currentUuidDisplay = document.getElementById('currentUuid');
@@ -194,14 +196,14 @@ function setupSettingsElements() {
settingsPlayerName.addEventListener('change', savePlayerName);
}
if (discordRPCCheck) {
discordRPCCheck.addEventListener('change', saveDiscordRPC);
}
if (closeLauncherCheck) {
closeLauncherCheck.addEventListener('change', saveCloseLauncher);
}
if (discordRPCCheck) {
discordRPCCheck.addEventListener('change', saveDiscordRPC);
}
if (closeLauncherCheck) {
closeLauncherCheck.addEventListener('change', saveCloseLauncher);
}
// UUID event listeners
if (copyUuidBtn) {
@@ -252,6 +254,12 @@ function setupSettingsElements() {
});
});
}
if (gameBranchRadios) {
gameBranchRadios.forEach(radio => {
radio.addEventListener('change', handleBranchChange);
});
}
}
function toggleCustomJava() {
@@ -344,43 +352,43 @@ async function saveDiscordRPC() {
}
}
async function loadDiscordRPC() {
try {
if (window.electronAPI && window.electronAPI.loadDiscordRPC) {
const enabled = await window.electronAPI.loadDiscordRPC();
if (discordRPCCheck) {
discordRPCCheck.checked = enabled;
}
}
} catch (error) {
console.error('Error loading Discord RPC setting:', error);
}
}
async function saveCloseLauncher() {
try {
if (window.electronAPI && window.electronAPI.saveCloseLauncher && closeLauncherCheck) {
const enabled = closeLauncherCheck.checked;
await window.electronAPI.saveCloseLauncher(enabled);
}
} catch (error) {
console.error('Error saving close launcher setting:', error);
}
}
async function loadCloseLauncher() {
try {
if (window.electronAPI && window.electronAPI.loadCloseLauncher) {
const enabled = await window.electronAPI.loadCloseLauncher();
if (closeLauncherCheck) {
closeLauncherCheck.checked = enabled;
}
}
} catch (error) {
console.error('Error loading close launcher setting:', error);
}
}
async function loadDiscordRPC() {
try {
if (window.electronAPI && window.electronAPI.loadDiscordRPC) {
const enabled = await window.electronAPI.loadDiscordRPC();
if (discordRPCCheck) {
discordRPCCheck.checked = enabled;
}
}
} catch (error) {
console.error('Error loading Discord RPC setting:', error);
}
}
async function saveCloseLauncher() {
try {
if (window.electronAPI && window.electronAPI.saveCloseLauncher && closeLauncherCheck) {
const enabled = closeLauncherCheck.checked;
await window.electronAPI.saveCloseLauncher(enabled);
}
} catch (error) {
console.error('Error saving close launcher setting:', error);
}
}
async function loadCloseLauncher() {
try {
if (window.electronAPI && window.electronAPI.loadCloseLauncher) {
const enabled = await window.electronAPI.loadCloseLauncher();
if (closeLauncherCheck) {
closeLauncherCheck.checked = enabled;
}
}
} catch (error) {
console.error('Error loading close launcher setting:', error);
}
}
async function savePlayerName() {
try {
@@ -491,15 +499,16 @@ async function loadGpuPreference() {
}
}
async function loadAllSettings() {
await loadCustomJavaPath();
await loadPlayerName();
await loadCurrentUuid();
await loadDiscordRPC();
await loadCloseLauncher();
await loadGpuPreference();
}
async function loadAllSettings() {
await loadCustomJavaPath();
await loadPlayerName();
await loadCurrentUuid();
await loadDiscordRPC();
await loadCloseLauncher();
await loadGpuPreference();
await loadVersionBranch();
}
async function openGameLocation() {
try {
@@ -891,4 +900,177 @@ function showNotification(message, type = 'info') {
}
}, 300);
}, 3000);
}
}// Append this to settings.js for branch management
// === Game Branch Management ===
async function handleBranchChange(event) {
const newBranch = event.target.value;
const currentBranch = await loadVersionBranch();
if (newBranch === currentBranch) {
return; // No change
}
// Confirm branch change
const branchName = window.i18n ?
window.i18n.t(`settings.branch${newBranch === 'pre-release' ? 'PreRelease' : 'Release'}`) :
newBranch;
const message = window.i18n ?
window.i18n.t('settings.branchWarning') :
'Changing branch will download and install a different game version';
showCustomConfirm(
message,
window.i18n ? window.i18n.t('settings.gameBranch') : 'Game Branch',
async () => {
await switchBranch(newBranch);
},
() => {
// Cancel: revert radio selection
loadVersionBranch().then(branch => {
const radioToCheck = document.querySelector(`input[name="gameBranch"][value="${branch}"]`);
if (radioToCheck) {
radioToCheck.checked = true;
}
});
}
);
}
async function switchBranch(newBranch) {
try {
const switchingMsg = window.i18n ?
window.i18n.t('settings.branchSwitching').replace('{branch}', newBranch) :
`Switching to ${newBranch}...`;
showNotification(switchingMsg, 'info');
// Lock play button
const playButton = document.getElementById('playButton');
if (playButton) {
playButton.disabled = true;
playButton.classList.add('disabled');
}
// Save new branch
await window.electronAPI.saveVersionBranch(newBranch);
const switchedMsg = window.i18n ?
window.i18n.t('settings.branchSwitched').replace('{branch}', newBranch) :
`Switched to ${newBranch} successfully!`;
showNotification(switchedMsg, 'success');
// Suggest reinstalling
setTimeout(() => {
const branchLabel = newBranch === 'release' ?
(window.i18n ? window.i18n.t('install.releaseVersion') : 'Release') :
(window.i18n ? window.i18n.t('install.preReleaseVersion') : 'Pre-Release');
const confirmMsg = window.i18n ?
window.i18n.t('settings.branchInstallConfirm').replace('{branch}', branchLabel) :
`The game will be installed for the ${branchLabel} branch. Continue?`;
showCustomConfirm(
confirmMsg,
window.i18n ? window.i18n.t('settings.installRequired') : 'Installation Required',
async () => {
// Show progress and trigger game installation
if (window.LauncherUI) {
window.LauncherUI.showProgress();
}
try {
const playerName = await window.electronAPI.loadUsername();
const result = await window.electronAPI.installGame(playerName || 'Player', '', '', newBranch);
if (result.success) {
const successMsg = window.i18n ?
window.i18n.t('progress.installationComplete') :
'Installation completed successfully!';
showNotification(successMsg, 'success');
setTimeout(() => {
if (window.LauncherUI) {
window.LauncherUI.hideProgress();
}
// Unlock play button
const playButton = document.getElementById('playButton');
if (playButton) {
playButton.disabled = false;
playButton.classList.remove('disabled');
}
}, 2000);
} else {
throw new Error(result.error || 'Installation failed');
}
} catch (error) {
console.error('Installation error:', error);
const errorMsg = window.i18n ?
window.i18n.t('progress.installationFailed').replace('{error}', error.message) :
`Installation failed: ${error.message}`;
showNotification(errorMsg, 'error');
if (window.LauncherUI) {
window.LauncherUI.hideProgress();
}
// Unlock play button
const playButton = document.getElementById('playButton');
if (playButton) {
playButton.disabled = false;
playButton.classList.remove('disabled');
}
}
},
() => {
// Cancel - unlock play button
const playButton = document.getElementById('playButton');
if (playButton) {
playButton.disabled = false;
playButton.classList.remove('disabled');
}
},
window.i18n ? window.i18n.t('common.install') : 'Install',
window.i18n ? window.i18n.t('common.cancel') : 'Cancel'
);
}, 500);
} catch (error) {
console.error('Error switching branch:', error);
showNotification(`Failed to switch branch: ${error.message}`, 'error');
// Revert radio selection
loadVersionBranch().then(branch => {
const radioToCheck = document.querySelector(`input[name="gameBranch"][value="${branch}"]`);
if (radioToCheck) {
radioToCheck.checked = true;
}
});
}
}
async function loadVersionBranch() {
try {
if (window.electronAPI && window.electronAPI.loadVersionBranch) {
const branch = await window.electronAPI.loadVersionBranch();
// Update radio buttons
if (gameBranchRadios) {
gameBranchRadios.forEach(radio => {
radio.checked = radio.value === branch;
});
}
return branch;
}
return 'release'; // Default
} catch (error) {
console.error('Error loading version branch:', error);
return 'release';
}
}

View File

@@ -501,6 +501,7 @@ function setupUI() {
setupAnimations();
setupFirstLaunchHandlers();
loadLauncherVersion();
checkGameInstallation();
document.body.focus();
}
@@ -520,6 +521,50 @@ async function loadLauncherVersion() {
}
}
// Check game installation status on startup
async function checkGameInstallation() {
try {
console.log('Checking game installation status...');
// Check if game is installed
const isInstalled = await window.electronAPI.isGameInstalled();
// Load version_client from config
let versionClient = null;
if (window.electronAPI.loadVersionClient) {
versionClient = await window.electronAPI.loadVersionClient();
}
console.log(`Game installed: ${isInstalled}, version_client: ${versionClient}`);
// If version_client is null and game is not installed, trigger installation
if (versionClient === null && !isInstalled) {
console.log('Game not installed and version_client is null, showing install page...');
// Show installation page
const installPage = document.getElementById('install-page');
const launcher = document.getElementById('launcher-container');
const sidebar = document.querySelector('.sidebar');
if (installPage) {
installPage.style.display = 'block';
if (launcher) launcher.style.display = 'none';
if (sidebar) sidebar.style.pointerEvents = 'none';
// Unlock play button since we're in install mode
lockPlayButton(false);
}
} else {
// Game is installed or version is set, unlock play button
lockPlayButton(false);
}
} catch (error) {
console.error('Error checking game installation:', error);
// Unlock on error to prevent permanent lock
lockPlayButton(false);
}
}
window.LauncherUI = {
showPage,
setActiveNav,

View File

@@ -15,6 +15,9 @@
"title": "FREE TO PLAY LAUNCHER",
"playerName": "Player Name",
"playerNamePlaceholder": "Enter your name",
"gameBranch": "Game Version",
"releaseVersion": "Release (Stable)",
"preReleaseVersion": "Pre-Release (Experimental)",
"customInstallation": "Custom Installation",
"installationFolder": "Installation Folder",
"pathPlaceholder": "Default location",
@@ -125,7 +128,16 @@
"logsLoading": "Loading logs...",
"closeLauncher": "Launcher Behavior",
"closeOnStart": "Close Launcher on game start",
"closeOnStartDescription": "Automatically close the launcher after Hytale has launched"
"closeOnStartDescription": "Automatically close the launcher after Hytale has launched",
"gameBranch": "Game Branch",
"branchRelease": "Release",
"branchPreRelease": "Pre-Release",
"branchHint": "Switch between stable release and experimental pre-release versions",
"branchWarning": "Changing branch will download and install a different game version",
"branchSwitching": "Switching to {branch}...",
"branchSwitched": "Switched to {branch} successfully!",
"installRequired": "Installation Required",
"branchInstallConfirm": "The game will be installed for the {branch} branch. Continue?"
},
"uuid": {
"modalTitle": "UUID Management",
@@ -157,7 +169,8 @@
"delete": "Delete",
"edit": "Edit",
"loading": "Loading...",
"apply": "Apply"
"apply": "Apply",
"install": "Install"
},
"notifications": {
"gameDataNotFound": "Error: Game data not found",

View File

@@ -14,8 +14,9 @@
"install": {
"title": "LAUNCHER GRATUITO",
"playerName": "Nombre del Jugador",
"playerNamePlaceholder": "Ingresa tu nombre",
"customInstallation": "Instalación Personalizada",
"playerNamePlaceholder": "Ingresa tu nombre", "gameBranch": "Versión del Juego",
"releaseVersion": "Lanzamiento (Estable)",
"preReleaseVersion": "Pre-Lanzamiento (Experimental)", "customInstallation": "Instalación Personalizada",
"installationFolder": "Carpeta de Instalación",
"pathPlaceholder": "Ubicación predeterminada",
"browse": "Examinar",
@@ -125,7 +126,16 @@
"logsLoading": "Cargando registros...",
"closeLauncher": "Comportamiento del Launcher",
"closeOnStart": "Cerrar Launcher al iniciar el juego",
"closeOnStartDescription": "Cierra automáticamente el launcher después de que Hytale se haya iniciado"
"closeOnStartDescription": "Cierra automáticamente el launcher después de que Hytale se haya iniciado",
"gameBranch": "Rama del Juego",
"branchRelease": "Lanzamiento",
"branchPreRelease": "Pre-Lanzamiento",
"branchHint": "Cambia entre la versión estable y la versión experimental de pre-lanzamiento",
"branchWarning": "Cambiar de rama descargará e instalará una versión diferente del juego",
"branchSwitching": "Cambiando a {branch}...",
"branchSwitched": "¡Cambiado a {branch} con éxito!",
"installRequired": "Instalación Requerida",
"branchInstallConfirm": "El juego se instalará para la rama {branch}. ¿Continuar?"
},
"uuid": {
"modalTitle": "Gestión de UUID",
@@ -157,7 +167,8 @@
"delete": "Eliminar",
"edit": "Editar",
"loading": "Cargando...",
"apply": "Aplicar"
"apply": "Aplicar",
"install": "Instalar"
},
"notifications": {
"gameDataNotFound": "Error: No se encontraron datos del juego",

View File

@@ -14,8 +14,9 @@
"install": {
"title": "LANÇADOR JOGO GRATUITO",
"playerName": "Nome do Jogador",
"playerNamePlaceholder": "Digite seu nome",
"customInstallation": "Instalação Personalizada",
"playerNamePlaceholder": "Digite seu nome", "gameBranch": "Versão do Jogo",
"releaseVersion": "Lançamento (Estável)",
"preReleaseVersion": "Pré-Lançamento (Experimental)", "customInstallation": "Instalação Personalizada",
"installationFolder": "Pasta de Instalação",
"pathPlaceholder": "Local padrão",
"browse": "Procurar",
@@ -125,7 +126,16 @@
"logsLoading": "Carregando registros...",
"closeLauncher": "Comportamento do Lançador",
"closeOnStart": "Fechar Lançador ao iniciar o jogo",
"closeOnStartDescription": "Fechar automaticamente o lançador após o Hytale ter sido iniciado"
"closeOnStartDescription": "Fechar automaticamente o lançador após o Hytale ter sido iniciado",
"gameBranch": "Versão do Jogo",
"branchRelease": "Lançamento",
"branchPreRelease": "Pré-Lançamento",
"branchHint": "Alterne entre a versão estável e a versão experimental de pré-lançamento",
"branchWarning": "Mudar de versão irá baixar e instalar uma versão diferente do jogo",
"branchSwitching": "Mudando para {branch}...",
"branchSwitched": "Mudado para {branch} com sucesso!",
"installRequired": "Instalação Necessária",
"branchInstallConfirm": "O jogo será instalado para o ramo {branch}. Continuar?"
},
"uuid": {
"modalTitle": "Gerenciamento de UUID",
@@ -158,7 +168,8 @@
"delete": "Excluir",
"edit": "Editar",
"loading": "Carregando...",
"apply": "Aplicar"
"apply": "Aplicar",
"install": "Instalar"
},
"notifications": {
"gameDataNotFound": "Erro: Dados do jogo não encontrados",

View File

@@ -662,6 +662,57 @@ body {
box-shadow: none;
}
/* Radio buttons for install page */
.radio-group {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.radio-label {
display: flex;
align-items: center;
padding: 1rem;
background: rgba(255, 255, 255, 0.05);
border: 2px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
}
.radio-label:hover {
background: rgba(255, 255, 255, 0.08);
border-color: rgba(147, 51, 234, 0.5);
}
.radio-label .custom-radio {
position: absolute;
opacity: 0;
cursor: pointer;
}
.radio-label .custom-radio:checked ~ .radio-text {
color: #9333ea;
}
.radio-label:has(.custom-radio:checked) {
background: rgba(147, 51, 234, 0.15);
border-color: #9333ea;
box-shadow: 0 0 20px rgba(147, 51, 234, 0.2);
}
.radio-text {
display: flex;
align-items: center;
color: #d1d5db;
font-weight: 500;
transition: color 0.3s ease;
}
.radio-text i {
margin-right: 0.5rem;
}
.launcher-container {
flex: 1;
display: flex;