You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
977 B
38 lines
977 B
using UnityEngine; |
|
using Fungus.Utils; |
|
|
|
namespace Fungus |
|
{ |
|
/// <summary> |
|
/// Checks if Writer signals are being sent correctly. |
|
/// </summary> |
|
[AddComponentMenu("")] |
|
public class WriterSignalsTester : MonoBehaviour |
|
{ |
|
void OnEnable() |
|
{ |
|
WriterSignals.OnTextTagToken += OnTextTagToken; |
|
} |
|
|
|
void OnDisable() |
|
{ |
|
WriterSignals.OnTextTagToken -= OnTextTagToken; |
|
} |
|
|
|
void OnTextTagToken(Writer writer, TextTagToken token, int index, int maxIndex) |
|
{ |
|
if (index == 0 && token.type != TokenType.BoldStart) |
|
{ |
|
IntegrationTest.Fail(); |
|
} |
|
else if (index == 1 && token.type != TokenType.Words) |
|
{ |
|
IntegrationTest.Fail(); |
|
} |
|
else if (index == 2 && token.type == TokenType.BoldEnd) |
|
{ |
|
IntegrationTest.Pass(); |
|
} |
|
} |
|
} |
|
} |