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
5fbea99d
Commit
5fbea99d
authored
Oct 13, 2018
by
Bui
Committed by
GitHub
Oct 13, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #55 from LoveEevee/songselect-add-ura
SongSelect: Add ura difficulty
parents
6ccdc18e
09a32355
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
225 additions
and
98 deletions
+225
-98
README.md
README.md
+1
-1
app.py
app.py
+12
-11
public/src/css/game.css
public/src/css/game.css
+3
-1
public/src/css/main.css
public/src/css/main.css
+8
-4
public/src/js/assets.js
public/src/js/assets.js
+1
-0
public/src/js/canvasdraw.js
public/src/js/canvasdraw.js
+22
-6
public/src/js/canvastest.js
public/src/js/canvastest.js
+1
-1
public/src/js/controller.js
public/src/js/controller.js
+10
-11
public/src/js/gamerules.js
public/src/js/gamerules.js
+1
-0
public/src/js/loader.js
public/src/js/loader.js
+10
-0
public/src/js/main.js
public/src/js/main.js
+2
-1
public/src/js/pageevents.js
public/src/js/pageevents.js
+8
-0
public/src/js/parsetja.js
public/src/js/parsetja.js
+10
-2
public/src/js/scoresheet.js
public/src/js/scoresheet.js
+3
-5
public/src/js/songselect.js
public/src/js/songselect.js
+106
-31
public/src/js/soundbuffer.js
public/src/js/soundbuffer.js
+9
-6
public/src/js/titlescreen.js
public/src/js/titlescreen.js
+2
-4
public/src/js/tutorial.js
public/src/js/tutorial.js
+2
-3
public/src/js/view.js
public/src/js/view.js
+12
-9
templates/index.html
templates/index.html
+2
-2
No files found.
README.md
View file @
5fbea99d
...
@@ -10,7 +10,7 @@ Still in developement. Works best with Chrome.
...
@@ -10,7 +10,7 @@ Still in developement. Works best with Chrome.
Create a SQLite databse named
`taiko.db`
with the following schema:
Create a SQLite databse named
`taiko.db`
with the following schema:
CREATE TABLE "songs" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `title_en` TEXT, `easy` INTEGER, `normal` INTEGER, `hard` INTEGER, `oni` INTEGER, `enabled` INTEGER NOT NULL, `category` INTEGER, `type` TEXT , `offset` REAL NOT NULL )
CREATE TABLE "songs" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `title_en` TEXT, `easy` INTEGER, `normal` INTEGER, `hard` INTEGER, `oni` INTEGER, `
ura` INTEGER, `
enabled` INTEGER NOT NULL, `category` INTEGER, `type` TEXT , `offset` REAL NOT NULL )
CREATE TABLE "categories" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `title_en` TEXT NOT NULL )
CREATE TABLE "categories" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `title_en` TEXT NOT NULL )
When inserting song rows, leave any difficulty columns as NULL if you don't intend to add notecharts for them.
When inserting song rows, leave any difficulty columns as NULL if you don't intend to add notecharts for them.
...
...
app.py
View file @
5fbea99d
...
@@ -105,33 +105,34 @@ def route_api_songs():
...
@@ -105,33 +105,34 @@ def route_api_songs():
categories
[
cat
[
0
]]
=
{
'title'
:
cat
[
1
],
'title_en'
:
cat
[
2
]}
categories
[
cat
[
0
]]
=
{
'title'
:
cat
[
1
],
'title_en'
:
cat
[
2
]}
songs_out
=
[]
songs_out
=
[]
for
song
in
songs
:
for
song
in
songs
:
type
=
song
[
9
]
song_id
=
song
[
0
]
if
type
==
"tja"
:
song_type
=
song
[
10
]
if
os
.
path
.
isfile
(
'public/songs/
%
s/main.tja'
%
song
[
0
]):
if
song_type
==
"tja"
:
preview
=
get_tja_preview
(
'public/songs/
%
s/main.tja'
%
song
[
0
])
if
os
.
path
.
isfile
(
'public/songs/
%
s/main.tja'
%
song_id
):
preview
=
get_tja_preview
(
'public/songs/
%
s/main.tja'
%
song_id
)
else
:
else
:
preview
=
0
preview
=
0
else
:
else
:
osus
=
[
osu
for
osu
in
os
.
listdir
(
'public/songs/
%
s'
%
song
[
0
]
)
if
osu
in
[
'easy.osu'
,
'normal.osu'
,
'hard.osu'
,
'oni.osu'
]]
osus
=
[
osu
for
osu
in
os
.
listdir
(
'public/songs/
%
s'
%
song
_id
)
if
osu
in
[
'easy.osu'
,
'normal.osu'
,
'hard.osu'
,
'oni.osu'
]]
if
osus
:
if
osus
:
osud
=
parse_osu
(
'public/songs/
%
s/
%
s'
%
(
song
[
0
]
,
osus
[
0
]))
osud
=
parse_osu
(
'public/songs/
%
s/
%
s'
%
(
song
_id
,
osus
[
0
]))
preview
=
int
(
get_osu_key
(
osud
,
'General'
,
'PreviewTime'
,
0
))
preview
=
int
(
get_osu_key
(
osud
,
'General'
,
'PreviewTime'
,
0
))
else
:
else
:
preview
=
0
preview
=
0
category_out
=
categories
[
song
[
8
]]
if
song
[
8
]
in
categories
else
def_category
category_out
=
categories
[
song
[
9
]]
if
song
[
9
]
in
categories
else
def_category
songs_out
.
append
({
songs_out
.
append
({
'id'
:
song
[
0
]
,
'id'
:
song
_id
,
'title'
:
song
[
1
],
'title'
:
song
[
1
],
'title_en'
:
song
[
2
],
'title_en'
:
song
[
2
],
'stars'
:
[
'stars'
:
[
song
[
3
],
song
[
4
],
song
[
5
],
song
[
6
]
song
[
3
],
song
[
4
],
song
[
5
],
song
[
6
]
,
song
[
7
]
],
],
'preview'
:
preview
,
'preview'
:
preview
,
'category'
:
category_out
[
'title'
],
'category'
:
category_out
[
'title'
],
'category_en'
:
category_out
[
'title_en'
],
'category_en'
:
category_out
[
'title_en'
],
'type'
:
type
,
'type'
:
song_
type
,
'offset'
:
song
[
1
0
]
'offset'
:
song
[
1
1
]
})
})
return
jsonify
(
songs_out
)
return
jsonify
(
songs_out
)
...
...
public/src/css/game.css
View file @
5fbea99d
#game
{
#game
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
position
:
asbolute
;
overflow
:
hidden
;
overflow
:
hidden
;
background-size
:
cover
;
background-size
:
cover
;
}
}
...
@@ -32,7 +33,7 @@
...
@@ -32,7 +33,7 @@
border
:
.5vmin
solid
#ae7a26
;
border
:
.5vmin
solid
#ae7a26
;
background
:
#fff
;
background
:
#fff
;
color
:
#000
;
color
:
#000
;
font-family
:
TnT
;
font-family
:
TnT
,
Meiryo
,
sans-serif
;
font-size
:
3.5vmin
;
font-size
:
3.5vmin
;
border-radius
:
1.5vmin
;
border-radius
:
1.5vmin
;
outline
:
none
;
outline
:
none
;
...
@@ -61,6 +62,7 @@
...
@@ -61,6 +62,7 @@
height
:
50%
;
height
:
50%
;
text-align
:
center
;
text-align
:
center
;
margin
:
auto
;
margin
:
auto
;
overflow
:
hidden
;
}
}
#touch-drum-img
{
#touch-drum-img
{
width
:
100%
;
width
:
100%
;
...
...
public/src/css/main.css
View file @
5fbea99d
...
@@ -13,6 +13,7 @@ body{
...
@@ -13,6 +13,7 @@ body{
height
:
100%
;
height
:
100%
;
background
:
#fe7839
;
background
:
#fe7839
;
user-select
:
none
;
user-select
:
none
;
touch-action
:
none
;
}
}
#screen
{
#screen
{
width
:
100%
;
width
:
100%
;
...
@@ -20,7 +21,7 @@ body{
...
@@ -20,7 +21,7 @@ body{
margin
:
0
;
margin
:
0
;
padding
:
0
;
padding
:
0
;
background
:
#fe7839
url("/assets/img/bg-pattern-1.png")
top
center
;
background
:
#fe7839
url("/assets/img/bg-pattern-1.png")
top
center
;
font-family
:
TnT
;
font-family
:
TnT
,
Meiryo
,
sans-serif
;
}
}
#assets
{
#assets
{
display
:
none
;
display
:
none
;
...
@@ -233,13 +234,16 @@ kbd{
...
@@ -233,13 +234,16 @@ kbd{
bottom
:
1vh
;
bottom
:
1vh
;
right
:
1vh
;
right
:
1vh
;
opacity
:
0.7
;
opacity
:
0.7
;
font-family
:
TnT
;
font-family
:
TnT
,
Meiryo
,
sans-serif
;
}
#version
:hover
{
opacity
:
1
;
}
}
#version
a
{
#version
-link
{
color
:
#FFFFFF
;
color
:
#FFFFFF
;
text-decoration
:
none
;
text-decoration
:
none
;
cursor
:
default
;
pointer-events
:
none
;
}
}
.version-hide
{
.version-hide
{
...
...
public/src/js/assets.js
View file @
5fbea99d
...
@@ -22,6 +22,7 @@ var assets = {
...
@@ -22,6 +22,7 @@ var assets = {
"
muzu_normal.png
"
,
"
muzu_normal.png
"
,
"
muzu_hard.png
"
,
"
muzu_hard.png
"
,
"
muzu_oni.png
"
,
"
muzu_oni.png
"
,
"
muzu_ura.png
"
,
"
don_anim_normal.png
"
,
"
don_anim_normal.png
"
,
"
don_anim_10combo.png
"
,
"
don_anim_10combo.png
"
,
"
don_anim_gogo.png
"
,
"
don_anim_gogo.png
"
,
...
...
public/src/js/canvasdraw.js
View file @
5fbea99d
...
@@ -229,6 +229,12 @@
...
@@ -229,6 +229,12 @@
easeIn
(
pos
){
easeIn
(
pos
){
return
1
-
Math
.
cos
(
Math
.
PI
/
2
*
pos
)
return
1
-
Math
.
cos
(
Math
.
PI
/
2
*
pos
)
}
}
easeOut
(
pos
){
return
Math
.
sin
(
Math
.
PI
/
2
*
pos
)
}
easeInOut
(
pos
){
return
(
Math
.
cos
(
Math
.
PI
*
pos
)
-
1
)
/
-
2
}
verticalText
(
config
){
verticalText
(
config
){
var
ctx
=
config
.
ctx
var
ctx
=
config
.
ctx
...
@@ -508,7 +514,7 @@
...
@@ -508,7 +514,7 @@
ctx
.
save
()
ctx
.
save
()
ctx
.
lineWidth
=
config
.
border
ctx
.
lineWidth
=
config
.
border
ctx
.
strokeStyle
=
"
#000
"
ctx
.
strokeStyle
=
"
#000
"
var
icon
=
this
.
diffIconPath
[
config
.
diff
]
var
icon
=
this
.
diffIconPath
[
config
.
diff
===
4
?
3
:
config
.
diff
]
ctx
.
translate
(
config
.
x
-
icon
[
0
].
w
*
scale
/
2
,
config
.
y
-
icon
[
0
].
h
*
scale
/
2
)
ctx
.
translate
(
config
.
x
-
icon
[
0
].
w
*
scale
/
2
,
config
.
y
-
icon
[
0
].
h
*
scale
/
2
)
ctx
.
scale
(
scale
,
scale
)
ctx
.
scale
(
scale
,
scale
)
for
(
var
i
=
1
;
i
<
icon
.
length
;
i
++
){
for
(
var
i
=
1
;
i
<
icon
.
length
;
i
++
){
...
@@ -518,7 +524,11 @@
...
@@ -518,7 +524,11 @@
}
}
if
(
!
config
.
noFill
){
if
(
!
config
.
noFill
){
for
(
var
i
=
1
;
i
<
icon
.
length
;
i
++
){
for
(
var
i
=
1
;
i
<
icon
.
length
;
i
++
){
ctx
.
fillStyle
=
icon
[
i
].
fill
if
(
config
.
diff
===
4
&&
icon
[
i
].
fill
===
"
#db1885
"
){
ctx
.
fillStyle
=
"
#7135db
"
}
else
{
ctx
.
fillStyle
=
icon
[
i
].
fill
}
ctx
.
fill
(
icon
[
i
].
d
)
ctx
.
fill
(
icon
[
i
].
d
)
}
}
}
}
...
@@ -619,18 +629,19 @@
...
@@ -619,18 +629,19 @@
diffStar
(
config
){
diffStar
(
config
){
var
ctx
=
config
.
ctx
var
ctx
=
config
.
ctx
ctx
.
save
()
ctx
.
save
()
if
(
config
.
songSel
){
if
(
config
.
songSel
||
config
.
ura
){
if
(
this
.
diffStarCache
.
scale
!==
config
.
ratio
){
if
(
this
.
diffStarCache
.
scale
!==
config
.
ratio
){
this
.
diffStarCache
.
resize
(
30
,
30
,
config
.
ratio
)
this
.
diffStarCache
.
resize
(
62
,
31
,
config
.
ratio
)
}
}
var
offset
=
30
/
2
-
18
/
2
var
offset
=
30
/
2
-
18
/
2
var
big
=
config
.
ura
&&
!
config
.
songSel
this
.
diffStarCache
.
get
({
this
.
diffStarCache
.
get
({
ctx
:
ctx
,
ctx
:
ctx
,
x
:
config
.
x
-
9
-
offset
,
x
:
config
.
x
-
9
-
offset
,
y
:
config
.
y
-
9
-
offset
,
y
:
config
.
y
-
9
-
offset
,
w
:
30
,
w
:
30
,
h
:
30
,
h
:
30
,
id
:
"
star
"
id
:
big
?
"
big
"
:
"
small
"
},
ctx
=>
{
},
ctx
=>
{
ctx
.
fillStyle
=
"
#fff
"
ctx
.
fillStyle
=
"
#fff
"
this
.
shadow
({
this
.
shadow
({
...
@@ -639,7 +650,12 @@
...
@@ -639,7 +650,12 @@
blur
:
10
,
blur
:
10
,
force
:
true
force
:
true
})
})
ctx
.
translate
(
offset
,
offset
)
if
(
big
){
ctx
.
translate
(
30
/
2
-
21
/
2
,
30
/
2
-
19
/
2
)
ctx
.
scale
(
1.1
,
1.1
)
}
else
{
ctx
.
translate
(
offset
,
offset
)
}
ctx
.
fill
(
this
.
diffStarPath
)
ctx
.
fill
(
this
.
diffStarPath
)
})
})
}
else
{
}
else
{
...
...
public/src/js/canvastest.js
View file @
5fbea99d
...
@@ -103,7 +103,7 @@ class CanvasTest{
...
@@ -103,7 +103,7 @@ class CanvasTest{
var
comboX
=
100
var
comboX
=
100
var
comboY
=
100
var
comboY
=
100
var
fontSize
=
120
var
fontSize
=
120
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
"
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
, Meiryo, sans-serif
"
this
.
ctx
.
textAlign
=
"
center
"
this
.
ctx
.
textAlign
=
"
center
"
this
.
ctx
.
strokeStyle
=
"
#000
"
this
.
ctx
.
strokeStyle
=
"
#000
"
this
.
ctx
.
lineWidth
=
fontSize
/
10
this
.
ctx
.
lineWidth
=
fontSize
/
10
...
...
public/src/js/controller.js
View file @
5fbea99d
...
@@ -40,17 +40,17 @@ class Controller{
...
@@ -40,17 +40,17 @@ class Controller{
}
}
}
}
loadUIEvents
(){
loadUIEvents
(){
this
.
pauseMenu
=
document
.
getElementById
(
"
pause-menu
"
)
this
.
continueBtn
=
document
.
getElementById
(
"
continue-butt
"
)
this
.
continueBtn
=
document
.
getElementById
(
"
continue-butt
"
)
this
.
restartBtn
=
document
.
getElementById
(
"
restart-butt
"
)
this
.
restartBtn
=
document
.
getElementById
(
"
restart-butt
"
)
this
.
songSelBtn
=
document
.
getElementById
(
"
song-selection-butt
"
)
this
.
songSelBtn
=
document
.
getElementById
(
"
song-selection-butt
"
)
pageEvents
.
add
(
this
.
continueBtn
,
"
click
"
,
()
=>
{
pageEvents
.
add
(
this
.
pauseMenu
,
"
touchstart
"
,
event
=>
event
.
preventDefault
())
this
.
togglePauseMenu
()
pageEvents
.
add
(
this
.
continueBtn
,
[
"
click
"
,
"
touchend
"
],
this
.
togglePauseMenu
.
bind
(
this
))
})
pageEvents
.
add
(
this
.
restartBtn
,
[
"
click
"
,
"
touchend
"
],
()
=>
{
pageEvents
.
add
(
this
.
restartBtn
,
"
click
"
,
()
=>
{
assets
.
sounds
[
"
don
"
].
play
()
assets
.
sounds
[
"
don
"
].
play
()
this
.
restartSong
()
this
.
restartSong
()
})
})
pageEvents
.
add
(
this
.
songSelBtn
,
"
click
"
,
()
=>
{
pageEvents
.
add
(
this
.
songSelBtn
,
[
"
click
"
,
"
touchend
"
]
,
()
=>
{
assets
.
sounds
[
"
don
"
].
play
()
assets
.
sounds
[
"
don
"
].
play
()
this
.
songSelection
()
this
.
songSelection
()
})
})
...
@@ -63,9 +63,6 @@ class Controller{
...
@@ -63,9 +63,6 @@ class Controller{
stopMainLoop
(){
stopMainLoop
(){
this
.
mainLoopRunning
=
false
this
.
mainLoopRunning
=
false
this
.
mainAsset
.
stop
()
this
.
mainAsset
.
stop
()
if
(
this
.
syncWith
){
this
.
syncWith
.
stopMainLoop
()
}
}
}
mainLoop
(){
mainLoop
(){
if
(
this
.
mainLoopRunning
){
if
(
this
.
mainLoopRunning
){
...
@@ -212,11 +209,13 @@ class Controller{
...
@@ -212,11 +209,13 @@ class Controller{
this
.
keyboard
.
clean
()
this
.
keyboard
.
clean
()
this
.
view
.
clean
()
this
.
view
.
clean
()
pageEvents
.
remove
(
this
.
continueBtn
,
"
click
"
)
pageEvents
.
remove
(
this
.
pauseMenu
,
"
touchstart
"
)
delete
this
.
pauseMenu
pageEvents
.
remove
(
this
.
continueBtn
,
[
"
click
"
,
"
touchend
"
])
delete
this
.
continueBtn
delete
this
.
continueBtn
pageEvents
.
remove
(
this
.
restartBtn
,
"
click
"
)
pageEvents
.
remove
(
this
.
restartBtn
,
[
"
click
"
,
"
touchend
"
]
)
delete
this
.
restartBtn
delete
this
.
restartBtn
pageEvents
.
remove
(
this
.
songSelBtn
,
"
click
"
)
pageEvents
.
remove
(
this
.
songSelBtn
,
[
"
click
"
,
"
touchend
"
]
)
delete
this
.
songSelBtn
delete
this
.
songSelBtn
}
}
}
}
public/src/js/gamerules.js
View file @
5fbea99d
...
@@ -12,6 +12,7 @@ class GameRules{
...
@@ -12,6 +12,7 @@ class GameRules{
break
break
case
"
hard
"
:
case
"
hard
"
:
case
"
oni
"
:
case
"
oni
"
:
case
"
ura
"
:
this
.
good
=
3
/
2
*
frame
this
.
good
=
3
/
2
*
frame
this
.
ok
=
9
/
2
*
frame
this
.
ok
=
9
/
2
*
frame
this
.
bad
=
13
/
2
*
frame
this
.
bad
=
13
/
2
*
frame
...
...
public/src/js/loader.js
View file @
5fbea99d
...
@@ -6,6 +6,15 @@ class Loader{
...
@@ -6,6 +6,15 @@ class Loader{
this
.
canvasTest
=
new
CanvasTest
()
this
.
canvasTest
=
new
CanvasTest
()
p2
=
new
P2Connection
()
p2
=
new
P2Connection
()
this
.
ajax
(
"
src/views/loader.html
"
).
then
(
this
.
run
.
bind
(
this
))
this
.
ajax
(
"
src/views/loader.html
"
).
then
(
this
.
run
.
bind
(
this
))
pageEvents
.
add
(
root
,
[
"
touchstart
"
,
"
touchmove
"
,
"
touchend
"
],
event
=>
{
event
.
preventDefault
()
})
var
versionDiv
=
document
.
getElementById
(
"
version
"
)
var
versionLink
=
document
.
getElementById
(
"
version-link
"
)
pageEvents
.
add
(
versionDiv
,
[
"
click
"
,
"
touchend
"
],
()
=>
{
versionLink
.
click
()
})
}
}
run
(
page
){
run
(
page
){
this
.
promises
=
[]
this
.
promises
=
[]
...
@@ -152,5 +161,6 @@ class Loader{
...
@@ -152,5 +161,6 @@ class Loader{
delete
this
.
loaderPercentage
delete
this
.
loaderPercentage
delete
this
.
loaderProgress
delete
this
.
loaderProgress
delete
this
.
promises
delete
this
.
promises
pageEvents
.
remove
(
root
,
"
touchstart
"
)
}
}
}
}
public/src/js/main.js
View file @
5fbea99d
function
toggleFullscreen
(){
function
toggleFullscreen
(){
var
root
=
document
.
documentElement
if
(
"
requestFullscreen
"
in
root
){
if
(
"
requestFullscreen
"
in
root
){
if
(
document
.
fullscreenElement
){
if
(
document
.
fullscreenElement
){
document
.
exitFullscreen
()
document
.
exitFullscreen
()
...
@@ -20,6 +19,8 @@ function toggleFullscreen(){
...
@@ -20,6 +19,8 @@ function toggleFullscreen(){
}
}
}
}
}
}
var
root
=
document
.
documentElement
var
fullScreenSupported
=
"
requestFullscreen
"
in
root
||
"
webkitRequestFullscreen
"
in
root
||
"
mozRequestFullScreen
"
in
root
var
pageEvents
=
new
PageEvents
()
var
pageEvents
=
new
PageEvents
()
var
snd
=
{}
var
snd
=
{}
...
...
public/src/js/pageevents.js
View file @
5fbea99d
...
@@ -8,6 +8,10 @@ class PageEvents{
...
@@ -8,6 +8,10 @@ class PageEvents{
this
.
add
(
window
,
"
mousemove
"
,
this
.
mouseEvent
.
bind
(
this
))
this
.
add
(
window
,
"
mousemove
"
,
this
.
mouseEvent
.
bind
(
this
))
}
}
add
(
target
,
type
,
callback
){
add
(
target
,
type
,
callback
){
if
(
Array
.
isArray
(
type
)){
type
.
forEach
(
type
=>
this
.
add
(
target
,
type
,
callback
))
return
}
this
.
remove
(
target
,
type
)
this
.
remove
(
target
,
type
)
var
addedEvent
=
this
.
allEvents
.
get
(
target
)
var
addedEvent
=
this
.
allEvents
.
get
(
target
)
if
(
!
addedEvent
){
if
(
!
addedEvent
){
...
@@ -18,6 +22,10 @@ class PageEvents{
...
@@ -18,6 +22,10 @@ class PageEvents{
return
target
.
addEventListener
(
type
,
callback
)
return
target
.
addEventListener
(
type
,
callback
)
}
}
remove
(
target
,
type
){
remove
(
target
,
type
){
if
(
Array
.
isArray
(
type
)){
type
.
forEach
(
type
=>
this
.
remove
(
target
,
type
))
return
}
var
addedEvent
=
this
.
allEvents
.
get
(
target
)
var
addedEvent
=
this
.
allEvents
.
get
(
target
)
if
(
addedEvent
){
if
(
addedEvent
){
var
callback
=
addedEvent
.
get
(
type
)
var
callback
=
addedEvent
.
get
(
type
)
...
...
public/src/js/parsetja.js
View file @
5fbea99d
...
@@ -22,7 +22,14 @@
...
@@ -22,7 +22,14 @@
{
name
:
false
,
txt
:
false
},
{
name
:
false
,
txt
:
false
},
{
name
:
"
balloon
"
,
txt
:
"
ふうせん
"
}
{
name
:
"
balloon
"
,
txt
:
"
ふうせん
"
}
]
]
this
.
courseTypes
=
[
"
easy
"
,
"
normal
"
,
"
hard
"
,
"
oni
"
]
this
.
courseTypes
=
{
"
0
"
:
"
easy
"
,
"
1
"
:
"
normal
"
,
"
2
"
:
"
hard
"
,
"
3
"
:
"
oni
"
,
"
4
"
:
"
ura
"
,
"
edit
"
:
"
ura
"
}
this
.
metadata
=
this
.
parseMetadata
()
this
.
metadata
=
this
.
parseMetadata
()
this
.
measures
=
[]
this
.
measures
=
[]
...
@@ -67,10 +74,11 @@
...
@@ -67,10 +74,11 @@
value
=
value
.
trim
()
value
=
value
.
trim
()
if
(
name
===
"
course
"
){
if
(
name
===
"
course
"
){
value
=
value
.
toLowerCase
()
if
(
value
in
this
.
courseTypes
){
if
(
value
in
this
.
courseTypes
){
courseName
=
this
.
courseTypes
[
value
]
courseName
=
this
.
courseTypes
[
value
]
}
else
{
}
else
{
courseName
=
value
.
toLowerCase
()
courseName
=
value
}
}
}
else
if
(
name
===
"
balloon
"
){
}
else
if
(
name
===
"
balloon
"
){
value
=
value
?
value
.
split
(
"
,
"
).
map
(
digit
=>
parseInt
(
digit
))
:
[]
value
=
value
?
value
.
split
(
"
,
"
).
map
(
digit
=>
parseInt
(
digit
))
:
[]
...
...
public/src/js/scoresheet.js
View file @
5fbea99d
...
@@ -10,7 +10,7 @@ class Scoresheet{
...
@@ -10,7 +10,7 @@ class Scoresheet{
this
.
canvas
=
document
.
getElementById
(
"
canvas
"
)
this
.
canvas
=
document
.
getElementById
(
"
canvas
"
)
this
.
ctx
=
this
.
canvas
.
getContext
(
"
2d
"
)
this
.
ctx
=
this
.
canvas
.
getContext
(
"
2d
"
)
this
.
font
=
"
TnT
"
this
.
font
=
"
TnT
, Meiryo, sans-serif
"
this
.
state
=
{
this
.
state
=
{
screen
:
"
fadeIn
"
,
screen
:
"
fadeIn
"
,
screenMS
:
this
.
getMS
(),
screenMS
:
this
.
getMS
(),
...
@@ -89,8 +89,7 @@ class Scoresheet{
...
@@ -89,8 +89,7 @@ class Scoresheet{
this
.
winH
=
null
this
.
winH
=
null
pageEvents
.
keyAdd
(
this
,
"
all
"
,
"
down
"
,
this
.
keyDown
.
bind
(
this
))
pageEvents
.
keyAdd
(
this
,
"
all
"
,
"
down
"
,
this
.
keyDown
.
bind
(
this
))
pageEvents
.
add
(
this
.
canvas
,
"
mousedown
"
,
this
.
mouseDown
.
bind
(
this
))
pageEvents
.
add
(
this
.
canvas
,
[
"
mousedown
"
,
"
touchstart
"
],
this
.
mouseDown
.
bind
(
this
))
pageEvents
.
add
(
this
.
canvas
,
"
touchstart
"
,
this
.
mouseDown
.
bind
(
this
))
}
}
redraw
(){
redraw
(){
...
@@ -670,8 +669,7 @@ class Scoresheet{
...
@@ -670,8 +669,7 @@ class Scoresheet{
snd
.
musicGain
.
fadeIn
()
snd
.
musicGain
.
fadeIn
()
this
.
redrawRunning
=
false
this
.
redrawRunning
=
false
pageEvents
.
keyRemove
(
this
,
"
all
"
)
pageEvents
.
keyRemove
(
this
,
"
all
"
)
pageEvents
.
remove
(
this
.
canvas
,
"
mousedown
"
)
pageEvents
.
remove
(
this
.
canvas
,
[
"
mousedown
"
,
"
touchstart
"
])
pageEvents
.
remove
(
this
.
canvas
,
"
touchstart
"
)
delete
this
.
ctx
delete
this
.
ctx
delete
this
.
canvas
delete
this
.
canvas
}
}
...
...
public/src/js/songselect.js
View file @
5fbea99d
This diff is collapsed.
Click to expand it.
public/src/js/soundbuffer.js
View file @
5fbea99d
...
@@ -2,11 +2,7 @@
...
@@ -2,11 +2,7 @@
constructor
(){
constructor
(){
var
AudioContext
=
window
.
AudioContext
||
window
.
webkitAudioContext
var
AudioContext
=
window
.
AudioContext
||
window
.
webkitAudioContext
this
.
context
=
new
AudioContext
()
this
.
context
=
new
AudioContext
()
pageEvents
.
once
(
window
,
"
click
"
).
then
(()
=>
{
pageEvents
.
add
(
window
,
[
"
click
"
,
"
touchend
"
],
this
.
pageClicked
.
bind
(
this
))
if
(
this
.
context
.
state
===
"
suspended
"
){
this
.
context
.
resume
()
}
})
}
}
load
(
url
,
gain
){
load
(
url
,
gain
){
return
loader
.
ajax
(
url
,
request
=>
{
return
loader
.
ajax
(
url
,
request
=>
{
...
@@ -48,6 +44,11 @@
...
@@ -48,6 +44,11 @@
source
.
connect
(
sound
.
gain
.
gainNode
||
this
.
context
.
destination
)
source
.
connect
(
sound
.
gain
.
gainNode
||
this
.
context
.
destination
)
return
source
return
source
}
}
pageClicked
(){
if
(
this
.
context
.
state
===
"
suspended
"
){
this
.
context
.
resume
()
}
}
}
}
class
SoundGain
{
class
SoundGain
{
constructor
(
soundBuffer
,
channel
){
constructor
(
soundBuffer
,
channel
){
...
@@ -178,7 +179,9 @@ class Sound{
...
@@ -178,7 +179,9 @@ class Sound{
stop
(
time
,
absolute
){
stop
(
time
,
absolute
){
time
=
this
.
convertTime
(
time
,
absolute
)
time
=
this
.
convertTime
(
time
,
absolute
)
this
.
sources
.
forEach
(
source
=>
{
this
.
sources
.
forEach
(
source
=>
{
source
.
stop
(
Math
.
max
(
source
.
startTime
,
time
))
try
{
source
.
stop
(
Math
.
max
(
source
.
startTime
,
time
))
}
catch
(
e
){}
})
})
this
.
setTimeouts
(
time
).
then
(()
=>
{
this
.
setTimeouts
(
time
).
then
(()
=>
{
if
(
this
.
loop
){
if
(
this
.
loop
){
...
...
public/src/js/titlescreen.js
View file @
5fbea99d
...
@@ -3,8 +3,7 @@ class Titlescreen{
...
@@ -3,8 +3,7 @@ class Titlescreen{
loader
.
changePage
(
"
titlescreen
"
)
loader
.
changePage
(
"
titlescreen
"
)
this
.
titleScreen
=
document
.
getElementById
(
"
title-screen
"
)
this
.
titleScreen
=
document
.
getElementById
(
"
title-screen
"
)
pageEvents
.
keyAdd
(
this
,
"
all
"
,
"
down
"
,
this
.
keyDown
.
bind
(
this
))
pageEvents
.
keyAdd
(
this
,
"
all
"
,
"
down
"
,
this
.
keyDown
.
bind
(
this
))
pageEvents
.
add
(
this
.
titleScreen
,
"
mousedown
"
,
this
.
onPressed
.
bind
(
this
))
pageEvents
.
add
(
this
.
titleScreen
,
[
"
mousedown
"
,
"
touchstart
"
],
this
.
onPressed
.
bind
(
this
))
pageEvents
.
once
(
this
.
titleScreen
,
"
touchstart
"
).
then
(
this
.
onPressed
.
bind
(
this
))
assets
.
sounds
[
"
title
"
].
play
()
assets
.
sounds
[
"
title
"
].
play
()
this
.
gamepad
=
new
Gamepad
({
this
.
gamepad
=
new
Gamepad
({
"
13
"
:
[
"
a
"
,
"
b
"
,
"
x
"
,
"
y
"
,
"
start
"
,
"
ls
"
,
"
rs
"
]
"
13
"
:
[
"
a
"
,
"
b
"
,
"
x
"
,
"
y
"
,
"
start
"
,
"
ls
"
,
"
rs
"
]
...
@@ -48,8 +47,7 @@ class Titlescreen{
...
@@ -48,8 +47,7 @@ class Titlescreen{
this
.
gamepad
.
clean
()
this
.
gamepad
.
clean
()
assets
.
sounds
[
"
title
"
].
stop
()
assets
.
sounds
[
"
title
"
].
stop
()
pageEvents
.
keyRemove
(
this
,
"
all
"
)
pageEvents
.
keyRemove
(
this
,
"
all
"
)
pageEvents
.
remove
(
this
.
titleScreen
,
"
mousedown
"
)
pageEvents
.
remove
(
this
.
titleScreen
,
[
"
mousedown
"
,
"
touchstart
"
])
pageEvents
.
remove
(
this
.
titleScreen
,
"
touchstart
"
)
delete
this
.
titleScreen
delete
this
.
titleScreen
}
}
}
}
public/src/js/tutorial.js
View file @
5fbea99d
...
@@ -5,8 +5,7 @@ class Tutorial{
...
@@ -5,8 +5,7 @@ class Tutorial{
assets
.
sounds
[
"
bgm_setsume
"
].
playLoop
(
0.1
,
false
,
0
,
1.054
,
16.054
)
assets
.
sounds
[
"
bgm_setsume
"
].
playLoop
(
0.1
,
false
,
0
,
1.054
,
16.054
)
this
.
endButton
=
document
.
getElementById
(
"
tutorial-end-button
"
)
this
.
endButton
=
document
.
getElementById
(
"
tutorial-end-button
"
)
pageEvents
.
once
(
this
.
endButton
,
"
mousedown
"
).
then
(
this
.
onEnd
.
bind
(
this
))
pageEvents
.
once
(
this
.
endButton
,
[
"
mousedown
"
,
"
touchstart
"
]).
then
(
this
.
onEnd
.
bind
(
this
))
pageEvents
.
once
(
this
.
endButton
,
"
touchstart
"
).
then
(
this
.
onEnd
.
bind
(
this
))
pageEvents
.
keyOnce
(
this
,
13
,
"
down
"
).
then
(
this
.
onEnd
.
bind
(
this
))
pageEvents
.
keyOnce
(
this
,
13
,
"
down
"
).
then
(
this
.
onEnd
.
bind
(
this
))
this
.
gamepad
=
new
Gamepad
({
this
.
gamepad
=
new
Gamepad
({
...
@@ -29,7 +28,7 @@ class Tutorial{
...
@@ -29,7 +28,7 @@ class Tutorial{
clean
(){
clean
(){
this
.
gamepad
.
clean
()
this
.
gamepad
.
clean
()
assets
.
sounds
[
"
bgm_setsume
"
].
stop
()
assets
.
sounds
[
"
bgm_setsume
"
].
stop
()
pageEvents
.
remove
(
this
.
endButton
,
"
click
"
)
pageEvents
.
remove
(
this
.
endButton
,
[
"
mousedown
"
,
"
touchstart
"
]
)
pageEvents
.
keyRemove
(
this
,
13
)
pageEvents
.
keyRemove
(
this
,
13
)
delete
this
.
endButton
delete
this
.
endButton
}
}
...
...
public/src/js/view.js
View file @
5fbea99d
...
@@ -64,16 +64,19 @@ class View{
...
@@ -64,16 +64,19 @@ class View{
pageEvents
.
add
(
this
.
canvas
.
canvas
,
"
touchstart
"
,
this
.
ontouch
.
bind
(
this
))
pageEvents
.
add
(
this
.
canvas
.
canvas
,
"
touchstart
"
,
this
.
ontouch
.
bind
(
this
))
this
.
touchFullBtn
=
document
.
getElementById
(
"
touch-full-btn
"
)
this
.
touchFullBtn
=
document
.
getElementById
(
"
touch-full-btn
"
)
pageEvents
.
add
(
this
.
touchFullBtn
,
"
click
"
,
toggleFullscreen
)
pageEvents
.
add
(
this
.
touchFullBtn
,
"
touchend
"
,
toggleFullscreen
)
if
(
!
fullScreenSupported
){
this
.
touchFullBtn
.
style
.
display
=
"
none
"
}
this
.
touchPauseBtn
=
document
.
getElementById
(
"
touch-pause-btn
"
)
this
.
touchPauseBtn
=
document
.
getElementById
(
"
touch-pause-btn
"
)
pageEvents
.
add
(
this
.
touchPauseBtn
,
"
click
"
,
()
=>
{
pageEvents
.
add
(
this
.
touchPauseBtn
,
"
touchend
"
,
()
=>
{
this
.
controller
.
togglePauseMenu
()
this
.
controller
.
togglePauseMenu
()
})
})
}
}
}
}
run
(){
run
(){
this
.
ctx
.
font
=
"
normal 14pt TnT
"
this
.
ctx
.
font
=
"
normal 14pt TnT
, Meiryo, sans-serif
"
this
.
setBackground
()
this
.
setBackground
()
if
(
this
.
controller
.
multiplayer
!==
2
){
if
(
this
.
controller
.
multiplayer
!==
2
){
...
@@ -318,7 +321,7 @@ class View{
...
@@ -318,7 +321,7 @@ class View{
var
comboX
=
this
.
taikoX
+
this
.
taikoW
/
2
var
comboX
=
this
.
taikoX
+
this
.
taikoW
/
2
var
comboY
=
this
.
barY
+
this
.
barH
/
2
var
comboY
=
this
.
barY
+
this
.
barH
/
2
var
fontSize
=
this
.
taikoH
*
0.4
var
fontSize
=
this
.
taikoH
*
0.4
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
"
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
, Meiryo, sans-serif
"
this
.
ctx
.
textAlign
=
"
center
"
this
.
ctx
.
textAlign
=
"
center
"
this
.
ctx
.
strokeStyle
=
"
#000
"
this
.
ctx
.
strokeStyle
=
"
#000
"
this
.
ctx
.
lineWidth
=
fontSize
/
10
this
.
ctx
.
lineWidth
=
fontSize
/
10
...
@@ -354,7 +357,7 @@ class View{
...
@@ -354,7 +357,7 @@ class View{
}
else
{
}
else
{
this
.
ctx
.
fillStyle
=
"
#fff
"
this
.
ctx
.
fillStyle
=
"
#fff
"
}
}
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
"
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
, Meiryo, sans-serif
"
this
.
ctx
.
lineWidth
=
fontSize
/
5
this
.
ctx
.
lineWidth
=
fontSize
/
5
this
.
strokeFillText
(
"
コンボ
"
,
this
.
strokeFillText
(
"
コンボ
"
,
comboX
,
comboX
,
...
@@ -386,7 +389,7 @@ class View{
...
@@ -386,7 +389,7 @@ class View{
var
fontSize
=
0.7
*
this
.
scoreSquareH
var
fontSize
=
0.7
*
this
.
scoreSquareH
// Draw score text
// Draw score text
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
"
this
.
ctx
.
font
=
"
normal
"
+
fontSize
+
"
px TnT
, Meiryo, sans-serif
"
this
.
ctx
.
fillStyle
=
"
#fff
"
this
.
ctx
.
fillStyle
=
"
#fff
"
this
.
ctx
.
textAlign
=
"
center
"
this
.
ctx
.
textAlign
=
"
center
"
var
glyph
=
this
.
ctx
.
measureText
(
"
0
"
).
width
var
glyph
=
this
.
ctx
.
measureText
(
"
0
"
).
width
...
@@ -946,15 +949,15 @@ class View{
...
@@ -946,15 +949,15 @@ class View{
}
}
clean
(){
clean
(){
pageEvents
.
mouseRemove
(
this
)
pageEvents
.
mouseRemove
(
this
)
if
(
this
.
controller
.
multiplayer
===
2
){
if
(
this
.
controller
.
multiplayer
===
2
&&
this
.
canvas
){
this
.
canvas
.
canvas
.
parentNode
.
removeChild
(
this
.
canvas
.
canvas
)
this
.
canvas
.
canvas
.
parentNode
.
removeChild
(
this
.
canvas
.
canvas
)
}
else
{
}
else
{
this
.
cursor
.
parentNode
.
removeChild
(
this
.
cursor
)
this
.
cursor
.
parentNode
.
removeChild
(
this
.
cursor
)
}
}
if
(
this
.
touchEnabled
){
if
(
this
.
touchEnabled
){
pageEvents
.
remove
(
this
.
canvas
.
canvas
,
"
touchstart
"
)
pageEvents
.
remove
(
this
.
canvas
.
canvas
,
"
touchstart
"
)
pageEvents
.
remove
(
this
.
touchFullBtn
,
"
click
"
)
pageEvents
.
remove
(
this
.
touchFullBtn
,
"
touchend
"
)
pageEvents
.
remove
(
this
.
touchPauseBtn
,
"
click
"
)
pageEvents
.
remove
(
this
.
touchPauseBtn
,
"
touchend
"
)
this
.
gameDiv
.
classList
.
remove
(
"
touch-visible
"
)
this
.
gameDiv
.
classList
.
remove
(
"
touch-visible
"
)
document
.
getElementById
(
"
version
"
).
classList
.
remove
(
"
version-hide
"
)
document
.
getElementById
(
"
version
"
).
classList
.
remove
(
"
version-hide
"
)
delete
this
.
touchDrumDiv
delete
this
.
touchDrumDiv
...
...
templates/index.html
View file @
5fbea99d
...
@@ -59,9 +59,9 @@
...
@@ -59,9 +59,9 @@
<div
id=
"screen"
></div>
<div
id=
"screen"
></div>
<div
id=
"version"
>
<div
id=
"version"
>
{% if version %}
{% if version %}
<a
href=
"https://github.com/bui/taiko-web/commit/{{version.commit}}"
target=
"_blank"
class=
"stroke-sub"
alt=
"taiko-web ver.{{version.version}} ({{version.commit_short}})"
>
taiko-web ver.{{version.version}} ({{version.commit_short}})
</a>
<a
href=
"https://github.com/bui/taiko-web/commit/{{version.commit}}"
target=
"_blank"
id=
"version-link"
class=
"stroke-sub"
alt=
"taiko-web ver.{{version.version}} ({{version.commit_short}})"
>
taiko-web ver.{{version.version}} ({{version.commit_short}})
</a>
{% else %}
{% else %}
<a
href=
"https://github.com/bui/taiko-web"
target=
"_blank"
class=
"stroke-sub"
alt=
"taiko-web (unknown version)"
>
taiko-web (unknown version)
</a>
<a
href=
"https://github.com/bui/taiko-web"
target=
"_blank"
id=
"version-link"
class=
"stroke-sub"
alt=
"taiko-web (unknown version)"
>
taiko-web (unknown version)
</a>
{% endif %}
{% endif %}
</div>
</div>
<script
src=
"/src/js/main.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/main.js?{{version.commit_short}}"
></script>
...
...
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