Browse Source

Fixed dialog issue

pull/2/head
Robert Chen 11 years ago
parent
commit
10766bb687
  1. 12
      js/dialogue.js

12
js/dialogue.js

@ -65,6 +65,10 @@ function DialogUI( stage, gameState ){
this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } );
this.textContent.addEventListener( "click", function(){ setTimeout( clickEvent, 100); }); this.textContent.addEventListener( "click", function(){ setTimeout( clickEvent, 100); });
// negate double setTimeout if clicked
var oldTime = new Date().getTime();
var delayCounter = 0;
this.endFunc = function(){}; this.endFunc = function(){};
this.showDialog= function( textSeq ){ this.showDialog= function( textSeq ){
@ -90,7 +94,8 @@ function DialogUI( stage, gameState ){
that.showRandomConvo(); that.showRandomConvo();
return; return;
} }
delayCounter = 0;
oldTime = new Date().getTime();
that.currDialogueSeq = new DialogueSequence( textSeq.seq ); that.currDialogueSeq = new DialogueSequence( textSeq.seq );
var nextDialogue = that.currDialogueSeq.next(); var nextDialogue = that.currDialogueSeq.next();
@ -121,9 +126,6 @@ function DialogUI( stage, gameState ){
gameState.pubsub.subscribe( "ShowDialog", this.showDialog ); gameState.pubsub.subscribe( "ShowDialog", this.showDialog );
// negate double setTimeout if clicked
var oldTime = new Date().getTime();
var delayCounter = 0;
var clickEvent = function( timer ){ var clickEvent = function( timer ){
if( !peopleImg["Me"] ){ if( !peopleImg["Me"] ){
@ -165,7 +167,6 @@ function DialogUI( stage, gameState ){
return { return {
tick: function(){ tick: function(){
delayCounter = new Date().getTime() - oldTime;
if( that.autoAdvance == true && that.dialogBox.y ==0 && delayCounter > ( (that.textContent.text.length * MILLIS_PER_CHAR) < 2000 ? 2000 : (that.textContent.text.length * MILLIS_PER_CHAR) ) ){ if( that.autoAdvance == true && that.dialogBox.y ==0 && delayCounter > ( (that.textContent.text.length * MILLIS_PER_CHAR) < 2000 ? 2000 : (that.textContent.text.length * MILLIS_PER_CHAR) ) ){
clickEvent(); clickEvent();
@ -205,6 +206,7 @@ function DialogUI( stage, gameState ){
if( that.dialogMotionQueue.length > 0 && that.dialogState == DIALOG_PAUSING ){ if( that.dialogMotionQueue.length > 0 && that.dialogState == DIALOG_PAUSING ){
that.dialogState = that.dialogMotionQueue.shift(); that.dialogState = that.dialogMotionQueue.shift();
} }
delayCounter = new Date().getTime() - oldTime;
}, },
minDialog: function(){ minDialog: function(){

Loading…
Cancel
Save