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
5a115040
Commit
5a115040
authored
Oct 25, 2018
by
Bui
Committed by
GitHub
Oct 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #60 from LoveEevee/view-rewrite
View: Rewrite
parents
ab2e3d24
378e2753
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1511 additions
and
967 deletions
+1511
-967
public/src/css/game.css
public/src/css/game.css
+9
-2
public/src/js/assets.js
public/src/js/assets.js
+3
-12
public/src/js/canvasasset.js
public/src/js/canvasasset.js
+2
-3
public/src/js/canvascache.js
public/src/js/canvascache.js
+18
-5
public/src/js/canvasdraw.js
public/src/js/canvasdraw.js
+254
-43
public/src/js/controller.js
public/src/js/controller.js
+20
-11
public/src/js/debug.js
public/src/js/debug.js
+4
-0
public/src/js/element.js
public/src/js/element.js
+0
-49
public/src/js/game.js
public/src/js/game.js
+4
-6
public/src/js/keyboard.js
public/src/js/keyboard.js
+1
-1
public/src/js/loadsong.js
public/src/js/loadsong.js
+1
-1
public/src/js/scalablecanvas.js
public/src/js/scalablecanvas.js
+0
-42
public/src/js/scoresheet.js
public/src/js/scoresheet.js
+21
-14
public/src/js/songselect.js
public/src/js/songselect.js
+143
-90
public/src/js/view.js
public/src/js/view.js
+994
-655
public/src/js/viewassets.js
public/src/js/viewassets.js
+37
-30
public/src/views/game.html
public/src/views/game.html
+0
-1
templates/index.html
templates/index.html
+0
-2
No files found.
public/src/css/game.css
View file @
5a115040
#game
{
#game
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
position
:
a
sb
olute
;
position
:
a
bs
olute
;
overflow
:
hidden
;
overflow
:
hidden
;
background-size
:
cover
;
background-size
:
cover
;
background-position
:
center
;
}
}
#game
.default-bg
{
#game
.default-bg
{
background-size
:
calc
(
100vh
/
720
*
512
);
background-size
:
calc
(
100vh
/
720
*
512
);
...
@@ -70,7 +71,7 @@
...
@@ -70,7 +71,7 @@
#touch-buttons
{
#touch-buttons
{
display
:
none
;
display
:
none
;
position
:
absolute
;
position
:
absolute
;
top
:
6.5
vh
;
top
:
8
vh
;
right
:
2vh
;
right
:
2vh
;
opacity
:
0.5
;
opacity
:
0.5
;
z-index
:
5
;
z-index
:
5
;
...
@@ -79,6 +80,12 @@
...
@@ -79,6 +80,12 @@
width
:
12.5vmin
;
width
:
12.5vmin
;
height
:
12.5vmin
;
height
:
12.5vmin
;
}
}
.portrait
#touch-buttons
{
top
:
11vh
;
}
.touchp2
#touch-buttons
{
top
:
-1.9vh
;
}
.touch-visible
#touch-drum
,
.touch-visible
#touch-drum
,
.touch-visible
#touch-buttons
{
.touch-visible
#touch-buttons
{
display
:
block
;
display
:
block
;
...
...
public/src/js/assets.js
View file @
5a115040
...
@@ -2,20 +2,11 @@ var assets = {
...
@@ -2,20 +2,11 @@ var assets = {
"
img
"
:
[
"
img
"
:
[
"
title-screen.png
"
,
"
title-screen.png
"
,
"
logo-big.png
"
,
"
logo-big.png
"
,
"
don-0.png
"
,
"
notes.png
"
,
"
don-1.png
"
,
"
notes_drumroll.png
"
,
"
big-don-0.png
"
,
"
notes_hit.png
"
,
"
big-don-1.png
"
,
"
balloon.png
"
,
"
balloon.png
"
,
"
taiko.png
"
,
"
taiko.png
"
,
"
taiko-key-blue.png
"
,
"
taiko-key-red.png
"
,
"
hp-bar-bg.png
"
,
"
hp-bar-colour.png
"
,
"
score-0.png
"
,
"
score-0-b.png
"
,
"
score-230.png
"
,
"
score-450.png
"
,
"
dancing-don.gif
"
,
"
dancing-don.gif
"
,
"
bg-pattern-1.png
"
,
"
bg-pattern-1.png
"
,
"
muzu_easy.png
"
,
"
muzu_easy.png
"
,
...
...
public/src/js/canvasasset.js
View file @
5a115040
...
@@ -27,6 +27,7 @@ class CanvasAsset{
...
@@ -27,6 +27,7 @@ class CanvasAsset{
}
else
{
}
else
{
frame
=
this
.
mod
(
this
.
animation
,
index
)
frame
=
this
.
mod
(
this
.
animation
,
index
)
}
}
this
.
ctx
.
save
()
var
pos
=
this
.
position
(
frame
)
var
pos
=
this
.
position
(
frame
)
if
(
this
.
image
){
if
(
this
.
image
){
this
.
ctx
.
drawImage
(
this
.
image
,
this
.
ctx
.
drawImage
(
this
.
image
,
...
@@ -35,9 +36,7 @@ class CanvasAsset{
...
@@ -35,9 +36,7 @@ class CanvasAsset{
pos
.
x
,
pos
.
y
,
pos
.
w
,
pos
.
h
pos
.
x
,
pos
.
y
,
pos
.
w
,
pos
.
h
)
)
}
}
if
(
pos
.
callback
){
this
.
ctx
.
restore
()
pos
.
callback
()
}
}
}
}
}
mod
(
length
,
index
){
mod
(
length
,
index
){
...
...
public/src/js/canvascache.js
View file @
5a115040
class
CanvasCache
{
class
CanvasCache
{
constructor
(
w
,
h
,
scale
){
constructor
(
w
,
h
,
scale
){
this
.
canvas
=
document
.
createElement
(
"
canvas
"
)
this
.
ctx
=
this
.
canvas
.
getContext
(
"
2d
"
)
this
.
map
=
new
Map
()
if
(
w
){
if
(
w
){
this
.
resize
(
w
,
h
,
scale
)
this
.
resize
(
w
,
h
,
scale
)
}
}
}
}
resize
(
w
,
h
,
scale
){
resize
(
w
,
h
,
scale
){
this
.
map
.
clear
()
if
(
this
.
canvas
){
this
.
map
.
clear
()
}
else
{
this
.
map
=
new
Map
()
this
.
canvas
=
document
.
createElement
(
"
canvas
"
)
this
.
ctx
=
this
.
canvas
.
getContext
(
"
2d
"
)
}
this
.
scale
=
scale
this
.
scale
=
scale
this
.
x
=
0
this
.
x
=
0
this
.
y
=
0
this
.
y
=
0
...
@@ -20,8 +23,11 @@ class CanvasCache{
...
@@ -20,8 +23,11 @@ class CanvasCache{
this
.
canvas
.
height
=
this
.
h
*
this
.
scale
this
.
canvas
.
height
=
this
.
h
*
this
.
scale
this
.
ctx
.
scale
(
this
.
scale
,
this
.
scale
)
this
.
ctx
.
scale
(
this
.
scale
,
this
.
scale
)
}
}
get
(
config
,
callback
){
get
(
config
,
callback
,
setOnly
){
var
img
=
this
.
map
.
get
(
config
.
id
)
var
img
=
this
.
map
.
get
(
config
.
id
)
if
(
img
&&
setOnly
||
!
img
&&
!
callback
){
return
}
var
saved
=
false
var
saved
=
false
if
(
!
img
){
if
(
!
img
){
var
w
=
config
.
w
var
w
=
config
.
w
...
@@ -50,6 +56,10 @@ class CanvasCache{
...
@@ -50,6 +56,10 @@ class CanvasCache{
callback
(
this
.
ctx
)
callback
(
this
.
ctx
)
}
}
if
(
setOnly
){
this
.
ctx
.
restore
()
return
}
var
z
=
this
.
scale
var
z
=
this
.
scale
config
.
ctx
.
drawImage
(
this
.
canvas
,
config
.
ctx
.
drawImage
(
this
.
canvas
,
img
.
x
*
z
|
0
,
img
.
y
*
z
|
0
,
img
.
w
*
z
|
0
,
img
.
h
*
z
|
0
,
img
.
x
*
z
|
0
,
img
.
y
*
z
|
0
,
img
.
w
*
z
|
0
,
img
.
h
*
z
|
0
,
...
@@ -59,6 +69,9 @@ class CanvasCache{
...
@@ -59,6 +69,9 @@ class CanvasCache{
this
.
ctx
.
restore
()
this
.
ctx
.
restore
()
}
}
}
}
set
(
config
,
callback
){
return
this
.
get
(
config
,
callback
,
true
)
}
clean
(){
clean
(){
delete
this
.
map
delete
this
.
map
delete
this
.
ctx
delete
this
.
ctx
...
...
public/src/js/canvasdraw.js
View file @
5a115040
This diff is collapsed.
Click to expand it.
public/src/js/controller.js
View file @
5a115040
...
@@ -81,6 +81,17 @@ class Controller{
...
@@ -81,6 +81,17 @@ class Controller{
if
(
this
.
syncWith
){
if
(
this
.
syncWith
){
this
.
syncWith
.
mainLoop
()
this
.
syncWith
.
mainLoop
()
}
}
if
(
this
.
scoresheet
){
if
(
this
.
view
.
ctx
){
this
.
view
.
ctx
.
save
()
this
.
view
.
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
)
}
this
.
scoresheet
.
redraw
()
if
(
this
.
view
.
ctx
){
this
.
view
.
ctx
.
restore
()
}
}
})
})
}
}
var
ms
=
this
.
game
.
elapsedTime
var
ms
=
this
.
game
.
elapsedTime
...
@@ -104,10 +115,6 @@ class Controller{
...
@@ -104,10 +115,6 @@ class Controller{
this
.
view
.
refresh
()
this
.
view
.
refresh
()
}
}
this
.
keyboard
.
checkMenuKeys
()
this
.
keyboard
.
checkMenuKeys
()
if
(
this
.
scoresheet
){
this
.
scoresheet
.
redraw
()
}
}
}
}
}
togglePauseMenu
(){
togglePauseMenu
(){
...
@@ -117,11 +124,13 @@ class Controller{
...
@@ -117,11 +124,13 @@ class Controller{
gameEnded
(){
gameEnded
(){
var
score
=
this
.
getGlobalScore
()
var
score
=
this
.
getGlobalScore
()
var
vp
var
vp
if
(
score
.
bad
===
0
){
if
(
Math
.
round
(
score
.
gauge
/
2
)
-
1
>=
25
){
vp
=
"
fullcombo
"
if
(
score
.
bad
===
0
){
this
.
playSoundMeka
(
"
fullcombo
"
,
1.350
)
vp
=
"
fullcombo
"
}
else
if
(
score
.
gauge
>=
50
){
this
.
playSoundMeka
(
"
fullcombo
"
,
1.350
)
vp
=
"
clear
"
}
else
{
vp
=
"
clear
"
}
}
else
{
}
else
{
vp
=
"
fail
"
vp
=
"
fail
"
}
}
...
@@ -132,8 +141,8 @@ class Controller{
...
@@ -132,8 +141,8 @@ class Controller{
this
.
scoresheet
=
new
Scoresheet
(
this
,
this
.
getGlobalScore
(),
this
.
multiplayer
)
this
.
scoresheet
=
new
Scoresheet
(
this
,
this
.
getGlobalScore
(),
this
.
multiplayer
)
}
}
}
}
displayScore
(
score
,
notPlayed
){
displayScore
(
score
,
notPlayed
,
bigNote
){
this
.
view
.
displayScore
(
score
,
notPlayed
)
this
.
view
.
displayScore
(
score
,
notPlayed
,
bigNote
)
}
}
songSelection
(
fadeIn
){
songSelection
(
fadeIn
){
if
(
!
fadeIn
){
if
(
!
fadeIn
){
...
...
public/src/js/debug.js
View file @
5a115040
...
@@ -117,6 +117,10 @@ class Debug{
...
@@ -117,6 +117,10 @@ class Debug{
break
break
}
}
}
}
if
(
game
.
mainMusicPlaying
){
game
.
mainMusicPlaying
=
false
game
.
mainAsset
.
stop
()
}
}
}
this
.
autoplayCheckbox
.
checked
=
this
.
controller
.
autoPlayEnabled
this
.
autoplayCheckbox
.
checked
=
this
.
controller
.
autoPlayEnabled
}
}
...
...
public/src/js/element.js
deleted
100644 → 0
View file @
ab2e3d24
function
element
(){
var
parent
var
lasttag
var
createdtag
var
toreturn
=
{}
for
(
var
i
=
0
;
i
<
arguments
.
length
;
i
++
){
var
current
=
arguments
[
i
]
if
(
current
){
if
(
current
.
nodeType
){
parent
=
lasttag
=
current
}
else
if
(
Array
.
isArray
(
current
)){
lasttag
=
parent
for
(
var
j
=
0
;
j
<
current
.
length
;
j
++
){
if
(
current
[
j
]){
if
(
j
==
0
&&
typeof
current
[
j
]
==
"
string
"
){
var
tagname
=
current
[
0
].
split
(
"
#
"
)
lasttag
=
createdtag
=
document
.
createElement
(
tagname
[
0
])
if
(
tagname
[
1
]){
toreturn
[
tagname
[
1
]]
=
createdtag
}
}
else
if
(
current
[
j
].
constructor
==
Object
){
if
(
lasttag
){
for
(
var
value
in
current
[
j
]){
if
(
value
!=
"
style
"
&&
value
in
lasttag
){
lasttag
[
value
]
=
current
[
j
][
value
]
}
else
{
lasttag
.
setAttribute
(
value
,
current
[
j
][
value
])
}
}
}
}
else
{
var
returned
=
element
(
lasttag
,
current
[
j
])
for
(
var
k
in
returned
){
toreturn
[
k
]
=
returned
[
k
]
}
}
}
}
}
else
if
(
current
){
createdtag
=
document
.
createTextNode
(
current
)
}
if
(
parent
&&
createdtag
){
parent
.
appendChild
(
createdtag
)
}
createdtag
=
0
}
}
return
toreturn
}
public/src/js/game.js
View file @
5a115040
...
@@ -116,9 +116,6 @@ class Game{
...
@@ -116,9 +116,6 @@ class Game{
}
}
}
}
}
}
setHPGain
(
gain
){
this
.
HPGain
=
gain
}
checkPlays
(){
checkPlays
(){
var
circles
=
this
.
songData
.
circles
var
circles
=
this
.
songData
.
circles
var
circle
=
circles
[
this
.
currentCircle
]
var
circle
=
circles
[
this
.
currentCircle
]
...
@@ -200,14 +197,15 @@ class Game{
...
@@ -200,14 +197,15 @@ class Game{
if
(
circleStatus
===
230
||
circleStatus
===
450
){
if
(
circleStatus
===
230
||
circleStatus
===
450
){
score
=
circleStatus
score
=
circleStatus
}
}
this
.
controller
.
displayScore
(
score
)
circle
.
played
(
score
,
score
===
0
?
typeDai
:
keyDai
)
this
.
controller
.
displayScore
(
score
,
false
,
typeDai
&&
keyDai
)
}
else
{
}
else
{
this
.
controller
.
displayScore
(
score
,
true
)
circle
.
played
(
-
1
,
typeDai
)
this
.
controller
.
displayScore
(
score
,
true
,
false
)
}
}
this
.
updateCombo
(
score
)
this
.
updateCombo
(
score
)
this
.
updateGlobalScore
(
score
,
typeDai
&&
keyDai
?
2
:
1
,
circle
.
gogoTime
)
this
.
updateGlobalScore
(
score
,
typeDai
&&
keyDai
?
2
:
1
,
circle
.
gogoTime
)
this
.
updateCurrentCircle
()
this
.
updateCurrentCircle
()
circle
.
played
(
score
,
score
===
0
?
typeDai
:
keyDai
)
if
(
this
.
controller
.
multiplayer
==
1
){
if
(
this
.
controller
.
multiplayer
==
1
){
p2
.
send
(
"
note
"
,
{
p2
.
send
(
"
note
"
,
{
score
:
score
,
score
:
score
,
...
...
public/src/js/keyboard.js
View file @
5a115040
...
@@ -111,7 +111,7 @@ class Keyboard{
...
@@ -111,7 +111,7 @@ class Keyboard{
this
.
controller
.
togglePauseMenu
()
this
.
controller
.
togglePauseMenu
()
for
(
var
key
in
this
.
keyTime
){
for
(
var
key
in
this
.
keyTime
){
this
.
keys
[
key
]
=
null
this
.
keys
[
key
]
=
null
this
.
keyTime
[
key
]
=
null
this
.
keyTime
[
key
]
=
-
Infinity
}
}
})
})
var
moveMenuMinus
=
()
=>
{
var
moveMenuMinus
=
()
=>
{
...
...
public/src/js/loadsong.js
View file @
5a115040
...
@@ -94,7 +94,7 @@ class loadSong{
...
@@ -94,7 +94,7 @@ class loadSong{
this
.
clean
()
this
.
clean
()
loader
.
changePage
(
"
game
"
)
loader
.
changePage
(
"
game
"
)
var
taikoGame1
=
new
Controller
(
this
.
selectedSong
,
this
.
songData
,
false
,
1
,
this
.
touchEnabled
)
var
taikoGame1
=
new
Controller
(
this
.
selectedSong
,
this
.
songData
,
false
,
1
,
this
.
touchEnabled
)
var
taikoGame2
=
new
Controller
(
this
.
selectedSong2
,
this
.
song2Data
,
true
,
2
)
var
taikoGame2
=
new
Controller
(
this
.
selectedSong2
,
this
.
song2Data
,
true
,
2
,
this
.
touchEnabled
)
taikoGame1
.
run
(
taikoGame2
)
taikoGame1
.
run
(
taikoGame2
)
}
}
})
})
...
...
public/src/js/scalablecanvas.js
deleted
100644 → 0
View file @
ab2e3d24
class
ScalableCanvas
{
constructor
(
id
,
width
,
height
,
noStyle
){
var
oldCanvas
=
document
.
getElementById
(
id
)
if
(
oldCanvas
){
this
.
canvas
=
oldCanvas
}
else
{
this
.
canvas
=
document
.
createElement
(
"
canvas
"
)
this
.
canvas
.
id
=
id
}
this
.
ctx
=
this
.
canvas
.
getContext
(
"
2d
"
)
this
.
rescale
()
this
.
resize
(
width
,
height
,
noStyle
)
}
resize
(
width
,
height
,
noStyle
){
if
(
width
!=
this
.
width
||
height
!=
this
.
height
){
this
.
width
=
width
this
.
height
=
height
this
.
scaledWidth
=
width
*
this
.
scale
this
.
canvas
.
width
=
this
.
scaledWidth
this
.
scaledHeight
=
height
*
this
.
scale
this
.
canvas
.
height
=
this
.
scaledHeight
if
(
noStyle
||
this
.
scale
==
1
){
if
(
this
.
canvas
.
style
.
width
){
this
.
canvas
.
style
.
width
=
""
}
if
(
this
.
canvas
.
style
.
height
){
this
.
canvas
.
style
.
height
=
""
}
}
else
{
this
.
canvas
.
style
.
width
=
width
+
"
px
"
this
.
canvas
.
style
.
height
=
height
+
"
px
"
}
}
}
rescale
(){
var
scale
=
window
.
devicePixelRatio
||
1
if
(
scale
!=
this
.
scale
){
this
.
ctx
.
scale
(
scale
,
scale
)
this
.
scale
=
scale
}
}
}
\ No newline at end of file
public/src/js/scoresheet.js
View file @
5a115040
...
@@ -416,16 +416,25 @@ class Scoresheet{
...
@@ -416,16 +416,25 @@ class Scoresheet{
results
=
p2
.
results
results
=
p2
.
results
ctx
.
translate
(
0
,
p2Offset
)
ctx
.
translate
(
0
,
p2Offset
)
}
}
ctx
.
drawImage
(
assets
.
image
[
"
hp-bar-bg
"
],
var
gaugePercent
=
Math
.
round
(
results
.
gauge
/
2
)
/
50
552
,
120
,
688
,
48
var
w
=
712
)
this
.
draw
.
gauge
({
var
gauge
=
results
.
gauge
/
100
ctx
:
ctx
,
if
(
gauge
>
0
){
x
:
558
+
w
,
ctx
.
drawImage
(
assets
.
image
[
"
hp-bar-colour
"
],
y
:
116
,
0
,
0
,
650
*
gauge
,
40
,
clear
:
25
/
50
,
557
,
127
,
635
*
gauge
,
37
,
percentage
:
gaugePercent
,
)
font
:
this
.
font
,
}
scale
:
w
/
788
,
scoresheet
:
true
})
this
.
draw
.
soul
({
ctx
:
ctx
,
x
:
1215
,
y
:
144
,
scale
:
36
/
42
,
cleared
:
gaugePercent
-
1
/
50
>=
25
/
50
})
}
}
ctx
.
restore
()
ctx
.
restore
()
}
}
...
@@ -441,10 +450,8 @@ class Scoresheet{
...
@@ -441,10 +450,8 @@ class Scoresheet{
results
=
p2
.
results
results
=
p2
.
results
}
}
var
crownType
=
null
var
crownType
=
null
if
(
results
.
bad
===
"
0
"
){
if
(
Math
.
round
(
results
.
gauge
/
2
)
-
1
>=
25
){
crownType
=
"
gold
"
crownType
=
results
.
bad
===
"
0
"
?
"
gold
"
:
"
silver
"
}
else
if
(
results
.
gauge
>=
50
){
crownType
=
"
silver
"
}
}
if
(
crownType
!==
null
){
if
(
crownType
!==
null
){
noCrownResultWait
=
0
;
noCrownResultWait
=
0
;
...
...
public/src/js/songselect.js
View file @
5a115040
This diff is collapsed.
Click to expand it.
public/src/js/view.js
View file @
5a115040
This diff is collapsed.
Click to expand it.
public/src/js/viewassets.js
View file @
5a115040
...
@@ -9,17 +9,17 @@ class ViewAssets{
...
@@ -9,17 +9,17 @@ class ViewAssets{
var
imgw
=
360
var
imgw
=
360
var
imgh
=
184
var
imgh
=
184
var
scale
=
165
var
scale
=
165
var
w
=
(
this
.
view
.
barH
*
imgw
)
/
scale
var
w
=
imgw
var
h
=
(
this
.
view
.
barH
*
imgh
)
/
scale
var
h
=
imgh
return
{
return
{
sx
:
Math
.
floor
(
frame
/
10
)
*
imgw
,
sx
:
Math
.
floor
(
frame
/
10
)
*
imgw
,
sy
:
(
frame
%
10
)
*
imgh
,
sy
:
(
frame
%
10
)
*
imgh
+
1
,
sw
:
imgw
,
sw
:
imgw
,
sh
:
imgh
,
sh
:
imgh
-
1
,
x
:
this
.
view
.
taikoSquareW
-
w
+
this
.
view
.
barH
*
0.2
,
x
:
view
.
portrait
?
-
60
:
0
,
y
:
this
.
view
.
barY
-
h
,
y
:
view
.
portrait
?
(
view
.
multiplayer
===
2
?
560
:
35
)
:
(
view
.
multiplayer
===
2
?
360
:
2
)
,
w
:
w
,
w
:
w
,
h
:
h
h
:
h
-
1
}
}
})
})
this
.
don
.
addFrames
(
"
normal
"
,
[
this
.
don
.
addFrames
(
"
normal
"
,
[
...
@@ -41,7 +41,7 @@ class ViewAssets{
...
@@ -41,7 +41,7 @@ class ViewAssets{
var
length
=
this
.
don
.
getAnimationLength
(
"
gogo
"
)
var
length
=
this
.
don
.
getAnimationLength
(
"
gogo
"
)
this
.
don
.
setUpdateSpeed
(
4
/
length
)
this
.
don
.
setUpdateSpeed
(
4
/
length
)
this
.
don
.
setAnimation
(
"
gogo
"
)
this
.
don
.
setAnimation
(
"
gogo
"
)
}
else
if
(
this
.
controller
.
getGlobalScore
().
gauge
>=
50
){
}
else
if
(
Math
.
round
(
this
.
controller
.
getGlobalScore
().
gauge
/
2
)
-
1
>=
25
){
this
.
don
.
setAnimationStart
(
0
)
this
.
don
.
setAnimationStart
(
0
)
var
length
=
this
.
don
.
getAnimationLength
(
"
clear
"
)
var
length
=
this
.
don
.
getAnimationLength
(
"
clear
"
)
this
.
don
.
setUpdateSpeed
(
2
/
length
)
this
.
don
.
setUpdateSpeed
(
2
/
length
)
...
@@ -58,31 +58,31 @@ class ViewAssets{
...
@@ -58,31 +58,31 @@ class ViewAssets{
this
.
fire
=
this
.
createAsset
(
"
bar
"
,
frame
=>
{
this
.
fire
=
this
.
createAsset
(
"
bar
"
,
frame
=>
{
var
imgw
=
360
var
imgw
=
360
var
imgh
=
370
var
imgh
=
370
var
scale
=
1
75
var
scale
=
1
30
var
ms
=
this
.
controller
.
getElapsedTime
()
var
ms
=
this
.
view
.
getMS
()
var
elapsed
=
ms
-
this
.
view
.
gogoTimeStarted
var
elapsed
=
ms
-
this
.
view
.
gogoTimeStarted
var
mul
=
this
.
view
.
slotPos
.
size
/
106
var
barH
=
130
*
mul
if
(
this
.
view
.
gogoTime
){
if
(
this
.
view
.
gogoTime
){
var
grow
=
3
-
Math
.
min
(
200
,
elapsed
)
/
100
var
grow
=
3
-
Math
.
min
(
200
,
elapsed
)
/
100
this
.
ctx
.
globalAlpha
=
Math
.
min
(
200
,
elapsed
)
/
200
this
.
ctx
.
globalAlpha
=
Math
.
min
(
200
,
elapsed
)
/
200
}
else
{
}
else
{
var
grow
=
1
-
Math
.
min
(
100
,
elapsed
)
/
100
var
grow
=
1
-
Math
.
min
(
100
,
elapsed
)
/
100
}
}
var
w
=
(
this
.
view
.
barH
*
imgw
)
/
scale
*
grow
var
w
=
(
barH
*
imgw
)
/
scale
*
grow
var
h
=
(
this
.
view
.
barH
*
imgh
)
/
scale
*
grow
var
h
=
(
barH
*
imgh
)
/
scale
*
grow
this
.
ctx
.
globalCompositeOperation
=
"
lighter
"
this
.
ctx
.
globalCompositeOperation
=
"
lighter
"
return
{
return
{
sx
:
frame
*
imgw
,
sx
:
frame
*
imgw
,
sy
:
0
,
sy
:
0
,
sw
:
imgw
,
sw
:
imgw
,
sh
:
imgh
,
sh
:
imgh
,
x
:
this
.
view
.
slot
X
-
w
/
2
,
x
:
this
.
view
.
slot
Pos
.
x
-
w
/
2
,
y
:
this
.
view
.
circleY
-
h
/
2
,
y
:
this
.
view
.
slotPos
.
y
-
h
/
2
,
w
:
w
,
w
:
w
,
h
:
h
,
h
:
h
callback
:
()
=>
{
this
.
ctx
.
globalCompositeOperation
=
"
source-over
"
this
.
ctx
.
globalAlpha
=
1
}
}
}
})
})
this
.
fire
.
addFrames
(
"
normal
"
,
7
,
"
fire_anim
"
)
this
.
fire
.
addFrames
(
"
normal
"
,
7
,
"
fire_anim
"
)
...
@@ -93,15 +93,17 @@ class ViewAssets{
...
@@ -93,15 +93,17 @@ class ViewAssets{
var
imgw
=
230
var
imgw
=
230
var
imgh
=
460
var
imgh
=
460
var
scale
=
165
var
scale
=
165
var
w
=
(
this
.
view
.
barH
*
imgw
)
/
scale
var
w
=
imgw
var
h
=
(
this
.
view
.
barH
*
imgh
)
/
scale
var
h
=
imgh
var
winW
=
this
.
view
.
winW
/
this
.
view
.
ratio
var
winH
=
this
.
view
.
winH
/
this
.
view
.
ratio
return
{
return
{
sx
:
Math
.
floor
(
frame
/
4
)
*
imgw
,
sx
:
Math
.
floor
(
frame
/
4
)
*
imgw
,
sy
:
(
frame
%
4
)
*
imgh
,
sy
:
(
frame
%
4
)
*
imgh
,
sw
:
imgw
,
sw
:
imgw
,
sh
:
imgh
,
sh
:
imgh
,
x
:
this
.
view
.
winW
/
4
*
i
-
w
/
2
*
(
i
/
2
),
x
:
winW
/
4
*
i
-
w
/
2
*
(
i
/
2
),
y
:
this
.
view
.
winH
-
h
,
y
:
winH
-
h
,
w
:
w
,
w
:
w
,
h
:
h
h
:
h
}
}
...
@@ -118,17 +120,22 @@ class ViewAssets{
...
@@ -118,17 +120,22 @@ class ViewAssets{
return
asset
return
asset
}
}
drawAssets
(
layer
){
drawAssets
(
layer
){
if
(
this
.
controller
.
multiplayer
!==
2
||
layer
===
"
bar
"
){
this
.
allAssets
.
forEach
(
asset
=>
{
this
.
allAssets
.
forEach
(
asset
=>
{
if
(
layer
===
asset
.
layer
){
if
(
layer
===
asset
.
layer
){
asset
.
draw
()
asset
.
draw
()
}
}
})
})
}
}
}
changeBeatInterval
(
beatMS
,
initial
){
changeBeatInterval
(
beatMS
,
initial
){
this
.
allAssets
.
forEach
(
asset
=>
{
this
.
allAssets
.
forEach
(
asset
=>
{
asset
.
changeBeatInterval
(
beatMS
,
initial
)
asset
.
changeBeatInterval
(
beatMS
,
initial
)
})
})
}
}
clean
(){
delete
this
.
ctx
delete
this
.
don
delete
this
.
fire
delete
this
.
fireworks
delete
this
.
allAssets
}
}
}
public/src/views/game.html
View file @
5a115040
<div
id=
"game"
>
<div
id=
"game"
>
<h3
alt=
""
class=
"stroke-sub game-song"
></h3>
<div
id=
"touch-drum"
>
<div
id=
"touch-drum"
>
<img
id=
"touch-drum-img"
src=
"/assets/img/touch_drum.png"
>
<img
id=
"touch-drum-img"
src=
"/assets/img/touch_drum.png"
>
</div>
</div>
...
...
templates/index.html
View file @
5a115040
...
@@ -39,8 +39,6 @@
...
@@ -39,8 +39,6 @@
<script
src=
"/src/js/mekadon.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/mekadon.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/gamepad.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/gamepad.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/tutorial.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/tutorial.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/scalablecanvas.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/element.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/soundbuffer.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/soundbuffer.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/p2.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/p2.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/canvasasset.js?{{version.commit_short}}"
></script>
<script
src=
"/src/js/canvasasset.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