-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathConEditPlus.Templates.Factory.pas
84 lines (58 loc) · 2.38 KB
/
ConEditPlus.Templates.Factory.pas
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
// ToDo: Place all templates here
unit ConEditPlus.Templates.Factory;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, System.StrUtils,
Conversation.Classes, ConEditPlus.Consts, ConEditPlus.Helpers, ConEditPlus.Enums;
function GenerateSpeech(aLabel, Speaker, SpeakingTo, SpeechString: string): TConEventSpeech;
function GenerateChoice(aLabel: string; NumChoices: Integer; ChoicesLabels: array of string): TConEventChoice;
function GenerateRandom(aLabel: string; JumpLabels: array of string; _bCycle, _bCycleOnce, _bCycleRandom: Boolean): TConEventRandom;
function GenerateEnd(aLabel: string = ''): TConEventEnd;
function GenerateConversation(Preset: TConversationPreset): TConversation;
implementation
uses MainWindow;
function GenerateSpeech(aLabel, Speaker, SpeakingTo, SpeechString: string): TConEventSpeech;
begin
var NewSpeech := TConEventSpeech.Create();
with NewSpeech do
begin
EventLabel := aLabel;
ActorValue := Speaker;
ActorIndex := frmMain.FindTableIdByName(TM_ActorsPawns, Speaker);
ActorToValue := SpeakingTo;
ActorToIndex := frmMain.FindTableIdByName(TM_ActorsPawns, SpeakingTo);
TextLine := SpeechString;
end;
Result := NewSpeech;
end;
function GenerateChoice(aLabel: string; NumChoices: Integer; ChoicesLabels: array of string): TConEventChoice;
begin
var NewChoice := TConEventChoice.Create();
Result := NewChoice;
end;
function GenerateRandom(aLabel: string; JumpLabels: array of string; _bCycle, _bCycleOnce, _bCycleRandom: Boolean): TConEventRandom;
begin
var NewRandom := TConEventRandom.Create();
with NewRandom do
begin
numLabels := Length(JumpLabels);
SetLength(GoToLabels, numLabels);
Move(JumpLabels[0], GoToLabels[0], numLabels * SizeOf(string)); // copy array
bCycle := _bCycle;
bCycleOnce := _bCycleOnce;
bCycleRandom := _bCycleRandom;
end;
Result := NewRandom;
end;
function GenerateEnd(aLabel: string = ''): TConEventEnd;
begin
var EndEvent := TConEventEnd.Create();
EndEvent.EventLabel := aLabel;
Result := EndEvent;
end;
function GenerateConversation(Preset: TConversationPreset): TConversation;
begin
var NewConvo := TConversation.Create();
Result := NewConvo;
end;
end.