-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCurglaffEscapeCodeResponder.cs
More file actions
50 lines (41 loc) · 1.45 KB
/
Copy pathCurglaffEscapeCodeResponder.cs
File metadata and controls
50 lines (41 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using UnityEngine;
using Clouds.UI.TextWriting;
namespace Clouds.Impl.UI.TextWriter {
[CreateAssetMenu(menuName = "One Instance Only/Dialogue/CURGLAFF Escape Code Responder")]
public class CurglaffEscapeCodeResponder : EscapeCodeResponder {
[SerializeField] char escapeInvoker = '>';
[SerializeField] char macroInvoker = '%';
public override char invokeFunctionCharacter {get => escapeInvoker;}
public override char invokeMacroCharacter {get => macroInvoker;}
public override bool customHandleEscapeInvokers {get => false;}
public override (IMessageCommand, int) EvaluateEscapeCode (
in string message,
int currentPosition,
out WriteCommand nextWrite
) {
(IMessageCommand cmdOut, int skipDist) returner;
int startPos = currentPosition;
//Eval the actual control-code set.
switch (message[currentPosition]) {
//Delay: >d[*.***]
case BuiltinEscapeCodes.delay: {
float timeToWait = EscapeCodeUtils.readNumber(message, ref currentPosition);
returner.cmdOut = new DelayCommand(timeToWait);
break;
}
default:
currentPosition++;
returner.cmdOut = null;
break;
}
//Figure out how many spaces we've moved.
returner.skipDist = currentPosition - startPos;
//Finally, initialize the next write command.
nextWrite = initializeNextWrite();
return returner;
}
WriteCommand initializeNextWrite() {
return new WriteCommand();
}
}
}