Browse Source

User can click to skip current line of text.

master
chrisgregan 10 years ago
parent
commit
e098549584
  1. 34
      Assets/Fungus/UI/Scripts/Writer.cs
  2. 2
      Assets/FungusExamples/Sherlock/TheExperiment.unity
  3. 2
      Assets/Tests/UI/FakeWriterInput.cs

34
Assets/Fungus/UI/Scripts/Writer.cs

@ -397,17 +397,15 @@ namespace Fungus
}
}
break;
}
inputFlag = false;
if (exit)
{
break;
}
}
inputFlag = false;
isWriting = false;
if (onComplete != null)
@ -432,6 +430,12 @@ namespace Fungus
PartitionString(writeWholeWords, param, i, out left, out right);
text = ConcatenateString(startText, openText, closeText, left, right);
// No delay if user has clicked
if (inputFlag)
{
continue;
}
// Punctuation pause
if (left.Length > 0 &&
IsPunctuation(left.Substring(left.Length - 1)[0]))
@ -496,11 +500,6 @@ namespace Fungus
return tempText;
}
public virtual void SetInputFlag()
{
inputFlag = true;
}
public virtual string GetTagHelp()
{
return "";
@ -513,21 +512,28 @@ namespace Fungus
{
duration = 1f;
}
yield return new WaitForSeconds(duration);
float timeRemaining = duration;
while (timeRemaining > 0f && !inputFlag)
{
timeRemaining -= Time.deltaTime;
yield return null;
}
}
protected virtual IEnumerator DoWaitForInput(bool clear)
{
inputFlag = false;
isWaitingForInput = true;
while (!inputFlag)
{
yield return null;
}
isWaitingForInput = false;
isWaitingForInput = false;
inputFlag = false;
if (clear)
{
textUI.text = "";
@ -576,7 +582,7 @@ namespace Fungus
//
public virtual void OnNextLineEvent()
{
SetInputFlag();
inputFlag = true;
}
}

2
Assets/FungusExamples/Sherlock/TheExperiment.unity

@ -2594,7 +2594,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
targetTextObject: {fileID: 1116800860}
writingSpeed: 60
writingSpeed: 10
punctuationPause: .25
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0

2
Assets/Tests/UI/FakeWriterInput.cs

@ -16,7 +16,7 @@ namespace Fungus
void DoFakeInput()
{
Writer writer = GetComponent<Writer>();
writer.SetInputFlag();
writer.OnNextLineEvent();
}
}

Loading…
Cancel
Save