Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
Taiko Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Taiko Web
Commits
6d07afaa
Commit
6d07afaa
authored
Oct 28, 2018
by
Bui
Committed by
GitHub
Oct 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #63 from bui/game-config
add game config
parents
5fcdca89
2598a501
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
8 deletions
+34
-8
.gitignore
.gitignore
+1
-0
app.py
app.py
+16
-0
config.example.json
config.example.json
+3
-0
public/src/js/assets.js
public/src/js/assets.js
+2
-0
public/src/js/controller.js
public/src/js/controller.js
+1
-1
public/src/js/loader.js
public/src/js/loader.js
+4
-0
public/src/js/loadsong.js
public/src/js/loadsong.js
+3
-3
public/src/js/songselect.js
public/src/js/songselect.js
+3
-3
public/src/js/view.js
public/src/js/view.js
+1
-1
No files found.
.gitignore
View file @
6d07afaa
...
@@ -46,3 +46,4 @@ public/api
...
@@ -46,3 +46,4 @@ public/api
taiko.db
taiko.db
version.json
version.json
public/index.html
public/index.html
config.json
\ No newline at end of file
app.py
View file @
6d07afaa
...
@@ -163,6 +163,22 @@ def route_api_songs():
...
@@ -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
...
...
config.example.json
0 → 100644
View file @
6d07afaa
{
"songs_baseurl"
:
""
}
public/src/js/assets.js
View file @
6d07afaa
...
@@ -125,3 +125,5 @@ var assets = {
...
@@ -125,3 +125,5 @@ var assets = {
"
image
"
:
{},
"
image
"
:
{},
"
pages
"
:
{}
"
pages
"
:
{}
}
}
var
gameConfig
=
{}
public/src/js/controller.js
View file @
6d07afaa
...
@@ -7,7 +7,7 @@ class Controller{
...
@@ -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
)
...
...
public/src/js/loader.js
View file @
6d07afaa
...
@@ -78,6 +78,10 @@ class Loader{
...
@@ -78,6 +78,10 @@ class Loader{
this
.
promises
.
push
(
this
.
ajax
(
"
/api/songs
"
).
then
(
songs
=>
{
this
.
promises
.
push
(
this
.
ajax
(
"
/api/songs
"
).
then
(
songs
=>
{
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
)
...
...
public/src/js/loadsong.js
View file @
6d07afaa
...
@@ -19,7 +19,7 @@ class loadSong{
...
@@ -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{
...
@@ -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{
...
@@ -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
{
...
...
public/src/js/songselect.js
View file @
6d07afaa
class
SongSelect
{
class
SongSelect
{
constructor
(
fromTutorial
,
fadeIn
,
touchEnabled
){
constructor
(
fromTutorial
,
fadeIn
,
touchEnabled
){
this
.
touchEnabled
=
touchEnabled
this
.
touchEnabled
=
touchEnabled
loader
.
changePage
(
"
songselect
"
)
loader
.
changePage
(
"
songselect
"
)
this
.
canvas
=
document
.
getElementById
(
"
song-sel-canvas
"
)
this
.
canvas
=
document
.
getElementById
(
"
song-sel-canvas
"
)
this
.
ctx
=
this
.
canvas
.
getContext
(
"
2d
"
)
this
.
ctx
=
this
.
canvas
.
getContext
(
"
2d
"
)
this
.
songSkin
=
{
this
.
songSkin
=
{
"
selected
"
:
{
"
selected
"
:
{
background
:
"
#ffdb2c
"
,
background
:
"
#ffdb2c
"
,
...
@@ -1363,7 +1363,7 @@ class SongSelect{
...
@@ -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
...
...
public/src/js/view.js
View file @
6d07afaa
...
@@ -751,7 +751,7 @@
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment