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
1d0fc883
Commit
1d0fc883
authored
Sep 14, 2018
by
LoveEevee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Don-chan
parent
a8b05df7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
167 additions
and
11 deletions
+167
-11
public/index.html
public/index.html
+1
-0
public/src/js/assets.js
public/src/js/assets.js
+2
-1
public/src/js/canvasasset.js
public/src/js/canvasasset.js
+94
-0
public/src/js/game.js
public/src/js/game.js
+2
-0
public/src/js/mekadon.js
public/src/js/mekadon.js
+0
-2
public/src/js/p2.js
public/src/js/p2.js
+3
-1
public/src/js/view.js
public/src/js/view.js
+65
-7
No files found.
public/index.html
View file @
1d0fc883
...
...
@@ -46,6 +46,7 @@
<script
src=
"/src/js/element.js"
></script>
<script
src=
"/src/js/soundbuffer.js"
></script>
<script
src=
"/src/js/p2.js"
></script>
<script
src=
"/src/js/canvasasset.js"
></script>
</head>
<body>
...
...
public/src/js/assets.js
View file @
1d0fc883
...
...
@@ -27,7 +27,8 @@ var assets = {
'
muzu_normal.png
'
,
'
muzu_hard.png
'
,
'
muzu_oni.png
'
,
'
don_anim_normal.png
'
'
don_anim_normal.png
'
,
'
don_anim_10combo.png
'
],
audioSfx
:
[
...
...
public/src/js/canvasasset.js
0 → 100644
View file @
1d0fc883
class
CanvasAsset
{
constructor
(
view
,
position
,
image
){
this
.
ctx
=
view
.
ctx
this
.
controller
=
view
.
controller
if
(
image
){
this
.
image
=
assets
.
image
[
image
]
}
this
.
position
=
position
this
.
animationFrames
=
{}
this
.
speed
=
1000
/
60
this
.
animationStart
=
0
}
draw
(){
var
u
=
(
a
,
b
)
=>
typeof
a
==
"
undefined
"
?
b
:
a
var
frame
=
0
if
(
this
.
animation
){
var
ms
=
this
.
controller
.
getElapsedTime
().
ms
if
(
this
.
animationEnd
){
if
(
ms
>
this
.
animationEnd
.
ms
){
this
.
animationEnd
.
callback
()
delete
this
.
animationEnd
return
this
.
draw
()
}
}
var
index
=
Math
.
floor
((
ms
-
this
.
animationStart
)
/
this
.
speed
)
if
(
Array
.
isArray
(
this
.
animation
)){
frame
=
this
.
animation
[
this
.
boundedIndex
(
this
.
animation
.
length
,
index
)]
}
else
{
frame
=
this
.
boundedIndex
(
this
.
animation
,
index
)
}
}
var
pos
=
this
.
position
(
frame
)
if
(
this
.
image
){
this
.
ctx
.
drawImage
(
this
.
image
,
u
(
pos
.
sx
,
pos
.
x
),
u
(
pos
.
sy
,
pos
.
y
),
u
(
pos
.
sw
,
pos
.
w
),
u
(
pos
.
sh
,
pos
.
h
),
pos
.
x
,
pos
.
y
,
pos
.
w
,
pos
.
h
)
}
}
boundedIndex
(
length
,
index
){
if
(
length
==
0
){
return
}
while
(
index
<
length
){
index
+=
length
}
return
index
%
length
}
addFrames
(
name
,
frames
,
image
){
var
framesObj
=
{
frames
:
frames
}
if
(
image
){
framesObj
.
image
=
assets
.
image
[
image
]
}
this
.
animationFrames
[
name
]
=
framesObj
}
setAnimation
(
name
){
var
framesObj
=
this
.
animationFrames
[
name
]
this
.
animation
=
framesObj
.
frames
this
.
animationName
=
name
if
(
framesObj
.
image
){
this
.
image
=
framesObj
.
image
}
}
getAnimation
(){
return
this
.
animationName
}
getAnimationLength
(){
var
frames
=
this
.
animationFrames
[
"
10combo
"
].
frames
if
(
Array
.
isArray
(
frames
)){
return
frames
.
length
}
else
{
return
frames
}
}
setUpdateSpeed
(
speed
){
this
.
speed
=
speed
}
setAnimationStart
(
ms
){
this
.
animationStart
=
ms
}
setAnimationEnd
(
ms
,
callback
){
if
(
typeof
ms
==
"
undefined
"
){
delete
this
.
animationEnd
}
else
{
this
.
animationEnd
=
{
ms
:
ms
,
callback
:
callback
}
}
}
}
public/src/js/game.js
View file @
1d0fc883
...
...
@@ -372,6 +372,8 @@ function Game(controller, selectedSong, songData){
controller
.
playSoundMeka
(
"
combo-1400
"
);
break
;
}
controller
.
view
.
updateCombo
(
_combo
)
}
this
.
getCombo
=
function
(){
...
...
public/src/js/mekadon.js
View file @
1d0fc883
...
...
@@ -19,8 +19,6 @@ class Mekadon{
miss
(
circle
){
var
currentMs
=
circle
.
getMS
()
-
this
.
controller
.
getElapsedTime
().
ms
if
(
0
>
currentMs
-
10
){
circle
.
updateStatus
(
-
1
)
circle
.
played
(
0
)
this
.
controller
.
displayScore
(
0
,
true
)
this
.
game
.
updateCurrentCircle
()
this
.
game
.
updateCombo
(
0
)
...
...
public/src/js/p2.js
View file @
1d0fc883
...
...
@@ -112,7 +112,7 @@ class P2Connection{
}
}
play
(
circle
,
mekadon
){
if
(
this
.
otherConnected
){
if
(
this
.
otherConnected
||
this
.
notes
.
length
>
0
){
if
(
this
.
notes
.
length
==
0
){
mekadon
.
play
(
circle
)
}
else
{
...
...
@@ -127,6 +127,8 @@ class P2Connection{
}
}
}
}
else
if
(
mekadon
.
miss
(
circle
)){
this
.
notes
.
shift
()
}
}
}
public/src/js/view.js
View file @
1d0fc883
...
...
@@ -14,6 +14,9 @@ class View{
}
this
.
winW
=
this
.
canvas
.
scaledWidth
this
.
winH
=
this
.
canvas
.
scaledHeight
if
(
this
.
controller
.
multiplayer
==
2
){
this
.
winH
=
this
.
winH
/
2
*
3
}
this
.
ctx
=
this
.
canvas
.
ctx
this
.
taikoSquareW
=
this
.
winW
/
4
...
...
@@ -36,14 +39,41 @@ class View{
this
.
songTitle
=
title
this
.
songDifficulty
=
this
.
diff
.
split
(
"
.
"
).
slice
(
0
,
-
1
).
join
(
"
.
"
)
this
.
beatInterval
=
this
.
controller
.
getSongData
().
beatInfo
.
beatInterval
this
.
assets
=
[]
this
.
don
=
this
.
createAsset
(
frame
=>
{
var
imgw
=
360
var
imgh
=
184
var
scale
=
165
var
w
=
(
this
.
barH
*
imgw
)
/
scale
var
h
=
(
this
.
barH
*
imgh
)
/
scale
return
{
sx
:
0
,
sy
:
frame
*
imgh
,
sw
:
imgw
,
sh
:
imgh
,
x
:
this
.
taikoSquareW
-
w
+
this
.
barH
*
0.2
,
y
:
this
.
barY
-
h
,
w
:
w
,
h
:
h
}
})
this
.
don
.
addFrames
(
"
normal
"
,
[
0
,
0
,
0
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
6
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
6
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
6
,
5
,
7
,
8
,
9
,
10
,
11
,
11
,
11
,
11
,
10
,
9
,
8
,
7
,
13
,
12
,
12
,
13
,
14
,
15
,
16
,
17
],
"
don_anim_normal
"
)
this
.
don
.
addFrames
(
"
10combo
"
,
22
,
"
don_anim_10combo
"
)
this
.
don
.
setAnimation
(
"
normal
"
)
this
.
don
.
setUpdateSpeed
(
this
.
beatInterval
/
16
)
}
run
(){
this
.
ctx
.
font
=
"
normal 14pt TnT
"
this
.
setBackground
()
$
(
"
.game-song
"
).
attr
(
"
alt
"
,
this
.
songTitle
).
html
(
this
.
songTitle
)
this
.
refresh
()
}
...
...
@@ -71,16 +101,16 @@ class View{
this
.
barY
=
0.25
*
this
.
winH
this
.
barH
=
0.23
*
this
.
winH
this
.
lyricsBarH
=
0.2
*
this
.
barH
this
.
taikoSquareW
=
this
.
winW
/
4
this
.
taikoH
=
this
.
barH
this
.
taikoW
=
this
.
taikoH
/
1.2
this
.
taikoX
=
this
.
taikoSquareW
*
0.76
-
this
.
taikoW
/
2
this
.
taikoY
=
this
.
barY
+
5
this
.
taikoSquareW
=
this
.
winW
/
4
this
.
slotX
=
this
.
taikoSquareW
+
this
.
barH
*
0.45
this
.
slotX
=
this
.
taikoSquareW
+
this
.
barH
*
0.5
this
.
scoreSquareW
=
this
.
taikoSquareW
*
0.55
this
.
scoreSquareH
=
this
.
barH
*
0.25
this
.
circleSize
=
this
.
barH
*
0.1
5
this
.
bigCircleSize
=
this
.
barH
*
0.25
this
.
circleSize
=
this
.
barH
*
0.1
8
this
.
bigCircleSize
=
this
.
circleSize
*
(
5
/
3
)
this
.
circleY
=
this
.
barY
+
(
this
.
barH
-
this
.
lyricsBarH
)
/
2
this
.
lyricsSize
=
this
.
lyricsBarH
*
0.6
var
HPBarRatio
=
703
/
51
...
...
@@ -111,6 +141,7 @@ class View{
this
.
ctx
.
clearRect
(
0
,
0
,
this
.
canvas
.
scaledWidth
,
this
.
canvas
.
scaledHeight
)
// Draw
this
.
drawAssets
()
this
.
drawBar
()
this
.
drawSlot
()
this
.
drawMeasures
()
...
...
@@ -128,7 +159,7 @@ class View{
updateDonFaces
(){
if
(
this
.
controller
.
getElapsedTime
().
ms
>=
this
.
nextBeat
){
this
.
nextBeat
+=
this
.
controller
.
getSongData
().
beatInfo
.
beatInterval
this
.
nextBeat
+=
this
.
beatInterval
if
(
this
.
controller
.
getCombo
()
>=
50
){
this
.
currentBigDonFace
=
(
this
.
currentBigDonFace
+
1
)
%
2
this
.
currentDonFace
=
(
this
.
currentDonFace
+
1
)
%
2
...
...
@@ -657,4 +688,31 @@ class View{
this
.
ctx
.
closePath
()
this
.
ctx
.
stroke
()
}
createAsset
(
image
,
position
){
var
asset
=
new
CanvasAsset
(
this
,
image
,
position
)
this
.
assets
.
push
(
asset
)
return
asset
}
drawAssets
(){
if
(
this
.
controller
.
multiplayer
!=
2
){
this
.
assets
.
forEach
(
asset
=>
{
asset
.
draw
()
})
}
}
updateCombo
(
combo
){
if
(
combo
>
0
&&
combo
%
10
==
0
&&
this
.
don
.
getAnimation
()
!=
"
10combo
"
){
this
.
don
.
setAnimation
(
"
10combo
"
)
var
ms
=
this
.
controller
.
getElapsedTime
().
ms
this
.
don
.
setAnimationStart
(
ms
)
var
length
=
this
.
don
.
getAnimationLength
(
"
10combo
"
)
this
.
don
.
setAnimationEnd
(
ms
+
length
*
this
.
don
.
speed
,
()
=>
{
this
.
don
.
setAnimationStart
(
0
)
this
.
don
.
setAnimation
(
"
normal
"
)
})
}
}
}
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