Skip to content

Commit

Permalink
修复自动播放问题
Browse files Browse the repository at this point in the history
  • Loading branch information
MakinoharaShoko committed Oct 19, 2021
1 parent 4862b68 commit 0a91a6f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
19 changes: 10 additions & 9 deletions res/script/js/InteractProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,16 @@ function autoNext(){
auto = 1;
document.getElementById('autoButton').style.backgroundColor = 'rgba(255,255,255,0.195)';
document.getElementById('autoButton').style.boxShadow = '0 0 25px rgba(255,255,255,0.5)';
if(document.getElementById('currentVocal')&&fast === 0){
let interval2 = setInterval(playNext,30)
function playNext(){
if(document.getElementById('currentVocal').ended){
nextSentenceProcessor();
clearInterval(interval2)
}
}
}else nextSentenceProcessor();
// if(document.getElementById('currentVocal')&&fast === 0){
// let interval2 = setInterval(playNext,30)
// function playNext(){
// if(document.getElementById('currentVocal').ended){
// nextSentenceProcessor();
// clearInterval(interval2)
// }
// }
// }else
nextSentenceProcessor();
}
else if(auto === 1){
autoWaitTime = setAutoWaitTime;
Expand Down
11 changes: 8 additions & 3 deletions res/script/jsx/viewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,18 @@ function playVocal() {
document.getElementById('currentVocal').pause();
}
let vocalName = currentInfo["vocal"];
if(vocalName === ''){
ReactDOM.render(<div/>,document.getElementById('vocal'));
return;
}
let url = './game/vocal/'+vocalName;
let vocal = <audio src={url} id={"currentVocal"}/>
ReactDOM.render(vocal,document.getElementById('vocal'));
let VocalControl = document.getElementById("currentVocal");
VocalControl.currentTime = 0;
VocalControl.play();
VocalControl.oncanplay = function (){
VocalControl.play();
}
}

function showIntro(text){
Expand Down Expand Up @@ -274,9 +280,8 @@ function showTextArray(textArray){
showingText = false;
}
if(i > textArray.length +(autoWaitTime/35)){

if(auto === 1){
if(document.getElementById('currentVocal')&&fast === 0){
if(document.getElementById('currentVocal') && fast === 0){
if(document.getElementById('currentVocal').ended)
{
clearInterval(interval);
Expand Down

0 comments on commit 0a91a6f

Please sign in to comment.