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
2f717614
"...svn:/svn.code.sf.net/p/irrlicht/code/trunk@4298" did not exist on "ecc6ea3884140f3b15b7938ba40840bbb5e4e754"
Commit
2f717614
authored
Aug 28, 2018
by
LoveEevee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add autoplay mode
parent
97eee0e2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
16 deletions
+100
-16
.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
+15
-1
public/src/js/game.js
public/src/js/game.js
+4
-0
public/src/js/keyboard.js
public/src/js/keyboard.js
+31
-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
No files found.
.gitignore
View file @
2f717614
...
@@ -42,4 +42,5 @@ Network Trash Folder
...
@@ -42,4 +42,5 @@ Network Trash Folder
Temporary Items
Temporary Items
.apdisk
.apdisk
public/songs
public/songs
public/api
taiko.db
taiko.db
\ No newline at end of file
public/index.html
View file @
2f717614
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
<script
type=
'application/javascript'
src=
'/src/js/main.js'
></script>
<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/view.js'
></script>
<script
type=
'application/javascript'
src=
'/src/js/bufferedloop.js'
></script>
<script
type=
'application/javascript'
src=
'/src/js/bufferedloop.js'
></script>
<script
type=
'application/javascript'
src=
'/src/js/mekadon.js'
></script>
</head>
</head>
<body>
<body>
...
...
public/src/js/bufferedloop.js
View file @
2f717614
...
@@ -81,10 +81,12 @@ class BufferedLoop{
...
@@ -81,10 +81,12 @@ class BufferedLoop{
},
100
)
},
100
)
}
}
pause
(){
pause
(){
var
self
=
this
clearInterval
(
this
.
interval
)
clearInterval
(
this
.
interval
)
this
.
sources
.
forEach
(
function
(
sourceObject
){
this
.
sources
.
forEach
(
function
(
sourceObject
){
sourceObject
.
source
.
stop
(
0
)
sourceObject
.
source
.
stop
(
0
)
clearTimeout
(
sourceObject
.
timeout
)
clearTimeout
(
sourceObject
.
timeout
)
self
.
sources
.
delete
(
sourceObject
)
})
})
}
}
}
}
public/src/js/controller.js
View file @
2f717614
function
Controller
(
selectedSong
,
songData
){
function
Controller
(
selectedSong
,
songData
,
autoPlayEnabled
){
var
_this
=
this
;
var
_this
=
this
;
var
_backgroundURL
=
"
/songs/
"
+
selectedSong
.
folder
+
"
/bg.png
"
;
var
_backgroundURL
=
"
/songs/
"
+
selectedSong
.
folder
+
"
/bg.png
"
;
...
@@ -8,6 +8,7 @@ function Controller(selectedSong, songData){
...
@@ -8,6 +8,7 @@ function Controller(selectedSong, songData){
var
_game
=
new
Game
(
this
,
selectedSong
,
_songData
);
var
_game
=
new
Game
(
this
,
selectedSong
,
_songData
);
var
_view
=
new
View
(
this
,
_backgroundURL
,
selectedSong
.
title
,
selectedSong
.
difficulty
);
var
_view
=
new
View
(
this
,
_backgroundURL
,
selectedSong
.
title
,
selectedSong
.
difficulty
);
var
_mekadon
=
new
Mekadon
(
this
,
_game
);
var
_keyboard
=
new
Keyboard
(
this
);
var
_keyboard
=
new
Keyboard
(
this
);
var
_mainLoop
;
var
_mainLoop
;
var
_pauseMenu
=
false
;
var
_pauseMenu
=
false
;
...
@@ -165,6 +166,10 @@ function Controller(selectedSong, songData){
...
@@ -165,6 +166,10 @@ function Controller(selectedSong, songData){
return
_keyboard
.
getKeys
();
return
_keyboard
.
getKeys
();
}
}
this
.
setKey
=
function
(
keyCode
,
down
){
return
_keyboard
.
setKey
(
keyCode
,
down
);
}
this
.
getSongData
=
function
(){
this
.
getSongData
=
function
(){
return
_game
.
getSongData
();
return
_game
.
getSongData
();
}
}
...
@@ -209,4 +214,13 @@ function Controller(selectedSong, songData){
...
@@ -209,4 +214,13 @@ function Controller(selectedSong, songData){
_game
.
updateGlobalScore
(
score
);
_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 @
2f717614
...
@@ -118,6 +118,10 @@ function Game(controller, selectedSong, songData){
...
@@ -118,6 +118,10 @@ function Game(controller, selectedSong, songData){
if
(
circle
){
if
(
circle
){
if
(
controller
.
autoPlay
(
circle
)){
return
}
if
(
controller
.
getKeys
()[
86
]){
if
(
controller
.
getKeys
()[
86
]){
if
(
!
circle
.
getPlayed
()
&&
!
controller
.
isWaitingForKeyup
(
86
,
"
score
"
)
&&
circle
.
getStatus
()
!=-
1
){
if
(
!
circle
.
getPlayed
()
&&
!
controller
.
isWaitingForKeyup
(
86
,
"
score
"
)
&&
circle
.
getStatus
()
!=-
1
){
var
score
=
_this
.
checkScore
(
circle
);
var
score
=
_this
.
checkScore
(
circle
);
...
...
public/src/js/keyboard.js
View file @
2f717614
...
@@ -8,35 +8,41 @@ function Keyboard(controller){
...
@@ -8,35 +8,41 @@ function Keyboard(controller){
$
(
document
).
keydown
(
function
(
e
){
$
(
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
();
e
.
preventDefault
();
_keys
[
e
.
which
]
=
true
;
if
(
!
controller
.
autoPlay
()){
_this
.
setKey
(
e
.
which
,
true
);
}
});
});
$
(
document
).
keyup
(
function
(
e
){
$
(
document
).
keyup
(
function
(
e
){
delete
_keys
[
e
.
which
];
if
(
!
controller
.
autoPlay
()){
delete
_waitKeyupScore
[
e
.
which
];
_this
.
setKey
(
e
.
which
,
false
);
delete
_waitKeyupSound
[
e
.
which
];
}
delete
_waitKeyupMenu
[
e
.
which
];
});
});
this
.
checkGameKeys
=
function
(){
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
'
);
controller
.
playSound
(
'
note_don
'
);
_this
.
waitForKeyup
(
86
,
"
sound
"
);
_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
'
);
controller
.
playSound
(
'
note_don
'
);
_this
.
waitForKeyup
(
66
,
"
sound
"
);
_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
'
);
controller
.
playSound
(
'
note_ka
'
);
_this
.
waitForKeyup
(
67
,
"
sound
"
);
_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
'
);
controller
.
playSound
(
'
note_ka
'
);
_this
.
waitForKeyup
(
78
,
"
sound
"
);
_this
.
waitForKeyup
(
78
,
"
sound
"
);
}
}
...
@@ -45,12 +51,14 @@ function Keyboard(controller){
...
@@ -45,12 +51,14 @@ function Keyboard(controller){
this
.
checkMenuKeys
=
function
(){
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
"
);
_this
.
waitForKeyup
(
8
,
"
menu
"
);
controller
.
pauseSound
(
"
main-music
"
,
true
);
controller
.
pauseSound
(
"
main-music
"
,
true
);
controller
.
songSelection
();
controller
.
songSelection
();
}
}
if
(
_keys
[
81
]
&&
!
_this
.
isWaitingForKeyup
(
81
,
"
menu
"
)){
//if press p key, pause the game
if
(
_keys
[
81
]
&&
!
_this
.
isWaitingForKeyup
(
81
,
"
menu
"
)){
// P, pause the game
_this
.
waitForKeyup
(
81
,
"
menu
"
);
_this
.
waitForKeyup
(
81
,
"
menu
"
);
controller
.
togglePauseMenu
();
controller
.
togglePauseMenu
();
}
}
...
@@ -61,6 +69,17 @@ function Keyboard(controller){
...
@@ -61,6 +69,17 @@ function Keyboard(controller){
return
_keys
;
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
){
this
.
isWaitingForKeyup
=
function
(
key
,
type
){
var
isWaiting
;
var
isWaiting
;
if
(
type
==
"
score
"
)
isWaiting
=
_waitKeyupScore
[
key
];
if
(
type
==
"
score
"
)
isWaiting
=
_waitKeyupScore
[
key
];
...
...
public/src/js/loadsong.js
View file @
2f717614
function
loadSong
(
selectedSong
){
function
loadSong
(
selectedSong
,
autoPlayEnabled
){
var
_this
=
this
;
var
_this
=
this
;
var
_selectedSong
=
selectedSong
;
var
_selectedSong
=
selectedSong
;
...
@@ -46,7 +46,7 @@ function loadSong(selectedSong){
...
@@ -46,7 +46,7 @@ function loadSong(selectedSong){
this
.
checkIfEverythingLoaded
=
function
(){
this
.
checkIfEverythingLoaded
=
function
(){
if
(
_musicLoaded
&&
_songDataLoaded
&&
_bgLoaded
){
if
(
_musicLoaded
&&
_songDataLoaded
&&
_bgLoaded
){
$
(
"
#screen
"
).
load
(
"
/src/views/game.html
"
,
function
(){
$
(
"
#screen
"
).
load
(
"
/src/views/game.html
"
,
function
(){
var
taikoGame
=
new
Controller
(
_selectedSong
,
_songData
);
var
taikoGame
=
new
Controller
(
_selectedSong
,
_songData
,
autoPlayEnabled
);
taikoGame
.
run
();
taikoGame
.
run
();
});
});
}
}
...
...
public/src/js/mekadon.js
0 → 100644
View file @
2f717614
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 @
2f717614
...
@@ -62,7 +62,7 @@ function SongSelect(){
...
@@ -62,7 +62,7 @@ function SongSelect(){
_selectedSong
.
folder
=
songID
;
_selectedSong
.
folder
=
songID
;
bgm
.
pause
();
bgm
.
pause
();
new
loadSong
(
_selectedSong
);
new
loadSong
(
_selectedSong
,
e
.
shiftKey
);
});
});
$
(
"
.song
"
).
hover
(
function
(){
$
(
"
.song
"
).
hover
(
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