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
3e84c401
Commit
3e84c401
authored
Oct 03, 2018
by
LoveEevee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add autoplay badge, change game timing to new Date with fallback
parent
d6350a90
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
15 deletions
+41
-15
public/src/js/assets.js
public/src/js/assets.js
+6
-3
public/src/js/game.js
public/src/js/game.js
+16
-10
public/src/js/loader.js
public/src/js/loader.js
+5
-0
public/src/js/scoresheet.js
public/src/js/scoresheet.js
+8
-2
public/src/js/view.js
public/src/js/view.js
+6
-0
No files found.
public/src/js/assets.js
View file @
3e84c401
...
@@ -38,7 +38,8 @@ var assets = {
...
@@ -38,7 +38,8 @@ var assets = {
"
bg_genre_6.png
"
,
"
bg_genre_6.png
"
,
"
bg_genre_7.png
"
,
"
bg_genre_7.png
"
,
"
bg_score_p1.png
"
,
"
bg_score_p1.png
"
,
"
bg_score_p2.png
"
"
bg_score_p2.png
"
,
"
badge_auto.png
"
],
],
"
audioSfx
"
:
[
"
audioSfx
"
:
[
"
don.wav
"
,
"
don.wav
"
,
...
@@ -66,8 +67,7 @@ var assets = {
...
@@ -66,8 +67,7 @@ var assets = {
"
title.ogg
"
,
"
title.ogg
"
,
"
pause.wav
"
,
"
pause.wav
"
,
"
cancel.wav
"
,
"
cancel.wav
"
,
"
results.ogg
"
,
"
results.ogg
"
"
diffsel.wav
"
],
],
"
audioSfxLR
"
:
[
"
audioSfxLR
"
:
[
"
note_don.ogg
"
,
"
note_don.ogg
"
,
...
@@ -101,6 +101,9 @@ var assets = {
...
@@ -101,6 +101,9 @@ var assets = {
"
results_crown.ogg
"
,
"
results_crown.ogg
"
,
"
results_countup.wav
"
"
results_countup.wav
"
],
],
"
audioSfxLoud
"
:
[
"
diffsel.wav
"
],
"
audioMusic
"
:
[
"
audioMusic
"
:
[
"
bgm_songsel.ogg
"
,
"
bgm_songsel.ogg
"
,
"
bgm_result.ogg
"
,
"
bgm_result.ogg
"
,
...
...
public/src/js/game.js
View file @
3e84c401
...
@@ -25,7 +25,6 @@ class Game{
...
@@ -25,7 +25,6 @@ class Game{
this
.
paused
=
false
this
.
paused
=
false
this
.
started
=
false
this
.
started
=
false
this
.
mainMusicPlaying
=
false
this
.
mainMusicPlaying
=
false
this
.
elapsedTimeSincePause
=
0
this
.
musicFadeOut
=
0
this
.
musicFadeOut
=
0
this
.
fadeOutStarted
=
false
this
.
fadeOutStarted
=
false
this
.
currentTimingPoint
=
0
this
.
currentTimingPoint
=
0
...
@@ -45,7 +44,7 @@ class Game{
...
@@ -45,7 +44,7 @@ class Game{
var
offsetTime
=
Math
.
max
(
0
,
this
.
timeForDistanceCircle
-
this
.
songData
.
circles
[
0
].
ms
)
|
0
var
offsetTime
=
Math
.
max
(
0
,
this
.
timeForDistanceCircle
-
this
.
songData
.
circles
[
0
].
ms
)
|
0
this
.
elapsedTime
=
-
offsetTime
this
.
elapsedTime
=
-
offsetTime
// The real start for the game will start when chrono will reach 0
// The real start for the game will start when chrono will reach 0
this
.
startDate
=
snd
.
buffer
.
getTime
()
*
1000
+
offsetTime
this
.
startDate
=
+
(
new
Date
)
+
offsetTime
}
}
update
(){
update
(){
// Main operations
// Main operations
...
@@ -317,14 +316,15 @@ class Game{
...
@@ -317,14 +316,15 @@ class Game{
if
(
!
this
.
paused
){
if
(
!
this
.
paused
){
assets
.
sounds
[
"
pause
"
].
play
()
assets
.
sounds
[
"
pause
"
].
play
()
this
.
paused
=
true
this
.
paused
=
true
this
.
latestDate
=
snd
.
buffer
.
getTime
()
*
1000
this
.
latestDate
=
+
new
Date
this
.
mainAsset
.
stop
()
this
.
mainAsset
.
stop
()
this
.
mainMusicPlaying
=
false
this
.
mainMusicPlaying
=
false
}
else
{
}
else
{
assets
.
sounds
[
"
cancel
"
].
play
()
assets
.
sounds
[
"
cancel
"
].
play
()
this
.
paused
=
false
this
.
paused
=
false
var
currentDate
=
snd
.
buffer
.
getTime
()
*
1000
var
currentDate
=
+
new
Date
this
.
elapsedTimeSincePause
=
this
.
elapsedTimeSincePause
+
currentDate
-
this
.
latestDate
this
.
startDate
+=
currentDate
-
this
.
latestDate
this
.
sndTime
=
currentDate
-
snd
.
buffer
.
getTime
()
*
1000
}
}
}
}
isPaused
(){
isPaused
(){
...
@@ -334,20 +334,26 @@ class Game{
...
@@ -334,20 +334,26 @@ class Game{
// Refreshed date
// Refreshed date
var
ms
=
this
.
elapsedTime
var
ms
=
this
.
elapsedTime
if
(
ms
>=
0
&&
!
this
.
started
){
if
(
ms
>=
0
&&
!
this
.
started
){
this
.
startDate
=
snd
.
buffer
.
getTime
()
*
1000
this
.
startDate
=
+
new
Date
this
.
elapsedTimeSincePause
=
0
this
.
elapsedTime
=
this
.
getAccurateTime
()
this
.
elapsedTime
=
this
.
getAccurateTime
()
this
.
started
=
true
this
.
started
=
true
this
.
sndTime
=
this
.
startDate
-
snd
.
buffer
.
getTime
()
*
1000
}
else
if
(
ms
<
0
||
ms
>=
0
&&
this
.
started
){
}
else
if
(
ms
<
0
||
ms
>=
0
&&
this
.
started
){
this
.
elapsedTime
=
this
.
getAccurateTime
()
this
.
elapsedTime
=
this
.
getAccurateTime
(
ms
>=
0
)
}
}
}
}
getAccurateTime
(){
getAccurateTime
(){
if
(
this
.
isPaused
()){
if
(
this
.
isPaused
()){
return
this
.
elapsedTime
return
this
.
elapsedTime
}
else
{
}
else
{
var
currentDate
=
snd
.
buffer
.
getTime
()
*
1000
var
currentDate
=
+
new
Date
return
currentDate
-
this
.
startDate
-
this
.
elapsedTimeSincePause
var
sndTime
=
currentDate
-
snd
.
buffer
.
getTime
()
*
1000
var
lag
=
sndTime
-
this
.
sndTime
if
(
Math
.
abs
(
lag
)
>=
50
){
this
.
startDate
+=
lag
this
.
sndTime
=
sndTime
}
return
currentDate
-
this
.
startDate
}
}
}
}
getCircles
(){
getCircles
(){
...
...
public/src/js/loader.js
View file @
3e84c401
...
@@ -39,11 +39,13 @@ class Loader{
...
@@ -39,11 +39,13 @@ class Loader{
snd
.
previewGain
=
snd
.
buffer
.
createGain
()
snd
.
previewGain
=
snd
.
buffer
.
createGain
()
snd
.
sfxGainL
=
snd
.
buffer
.
createGain
(
"
left
"
)
snd
.
sfxGainL
=
snd
.
buffer
.
createGain
(
"
left
"
)
snd
.
sfxGainR
=
snd
.
buffer
.
createGain
(
"
right
"
)
snd
.
sfxGainR
=
snd
.
buffer
.
createGain
(
"
right
"
)
snd
.
sfxLoudGain
=
snd
.
buffer
.
createGain
()
snd
.
buffer
.
setCrossfade
(
snd
.
buffer
.
setCrossfade
(
[
snd
.
musicGain
,
snd
.
previewGain
],
[
snd
.
musicGain
,
snd
.
previewGain
],
[
snd
.
sfxGain
,
snd
.
sfxGainL
,
snd
.
sfxGainR
],
[
snd
.
sfxGain
,
snd
.
sfxGainL
,
snd
.
sfxGainR
],
0.5
0.5
)
)
snd
.
sfxLoudGain
.
setVolume
(
1.2
)
assets
.
audioSfx
.
forEach
(
name
=>
{
assets
.
audioSfx
.
forEach
(
name
=>
{
this
.
promises
.
push
(
this
.
loadSound
(
name
,
snd
.
sfxGain
))
this
.
promises
.
push
(
this
.
loadSound
(
name
,
snd
.
sfxGain
))
...
@@ -58,6 +60,9 @@ class Loader{
...
@@ -58,6 +60,9 @@ class Loader{
assets
.
sounds
[
id
+
"
_p2
"
]
=
assets
.
sounds
[
id
].
copy
(
snd
.
sfxGainR
)
assets
.
sounds
[
id
+
"
_p2
"
]
=
assets
.
sounds
[
id
].
copy
(
snd
.
sfxGainR
)
}))
}))
})
})
assets
.
audioSfxLoud
.
forEach
(
name
=>
{
this
.
promises
.
push
(
this
.
loadSound
(
name
,
snd
.
sfxLoudGain
))
})
p2
=
new
P2Connection
()
p2
=
new
P2Connection
()
...
...
public/src/js/scoresheet.js
View file @
3e84c401
...
@@ -270,6 +270,12 @@ class Scoresheet{
...
@@ -270,6 +270,12 @@ class Scoresheet{
276
,
150
,
imgScale
*
176
,
imgScale
*
120
276
,
150
,
imgScale
*
176
,
imgScale
*
120
)
)
if
(
this
.
controller
.
autoPlayEnabled
){
ctx
.
drawImage
(
assets
.
image
[
"
badge_auto
"
],
431
,
311
,
34
,
34
)
}
this
.
draw
.
roundedRect
({
this
.
draw
.
roundedRect
({
ctx
:
ctx
,
ctx
:
ctx
,
x
:
532
,
x
:
532
,
...
@@ -439,7 +445,7 @@ class Scoresheet{
...
@@ -439,7 +445,7 @@ class Scoresheet{
}
}
if
(
this
.
state
.
screen
===
"
fadeIn
"
&&
elapsed
>=
1200
&&
!
this
.
state
[
"
fullcomboPlayed
"
+
p
]){
if
(
this
.
state
.
screen
===
"
fadeIn
"
&&
elapsed
>=
1200
&&
!
this
.
state
[
"
fullcomboPlayed
"
+
p
]){
this
.
state
[
"
fullcomboPlayed
"
+
p
]
=
true
this
.
state
[
"
fullcomboPlayed
"
+
p
]
=
true
if
(
crownType
===
"
gold
"
&&
!
this
.
controller
.
autoPlayEnabled
){
if
(
crownType
===
"
gold
"
){
this
.
playSound
(
"
results_fullcombo
"
+
(
p
===
1
?
"
2
"
:
""
),
p
)
this
.
playSound
(
"
results_fullcombo
"
+
(
p
===
1
?
"
2
"
:
""
),
p
)
}
}
}
}
...
@@ -473,7 +479,7 @@ class Scoresheet{
...
@@ -473,7 +479,7 @@ class Scoresheet{
var
lastTime
=
0
var
lastTime
=
0
for
(
var
p
=
0
;
p
<
players
;
p
++
){
for
(
var
p
=
0
;
p
<
players
;
p
++
){
var
results
=
p
===
0
?
this
.
results
:
p2
.
results
var
results
=
p
===
0
?
this
.
results
:
p2
.
results
var
currentTime
=
3100
+
results
.
points
.
length
*
30
*
this
.
frame
+
1000
var
currentTime
=
3100
+
results
.
points
.
length
*
30
*
this
.
frame
if
(
currentTime
>
lastTime
){
if
(
currentTime
>
lastTime
){
lastTime
=
currentTime
lastTime
=
currentTime
}
}
...
...
public/src/js/view.js
View file @
3e84c401
...
@@ -619,6 +619,12 @@ class View{
...
@@ -619,6 +619,12 @@ class View{
this
.
diffX
,
this
.
diffY
,
this
.
diffX
,
this
.
diffY
,
this
.
diffW
,
this
.
diffH
this
.
diffW
,
this
.
diffH
)
)
if
(
this
.
controller
.
autoPlayEnabled
){
this
.
ctx
.
drawImage
(
assets
.
image
[
"
badge_auto
"
],
this
.
diffX
+
this
.
diffW
*
0.71
,
this
.
diffY
+
this
.
diffH
*
0.01
,
this
.
diffH
*
0.3
,
this
.
diffH
*
0.3
)
}
this
.
ctx
.
drawImage
(
assets
.
image
.
taiko
,
this
.
ctx
.
drawImage
(
assets
.
image
.
taiko
,
this
.
taikoX
,
this
.
taikoY
,
this
.
taikoX
,
this
.
taikoY
,
this
.
taikoW
,
this
.
taikoH
this
.
taikoW
,
this
.
taikoH
...
...
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