mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 07:21:50 +08:00
commit
6d07afaa11
1
.gitignore
vendored
1
.gitignore
vendored
@ -46,3 +46,4 @@ public/api
|
|||||||
taiko.db
|
taiko.db
|
||||||
version.json
|
version.json
|
||||||
public/index.html
|
public/index.html
|
||||||
|
config.json
|
16
app.py
16
app.py
@ -163,6 +163,22 @@ def route_api_songs():
|
|||||||
return jsonify(songs_out)
|
return jsonify(songs_out)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/api/config')
|
||||||
|
def route_api_config():
|
||||||
|
if os.path.isfile('config.json'):
|
||||||
|
config = json.load(open('config.json', 'r'))
|
||||||
|
else:
|
||||||
|
print 'WARNING: No config.json found, using default values'
|
||||||
|
config = {
|
||||||
|
'songs_baseurl': ''.join([request.host_url, 'songs']) + '/'
|
||||||
|
}
|
||||||
|
|
||||||
|
if not config.get('songs_baseurl'):
|
||||||
|
config['songs_baseurl'] = ''.join([request.host_url, 'songs']) + '/'
|
||||||
|
|
||||||
|
return jsonify(config)
|
||||||
|
|
||||||
|
|
||||||
def make_preview(song_id, song_type):
|
def make_preview(song_id, song_type):
|
||||||
song_path = 'public/songs/%s/main.mp3' % song_id
|
song_path = 'public/songs/%s/main.mp3' % song_id
|
||||||
prev_path = 'public/songs/%s/preview.mp3' % song_id
|
prev_path = 'public/songs/%s/preview.mp3' % song_id
|
||||||
|
3
config.example.json
Normal file
3
config.example.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"songs_baseurl": ""
|
||||||
|
}
|
@ -125,3 +125,5 @@ var assets = {
|
|||||||
"image": {},
|
"image": {},
|
||||||
"pages": {}
|
"pages": {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var gameConfig = {}
|
||||||
|
@ -7,7 +7,7 @@ class Controller{
|
|||||||
this.touchEnabled = touchEnabled
|
this.touchEnabled = touchEnabled
|
||||||
this.snd = this.multiplayer ? "_p" + this.multiplayer : ""
|
this.snd = this.multiplayer ? "_p" + this.multiplayer : ""
|
||||||
|
|
||||||
var backgroundURL = "/songs/" + this.selectedSong.folder + "/bg.png"
|
var backgroundURL = gameConfig.songs_baseurl + this.selectedSong.folder + "/bg.png"
|
||||||
|
|
||||||
if(selectedSong.type === "tja"){
|
if(selectedSong.type === "tja"){
|
||||||
this.parsedSongData = new ParseTja(songData, selectedSong.difficulty, selectedSong.offset)
|
this.parsedSongData = new ParseTja(songData, selectedSong.difficulty, selectedSong.offset)
|
||||||
|
@ -79,6 +79,10 @@ class Loader{
|
|||||||
assets.songs = JSON.parse(songs)
|
assets.songs = JSON.parse(songs)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
this.promises.push(this.ajax("/api/config").then(conf => {
|
||||||
|
gameConfig = JSON.parse(conf)
|
||||||
|
}))
|
||||||
|
|
||||||
assets.views.forEach(name => {
|
assets.views.forEach(name => {
|
||||||
var id = this.getFilename(name)
|
var id = this.getFilename(name)
|
||||||
this.promises.push(this.ajax("src/views/" + name).then(page => {
|
this.promises.push(this.ajax("src/views/" + name).then(page => {
|
||||||
|
@ -19,7 +19,7 @@ class loadSong{
|
|||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
img.id = "music-bg"
|
img.id = "music-bg"
|
||||||
img.src = "/songs/" + id + "/bg.png"
|
img.src = gameConfig.songs_baseurl + id + "/bg.png"
|
||||||
document.getElementById("assets").appendChild(img)
|
document.getElementById("assets").appendChild(img)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class loadSong{
|
|||||||
songObj.sound.gain = snd.musicGain
|
songObj.sound.gain = snd.musicGain
|
||||||
resolve()
|
resolve()
|
||||||
}else{
|
}else{
|
||||||
snd.musicGain.load("/songs/" + id + "/main.mp3").then(sound => {
|
snd.musicGain.load(gameConfig.songs_baseurl + id + "/main.mp3").then(sound => {
|
||||||
songObj.sound = sound
|
songObj.sound = sound
|
||||||
resolve()
|
resolve()
|
||||||
}, reject)
|
}, reject)
|
||||||
@ -51,7 +51,7 @@ class loadSong{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
getSongPath(selectedSong){
|
getSongPath(selectedSong){
|
||||||
var directory = "/songs/" + selectedSong.folder + "/"
|
var directory = gameConfig.songs_baseurl + selectedSong.folder + "/"
|
||||||
if(selectedSong.type === "tja"){
|
if(selectedSong.type === "tja"){
|
||||||
return directory + "main.tja"
|
return directory + "main.tja"
|
||||||
}else{
|
}else{
|
||||||
|
@ -1363,7 +1363,7 @@ class SongSelect{
|
|||||||
var previewFilename = prvTime > 0.1 ? "/preview.mp3" : "/main.mp3"
|
var previewFilename = prvTime > 0.1 ? "/preview.mp3" : "/main.mp3"
|
||||||
|
|
||||||
var loadPreview = previewFilename => {
|
var loadPreview = previewFilename => {
|
||||||
return snd.previewGain.load("/songs/" + id + previewFilename)
|
return snd.previewGain.load(gameConfig.songs_baseurl + id + previewFilename)
|
||||||
}
|
}
|
||||||
|
|
||||||
songObj.preview_time = 0
|
songObj.preview_time = 0
|
||||||
|
@ -751,7 +751,7 @@
|
|||||||
setBackground(){
|
setBackground(){
|
||||||
var gameDiv = document.getElementById("game")
|
var gameDiv = document.getElementById("game")
|
||||||
var selectedSong = this.controller.selectedSong
|
var selectedSong = this.controller.selectedSong
|
||||||
var bg = "/songs/" + selectedSong.folder + "/bg.png"
|
var bg = gameConfig.songs_baseurl + selectedSong.folder + "/bg.png"
|
||||||
if(selectedSong.defaultBg){
|
if(selectedSong.defaultBg){
|
||||||
var categories = {
|
var categories = {
|
||||||
"J-POP": 0,
|
"J-POP": 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user