mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-12-23 09:46:15 +08:00
Merge pull request #139 from bui/view-fix-donbg-scrolling
View: Fix donbg scrolling
This commit is contained in:
commit
eb4ddb0b1f
@ -94,3 +94,6 @@
|
||||
z-index: 2;
|
||||
transition: 1s background-color linear;
|
||||
}
|
||||
.fix-animations *{
|
||||
animation: none !important;
|
||||
}
|
||||
|
@ -48,9 +48,9 @@
|
||||
this.regex = {
|
||||
comma: /[,.]/,
|
||||
ideographicComma: /[、。]/,
|
||||
apostrophe: /['']/,
|
||||
apostrophe: /[''’]/,
|
||||
degree: /[゚°]/,
|
||||
brackets: /[\((\))\[\]「」『』【】]/,
|
||||
brackets: /[\((\))\[\]「」『』【】::;;]/,
|
||||
tilde: /[\--~~〜_]/,
|
||||
tall: /[bbddffgghhj-lj-ltt♪]/,
|
||||
i: /[ii]/,
|
||||
@ -625,8 +625,6 @@
|
||||
drawn.push({text: symbol, x: -2, y: 0, w: 20, scale: [0.6, 0.5]})
|
||||
}else if(symbol === " "){
|
||||
drawn.push({text: symbol, x: 0, y: 0, w: 10})
|
||||
}else if(symbol === "'"){
|
||||
drawn.push({text: ",", x: 0, y: -15, w: 7, scale: [1, 0.7]})
|
||||
}else if(symbol === '"'){
|
||||
drawn.push({text: symbol, x: 2, y: 0, w: 10})
|
||||
}else if(symbol === "∀"){
|
||||
@ -637,6 +635,8 @@
|
||||
}
|
||||
}else if(symbol === "."){
|
||||
drawn.push({text: symbol, x: -9, y: 0, w: 37})
|
||||
}else if(r.apostrophe.test(symbol)){
|
||||
drawn.push({text: ",", x: 0, y: -15, w: 7, scale: [1, 0.7]})
|
||||
}else if(r.comma.test(symbol)){
|
||||
// Comma, full stop
|
||||
if(bold){
|
||||
|
@ -68,7 +68,9 @@ class Controller{
|
||||
}
|
||||
stopMainLoop(){
|
||||
this.mainLoopRunning = false
|
||||
this.mainAsset.stop()
|
||||
if(this.mainAsset){
|
||||
this.mainAsset.stop()
|
||||
}
|
||||
if(this.multiplayer !== 2){
|
||||
clearInterval(this.gameInterval)
|
||||
}
|
||||
|
@ -465,7 +465,8 @@ class Game{
|
||||
var started = this.fadeOutStarted
|
||||
if(started){
|
||||
var ms = this.elapsedTime
|
||||
var musicDuration = this.controller.mainAsset.duration * 1000 - this.controller.offset
|
||||
var duration = this.mainAsset ? this.mainAsset.duration : 0
|
||||
var musicDuration = duration * 1000 - this.controller.offset
|
||||
if(this.musicFadeOut === 0){
|
||||
if(this.controller.multiplayer === 1){
|
||||
p2.send("gameresults", this.getGlobalScore())
|
||||
@ -491,7 +492,7 @@ class Game{
|
||||
playMainMusic(){
|
||||
var ms = this.elapsedTime + this.controller.offset
|
||||
if(!this.mainMusicPlaying && (!this.fadeOutStarted || ms < this.fadeOutStarted + 1600)){
|
||||
if(this.controller.multiplayer !== 2){
|
||||
if(this.controller.multiplayer !== 2 && this.mainAsset){
|
||||
this.mainAsset.play((ms < 0 ? -ms : 0) / 1000, false, Math.max(0, ms / 1000))
|
||||
}
|
||||
this.mainMusicPlaying = true
|
||||
@ -502,7 +503,9 @@ class Game{
|
||||
assets.sounds["se_pause"].play()
|
||||
this.paused = true
|
||||
this.latestDate = Date.now()
|
||||
this.mainAsset.stop()
|
||||
if(this.mainAsset){
|
||||
this.mainAsset.stop()
|
||||
}
|
||||
this.mainMusicPlaying = false
|
||||
this.view.pauseMove(0, true)
|
||||
this.view.gameDiv.classList.add("game-paused")
|
||||
|
@ -184,25 +184,26 @@
|
||||
id: index + 1,
|
||||
type: "tja",
|
||||
chart: data,
|
||||
stars: []
|
||||
stars: [],
|
||||
music: "muted"
|
||||
}
|
||||
var titleLang = {}
|
||||
var subtitleLang = {}
|
||||
var dir = file.webkitRelativePath.toLowerCase()
|
||||
dir = dir.slice(0, dir.lastIndexOf("/") + 1)
|
||||
var hasCategory = false
|
||||
for(var diff in tja.metadata){
|
||||
var meta = tja.metadata[diff]
|
||||
songObj.title = songObj.title_en = meta.title || file.name.slice(0, file.name.lastIndexOf("."))
|
||||
songObj.title = meta.title || file.name.slice(0, file.name.lastIndexOf("."))
|
||||
var subtitle = meta.subtitle || ""
|
||||
if(subtitle.startsWith("--")){
|
||||
subtitle = subtitle.slice(2)
|
||||
if(subtitle.startsWith("--") || subtitle.startsWith("++")){
|
||||
subtitle = subtitle.slice(2).trim()
|
||||
}
|
||||
songObj.subtitle = songObj.subtitle_en = subtitle
|
||||
songObj.subtitle = subtitle
|
||||
songObj.preview = meta.demostart || 0
|
||||
if(meta.level){
|
||||
songObj.stars[this.courseTypes[diff]] = meta.level + (meta.branch ? " B" : "")
|
||||
}
|
||||
songObj.stars[this.courseTypes[diff]] = (meta.level || "0") + (meta.branch ? " B" : "")
|
||||
if(meta.wave){
|
||||
songObj.music = this.otherFiles[dir + meta.wave.toLowerCase()]
|
||||
songObj.music = this.otherFiles[dir + meta.wave.toLowerCase()] || songObj.music
|
||||
}
|
||||
if(meta.genre){
|
||||
songObj.category = this.categories[meta.genre.toLowerCase()] || meta.genre
|
||||
@ -210,11 +211,33 @@
|
||||
if(meta.taikowebskin){
|
||||
songObj.song_skin = this.getSkin(dir, meta.taikowebskin)
|
||||
}
|
||||
for(var id in allStrings){
|
||||
if(meta["title" + id]){
|
||||
titleLang[id] = meta["title" + id]
|
||||
}
|
||||
if(meta["subtitle" + id]){
|
||||
subtitleLang[id] = meta["subtitle" + id]
|
||||
}
|
||||
}
|
||||
}
|
||||
var titleLangArray = []
|
||||
for(var id in titleLang){
|
||||
titleLangArray.push(id + " " + titleLang[id])
|
||||
}
|
||||
if(titleLangArray.length !== 0){
|
||||
songObj.title_lang = titleLangArray.join("\n")
|
||||
}
|
||||
var subtitleLangArray = []
|
||||
for(var id in subtitleLang){
|
||||
subtitleLangArray.push(id + " " + subtitleLang[id])
|
||||
}
|
||||
if(subtitleLangArray.length !== 0){
|
||||
songObj.subtitle_lang = subtitleLangArray.join("\n")
|
||||
}
|
||||
if(!songObj.category){
|
||||
songObj.category = category || this.getCategory(file)
|
||||
}
|
||||
if(songObj.music && songObj.stars.filter(star => star).length !== 0){
|
||||
if(songObj.stars.length !== 0){
|
||||
this.songs[index] = songObj
|
||||
}
|
||||
}).catch(() => {})
|
||||
@ -237,10 +260,10 @@
|
||||
type: "osu",
|
||||
chart: data,
|
||||
subtitle: osu.metadata.ArtistUnicode || osu.metadata.Artist,
|
||||
subtitle_en: osu.metadata.Artist || osu.metadata.ArtistUnicode,
|
||||
subtitle_lang: osu.metadata.Artist || osu.metadata.ArtistUnicode,
|
||||
preview: osu.generalInfo.PreviewTime / 1000,
|
||||
stars: [null, null, null, parseInt(osu.difficulty.overallDifficulty) || 1],
|
||||
music: this.otherFiles[dir + osu.generalInfo.AudioFilename.toLowerCase()]
|
||||
music: this.otherFiles[dir + osu.generalInfo.AudioFilename.toLowerCase()] || "muted"
|
||||
}
|
||||
var filename = file.name.slice(0, file.name.lastIndexOf("."))
|
||||
var title = osu.metadata.TitleUnicode || osu.metadata.Title
|
||||
@ -251,13 +274,11 @@
|
||||
suffix = " " + matches[0]
|
||||
}
|
||||
songObj.title = title + suffix
|
||||
songObj.title_en = (osu.metadata.Title || osu.metadata.TitleUnicode) + suffix
|
||||
songObj.title_lang = (osu.metadata.Title || osu.metadata.TitleUnicode) + suffix
|
||||
}else{
|
||||
songObj.title = filename
|
||||
}
|
||||
if(songObj.music){
|
||||
this.songs[index] = songObj
|
||||
}
|
||||
this.songs[index] = songObj
|
||||
songObj.category = category || this.getCategory(file)
|
||||
}).catch(() => {})
|
||||
reader.readAsText(file)
|
||||
|
@ -97,16 +97,18 @@ class LoadSong{
|
||||
if(songObj.sound){
|
||||
songObj.sound.gain = snd.musicGain
|
||||
resolve()
|
||||
}else if(songObj.music){
|
||||
}else if(!songObj.music){
|
||||
snd.musicGain.load(gameConfig.songs_baseurl + id + "/main.mp3").then(sound => {
|
||||
songObj.sound = sound
|
||||
resolve()
|
||||
}, reject)
|
||||
}else if(songObj.music !== "muted"){
|
||||
snd.musicGain.load(songObj.music, true).then(sound => {
|
||||
songObj.sound = sound
|
||||
resolve()
|
||||
}, reject)
|
||||
}else{
|
||||
snd.musicGain.load(gameConfig.songs_baseurl + id + "/main.mp3").then(sound => {
|
||||
songObj.sound = sound
|
||||
resolve()
|
||||
}, reject)
|
||||
resolve()
|
||||
}
|
||||
}))
|
||||
if(songObj.chart){
|
||||
@ -119,10 +121,10 @@ class LoadSong{
|
||||
Promise.all(promises).then(() => {
|
||||
this.setupMultiplayer()
|
||||
}, error => {
|
||||
console.error(error)
|
||||
if(Array.isArray(error) && error[1] instanceof HTMLElement){
|
||||
error = error[0] + ": " + error[1].outerHTML
|
||||
}
|
||||
console.error(error)
|
||||
pageEvents.send("load-song-error", error)
|
||||
errorMessage(new Error(error).stack)
|
||||
alert("An error occurred, please refresh")
|
||||
|
@ -44,7 +44,7 @@
|
||||
var hasSong = false
|
||||
var courses = {}
|
||||
var currentCourse = {}
|
||||
var courseName = this.difficulty
|
||||
var courseName = "oni"
|
||||
for(var lineNum = 0; lineNum < this.data.length; lineNum++){
|
||||
var line = this.data[lineNum]
|
||||
|
||||
@ -55,10 +55,10 @@
|
||||
|
||||
inSong = true
|
||||
if(!hasSong){
|
||||
if(!(courseName in courses)){
|
||||
courses[courseName] = {}
|
||||
}
|
||||
for(var name in currentCourse){
|
||||
if(!(courseName in courses)){
|
||||
courses[courseName] = {}
|
||||
}
|
||||
if(name !== "branch"){
|
||||
courses[courseName][name] = currentCourse[name]
|
||||
}
|
||||
@ -118,10 +118,7 @@
|
||||
parseCircles(){
|
||||
var meta = this.metadata[this.difficulty]
|
||||
var ms = (meta.offset || 0) * -1000 + this.offset
|
||||
var bpm = meta.bpm || 0
|
||||
if(bpm <= 0){
|
||||
bpm = 1
|
||||
}
|
||||
var bpm = Math.abs(meta.bpm) || 120
|
||||
var scroll = 1
|
||||
var measure = 4
|
||||
this.beatInfo.beatInterval = 60000 / bpm
|
||||
@ -227,7 +224,7 @@
|
||||
bpm = parseFloat(value) || bpm
|
||||
break
|
||||
case "scroll":
|
||||
scroll = parseFloat(value) || scroll
|
||||
scroll = Math.abs(parseFloat(value)) || scroll
|
||||
break
|
||||
case "measure":
|
||||
var [numerator, denominator] = value.split("/")
|
||||
|
@ -1753,15 +1753,15 @@ class SongSelect{
|
||||
}
|
||||
|
||||
new Promise((resolve, reject) => {
|
||||
if(currentSong.music){
|
||||
songObj.preview_time = prvTime
|
||||
snd.previewGain.load(currentSong.music, true).then(resolve, reject)
|
||||
}else{
|
||||
if(!currentSong.music){
|
||||
songObj.preview_time = 0
|
||||
loadPreview(previewFilename).catch(() => {
|
||||
songObj.preview_time = prvTime
|
||||
return loadPreview("/main.mp3")
|
||||
}).then(resolve, reject)
|
||||
}else if(currentSong.music !== "muted"){
|
||||
songObj.preview_time = prvTime
|
||||
snd.previewGain.load(currentSong.music, true).then(resolve, reject)
|
||||
}
|
||||
}).then(sound => {
|
||||
if(currentId === this.previewId){
|
||||
|
@ -1180,6 +1180,10 @@
|
||||
}
|
||||
setDonBgHeight(){
|
||||
this.donBg.style.setProperty("--h", getComputedStyle(this.donBg).height)
|
||||
this.gameDiv.classList.add("fix-animations")
|
||||
setTimeout(()=>{
|
||||
this.gameDiv.classList.remove("fix-animations")
|
||||
}, 50)
|
||||
}
|
||||
setLayers(elements, file, ab){
|
||||
if(ab){
|
||||
|
Loading…
Reference in New Issue
Block a user