-
Notifications
You must be signed in to change notification settings - Fork 477
/
ControlCommand.cs
158 lines (128 loc) · 4.39 KB
/
ControlCommand.cs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
using System;
namespace Ink.Runtime
{
internal class ControlCommand : Runtime.Object
{
public enum CommandType
{
NotSet = -1,
EvalStart,
EvalOutput,
EvalEnd,
Duplicate,
PopEvaluatedValue,
PopFunction,
PopTunnel,
BeginString,
EndString,
NoOp,
ChoiceCount,
TurnsSince,
ReadCount,
Random,
SeedRandom,
VisitIndex,
SequenceShuffleIndex,
StartThread,
Done,
End,
ListFromInt,
ListRange,
//----
TOTAL_VALUES
}
public CommandType commandType { get; protected set; }
public ControlCommand (CommandType commandType)
{
this.commandType = commandType;
}
// Require default constructor for serialisation
public ControlCommand() : this(CommandType.NotSet) {}
internal override Object Copy()
{
return new ControlCommand (commandType);
}
// The following static factory methods are to make generating these objects
// slightly more succinct. Without these, the code gets pretty massive! e.g.
//
// var c = new Runtime.ControlCommand(Runtime.ControlCommand.CommandType.EvalStart)
//
// as opposed to
//
// var c = Runtime.ControlCommand.EvalStart()
public static ControlCommand EvalStart() {
return new ControlCommand(CommandType.EvalStart);
}
public static ControlCommand EvalOutput() {
return new ControlCommand(CommandType.EvalOutput);
}
public static ControlCommand EvalEnd() {
return new ControlCommand(CommandType.EvalEnd);
}
public static ControlCommand Duplicate() {
return new ControlCommand(CommandType.Duplicate);
}
public static ControlCommand PopEvaluatedValue() {
return new ControlCommand (CommandType.PopEvaluatedValue);
}
public static ControlCommand PopFunction() {
return new ControlCommand (CommandType.PopFunction);
}
public static ControlCommand PopTunnel() {
return new ControlCommand (CommandType.PopTunnel);
}
public static ControlCommand BeginString() {
return new ControlCommand (CommandType.BeginString);
}
public static ControlCommand EndString() {
return new ControlCommand (CommandType.EndString);
}
public static ControlCommand NoOp() {
return new ControlCommand(CommandType.NoOp);
}
public static ControlCommand ChoiceCount() {
return new ControlCommand(CommandType.ChoiceCount);
}
public static ControlCommand TurnsSince() {
return new ControlCommand(CommandType.TurnsSince);
}
public static ControlCommand ReadCount ()
{
return new ControlCommand (CommandType.ReadCount);
}
public static ControlCommand Random ()
{
return new ControlCommand (CommandType.Random);
}
public static ControlCommand SeedRandom ()
{
return new ControlCommand (CommandType.SeedRandom);
}
public static ControlCommand VisitIndex() {
return new ControlCommand(CommandType.VisitIndex);
}
public static ControlCommand SequenceShuffleIndex() {
return new ControlCommand(CommandType.SequenceShuffleIndex);
}
public static ControlCommand StartThread() {
return new ControlCommand (CommandType.StartThread);
}
public static ControlCommand Done() {
return new ControlCommand (CommandType.Done);
}
public static ControlCommand End() {
return new ControlCommand (CommandType.End);
}
public static ControlCommand ListFromInt () {
return new ControlCommand (CommandType.ListFromInt);
}
public static ControlCommand ListRange ()
{
return new ControlCommand (CommandType.ListRange);
}
public override string ToString ()
{
return commandType.ToString();
}
}
}