game halves animation and background default for unset game folder

This commit is contained in:
SpikeHD 2022-04-20 19:57:00 -07:00
parent ce8adbc301
commit 8c2e0d09f1
7 changed files with 37 additions and 4 deletions

View File

@ -7,7 +7,7 @@
"scripts": {
"dev": "neu run",
"build": "npm run clean_dist && neu build && npm run move_files && npm run move_bgs && npm run rename_exe",
"move_files": "cp -r ./ext ./dist/GrassClipper && cp -r ./proxy ./dist/GrassClipper && cp install.cmd ./dist/GrassClipper && cp -r ./scripts ./dist/GrassClipper",
"move_files": "cp -r ./proxy ./dist/GrassClipper && cp install.cmd ./dist/GrassClipper && cp -r ./scripts ./dist/GrassClipper",
"move_bgs": "mkdir dist\\GrassClipper\\resources\\bg\\private && cp -r ./resources/bg/private ./dist/GrassClipper/resources/bg",
"rename_exe": "mv ./dist/GrassClipper/GrassClipper-win_x64.exe ./dist/GrassClipper/GrassClipper.exe",
"clean_dist": "rm -rf ./dist"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -4,6 +4,7 @@
<link rel="stylesheet" type="text/css" href="style/index.css" />
<script src="js/neutralino.js"></script>
<script src="js/windowDrag.js"></script>
<script src="js/hoverEvt.js"></script>
<script src="js/index.js"></script>
</head>
<body>

21
resources/js/hoverEvt.js Normal file
View File

@ -0,0 +1,21 @@
document.addEventListener('DOMContentLoaded', async () => {
const firstHalf = document.querySelector('#firstHalf')
const secondHalf = document.querySelector('#secondHalf')
// Listen to hovers
firstHalf.addEventListener('mouseover', () => {
secondHalf.classList.add('darken')
})
firstHalf.addEventListener('mouseout', () => {
secondHalf.classList.remove('darken')
})
secondHalf.addEventListener('mouseover', () => {
firstHalf.classList.add('darken')
})
secondHalf.addEventListener('mouseout', () => {
firstHalf.classList.remove('darken')
})
})

View File

@ -1,6 +1,5 @@
Neutralino.init();
document.addEventListener('DOMContentLoaded', async () => {
setBackgroundImage();
displayGenshinFolder();
@ -47,6 +46,9 @@ async function handleGenshinFolderNotSet() {
// Set buttons to greyed out and disable
document.querySelector('#genshinPath').innerHTML = 'Not set'
// Set official server background to default
document.querySelector('#firstHalf').style.backgroundImage = `url("../bg/private/default.png")`
const offBtn = document.querySelector('#playOfficial')
const privBtn = document.querySelector('#playPrivate')
@ -106,7 +108,7 @@ async function setBackgroundImage() {
document.querySelector('#firstHalf').style.backgroundImage = `url("../bg/official/${image}")`
}
const privImages = (await Neutralino.filesystem.readDirectory(NL_CWD + '/resources/bg/private')).filter(file => file.type === 'FILE')
const privImages = (await Neutralino.filesystem.readDirectory(NL_CWD + '/resources/bg/private')).filter(file => file.type === 'FILE' && !file.entry.includes('default'))
const privImage = privImages[Math.floor(Math.random() * privImages.length)].entry
// Set the background image

View File

@ -7,6 +7,10 @@ body {
font-family: Arial, Helvetica, sans-serif;
}
.darken {
filter: brightness(0.6);
}
#controlBar {
display: flex;
flex-direction: row;
@ -66,7 +70,6 @@ body {
margin-left: auto !important;
}
.playBtn:hover, .smolBtn:hover {
cursor: pointer;
}
@ -142,6 +145,12 @@ body {
width: 100%;
background-repeat: no-repeat;
background-size: cover;
transition: width 0.2s ease-in-out, filter 0.2s ease-in-out;
}
#firstHalf:hover, #secondHalf:hover {
width: calc(100% + 150px);
}
#firstHalf {