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
2adbfc1e
Commit
2adbfc1e
authored
Aug 28, 2018
by
Bui
Committed by
GitHub
Aug 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from LoveEevee/mekadon
Add autoplay mode
parents
97eee0e2
874445bd
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
118 additions
and
17 deletions
+118
-17
.gitignore
.gitignore
+1
-0
public/index.html
public/index.html
+1
-0
public/src/js/bufferedloop.js
public/src/js/bufferedloop.js
+2
-0
public/src/js/controller.js
public/src/js/controller.js
+16
-2
public/src/js/game.js
public/src/js/game.js
+4
-0
public/src/js/keyboard.js
public/src/js/keyboard.js
+44
-12
public/src/js/loadsong.js
public/src/js/loadsong.js
+2
-2
public/src/js/mekadon.js
public/src/js/mekadon.js
+43
-0
public/src/js/songselect.js
public/src/js/songselect.js
+1
-1
public/src/js/soundsystem.js
public/src/js/soundsystem.js
+4
-0
No files found.
.gitignore
View file @
2adbfc1e
...
...
@@ -42,4 +42,5 @@ Network Trash Folder
Temporary Items
.apdisk
public/songs
public/api
taiko.db
\ No newline at end of file
public/index.html
View file @
2adbfc1e
...
...
@@ -45,6 +45,7 @@
<script
type=
'application/javascript'
src=
'/src/js/main.js'
></script>
<script
type=
'application/javascript'
src=
'/src/js/view.js'
></script>
<script
type=
'application/javascript'
src=
'/src/js/bufferedloop.js'
></script>
<script
type=
'application/javascript'
src=
'/src/js/mekadon.js'
></script>
</head>
<body>
...
...
public/src/js/bufferedloop.js
View file @
2adbfc1e
...
...
@@ -81,10 +81,12 @@ class BufferedLoop{
},
100
)
}
pause
(){
var
self
=
this
clearInterval
(
this
.
interval
)
this
.
sources
.
forEach
(
function
(
sourceObject
){
sourceObject
.
source
.
stop
(
0
)
clearTimeout
(
sourceObject
.
timeout
)
self
.
sources
.
delete
(
sourceObject
)
})
}
}
public/src/js/controller.js
View file @
2adbfc1e
function
Controller
(
selectedSong
,
songData
){
function
Controller
(
selectedSong
,
songData
,
autoPlayEnabled
){
var
_this
=
this
;
var
_backgroundURL
=
"
/songs/
"
+
selectedSong
.
folder
+
"
/bg.png
"
;
...
...
@@ -8,6 +8,7 @@ function Controller(selectedSong, songData){
var
_game
=
new
Game
(
this
,
selectedSong
,
_songData
);
var
_view
=
new
View
(
this
,
_backgroundURL
,
selectedSong
.
title
,
selectedSong
.
difficulty
);
var
_mekadon
=
new
Mekadon
(
this
,
_game
);
var
_keyboard
=
new
Keyboard
(
this
);
var
_mainLoop
;
var
_pauseMenu
=
false
;
...
...
@@ -124,7 +125,7 @@ function Controller(selectedSong, songData){
assets
.
sounds
[
"
main-music
"
].
currentTime
=
0
;
clearInterval
(
_mainLoop
);
$
(
"
#screen
"
).
load
(
"
/src/views/game.html
"
,
function
(){
var
taikoGame
=
new
Controller
(
selectedSong
,
songData
);
var
taikoGame
=
new
Controller
(
selectedSong
,
songData
,
autoPlayEnabled
);
taikoGame
.
run
();
});
}
...
...
@@ -165,6 +166,10 @@ function Controller(selectedSong, songData){
return
_keyboard
.
getKeys
();
}
this
.
setKey
=
function
(
keyCode
,
down
){
return
_keyboard
.
setKey
(
keyCode
,
down
);
}
this
.
getSongData
=
function
(){
return
_game
.
getSongData
();
}
...
...
@@ -209,4 +214,13 @@ function Controller(selectedSong, songData){
_game
.
updateGlobalScore
(
score
);
}
this
.
autoPlay
=
function
(
circle
){
if
(
autoPlayEnabled
){
if
(
circle
&&
circle
.
getStatus
()
==
450
){
_mekadon
.
play
(
circle
)
}
return
true
}
}
}
\ No newline at end of file
public/src/js/game.js
View file @
2adbfc1e
...
...
@@ -118,6 +118,10 @@ function Game(controller, selectedSong, songData){
if
(
circle
){
if
(
controller
.
autoPlay
(
circle
)){
return
}
if
(
controller
.
getKeys
()[
86
]){
if
(
!
circle
.
getPlayed
()
&&
!
controller
.
isWaitingForKeyup
(
86
,
"
score
"
)
&&
circle
.
getStatus
()
!=-
1
){
var
score
=
_this
.
checkScore
(
circle
);
...
...
public/src/js/keyboard.js
View file @
2adbfc1e
...
...
@@ -8,35 +8,54 @@ function Keyboard(controller){
$
(
document
).
keydown
(
function
(
e
){
if
(
e
.
which
===
8
&&
!
$
(
e
.
target
).
is
(
"
input, textarea
"
))
//disable back navigation when pressing backspace
if
(
e
.
which
===
8
&&
!
$
(
e
.
target
).
is
(
"
input, textarea
"
))
// Disable back navigation when pressing backspace
e
.
preventDefault
();
_keys
[
e
.
which
]
=
true
;
if
(
_this
.
buttonEnabled
(
e
.
which
)){
_this
.
setKey
(
e
.
which
,
true
);
}
});
$
(
document
).
keyup
(
function
(
e
){
delete
_keys
[
e
.
which
];
delete
_waitKeyupScore
[
e
.
which
];
delete
_waitKeyupSound
[
e
.
which
];
delete
_waitKeyupMenu
[
e
.
which
];
if
(
_this
.
buttonEnabled
(
e
.
which
)){
_this
.
setKey
(
e
.
which
,
false
);
}
});
this
.
buttonEnabled
=
function
(
keyCode
){
if
(
controller
.
autoPlay
()){
switch
(
keyCode
){
case
86
:
case
66
:
case
67
:
case
78
:
return
false
}
}
return
true
}
this
.
checkGameKeys
=
function
(){
if
(
_keys
[
86
]
&&
!
_this
.
isWaitingForKeyup
(
86
,
"
sound
"
)){
//if press v, play 'don' sound
if
(
_keys
[
86
]
&&
!
_this
.
isWaitingForKeyup
(
86
,
"
sound
"
)){
// V, play 'don' sound
controller
.
playSound
(
'
note_don
'
);
_this
.
waitForKeyup
(
86
,
"
sound
"
);
}
if
(
_keys
[
66
]
&&
!
_this
.
isWaitingForKeyup
(
66
,
"
sound
"
)){
//if press b, play 'don' sound
if
(
_keys
[
66
]
&&
!
_this
.
isWaitingForKeyup
(
66
,
"
sound
"
)){
// B, play 'don' sound
controller
.
playSound
(
'
note_don
'
);
_this
.
waitForKeyup
(
66
,
"
sound
"
);
}
if
(
_keys
[
67
]
&&
!
_this
.
isWaitingForKeyup
(
67
,
"
sound
"
)){
//if press c, play 'ka' sound
if
(
_keys
[
67
]
&&
!
_this
.
isWaitingForKeyup
(
67
,
"
sound
"
)){
// C, play 'ka' sound
controller
.
playSound
(
'
note_ka
'
);
_this
.
waitForKeyup
(
67
,
"
sound
"
);
}
if
(
_keys
[
78
]
&&
!
_this
.
isWaitingForKeyup
(
78
,
"
sound
"
)){
//if press n, play 'ka' sound
if
(
_keys
[
78
]
&&
!
_this
.
isWaitingForKeyup
(
78
,
"
sound
"
)){
// N, play 'ka' sound
controller
.
playSound
(
'
note_ka
'
);
_this
.
waitForKeyup
(
78
,
"
sound
"
);
}
...
...
@@ -45,12 +64,14 @@ function Keyboard(controller){
this
.
checkMenuKeys
=
function
(){
if
(
_keys
[
8
]
&&
!
_this
.
isWaitingForKeyup
(
8
,
"
menu
"
)){
//If press return key, go back to song selection
if
(
_keys
[
8
]
&&
!
_this
.
isWaitingForKeyup
(
8
,
"
menu
"
)){
// Backspace, go back to song selection
_this
.
waitForKeyup
(
8
,
"
menu
"
);
controller
.
pauseSound
(
"
main-music
"
,
true
);
controller
.
songSelection
();
}
if
(
_keys
[
81
]
&&
!
_this
.
isWaitingForKeyup
(
81
,
"
menu
"
)){
//if press p key, pause the game
if
(
_keys
[
81
]
&&
!
_this
.
isWaitingForKeyup
(
81
,
"
menu
"
)){
// Q, pause the game
_this
.
waitForKeyup
(
81
,
"
menu
"
);
controller
.
togglePauseMenu
();
}
...
...
@@ -61,6 +82,17 @@ function Keyboard(controller){
return
_keys
;
}
this
.
setKey
=
function
(
keyCode
,
down
){
if
(
down
){
_keys
[
keyCode
]
=
true
;
}
else
{
delete
_keys
[
keyCode
];
delete
_waitKeyupScore
[
keyCode
];
delete
_waitKeyupSound
[
keyCode
];
delete
_waitKeyupMenu
[
keyCode
];
}
}
this
.
isWaitingForKeyup
=
function
(
key
,
type
){
var
isWaiting
;
if
(
type
==
"
score
"
)
isWaiting
=
_waitKeyupScore
[
key
];
...
...
public/src/js/loadsong.js
View file @
2adbfc1e
function
loadSong
(
selectedSong
){
function
loadSong
(
selectedSong
,
autoPlayEnabled
){
var
_this
=
this
;
var
_selectedSong
=
selectedSong
;
...
...
@@ -46,7 +46,7 @@ function loadSong(selectedSong){
this
.
checkIfEverythingLoaded
=
function
(){
if
(
_musicLoaded
&&
_songDataLoaded
&&
_bgLoaded
){
$
(
"
#screen
"
).
load
(
"
/src/views/game.html
"
,
function
(){
var
taikoGame
=
new
Controller
(
_selectedSong
,
_songData
);
var
taikoGame
=
new
Controller
(
_selectedSong
,
_songData
,
autoPlayEnabled
);
taikoGame
.
run
();
});
}
...
...
public/src/js/mekadon.js
0 → 100644
View file @
2adbfc1e
class
Mekadon
{
constructor
(
controller
,
game
){
this
.
controller
=
controller
this
.
game
=
game
this
.
lr
=
false
this
.
keys
=
{}
}
play
(
circle
){
if
(
circle
.
getType
()
==
"
don
"
){
this
.
setKey
(
this
.
lr
?
86
:
66
)
this
.
lr
=
!
this
.
lr
}
else
if
(
circle
.
getType
()
==
"
daiDon
"
){
this
.
setKey
(
86
)
this
.
setKey
(
66
)
this
.
lr
=
false
}
else
if
(
circle
.
getType
()
==
"
ka
"
){
this
.
setKey
(
this
.
lr
?
67
:
78
)
this
.
lr
=
!
this
.
lr
}
else
if
(
circle
.
getType
()
==
"
daiKa
"
){
this
.
setKey
(
67
)
this
.
setKey
(
78
)
this
.
lr
=
false
}
var
score
=
this
.
game
.
checkScore
(
circle
);
circle
.
played
(
score
);
this
.
game
.
updateCurrentCircle
();
}
setKey
(
keyCode
){
var
self
=
this
if
(
this
.
keys
[
keyCode
]){
clearTimeout
(
this
.
keys
[
keyCode
])
self
.
clearKey
(
keyCode
)
}
this
.
controller
.
setKey
(
keyCode
,
true
)
this
.
keys
[
keyCode
]
=
setTimeout
(
function
(){
self
.
clearKey
(
keyCode
)
},
100
)
}
clearKey
(
keyCode
){
this
.
controller
.
setKey
(
keyCode
,
false
)
delete
this
.
keys
[
keyCode
]
}
}
public/src/js/songselect.js
View file @
2adbfc1e
...
...
@@ -62,7 +62,7 @@ function SongSelect(){
_selectedSong
.
folder
=
songID
;
bgm
.
pause
();
new
loadSong
(
_selectedSong
);
new
loadSong
(
_selectedSong
,
e
.
shiftKey
);
});
$
(
"
.song
"
).
hover
(
function
(){
...
...
public/src/js/soundsystem.js
View file @
2adbfc1e
...
...
@@ -29,6 +29,10 @@ function soundSystem(controller){
}
}
this
.
pauseSound
=
function
(){
_sounds
[
"
main-music
"
].
pause
();
}
this
.
fadeOutMusic
=
function
(){
...
...
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