mirror of
https://github.com/yuukiwww/taiko-web.git
synced 2024-06-27 14:59:30 +02:00
e43c4afceb
- #LYRIC - Parse #LYRIC commands and apply them to all difficulties that do not have them - #LYRIC command now supports branches - Fix last #LYRIC at the end of the chart getting ignored - Fix the glitchy dragging and dropping of files on the custom song importing page - Fix Ctrl and Shift keys getting stuck on song select when switching tabs with Ctrl(+Shift)+Tab - Search - Fix the search box "random:yes" query to randomize the entire results and not just the first 50 - Add "all:yes" query to the search box to remove the result limit and display all of the results - Fix searching for an invalid query (like "cleared:yes" or ":") unexpectedly returning all the songs - Fix pressing Q then jumping to a song through search not unmuting the sound - Pressing the search key on mobile will hide the keyboard - Fix search tips changing rapidly when the window is resized - Use comments instead of `######` in the issue template so that the warning does not appear in the issue - Fix TJA MAKER: url between angle brackets not working - Add a check for Class field declarations in the browser support warning - Fix gpicker getting stuck if a network error occurs - Fix not being able to replace some assets using a "taiko-web assets" folder - Fix selectable song title not being aligned with the game if the game window is too wide - Allow plugin developers to use the "select" type for the settings options - It uses "options" array and "options_lang" object - Fix plugins not getting removed from the plugin list on syntax error - Fix error messages not working if a default plugin is broken - Fix the start of default plugins not stopping the page from loading on error - Fix not being able to scroll the plugins screen on mobile
147 lines
4.1 KiB
JavaScript
147 lines
4.1 KiB
JavaScript
class Titlescreen{
|
|
constructor(...args){
|
|
this.init(...args)
|
|
}
|
|
init(songId){
|
|
this.songId = songId
|
|
db.getItem("customFolder").then(folder => this.customFolder = folder)
|
|
|
|
if(!songId){
|
|
loader.changePage("titlescreen", false)
|
|
loader.screen.style.backgroundImage = ""
|
|
|
|
this.titleScreen = document.getElementById("title-screen")
|
|
this.proceed = document.getElementById("title-proceed")
|
|
this.disclaimerText = document.getElementById("title-disclaimer-text")
|
|
this.disclaimerCopyright = document.getElementById("title-disclaimer-copyright")
|
|
this.logo = new Logo()
|
|
}
|
|
this.setLang(allStrings[settings.getItem("language")])
|
|
|
|
if(songId){
|
|
if(localStorage.getItem("tutorial") === "true"){
|
|
new SongSelect(false, false, this.touched, this.songId)
|
|
}else{
|
|
new SettingsView(false, true, this.songId)
|
|
}
|
|
}else{
|
|
pageEvents.add(this.titleScreen, ["mousedown", "touchstart"], event => {
|
|
if(event.type === "touchstart"){
|
|
event.preventDefault()
|
|
this.touched = true
|
|
}else if(event.type === "mousedown" && event.which !== 1){
|
|
return
|
|
}
|
|
this.onPressed(true)
|
|
})
|
|
|
|
assets.sounds["v_title"].play()
|
|
this.keyboard = new Keyboard({
|
|
confirm: ["enter", "space", "don_l", "don_r"]
|
|
}, this.onPressed.bind(this))
|
|
this.gamepad = new Gamepad({
|
|
gamepadConfirm: ["a", "b", "x", "y", "start", "ls", "rs"]
|
|
}, this.onPressed.bind(this))
|
|
if(p2.session){
|
|
pageEvents.add(p2, "message", response => {
|
|
if(response.type === "songsel"){
|
|
this.goNext(true)
|
|
}
|
|
})
|
|
}
|
|
pageEvents.send("title-screen")
|
|
}
|
|
}
|
|
|
|
onPressed(pressed, name){
|
|
if(pressed){
|
|
if(name === "gamepadConfirm" && (snd.buffer.context.state === "suspended" || this.customFolder)){
|
|
return
|
|
}
|
|
this.titleScreen.style.cursor = "auto"
|
|
this.clean()
|
|
if(!this.customFolder || assets.customSongs){
|
|
assets.sounds["se_don"].play()
|
|
}
|
|
this.goNext()
|
|
}
|
|
}
|
|
goNext(fromP2){
|
|
if(p2.session && !fromP2){
|
|
p2.send("songsel")
|
|
}else{
|
|
if(fromP2 || this.customFolder || localStorage.getItem("tutorial") === "true"){
|
|
if(this.touched){
|
|
localStorage.setItem("tutorial", "true")
|
|
}
|
|
pageEvents.remove(p2, "message")
|
|
if(this.customFolder && !fromP2 && !assets.customSongs){
|
|
var customSongs = new CustomSongs(this.touched, true, true)
|
|
var soundPlayed = false
|
|
var noError = true
|
|
var promises = []
|
|
var allFiles = []
|
|
this.customFolder.forEach(file => {
|
|
promises.push(customSongs.walkFilesystem(file, undefined, allFiles))
|
|
})
|
|
Promise.all(promises).then(() => {
|
|
assets.sounds["se_don"].play()
|
|
soundPlayed = true
|
|
return customSongs.importLocal(allFiles)
|
|
}).catch(() => {
|
|
localStorage.removeItem("customSelected")
|
|
db.removeItem("customFolder")
|
|
if(!soundPlayed){
|
|
assets.sounds["se_don"].play()
|
|
}
|
|
setTimeout(() => {
|
|
new SongSelect(false, false, this.touched, this.songId)
|
|
}, 500)
|
|
noError = false
|
|
}).then(() => {
|
|
if(noError){
|
|
setTimeout(() => {
|
|
new SongSelect("customSongs", false, this.touched)
|
|
}, 500)
|
|
}
|
|
})
|
|
}else{
|
|
setTimeout(() => {
|
|
new SongSelect(false, false, this.touched, this.songId)
|
|
}, 500)
|
|
}
|
|
}else{
|
|
setTimeout(() => {
|
|
new SettingsView(this.touched, true, this.songId)
|
|
}, 500)
|
|
}
|
|
}
|
|
}
|
|
setLang(lang, noEvent){
|
|
settings.setLang(lang, true)
|
|
if(this.songId){
|
|
return
|
|
}
|
|
this.proceed.innerText = strings.titleProceed
|
|
this.proceed.setAttribute("alt", strings.titleProceed)
|
|
|
|
this.disclaimerText.innerText = strings.titleDisclaimer
|
|
this.disclaimerText.setAttribute("alt", strings.titleDisclaimer)
|
|
this.disclaimerCopyright.innerText = strings.titleCopyright
|
|
this.disclaimerCopyright.setAttribute("alt", strings.titleCopyright)
|
|
|
|
this.logo.updateSubtitle()
|
|
}
|
|
clean(){
|
|
this.keyboard.clean()
|
|
this.gamepad.clean()
|
|
this.logo.clean()
|
|
assets.sounds["v_title"].stop()
|
|
pageEvents.remove(this.titleScreen, ["mousedown", "touchstart"])
|
|
delete this.titleScreen
|
|
delete this.proceed
|
|
delete this.titleDisclaimer
|
|
delete this.titleCopyright
|
|
}
|
|
}
|