Browse Source

Merge pull request #291 from FungusGames/writer-improvements

Misc improvements to the Writer system
master
Chris Gregan 9 years ago
parent
commit
8cc6097bea
  1. 37
      Assets/Fungus/UI/Scripts/TextTagParser.cs
  2. 363
      Assets/Fungus/UI/Scripts/Writer.cs
  3. 18
      Assets/Tests/UI/DummyText.cs
  4. 12
      Assets/Tests/UI/DummyText.cs.meta
  5. 78
      Assets/Tests/UI/Editor/TextTagParserTests.cs
  6. 244
      Assets/Tests/UI/TextTests.unity

37
Assets/Fungus/UI/Scripts/TextTagParser.cs

@ -1,5 +1,4 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
@ -30,7 +29,7 @@ namespace Fungus
Message, // m=MessageName
VerticalPunch, // {vpunch=0.5}
HorizontalPunch, // {hpunch=0.5}
Punch, // {shake=0.5}
Punch, // {punch=0.5}
Flash, // {flash=0.5}
Audio, // {audio=Sound}
AudioLoop, // {audioloop=Sound}
@ -41,7 +40,7 @@ namespace Fungus
public class Token
{
public TokenType type = TokenType.Invalid;
public string param = "";
public List<string> paramList;
}
public static string GetTagHelp()
@ -59,9 +58,9 @@ namespace Fungus
"\t{c} Clear\n" +
"\t{x} Exit, advance to the next command without waiting for input\n" +
"\n" +
"\t{vpunch=0.5} Vertically punch screen (intensity)\n" +
"\t{hpunch=0.5} Horizontally punch screen (intensity)\n" +
"\t{shake=1} Shake screen (intensity)\n" +
"\t{vpunch=10,0.5} Vertically punch screen (intensity,time)\n" +
"\t{hpunch=10,0.5} Horizontally punch screen (intensity,time)\n" +
"\t{punch=10,0.5} Punch screen (intensity,time)\n" +
"\t{flash=0.5} Flash screen (duration)\n" +
"\n" +
"\t{audio=AudioObjectName} Play Audio Once\n" +
@ -117,7 +116,7 @@ namespace Fungus
if (trimLeading &&
token.type == TokenType.Words)
{
token.param = token.param.TrimStart(' ', '\t', '\r', '\n');
token.paramList[0] = token.paramList[0].TrimStart(' ', '\t', '\r', '\n');
}
if (token.type == TokenType.Clear ||
@ -138,7 +137,8 @@ namespace Fungus
{
Token token = new Token();
token.type = TokenType.Words;
token.param = words;
token.paramList = new List<string>();
token.paramList.Add(words);
tokenList.Add(token);
}
@ -154,7 +154,7 @@ namespace Fungus
string tag = tagText.Substring(1, tagText.Length - 2);
TokenType type = TokenType.Invalid;
string paramText = ExtractParameter(tag);
List<string> parameters = ExtractParameters(tag);
if (tag == "b")
{
@ -273,7 +273,7 @@ namespace Fungus
{
Token token = new Token();
token.type = type;
token.param = paramText.Trim();
token.paramList = parameters;
tokenList.Add(token);
}
else
@ -281,16 +281,23 @@ namespace Fungus
Debug.LogWarning("Invalid text tag " + tag);
}
}
protected virtual string ExtractParameter(string input)
protected virtual List<string> ExtractParameters(string input)
{
List<string> paramsList = new List<string>();
int index = input.IndexOf('=');
if (index == -1)
{
return "";
return paramsList;
}
return input.Substring(index +1);
string paramsStr = input.Substring(index + 1);
var splits = paramsStr.Split(',');
foreach (var p in splits)
{
paramsList.Add(p.Trim());
}
return paramsList;
}
}

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

@ -3,6 +3,7 @@ using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Reflection;
namespace Fungus
{
@ -52,15 +53,14 @@ namespace Fungus
[Tooltip("Force the target text object to use Rich Text mode so text color and alpha appears correctly")]
public bool forceRichText = true;
/**
* This property is true when the writer is waiting for user input to continue
*/
[Tooltip("Click while text is writing to finish writing immediately")]
public bool instantComplete = true;
// This property is true when the writer is waiting for user input to continue
[System.NonSerialized]
public bool isWaitingForInput;
/**
* This property is true when the writer is writing text or waiting (i.e. still processing tokens)
*/
// This property is true when the writer is writing text or waiting (i.e. still processing tokens)
[System.NonSerialized]
public bool isWriting;
@ -69,6 +69,9 @@ namespace Fungus
protected Text textUI;
protected InputField inputField;
protected TextMesh textMesh;
protected Component textComponent;
protected PropertyInfo textProperty;
protected bool boldActive = false;
protected bool italicActive = false;
protected bool colorActive = false;
@ -94,6 +97,11 @@ namespace Fungus
{
return textMesh.text;
}
else if (textProperty != null)
{
return textProperty.GetValue(textComponent, null) as string;
}
return "";
}
@ -111,6 +119,10 @@ namespace Fungus
{
textMesh.text = value;
}
else if (textProperty != null)
{
textProperty.SetValue(textComponent, value, null);
}
}
}
@ -126,6 +138,20 @@ namespace Fungus
inputField = go.GetComponent<InputField>();
textMesh = go.GetComponent<TextMesh>();
// Try to find any component with a text property
if (textUI == null && inputField == null && textMesh == null)
{
foreach (Component c in GetComponents<Component>())
{
textProperty = c.GetType().GetProperty("text");
if (textProperty != null)
{
textComponent = c;
break;
}
}
}
// Cache the list of child writer listeners
foreach (Component component in GetComponentsInChildren<Component>())
{
@ -157,7 +183,7 @@ namespace Fungus
public virtual bool HasTextObject()
{
return (textUI != null || inputField != null || textMesh != null);
return (textUI != null || inputField != null || textMesh != null || textComponent != null);
}
public virtual bool SupportsRichText()
@ -301,8 +327,35 @@ namespace Fungus
StartCoroutine(ProcessTokens(tokens, onComplete));
}
protected virtual IEnumerator ProcessTokens(List<TextTagParser.Token> tokens, Action onComplete)
virtual protected bool CheckParamCount(List<string> paramList, int count)
{
if (paramList == null)
{
Debug.LogError("paramList is null");
return false;
}
if (paramList.Count != count)
{
Debug.LogError("There must be exactly " + paramList.Count + " parameters.");
return false;
}
return true;
}
protected virtual bool TryGetSingleParam(List<string> paramList, int index, float defaultValue, out float value)
{
value = defaultValue;
if (paramList.Count > index)
{
Single.TryParse(paramList[index], out value);
return true;
}
return false;
}
protected virtual IEnumerator ProcessTokens(List<TextTagParser.Token> tokens, Action onComplete)
{
// Reset control members
boldActive = false;
@ -321,8 +374,8 @@ namespace Fungus
switch (token.type)
{
case TextTagParser.TokenType.Words:
yield return StartCoroutine(DoWords(token.param));
break;
yield return StartCoroutine(DoWords(token.paramList));
break;
case TextTagParser.TokenType.BoldStart:
boldActive = true;
@ -341,17 +394,20 @@ namespace Fungus
break;
case TextTagParser.TokenType.ColorStart:
colorActive = true;
colorText = token.param;
break;
if (CheckParamCount(token.paramList, 1))
{
colorActive = true;
colorText = token.paramList[0];
}
break;
case TextTagParser.TokenType.ColorEnd:
colorActive = false;
break;
case TextTagParser.TokenType.Wait:
yield return StartCoroutine(DoWait(token.param));
break;
yield return StartCoroutine(DoWait(token.paramList));
break;
case TextTagParser.TokenType.WaitForInputNoClear:
yield return StartCoroutine(DoWaitForInput(false));
@ -362,11 +418,8 @@ namespace Fungus
break;
case TextTagParser.TokenType.WaitOnPunctuationStart:
if (!Single.TryParse(token.param, out currentPunctuationPause))
{
currentPunctuationPause = punctuationPause;
}
break;
TryGetSingleParam(token.paramList, 0, punctuationPause, out currentPunctuationPause);
break;
case TextTagParser.TokenType.WaitOnPunctuationEnd:
currentPunctuationPause = punctuationPause;
@ -377,10 +430,7 @@ namespace Fungus
break;
case TextTagParser.TokenType.SpeedStart:
if (!Single.TryParse(token.param, out currentWritingSpeed))
{
currentWritingSpeed = writingSpeed;
}
TryGetSingleParam(token.paramList, 0, writingSpeed, out currentWritingSpeed);
break;
case TextTagParser.TokenType.SpeedEnd:
@ -392,58 +442,69 @@ namespace Fungus
break;
case TextTagParser.TokenType.Message:
Flowchart.BroadcastFungusMessage(token.param);
break;
case TextTagParser.TokenType.VerticalPunch:
float vintensity;
if (!Single.TryParse(token.param, out vintensity))
if (CheckParamCount(token.paramList, 1))
{
vintensity = 10f;
}
Punch(new Vector3(0, vintensity, 0), 0.5f);
break;
Flowchart.BroadcastFungusMessage(token.paramList[0]);
}
break;
case TextTagParser.TokenType.HorizontalPunch:
float hintensity;
if (!Single.TryParse(token.param, out hintensity))
{
hintensity = 10f;
}
Punch(new Vector3(hintensity, 0, 0), 0.5f);
break;
case TextTagParser.TokenType.VerticalPunch:
{
float vintensity;
float time;
TryGetSingleParam(token.paramList, 0, 10.0f, out vintensity);
TryGetSingleParam(token.paramList, 1, 0.5f, out time);
Punch(new Vector3(0, vintensity, 0), time);
}
break;
case TextTagParser.TokenType.Punch:
float intensity;
if (!Single.TryParse(token.param, out intensity))
{
intensity = 10f;
}
Punch(new Vector3(intensity, intensity, 0), 0.5f);
break;
case TextTagParser.TokenType.HorizontalPunch:
{
float hintensity;
float time;
TryGetSingleParam(token.paramList, 0, 10.0f, out hintensity);
TryGetSingleParam(token.paramList, 1, 0.5f, out time);
Punch(new Vector3(hintensity, 0, 0), time);
}
break;
case TextTagParser.TokenType.Punch:
{
float intensity;
float time;
TryGetSingleParam(token.paramList, 0, 10.0f, out intensity);
TryGetSingleParam(token.paramList, 1, 0.5f, out time);
Punch(new Vector3(intensity, intensity, 0), time);
}
break;
case TextTagParser.TokenType.Flash:
float flashDuration;
if (!Single.TryParse(token.param, out flashDuration))
{
flashDuration = 0.2f;
}
TryGetSingleParam(token.paramList, 0, 0.2f, out flashDuration);
Flash(flashDuration);
break;
case TextTagParser.TokenType.Audio:
{
AudioSource audioSource = FindAudio(token.param);
if (audioSource != null)
{
audioSource.PlayOneShot(audioSource.clip);
}
}
break;
case TextTagParser.TokenType.Audio:
{
AudioSource audioSource = null;
if (CheckParamCount(token.paramList, 1))
{
audioSource = FindAudio(token.paramList[0]);
}
if (audioSource != null)
{
audioSource.PlayOneShot(audioSource.clip);
}
}
break;
case TextTagParser.TokenType.AudioLoop:
{
AudioSource audioSource = FindAudio(token.param);
AudioSource audioSource = null;
if (CheckParamCount(token.paramList, 1))
{
audioSource = FindAudio(token.paramList[0]);
}
if (audioSource != null)
{
audioSource.Play();
@ -454,7 +515,11 @@ namespace Fungus
case TextTagParser.TokenType.AudioPause:
{
AudioSource audioSource = FindAudio(token.param);
AudioSource audioSource = null;
if (CheckParamCount(token.paramList, 1))
{
audioSource = FindAudio(token.paramList[0]);
}
if (audioSource != null)
{
audioSource.Pause();
@ -464,7 +529,11 @@ namespace Fungus
case TextTagParser.TokenType.AudioStop:
{
AudioSource audioSource = FindAudio(token.param);
AudioSource audioSource = null;
if (CheckParamCount(token.paramList, 1))
{
audioSource = FindAudio(token.paramList[0]);
}
if (audioSource != null)
{
audioSource.Stop();
@ -491,61 +560,67 @@ namespace Fungus
onComplete();
}
}
protected virtual IEnumerator DoWords(string param)
{
string startText = text;
string openText = OpenMarkup();
string closeText = CloseMarkup();
float timeAccumulator = Time.deltaTime;
for (int i = 0; i < param.Length; ++i)
{
// Exit immediately if the exit flag has been set
if (exitFlag)
{
break;
}
string left = "";
string right = "";
PartitionString(writeWholeWords, param, i, out left, out right);
text = ConcatenateString(startText, openText, closeText, left, right);
NotifyGlyph();
// No delay if user has clicked
if (inputFlag)
{
continue;
}
// Punctuation pause
if (left.Length > 0 &&
right.Length > 0 &&
IsPunctuation(left.Substring(left.Length - 1)[0]))
{
yield return StartCoroutine(DoWait(currentPunctuationPause));
}
// Delay between characters
if (currentWritingSpeed > 0f)
{
if (timeAccumulator > 0f)
{
timeAccumulator -= 1f / currentWritingSpeed;
}
else
{
yield return new WaitForSeconds(1f / currentWritingSpeed);
}
}
}
}
protected void PartitionString(bool wholeWords, string inputString, int i, out string left, out string right)
protected virtual IEnumerator DoWords(List<string> paramList)
{
if (!CheckParamCount(paramList, 1))
{
yield break;
}
string param = paramList[0];
string startText = text;
string openText = OpenMarkup();
string closeText = CloseMarkup();
float timeAccumulator = Time.deltaTime;
for (int i = 0; i < param.Length; ++i)
{
// Exit immediately if the exit flag has been set
if (exitFlag)
{
break;
}
string left = "";
string right = "";
PartitionString(writeWholeWords, param, i, out left, out right);
text = ConcatenateString(startText, openText, closeText, left, right);
NotifyGlyph();
// No delay if user has clicked and Instant Complete is enabled
if (instantComplete && inputFlag)
{
continue;
}
// Punctuation pause
if (left.Length > 0 &&
right.Length > 0 &&
IsPunctuation(left.Substring(left.Length - 1)[0]))
{
yield return StartCoroutine(DoWait(currentPunctuationPause));
}
// Delay between characters
if (currentWritingSpeed > 0f)
{
if (timeAccumulator > 0f)
{
timeAccumulator -= 1f / currentWritingSpeed;
}
else
{
yield return new WaitForSeconds(1f / currentWritingSpeed);
}
}
}
}
protected void PartitionString(bool wholeWords, string inputString, int i, out string left, out string right)
{
left = "";
right = "";
@ -593,24 +668,21 @@ namespace Fungus
return "";
}
protected virtual IEnumerator DoWait(string param)
protected virtual IEnumerator DoWait(List<string> paramList)
{
float duration = 1f;
if (!Single.TryParse(param, out duration))
{
duration = 1f;
}
NotifyPause();
float timeRemaining = duration;
while (timeRemaining > 0f && !inputFlag)
{
timeRemaining -= Time.deltaTime;
yield return null;
}
NotifyResume();
var param = "";
if (paramList.Count == 1)
{
param = paramList[0];
}
float duration = 1f;
if (!Single.TryParse(param, out duration))
{
duration = 1f;
}
yield return StartCoroutine( DoWait(duration) );
}
protected virtual IEnumerator DoWait(float duration)
@ -618,8 +690,13 @@ namespace Fungus
NotifyPause();
float timeRemaining = duration;
while (timeRemaining > 0f && !inputFlag && !exitFlag)
while (timeRemaining > 0f && !exitFlag)
{
if (instantComplete && inputFlag)
{
break;
}
timeRemaining -= Time.deltaTime;
yield return null;
}
@ -663,7 +740,11 @@ namespace Fungus
protected virtual void Punch(Vector3 axis, float time)
{
iTween.ShakePosition(this.gameObject, axis, time);
if (Camera.main == null)
{
return;
}
iTween.ShakePosition(Camera.main.gameObject, axis, time);
}
protected virtual void Flash(float duration)

18
Assets/Tests/UI/DummyText.cs

@ -0,0 +1,18 @@
using UnityEngine;
using System.Collections;
public class DummyText : MonoBehaviour
{
protected string _text;
public string text
{
get { return _text; }
set
{
_text = value;
Debug.Log (_text);
IntegrationTest.Pass();
}
}
}

12
Assets/Tests/UI/DummyText.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fef3ddda75e9a4813ae8e0764d2b7880
timeCreated: 1444742315
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

78
Assets/Tests/UI/Editor/TextTagParserTests.cs

@ -35,127 +35,127 @@ public class TextTagParserTests
int i = 0;
Assert.That(tokens[i].type == TextTagParser.TokenType.Words);
Assert.That(tokens[i].param == "Words ");
Assert.That(tokens[i].paramList[0] == "Words ");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.BoldStart);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Words);
Assert.That(tokens[i].param == "bold test");
Assert.That(tokens[i].paramList[0] == "bold test");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.BoldEnd);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.ItalicStart);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Words);
Assert.That(tokens[i].param == "italic test");
Assert.That(tokens[i].paramList[0] == "italic test");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.ItalicEnd);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.ColorStart);
Assert.That(tokens[i].param == "red");
Assert.That(tokens[i].paramList[0] == "red");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Words);
Assert.That(tokens[i].param == "color test");
Assert.That(tokens[i].paramList[0] == "color test");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.ColorEnd);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Wait);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Wait);
Assert.That(tokens[i].param == "0.5");
Assert.That(tokens[i].paramList[0] == "0.5");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.WaitForInputNoClear);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.WaitForInputAndClear);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.WaitOnPunctuationStart);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.WaitOnPunctuationStart);
Assert.That(tokens[i].param == "0.5");
Assert.That(tokens[i].paramList[0] == "0.5");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.WaitOnPunctuationEnd);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Clear);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.SpeedStart);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.SpeedStart);
Assert.That(tokens[i].param == "60");
Assert.That(tokens[i].paramList[0] == "60");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.SpeedEnd);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Exit);
Assert.That(tokens[i].param == "");
Assert.That(tokens[i].paramList.Count == 0);
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Message);
Assert.That(tokens[i].param == "Message");
Assert.That(tokens[i].paramList[0] == "Message");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.VerticalPunch);
Assert.That(tokens[i].param == "0.5");
Assert.That(tokens[i].paramList[0] == "0.5");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.HorizontalPunch);
Assert.That(tokens[i].param == "0.5");
Assert.That(tokens[i].paramList[0] == "0.5");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Punch);
Assert.That(tokens[i].param == "0.5");
Assert.That(tokens[i].paramList[0] == "0.5");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Flash);
Assert.That(tokens[i].param == "0.5");
Assert.That(tokens[i].paramList[0] == "0.5");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Audio);
Assert.That(tokens[i].param == "Sound");
Assert.That(tokens[i].paramList[0] == "Sound");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.AudioLoop);
Assert.That(tokens[i].param == "Sound");
Assert.That(tokens[i].paramList[0] == "Sound");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.AudioPause);
Assert.That(tokens[i].param == "Sound");
Assert.That(tokens[i].paramList[0] == "Sound");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.AudioStop);
Assert.That(tokens[i].param == "Sound");
Assert.That(tokens[i].paramList[0] == "Sound");
Assert.That(tokens.Count == 31);
}
@ -170,35 +170,35 @@ public class TextTagParserTests
int i = 0;
Assert.That(tokens[i].type == TextTagParser.TokenType.Words);
Assert.That(tokens[i].param == "Play sound");
Assert.That(tokens[i].paramList[0] == "Play sound");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Audio);
Assert.That(tokens[i].param == "BeepSound");
Assert.That(tokens[i].paramList[0] == "BeepSound");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Wait);
Assert.That(tokens[i].param == "1");
Assert.That(tokens[i].paramList[0] == "1");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Words);
Assert.That(tokens[i].param == " Play loop");
Assert.That(tokens[i].paramList[0] == " Play loop");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.AudioLoop);
Assert.That(tokens[i].param == "BeepSound");
Assert.That(tokens[i].paramList[0] == "BeepSound");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Wait);
Assert.That(tokens[i].param == "3");
Assert.That(tokens[i].paramList[0] == "3");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.Words);
Assert.That(tokens[i].param == " Stop");
Assert.That(tokens[i].paramList[0] == " Stop");
i++;
Assert.That(tokens[i].type == TextTagParser.TokenType.AudioStop);
Assert.That(tokens[i].param == "BeepSound");
Assert.That(tokens[i].paramList[0] == "BeepSound");
Assert.That(tokens.Count == 8);
}

244
Assets/Tests/UI/TextTests.unity

@ -407,6 +407,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &185519275
MonoBehaviour:
m_ObjectHideFlags: 0
@ -924,6 +925,57 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!1 &396899562
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 396899564}
- 114: {fileID: 396899563}
m_Layer: 0
m_Name: GenericTextTest
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &396899563
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 396899562}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3}
m_Name:
m_EditorClassIdentifier:
timeout: 5
ignored: 0
succeedAfterAllAssertionsAreExecuted: 0
expectException: 0
expectedExceptionList:
succeedWhenExceptionIsThrown: 0
includedPlatforms: -1
platformsToIgnore: []
dynamic: 0
dynamicTypeName:
--- !u!4 &396899564
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 396899562}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1619905204}
- {fileID: 954527802}
m_Father: {fileID: 0}
m_RootOrder: 8
--- !u!114 &419867297
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1001,6 +1053,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &497932659
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1131,6 +1184,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &501693569
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1349,7 +1403,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &717214672
Transform:
m_ObjectHideFlags: 0
@ -1480,6 +1534,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &750279030
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1916,6 +1971,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &899652413
MonoBehaviour:
m_ObjectHideFlags: 0
@ -2071,6 +2127,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!1 &945055421
GameObject:
m_ObjectHideFlags: 0
@ -2186,6 +2243,138 @@ MonoBehaviour:
other: {fileID: 0}
otherPropertyPath:
constantValueGeneric: 0
--- !u!1 &954527801
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 142980, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 954527802}
- 114: {fileID: 954527806}
- 114: {fileID: 954527805}
- 114: {fileID: 954527804}
- 114: {fileID: 954527803}
m_Layer: 0
m_Name: Flowchart
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &954527802
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 467082, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 954527801}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 396899564}
m_RootOrder: 1
--- !u!114 &954527803
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 954527801}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad2261dbe44de43a980e6f7c77c88f7f, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
textObject: {fileID: 1619905202}
text:
stringRef: {fileID: 0}
stringVal: Test text
description:
clearText: 1
waitUntilFinished: 1
textColor: 0
setAlpha:
floatRef: {fileID: 0}
floatVal: 1
setColor:
colorRef: {fileID: 0}
colorVal: {r: 1, g: 1, b: 1, a: 1}
--- !u!114 &954527804
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 11462346, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 954527801}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2f6487d21a03404cb21b245f0242e79, type: 3}
m_Name:
m_EditorClassIdentifier:
parentBlock: {fileID: 954527805}
--- !u!114 &954527805
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 11433304, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 954527801}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3}
m_Name:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 67
y: 72
width: 120
height: 40
itemId: 0
blockName: Start
description:
eventHandler: {fileID: 954527804}
commandList:
- {fileID: 954527803}
--- !u!114 &954527806
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 11430050, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 954527801}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 1.0
scrollPos: {x: 0, y: 0}
variablesScrollPos: {x: 0, y: 0}
variablesExpanded: 1
blockViewHeight: 400
zoom: 1
scrollViewRect:
serializedVersion: 2
x: -343
y: -340
width: 1114
height: 859
selectedBlock: {fileID: 0}
selectedCommands: []
variables: []
description: "Tests using the Write command with a \ncomponent that exposes the
'text' property.\nThis allows Write to work with TextMeshPro or any other\ntext
object that uses the 'text' property."
stepPause: 0
colorCommands: 1
hideComponents: 1
saveSelection: 1
localizationId:
hideCommands: []
--- !u!1 &988367244
GameObject:
m_ObjectHideFlags: 0
@ -2239,6 +2428,7 @@ MonoBehaviour:
hiddenTextColor: {r: .500811279, g: .213235319, b: 1, a: 1}
writeWholeWords: 1
forceRichText: 1
instantComplete: 1
--- !u!114 &988367247
MonoBehaviour:
m_ObjectHideFlags: 0
@ -3633,6 +3823,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &1121374953
MonoBehaviour:
m_ObjectHideFlags: 0
@ -3946,6 +4137,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &1218238777
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4031,7 +4223,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3}
m_Name:
m_EditorClassIdentifier:
selectedFlowchart: {fileID: 1106313368}
selectedFlowchart: {fileID: 954527806}
--- !u!4 &1308535842
Transform:
m_ObjectHideFlags: 1
@ -4692,6 +4884,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &1476144416
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4839,6 +5032,7 @@ MonoBehaviour:
hiddenTextColor: {r: .463235319, g: .463235319, b: .463235319, a: 1}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &1490749235
MonoBehaviour:
m_ObjectHideFlags: 0
@ -5217,6 +5411,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &1614606400
MonoBehaviour:
m_ObjectHideFlags: 0
@ -5255,6 +5450,45 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1614606397}
--- !u!1 &1619905202
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1619905204}
- 114: {fileID: 1619905203}
m_Layer: 0
m_Name: DummyText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1619905203
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1619905202}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fef3ddda75e9a4813ae8e0764d2b7880, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1619905204
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1619905202}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 396899564}
m_RootOrder: 0
--- !u!1 &1649786890
GameObject:
m_ObjectHideFlags: 0
@ -5418,6 +5652,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &1651293178
MonoBehaviour:
m_ObjectHideFlags: 0
@ -5582,6 +5817,7 @@ MonoBehaviour:
hiddenTextColor: {r: .500811279, g: .213235319, b: 1, a: 1}
writeWholeWords: 1
forceRichText: 1
instantComplete: 1
--- !u!114 &1719294952
MonoBehaviour:
m_ObjectHideFlags: 0
@ -5893,6 +6129,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!1 &1783342057
GameObject:
m_ObjectHideFlags: 0
@ -6480,6 +6717,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &1920590684
MonoBehaviour:
m_ObjectHideFlags: 0
@ -6607,6 +6845,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &2004095631
MonoBehaviour:
m_ObjectHideFlags: 0
@ -6697,6 +6936,7 @@ MonoBehaviour:
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &2015818683
MonoBehaviour:
m_ObjectHideFlags: 0

Loading…
Cancel
Save