enable/disable server launcher panel

This commit is contained in:
SpikeHD 2022-04-22 19:14:40 -07:00
parent ef44855597
commit f571ddc370
4 changed files with 31 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -56,6 +56,15 @@
Auto updating is temporarily disabled. Check GitHub for the newest release. Auto updating is temporarily disabled. Check GitHub for the newest release.
</span> </span>
</div> </div>
<div class="settingsRow">
<div class="settingSection">
<span class="settingLabel">Enable Server Launcher</span>
<input type="checkbox" id="serverLaunchOption" onchange="toggleServerLaunchSection()" />
</div>
<span class="settingSubtitle" id="serverSubtitle">
Enable to server launcher tile for launcher a local Grasscutter instance.
</span>
</div>
</div> </div>
</div> </div>
<div id="controlBar"> <div id="controlBar">
@ -88,7 +97,7 @@
<button class="playBtn" id="playPrivate" onclick="launchPrivate()">Play Private</button> <button class="playBtn" id="playPrivate" onclick="launchPrivate()">Play Private</button>
</div> </div>
</div> </div>
<div id="thirdPanel"> <div id="thirdPanel" style="display: none;">
<button class="playBtn" id="serverLaunch">Launch Local Server</button> <button class="playBtn" id="serverLaunch">Launch Local Server</button>
</div> </div>
</div> </div>

View File

@ -93,7 +93,8 @@ async function getCfg() {
const defaultConf = { const defaultConf = {
genshinImpactFolder: '', genshinImpactFolder: '',
lastConnect: '', lastConnect: '',
enableKillswitch: false enableKillswitch: false,
serverLaunchPanel: false
} }
const cfgStr = await Neutralino.storage.getData('config').catch(e => { const cfgStr = await Neutralino.storage.getData('config').catch(e => {
// The data isn't set, so this is our first time opening // The data isn't set, so this is our first time opening
@ -417,6 +418,21 @@ async function checkForUpdatesAndShow() {
} }
} }
async function toggleServerLaunchSection() {
const serverPanel = document.querySelector('#thirdPanel')
const config = await getCfg()
if (serverPanel.style.display === 'none') {
serverPanel.style.removeProperty('display')
} else {
serverPanel.style.display = 'none'
}
// Save setting
config.serverLaunchPanel = !config.serverLaunchPanel
Neutralino.storage.setData('config', JSON.stringify(config))
}
/** /**
* Set the game folder by opening a folder picker * Set the game folder by opening a folder picker
*/ */

View File

@ -50,7 +50,7 @@ body {
} }
#settingsPanel { #settingsPanel {
width: 30%; width: 35%;
height: 60%; height: 60%;
} }
@ -65,7 +65,7 @@ body {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 10px 20%; padding: 10px 10%;
} }
.settingsRow { .settingsRow {
@ -104,7 +104,7 @@ body {
#settingsClose { #settingsClose {
display: inline-block; display: inline-block;
margin-left: 65%; margin-left: 70%;
transition: filter 0.1s ease-in-out; transition: filter 0.1s ease-in-out;
} }
@ -365,7 +365,7 @@ body {
} }
#secondControlContainer, #firstPanel button, #thirdPanel button { #secondControlContainer, #firstPanel button, #thirdPanel button {
margin-top: 100%; margin-top: 62vh;
} }
#serverInput input, #serverInput img{ #serverInput input, #serverInput img{