taiko-web development has returned to GitHub. This Gitea instance will be shut down soon.
If your taiko-web fork is unavailable due to DMCA takedown, you can contact GitHub Support and ask for it to be deleted.
Browse Source

remove ogg test

Bui 2 months ago
parent
commit
8e75917827
2 changed files with 71 additions and 83 deletions
  1. 0
    1
      public/src/js/assets.js
  2. 71
    82
      public/src/js/loader.js

+ 0
- 1
public/src/js/assets.js View File

@@ -155,7 +155,6 @@ var assets = {
155 155
 		"bgm_result.mp3",
156 156
 		"bgm_setsume.mp3"
157 157
 	],
158
-	"audioOgg": "note_ka.ogg",
159 158
 	"fonts": [
160 159
 		"Kozuka",
161 160
 		"TnT"

+ 71
- 82
public/src/js/loader.js View File

@@ -90,7 +90,7 @@ class Loader{
90 90
 		}))
91 91
 		
92 92
 		this.afterJSCount =
93
-			[assets.audioOgg, "blurPerformance", "P2Connection"].length +
93
+			["blurPerformance", "P2Connection"].length +
94 94
 			assets.fonts.length +
95 95
 			assets.audioSfx.length +
96 96
 			assets.audioMusic.length +
@@ -113,88 +113,80 @@ class Loader{
113 113
 			)
114 114
 			snd.sfxLoudGain.setVolume(1.2)
115 115
 			
116
-			this.afterJSCount--
116
+			this.afterJSCount = 0
117 117
 			
118
-			this.addPromise(snd.buffer.load(gameConfig.assets_baseurl + "audio/" + assets.audioOgg).then(() => {
119
-				this.oggNotSupported = false
120
-			}, () => {
121
-				this.oggNotSupported = true
122
-			}).then(() => {
123
-				
124
-				this.afterJSCount = 0
125
-				
126
-				assets.fonts.forEach(name => {
127
-					this.addPromise(new Promise(resolve => {
128
-						FontDetect.onFontLoaded(name, resolve, resolve, {msTimeout: Infinity})
129
-					}))
130
-				})
131
-				
132
-				assets.audioSfx.forEach(name => {
133
-					this.addPromise(this.loadSound(name, snd.sfxGain))
134
-				})
135
-				assets.audioMusic.forEach(name => {
136
-					this.addPromise(this.loadSound(name, snd.musicGain))
137
-				})
138
-				assets.audioSfxLR.forEach(name => {
139
-					this.addPromise(this.loadSound(name, snd.sfxGain).then(sound => {
140
-						var id = this.getFilename(name)
141
-						assets.sounds[id + "_p1"] = assets.sounds[id].copy(snd.sfxGainL)
142
-						assets.sounds[id + "_p2"] = assets.sounds[id].copy(snd.sfxGainR)
143
-					}))
144
-				})
145
-				assets.audioSfxLoud.forEach(name => {
146
-					this.addPromise(this.loadSound(name, snd.sfxLoudGain))
147
-				})
148
-				
149
-				this.canvasTest = new CanvasTest()
150
-				this.addPromise(this.canvasTest.blurPerformance().then(result => {
151
-					perf.blur = result
152
-					if(result > 1000 / 50){
153
-						// Less than 50 fps with blur enabled
154
-						disableBlur = true
155
-					}
118
+			assets.fonts.forEach(name => {
119
+				this.addPromise(new Promise(resolve => {
120
+					FontDetect.onFontLoaded(name, resolve, resolve, {msTimeout: Infinity})
121
+				}))
122
+			})
123
+			
124
+			assets.audioSfx.forEach(name => {
125
+				this.addPromise(this.loadSound(name, snd.sfxGain))
126
+			})
127
+			assets.audioMusic.forEach(name => {
128
+				this.addPromise(this.loadSound(name, snd.musicGain))
129
+			})
130
+			assets.audioSfxLR.forEach(name => {
131
+				this.addPromise(this.loadSound(name, snd.sfxGain).then(sound => {
132
+					var id = this.getFilename(name)
133
+					assets.sounds[id + "_p1"] = assets.sounds[id].copy(snd.sfxGainL)
134
+					assets.sounds[id + "_p2"] = assets.sounds[id].copy(snd.sfxGainR)
156 135
 				}))
157
-				
158
-				p2 = new P2Connection()
159
-				if(location.hash.length === 6){
160
-					p2.hashLock = true
161
-					this.addPromise(new Promise(resolve => {
162
-						p2.open()
163
-						pageEvents.add(p2, "message", response => {
164
-							if(response.type === "session"){
165
-								resolve()
166
-							}else if(response.type === "gameend"){
167
-								p2.hash("")
168
-								p2.hashLock = false
169
-								resolve()
170
-							}
171
-						})
172
-						p2.send("invite", location.hash.slice(1).toLowerCase())
173
-						setTimeout(() => {
174
-							if(p2.socket.readyState !== 1){
175
-								p2.hash("")
176
-								p2.hashLock = false
177
-								resolve()
178
-							}
179
-						}, 10000)
180
-					}).then(() => {
181
-						pageEvents.remove(p2, "message")
182
-					}))
183
-				}else{
184
-					p2.hash("")
136
+			})
137
+			assets.audioSfxLoud.forEach(name => {
138
+				this.addPromise(this.loadSound(name, snd.sfxLoudGain))
139
+			})
140
+			
141
+			this.canvasTest = new CanvasTest()
142
+			this.addPromise(this.canvasTest.blurPerformance().then(result => {
143
+				perf.blur = result
144
+				if(result > 1000 / 50){
145
+					// Less than 50 fps with blur enabled
146
+					disableBlur = true
185 147
 				}
186
-				
187
-				Promise.all(this.promises).then(() => {
188
-					this.canvasTest.drawAllImages().then(result => {
189
-						perf.allImg = result
190
-						perf.load = Date.now() - this.startTime
191
-						this.canvasTest.clean()
192
-						this.clean()
193
-						this.callback()
194
-					})
195
-				}, this.errorMsg.bind(this))
196
-				
197 148
 			}))
149
+			
150
+			p2 = new P2Connection()
151
+			if(location.hash.length === 6){
152
+				p2.hashLock = true
153
+				this.addPromise(new Promise(resolve => {
154
+					p2.open()
155
+					pageEvents.add(p2, "message", response => {
156
+						if(response.type === "session"){
157
+							resolve()
158
+						}else if(response.type === "gameend"){
159
+							p2.hash("")
160
+							p2.hashLock = false
161
+							resolve()
162
+						}
163
+					})
164
+					p2.send("invite", location.hash.slice(1).toLowerCase())
165
+					setTimeout(() => {
166
+						if(p2.socket.readyState !== 1){
167
+							p2.hash("")
168
+							p2.hashLock = false
169
+							resolve()
170
+						}
171
+					}, 10000)
172
+				}).then(() => {
173
+					pageEvents.remove(p2, "message")
174
+				}))
175
+			}else{
176
+				p2.hash("")
177
+			}
178
+			
179
+			Promise.all(this.promises).then(() => {
180
+				this.canvasTest.drawAllImages().then(result => {
181
+					perf.allImg = result
182
+					perf.load = Date.now() - this.startTime
183
+					this.canvasTest.clean()
184
+					this.clean()
185
+					this.callback()
186
+				})
187
+			}, this.errorMsg.bind(this))
188
+			
189
+		
198 190
 		})
199 191
 	
200 192
 	}
@@ -203,9 +195,6 @@ class Loader{
203 195
 		promise.then(this.assetLoaded.bind(this))
204 196
 	}
205 197
 	loadSound(name, gain){
206
-		if(this.oggNotSupported && name.endsWith(".ogg")){
207
-			name = name.slice(0, -4) + ".wav"
208
-		}
209 198
 		var id = this.getFilename(name)
210 199
 		return gain.load(gameConfig.assets_baseurl + "audio/" + name).then(sound => {
211 200
 			assets.sounds[id] = sound

Loading…
Cancel
Save