-
Notifications
You must be signed in to change notification settings - Fork 2
/
GenerativeTextingSystem.reds
1452 lines (1307 loc) · 69.7 KB
/
GenerativeTextingSystem.reds
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import Codeware.*
import Codeware.UI.*
public class GenerativeTextingSystem extends ScriptableService {
private let initialized: Bool = false;
private let callbackSystem: wref<CallbackSystem>;
private let npcSelected: Bool = false;
private let chatOpen: Bool = false;
private let parent: wref<inkCanvas>;
private let contactListSlot: wref<inkCanvas>;
private let chatContainer: wref<inkCanvas>;
private let defaultPhoneController: wref<NewHudPhoneGameController>;
private let defaultChatUi: wref<inkCanvas>;
private let messageParent: wref<inkVerticalPanel>;
private let rootAnim: wref<inkAnimDef>;
private let messageAnim: wref<inkAnimDef>;
private let player: wref<PlayerPuppet>;
private let isTyping: Bool = false;
private let typedMessage: String = "";
private let typedMessageText: wref<inkText>;
private let typedMessageWrapper: wref<inkHorizontalPanel>;
private let chatInputHint: wref<inkImage>;
private let messengerSlotRoot: wref<inkCanvas>;
private let chatScrollController: wref<inkScrollController>;
private let typingIndicator: wref<inkFlex>;
private let lastActiveCharacter: CharacterSetting = CharacterSetting.Panam;
private let unread: Bool = false;
private let disabled: Bool = false;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Player Gender")
@runtimeProperty("ModSettings.description", "Controls the gender you will be referred to as.")
@runtimeProperty("ModSettings.displayValues.Male", "Male")
@runtimeProperty("ModSettings.displayValues.Female", "Female")
public let gender: PlayerGender = PlayerGender.Male;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Character")
@runtimeProperty("ModSettings.description", "Controls the character you can chat with.")
@runtimeProperty("ModSettings.displayValues.Panam", "Panam Palmer")
@runtimeProperty("ModSettings.displayValues.Judy", "Judy Alvarez")
@runtimeProperty("ModSettings.displayValues.River", "River Ward")
@runtimeProperty("ModSettings.displayValues.Kerry", "Kerry Eurodyne")
@runtimeProperty("ModSettings.displayValues.Songbird", "Songbird")
@runtimeProperty("ModSettings.displayValues.Rogue", "Rogue Amendiares")
@runtimeProperty("ModSettings.displayValues.Viktor", "Viktor Vektor")
// @runtimeProperty("ModSettings.displayValues.Misty", "Misty Olszewski")
@runtimeProperty("ModSettings.displayValues.Takemura", "Goro Takemura")
public let character: CharacterSetting = CharacterSetting.Panam;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Model")
@runtimeProperty("ModSettings.description", "Controls the LLM powering the character.")
@runtimeProperty("ModSettings.displayValues.StableHorde", "Stable Horde")
@runtimeProperty("ModSettings.displayValues.OpenAI", "ChatGPT")
public let aiModel: LLMProvider = LLMProvider.StableHorde;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Language")
@runtimeProperty("ModSettings.description", "Controls the language of the generated text. Works more consistently with ChatGPT.")
@runtimeProperty("ModSettings.displayValues.English", "English")
@runtimeProperty("ModSettings.displayValues.Spanish", "Spanish")
@runtimeProperty("ModSettings.displayValues.French", "French")
@runtimeProperty("ModSettings.displayValues.German", "German")
@runtimeProperty("ModSettings.displayValues.Italian", "Italian")
@runtimeProperty("ModSettings.displayValues.Portuguese", "Portuguese")
public let language: PlayerLanguage = PlayerLanguage.English;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Romance")
@runtimeProperty("ModSettings.description", "Controls whether the responses are predisposed to romance.")
public let romance: Bool = false;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Temperature")
@runtimeProperty("ModSettings.description", "Controls the randomness of the generated text. Lower = more predictable, higher = more random.")
@runtimeProperty("ModSettings.step", "0.1")
@runtimeProperty("ModSettings.min", "0.0")
@runtimeProperty("ModSettings.max", "2.0")
public let temperature: Float = 1.0;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Top K")
@runtimeProperty("ModSettings.description", "Limits the token pool to the K most likely tokens. A lower number is more consistent but less creative.")
@runtimeProperty("ModSettings.step", "1")
@runtimeProperty("ModSettings.min", "0")
@runtimeProperty("ModSettings.max", "100")
public let top_k: Int32 = 0;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Top P")
@runtimeProperty("ModSettings.description", "Limits the token pool to however many tokens it takes for their probabilities to add up to P. A lower number is more consistent but less creative.")
@runtimeProperty("ModSettings.step", "0.05")
@runtimeProperty("ModSettings.min", "0.0")
@runtimeProperty("ModSettings.max", "1.0")
public let top_p: Float = 0.95;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Top A")
@runtimeProperty("ModSettings.description", "The number of tokens chosen from the most likely options is automatically determined based on the likelihood distribution of the options, but instead of choosing the Top P or Top K tokens, it chooses all tokens with probabilities above a certain threshold.")
@runtimeProperty("ModSettings.step", "0.1")
@runtimeProperty("ModSettings.min", "0.0")
@runtimeProperty("ModSettings.max", "1.0")
public let top_a: Float = 0.0;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Tail Free Sampling (TFS)")
@runtimeProperty("ModSettings.description", "Removes the least probable tokens from consideration during text generation, which can improve the quality and coherence of the generated text.")
@runtimeProperty("ModSettings.step", "0.1")
@runtimeProperty("ModSettings.min", "0.0")
@runtimeProperty("ModSettings.max", "1.0")
public let tfs: Float = 1.0;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Minimum Probability (Min P)")
@runtimeProperty("ModSettings.description", "Limits the token pool by cutting off low-probability tokens relative to the top token. Produces more coherent responses but can also worsen repetition if set too high.")
@runtimeProperty("ModSettings.step", "0.05")
@runtimeProperty("ModSettings.min", "0.0")
@runtimeProperty("ModSettings.max", "1.0")
public let min_p: Float = 0.05;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Typical P")
@runtimeProperty("ModSettings.description", "Selects tokens randomly from the list of possible tokens, with each token having an equal chance of being selected. Produces responses that are more diverse but may also be less coherent.")
@runtimeProperty("ModSettings.step", "0.05")
@runtimeProperty("ModSettings.min", "0.0")
@runtimeProperty("ModSettings.max", "1.0")
public let typical: Float = 1.0;
@runtimeProperty("ModSettings.mod", "Generative Texting")
@runtimeProperty("ModSettings.displayName", "Enable Logs")
@runtimeProperty("ModSettings.description", "Allows you to view logs in the CET console.")
public let logging: Bool = false;
private cb func OnReload() {
ConsoleLog("Reloading Generative Texting System...");
this.initialized = false;
this.InitializeSystem();
}
// Initialize callbacks, widgets, and other necessary components
private func InitializeSystem() {
this.player = GetPlayer(GetGameInstance());
this.npcSelected = false;
this.chatOpen = false;
this.isTyping = false;
this.callbackSystem = GameInstance.GetCallbackSystem();
this.callbackSystem.UnregisterCallback(n"Input/Key", this, n"OnKeyInput");
this.callbackSystem.UnregisterCallback(n"Input/Axis", this, n"OnAxisInput");
ModSettings.RegisterListenerToClass(this);
this.GetWidgetReferences(54);
this.InitializeDefaultPhoneController();
this.SetupChatContainer();
this.initialized = true;
GetHttpRequestSystem().ToggleIsGenerating(false);
ConsoleLog("Generative Texting System initialized");
}
private func GetWidgetReferences(middleWidgetIndex: Int32) {
let inkSystem = GameInstance.GetInkSystem();
let virtualWindow = inkSystem.GetLayer(n"inkHUDLayer").GetVirtualWindow();
let virtualWindowRoot = virtualWindow.GetWidget(0) as inkCanvas;
let hudMiddleWidget = virtualWindowRoot.GetWidget(middleWidgetIndex) as inkCanvas;
this.parent = hudMiddleWidget.GetWidget(0) as inkCanvas;
this.contactListSlot = FindWidgetWithName(this.parent, n"contact_list_slot") as inkCanvas;
this.defaultChatUi = FindWidgetWithName(this.parent, n"sms_messenger_slot") as inkCanvas;
if !IsDefined(this.contactListSlot) {
if middleWidgetIndex < 45 {
ConsoleLog("Contact List Slot not found, giving up.");
this.disabled = true;
return;
}
ConsoleLog(s"Contact List Slot not found, checking Hud Middle Widget \(middleWidgetIndex - 1)");
this.GetWidgetReferences(middleWidgetIndex - 1);
} else {
this.disabled = false;
}
}
// Handle key input events
private cb func OnKeyInput(event: ref<KeyInputEvent>) {
if NotEquals(s"\(event.GetAction())", "IACT_Press") {
return;
}
if this.isTyping {
if Equals(s"\(event.GetKey())", "IK_Enter") {
this.isTyping = false;
let message = this.GetInputText();
if Equals(StrLen(message), 0) {
this.UpdateInputUi();
return;
}
this.BuildMessage(message, true, true);
} else {
this.PlaySound(n"ui_menu_mouse_click");
}
return;
}
if Equals(s"\(event.GetKey())", "IK_T") {
if this.disabled {
ConsoleLog("Generative Texting System is disabled. Please contact the mod author for support.");
return;
}
if (!this.chatOpen && this.npcSelected) {
this.HidePhoneUi();
} else {
ConsoleLog(s"Chat open: \(this.chatOpen), NPC selected: \(this.npcSelected)");
return;
}
}
if Equals(s"\(event.GetKey())", "IK_C") {
if this.chatOpen {
this.npcSelected = false;
this.chatOpen = false;
this.ShowPhoneUI();
} else {
return;
}
}
if Equals(s"\(event.GetKey())", "IK_R") {
if (this.chatOpen && !this.isTyping) {
this.ResetConversation(true);
} else {
return;
}
}
if Equals(s"\(event.GetKey())", "IK_Z") {
if (this.chatOpen && !this.isTyping) {
this.UndoMessage();
} else {
return;
}
}
if Equals(s"\(event.GetKey())", "IK_LeftMouse") {
if (!this.chatOpen || this.isTyping ) {
return;
}
if GetHttpRequestSystem().GetIsGenerating() {
return;
}
this.isTyping = true;
this.typedMessageText.SetText("Start Typing...");
this.typedMessageText.SetVisible(false);
this.chatInputHint.SetTexturePart(n"kb_enter");
this.BuildInput();
}
}
// Handle scrolling messages
private cb func OnAxisInput(event: ref<AxisInputEvent>) {
if Equals(s"\(event.GetKey())", "IK_MouseZ") {
if Equals(event.GetValue(), 1.0) {
this.chatScrollController.Scroll(1.0, true);
} else if Equals(event.GetValue(), -1.0) {
this.chatScrollController.Scroll(-1.0, true);
}
}
}
// Reset the conversation history and remove all messages
private func ResetConversation(playSound: Bool) {
GetHttpRequestSystem().ResetConversation();
this.messageParent.RemoveAllChildren();
if playSound {
this.PlaySound(n"ui_menu_map_pin_off");
}
}
// Undo the last message sent from the NPC and V
private func UndoMessage() {
GetHttpRequestSystem().UndoMessage();
let len = this.messageParent.GetNumChildren();
if len > 0 {
this.messageParent.RemoveChild(this.messageParent.GetWidget(len - 1));
this.messageParent.RemoveChild(this.messageParent.GetWidget(len - 2));
this.PlaySound(n"ui_menu_map_pin_off");
}
}
// Handle selecting an NPC
public func ToggleNpcSelected(value: Bool) {
if !this.initialized {
this.InitializeSystem();
}
this.npcSelected = value;
if this.npcSelected {
this.callbackSystem.RegisterCallback(n"Input/Key", this, n"OnKeyInput", true)
.AddTarget(InputTarget.Key(EInputKey.IK_T));
if NotEquals(this.lastActiveCharacter, this.character) {
this.ResetConversation(false);
this.lastActiveCharacter = this.character;
}
} else {
this.callbackSystem.UnregisterCallback(n"Input/Key", this, n"OnKeyInput");
this.callbackSystem.UnregisterCallback(n"Input/Axis", this, n"OnAxisInput");
}
}
public func ToggleIsTyping(value: Bool) {
this.isTyping = value;
}
public func ToggleUnread(value: Bool) {
this.unread = value;
}
public func GetUnread() -> Bool {
return this.unread;
}
// Update the input UI based on the current state
public func UpdateInputUi() {
let input = this.typedMessageWrapper.GetWidget(2) as inkCompoundWidget;
if GetHttpRequestSystem().GetIsGenerating() {
this.typedMessageWrapper.RemoveChildByName(input.GetName());
this.typedMessageText.SetVisible(true);
this.typedMessageText.SetText("Send a message.");
this.typedMessageText.SetOpacity(0.2);
this.chatInputHint.SetTexturePart(n"mouse_left");
this.chatInputHint.SetOpacity(0.2);
} else if !this.isTyping {
this.typedMessageWrapper.RemoveChildByName(input.GetName());
this.typedMessageText.SetVisible(true);
this.typedMessageText.SetText("Send a message.");
this.typedMessageText.SetOpacity(1);
this.chatInputHint.SetTexturePart(n"mouse_left");
this.chatInputHint.SetOpacity(1);
} else {
this.typedMessageText.SetOpacity(1);
this.chatInputHint.SetOpacity(1);
}
}
// Show the mod chat UI
private func ShowModChat() {
this.chatOpen = true;
this.parent.ReorderChild(this.chatContainer, 12);
this.parent.ReorderChild(this.defaultChatUi, 14);
GetTextingSystem().ToggleUnread(false);
this.BuildChatUi();
this.PlaySound(n"ui_menu_map_pin_created");
this.callbackSystem.RegisterCallback(n"Input/Key", this, n"OnKeyInput", true);
this.callbackSystem.RegisterCallback(n"Input/Axis", this, n"OnAxisInput", true);
if IsDefined(this.chatScrollController) {
this.chatScrollController.SetScrollPosition(1.0);
}
}
// Hide the mod chat UI
public func HideModChat() {
this.parent.ReorderChild(this.defaultChatUi, 12);
this.parent.ReorderChild(this.chatContainer, 14);
this.chatContainer.RemoveAllChildren();
this.chatOpen = false;
}
// Hide the default phone UI
public func HidePhoneUi() {
if IsDefined(this.defaultPhoneController) {
this.defaultPhoneController.DisableContactsInput();
this.ToggleContactList(false);
this.ShowModChat();
} else {
this.InitializeDefaultPhoneController();
}
}
// Show the default phone UI
private func ShowPhoneUI() {
if (IsDefined(this.defaultPhoneController) && IsDefined(this.contactListSlot)) {
this.defaultPhoneController.EnableContactsInput();
this.ToggleContactList(true);
} else {
this.InitializeDefaultPhoneController();
this.ShowPhoneUI();
}
this.HideModChat();
}
private func ToggleContactList(value: Bool) {
ConsoleLog(s"Toggling contact list: \(value)");
let contactListRoot = this.contactListSlot.GetWidget(0) as inkCanvas;
let contactListContainer = contactListRoot.GetWidget(0) as inkCanvas;
let contactCentralContainer = contactListContainer.GetWidget(1) as inkVerticalPanel;
if !IsDefined(contactCentralContainer) {
ConsoleLog("Contact list not found.");
return;
}
if value {
ConsoleLog("Setting contact list to visible.");
contactCentralContainer.SetVisible(true);
} else {
ConsoleLog("Setting contact list to invisible.");
contactCentralContainer.SetVisible(false);
}
}
// Build the widget containing the chat message list
private func SetupChatContainer() {
if this.parent.GetNumChildren() > 14 {
this.parent.RemoveChildByName(n"mod_messenger_slot");
}
let modMessengerSlot = new inkCanvas();
modMessengerSlot.Reparent(this.parent);
modMessengerSlot.SetMargin(new inkMargin(80.0, 480.0, 0.0, 0.0));
modMessengerSlot.SetChildOrder(inkEChildOrder.Backward);
modMessengerSlot.SetName(n"mod_messenger_slot");
this.chatContainer = modMessengerSlot;
}
// Get a reference to the phone controller
private func InitializeDefaultPhoneController() {
let inkSystem = GameInstance.GetInkSystem();
for controller in inkSystem.GetLayer(n"inkHUDLayer").GetGameControllers() {
if Equals(s"\(controller.GetClassName())", "NewHudPhoneGameController") {
this.defaultPhoneController = controller as NewHudPhoneGameController;
ConsoleLog("Phone controller found.");
}
}
}
private func PlaySound(sound: CName) {
GameObject.PlaySoundEvent(this.player, sound);
}
// Build the input widget for the chat
private func BuildInput() {
let inkSystem = GameInstance.GetInkSystem();
let input = HubTextInput.Create();
input.SetText("");
input.Reparent(this.typedMessageWrapper);
let inputWidget = this.typedMessageWrapper.GetWidget(2) as inkCompoundWidget;
inputWidget.RemoveChildByName(n"theme");
inputWidget.SetTranslation(new Vector2(0.0, -9.0));
let inputChild1 = inputWidget.GetWidget(1) as inkCompoundWidget;
let inputChild2 = inputChild1.GetWidget(0) as inkCompoundWidget;
let inputChild3 = inputChild2.GetWidget(1) as inkText;
inputChild3.SetTintColor(new Color(Cast(255u), Cast(255u), Cast(78u), Cast(255u)));
inkSystem.SetFocus(input.GetRootWidget());
}
// Get the text from the input widget
private func GetInputText() -> String {
let input = this.typedMessageWrapper.GetWidget(2) as inkCompoundWidget;
let inputChild1 = input.GetWidget(1) as inkCompoundWidget;
let inputChild2 = inputChild1.GetWidget(0) as inkCompoundWidget;
let inputChild3 = inputChild2.GetWidget(1) as inkText;
let message = inputChild3.GetText();
return message;
}
public func GetChatOpen() -> Bool {
return this.chatOpen;
}
public func ToggleTypingIndicator(value: Bool) {
if value {
this.typingIndicator.SetVisible(!this.typingIndicator.IsVisible());
if this.typingIndicator.IsVisible() {
this.PlaySound(n"ui_messenger_typing");
}
} else {
this.typingIndicator.SetVisible(false);
}
}
// Build a message for the player or NPC
private func BuildMessage(text: String, fromPlayer: Bool, useAnim: Bool) {
if !IsDefined(this.messageParent) {
return;
}
let message = new inkFlex();
message.SetName(n"Root");
message.SetHAlign(inkEHorizontalAlign.Left);
message.SetSize(new Vector2(100.0, 100.0));
message.SetStyle(r"base\\gameplay\\gui\\fullscreen\\phone_quest_menu\\messenger.inkstyle");
message.Reparent(this.messageParent);
let wide = new inkCanvas();
wide.SetName(n"wide");
wide.SetHAlign(inkEHorizontalAlign.Left);
wide.SetSize(new Vector2(1200.0, 600.0));
wide.SetChildOrder(inkEChildOrder.Backward);
wide.Reparent(message);
let messageContainer = new inkFlex();
messageContainer.SetName(n"container");
messageContainer.SetVAlign(inkEVerticalAlign.Top);
messageContainer.SetSize(new Vector2(100.0, 100.0));
messageContainer.Reparent(message);
let messageBackground = new inkImage();
messageBackground.SetName(n"background");
messageBackground.SetAtlasResource(r"base\\gameplay\\gui\\widgets\\phone\\new_phone_assets.inkatlas");
messageBackground.SetNineSliceScale(true);
messageBackground.SetTileHAlign(inkEHorizontalAlign.Left);
messageBackground.SetTileVAlign(inkEVerticalAlign.Top);
messageBackground.SetSize(new Vector2(32.0, 32.0));
messageBackground.SetFitToContent(true);
messageBackground.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
messageBackground.BindProperty(n"tintColor", n"Message.BackgroundColor");
messageBackground.BindProperty(n"opacity", n"Message.BackgroundOpacity");
messageBackground.Reparent(messageContainer);
let messageBorder = new inkImage();
messageBorder.SetName(n"border");
messageBorder.SetAtlasResource(r"base\\gameplay\\gui\\widgets\\phone\\new_phone_assets.inkatlas");
messageBorder.SetNineSliceScale(true);
messageBorder.SetTileHAlign(inkEHorizontalAlign.Left);
messageBorder.SetTileVAlign(inkEVerticalAlign.Top);
messageBorder.SetOpacity(0.5);
messageBorder.SetSize(new Vector2(32.0, 32.0));
messageBorder.SetFitToContent(true);
messageBorder.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
messageBorder.BindProperty(n"tintColor", n"Message.BorderColor");
messageBorder.Reparent(messageContainer);
let messageContent = new inkVerticalPanel();
messageContent.SetName(n"container");
messageContent.SetHAlign(inkEHorizontalAlign.Left);
messageContent.SetVAlign(inkEVerticalAlign.Top);
messageContent.SetMargin(new inkMargin(24.0, 20.0, 20.0, 30.0));
messageContent.SetFitToContent(true);
messageContent.Reparent(messageContainer);
let messageText = new inkText();
messageText.SetName(n"Message");
messageText.SetText(text);
messageText.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
messageText.SetFontStyle(n"Medium");
messageText.SetFontSize(42);
messageText.SetLetterCase(textLetterCase.OriginalCase);
messageText.SetContentVAlign(inkEVerticalAlign.Top);
messageText.SetWrapping(true);
messageText.SetWrappingAtPosition(1000);
messageText.SetHAlign(inkEHorizontalAlign.Left);
messageText.SetVAlign(inkEVerticalAlign.Top);
messageText.SetMargin(new inkMargin(0.0, 0.0, 10.0, 0.0));
messageText.SetSize(new Vector2(0.0, 32.0));
messageText.SetFitToContent(true);
messageText.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
messageText.BindProperty(n"tintColor", n"Message.TextColor");
messageText.BindProperty(n"fontSize", n"MainColors.ReadableMedium");
messageText.Reparent(messageContent);
if fromPlayer {
message.SetState(n"Player");
messageContainer.SetHAlign(inkEHorizontalAlign.Right);
messageBackground.SetTexturePart(n"msgBuble_reply_bg");
messageBackground.SetTintColor(new Color(Cast(0u), Cast(255u), Cast(198u), Cast(255u)));
messageBackground.SetOpacity(0.05);
messageBorder.SetTexturePart(n"msgBuble_reply_fg");
messageBorder.SetTintColor(new Color(Cast(0u), Cast(255u), Cast(198u), Cast(255u)));
messageText.SetTintColor(new Color(Cast(0u), Cast(255u), Cast(188u), Cast(255u)));
if useAnim {
GetHttpRequestSystem().TriggerPostRequest(text);
GetHttpRequestSystem().AppendToHistory(text, true);
}
} else {
messageContainer.SetHAlign(inkEHorizontalAlign.Left);
messageBackground.SetTexturePart(n"msgBuble_bg");
messageBackground.SetTintColor(new Color(Cast(23u), Cast(44u), Cast(46u), Cast(255u)));
messageBackground.SetOpacity(0.35);
messageBorder.SetTexturePart(n"msgBuble_fg");
messageBorder.SetTintColor(new Color(Cast(52u), Cast(145u), Cast(151u), Cast(255u)));
messageText.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
}
if useAnim {
let translateAnimMessage = new inkAnimTranslation();
translateAnimMessage.SetStartTranslation(new Vector2(0.0, 50.0));
translateAnimMessage.SetEndTranslation(new Vector2(0, 0));
translateAnimMessage.SetType(inkanimInterpolationType.Linear);
translateAnimMessage.SetMode(inkanimInterpolationMode.EasyOut);
translateAnimMessage.SetDuration(0.15);
let alphaAnim = new inkAnimTransparency();
alphaAnim.SetStartTransparency(0.0);
alphaAnim.SetEndTransparency(1.0);
alphaAnim.SetType(inkanimInterpolationType.Linear);
alphaAnim.SetMode(inkanimInterpolationMode.EasyOut);
alphaAnim.SetDuration(0.15);
let animDefMessage = new inkAnimDef();
animDefMessage.AddInterpolator(translateAnimMessage);
animDefMessage.AddInterpolator(alphaAnim);
message.PlayAnimation(animDefMessage);
this.PlaySound(n"ui_messenger_recieved");
}
this.chatScrollController.SetScrollPosition(1.0);
}
// Retrieve and build the conversation based on the current history
private func BuildConversation() {
let vMessages = GetHttpRequestSystem().vMessages;
let npcResponses = GetHttpRequestSystem().npcResponses;
let i = 0;
while i < ArraySize(vMessages) {
let vMessage = vMessages[i];
let npcResponse = npcResponses[i];
this.BuildMessage(vMessage, true, false);
if StrLen(npcResponse) == 0 {
i += 1;
} else if StrLen(npcResponse) > 1000 {
let firstHalf = StrLeft(npcResponse, 1000);
let secondHalf = StrRight(npcResponse, (StrLen(npcResponse) - 1000));
this.BuildMessage(firstHalf, false, false);
this.BuildMessage(secondHalf, false, false);
} else {
this.BuildMessage(npcResponse, false, false);
}
i += 1;
}
this.UpdateInputUi();
}
// Build all widgets for the chat UI
private func BuildChatUi() {
ConsoleLog("Building chat UI...");
let modMessengerSlotRoot = new inkCanvas();
modMessengerSlotRoot.SetName(n"Root");
modMessengerSlotRoot.SetStyle(r"base\\gameplay\\gui\\common\\styles\\panel.inkstyle");
modMessengerSlotRoot.BindProperty(n"tintColor", n"MainColors.Blue");
modMessengerSlotRoot.SetChildOrder(inkEChildOrder.Backward);
modMessengerSlotRoot.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
modMessengerSlotRoot.SetSize(new Vector2(1500.0, 1500.0));
modMessengerSlotRoot.Reparent(this.chatContainer);
this.messengerSlotRoot = modMessengerSlotRoot;
// Widgets under Root/container
let rootContainer = new inkCanvas();
rootContainer.SetName(n"container");
rootContainer.SetMargin(new inkMargin(100.0, 0.0, 0.0, 0.0));
rootContainer.SetSize(new Vector2(1550.0, 1200.0));
rootContainer.SetChildOrder(inkEChildOrder.Backward);
rootContainer.Reparent(modMessengerSlotRoot);
let topHolder = new inkFlex();
topHolder.SetName(n"top_holder");
topHolder.SetAnchor(inkEAnchor.TopFillHorizontaly);
topHolder.SetHAlign(inkEHorizontalAlign.Left);
topHolder.SetVAlign(inkEVerticalAlign.Top);
topHolder.SetMargin(new inkMargin(120.0, -60.0, 0.0, 0.0));
topHolder.SetSize(new Vector2(100.0, 100.0));
topHolder.Reparent(rootContainer);
let horizontalPanelWidget5 = new inkHorizontalPanel();
horizontalPanelWidget5.SetName(n"inkHorizontalPanelWidget5");
horizontalPanelWidget5.SetSize(new Vector2(100.0, 100.0));
horizontalPanelWidget5.SetFitToContent(true);
horizontalPanelWidget5.SetVAlign(inkEVerticalAlign.Top);
horizontalPanelWidget5.Reparent(topHolder);
let pathContainer = new inkVerticalPanel();
pathContainer.SetName(n"pathContainer");
pathContainer.SetHAlign(inkEHorizontalAlign.Left);
pathContainer.SetVAlign(inkEVerticalAlign.Top);
pathContainer.SetPadding(new inkMargin(0.0, 0.0, 20.0, 0.0));
pathContainer.SetFitToContent(true);
pathContainer.Reparent(horizontalPanelWidget5);
let messagesPath = new inkHorizontalPanel();
messagesPath.SetName(n"messagesPath");
messagesPath.SetOpacity(0.6);
messagesPath.SetHAlign(inkEHorizontalAlign.Left);
messagesPath.SetVAlign(inkEVerticalAlign.Top);
messagesPath.SetSizeRule(inkESizeRule.Stretch);
messagesPath.SetFitToContent(true);
messagesPath.SetChildMargin(new inkMargin(0.0, 20.0, 0.0, 20.0));
messagesPath.Reparent(pathContainer);
let messagesLine = new inkRectangle();
messagesLine.SetName(n"line");
messagesLine.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
messagesLine.SetMargin(new inkMargin(-20.0, 0.0, -20.0, 0.0));
messagesLine.SetSize(new Vector2(0.0, 7.0));
messagesLine.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
messagesLine.BindProperty(n"tintColor", n"MainColors.Blue");
messagesLine.Reparent(pathContainer);
let messagesFluff = new inkImage();
messagesFluff.SetName(n"fluff");
messagesFluff.SetAtlasResource(r"base\\gameplay\\gui\\common\\icons\\atlas_common.inkatlas");
messagesFluff.SetTexturePart(n"ico_envelelope");
messagesFluff.SetTileHAlign(inkEHorizontalAlign.Left);
messagesFluff.SetTileVAlign(inkEVerticalAlign.Top);
messagesFluff.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
messagesFluff.SetHAlign(inkEHorizontalAlign.Center);
messagesFluff.SetVAlign(inkEVerticalAlign.Center);
messagesFluff.SetSize(new Vector2(48.0, 48.0));
messagesFluff.SetFitToContent(true);
messagesFluff.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
messagesFluff.BindProperty(n"tintColor", n"MainColors.Blue");
messagesFluff.BindProperty(n"opacity", n"MenuLabel.MainOpacity");
messagesFluff.Reparent(messagesPath);
let messagesPathText = new inkText();
messagesPathText.SetName(n"txtValue");
messagesPathText.SetText("Messages");
messagesPathText.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
messagesPathText.SetFontStyle(n"Medium");
messagesPathText.SetFontSize(50);
messagesPathText.SetLetterCase(textLetterCase.UpperCase);
messagesPathText.SetVerticalAlignment(textVerticalAlignment.Center);
messagesPathText.SetContentHAlign(inkEHorizontalAlign.Center);
messagesPathText.SetContentVAlign(inkEVerticalAlign.Center);
messagesPathText.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
messagesPathText.SetHAlign(inkEHorizontalAlign.Left);
messagesPathText.SetVAlign(inkEVerticalAlign.Center);
messagesPathText.SetAnchor(inkEAnchor.Centered);
messagesPathText.SetAnchorPoint(new Vector2(0.5, 0.5));
messagesPathText.SetMargin(new inkMargin(10.0, 0.0, 0.0, 0.0));
messagesPathText.SetFitToContent(true);
messagesPathText.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
messagesPathText.BindProperty(n"tintColor", n"MainColors.Blue");
messagesPathText.BindProperty(n"fontSize", n"MainColors.ReadableFontSize");
messagesPathText.BindProperty(n"opacity", n"MenuLabel.MainOpacity");
messagesPathText.Reparent(messagesPath);
let arrowIcon = new inkImage();
arrowIcon.SetName(n"arrow");
arrowIcon.SetAtlasResource(r"base\\gameplay\\gui\\widgets\\hud_johnny\\notification_assets.inkatlas");
arrowIcon.SetTexturePart(n"+1");
arrowIcon.SetTileHAlign(inkEHorizontalAlign.Left);
arrowIcon.SetTileVAlign(inkEVerticalAlign.Top);
arrowIcon.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
arrowIcon.SetHAlign(inkEHorizontalAlign.Center);
arrowIcon.SetVAlign(inkEVerticalAlign.Center);
arrowIcon.SetMargin(new inkMargin(0.0, -20.0, 0.0, 0.0));
arrowIcon.SetSize(new Vector2(20.0, 20.0));
arrowIcon.SetFitToContent(true);
arrowIcon.SetRotation(90);
arrowIcon.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
arrowIcon.BindProperty(n"tintColor", n"MainColors.Blue");
arrowIcon.Reparent(horizontalPanelWidget5);
let nameHolder = new inkFlex();
nameHolder.SetName(n"name_holder");
nameHolder.SetMargin(new inkMargin(20.0, 0.0, 0.0, 0.0));
nameHolder.SetSize(new Vector2(100.0, 100.0));
nameHolder.Reparent(horizontalPanelWidget5);
let nameLine = new inkRectangle();
nameLine.SetName(n"line");
nameLine.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
nameLine.SetVAlign(inkEVerticalAlign.Bottom);
nameLine.SetMargin(new inkMargin(-20.0, 0.0, -20.0, 0.0));
nameLine.SetSize(new Vector2(300.0, 7.0));
nameLine.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
nameLine.BindProperty(n"tintColor", n"MainColors.Blue");
nameLine.Reparent(nameHolder);
let nameText = new inkText();
nameText.SetName(n"contact_name");
nameText.SetText(GetCharacterLocalizedName(this.character));
nameText.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
nameText.SetFontStyle(n"Medium");
nameText.SetFontSize(50);
nameText.SetLetterCase(textLetterCase.UpperCase);
nameText.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
nameText.SetHorizontalAlignment(textHorizontalAlignment.Center);
nameText.SetVerticalAlignment(textVerticalAlignment.Center);
nameText.SetContentHAlign(inkEHorizontalAlign.Left);
nameText.SetOverflowPolicy(textOverflowPolicy.AutoScroll);
nameText.SetWrappingAtPosition(700);
nameText.SetHAlign(inkEHorizontalAlign.Left);
nameText.SetVAlign(inkEVerticalAlign.Center);
nameText.SetMargin(new inkMargin(0.0, -12.0, 0.0, 0.0));
nameText.SetSizeRule(inkESizeRule.Stretch);
nameText.SetSize(new Vector2(900.0, 63.0));
nameText.SetFitToContent(true);
nameText.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
nameText.BindProperty(n"tintColor", n"MainColors.Blue");
nameText.Reparent(nameHolder);
let rectangleRight = new inkRectangle();
rectangleRight.SetName(n"right");
rectangleRight.SetTintColor(new Color(Cast(255u), Cast(97u), Cast(89u), Cast(255u)));
rectangleRight.SetVAlign(inkEVerticalAlign.Center);
rectangleRight.SetMargin(new inkMargin(30.0, 92.0, 270.0, 0.0));
rectangleRight.SetSizeRule(inkESizeRule.Stretch);
rectangleRight.SetSize(new Vector2(0.0, 2.0));
rectangleRight.SetRenderTransformPivot(new Vector2(1, 0.5));
rectangleRight.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
rectangleRight.BindProperty(n"tintColor", n"MainColors.PanelRed");
rectangleRight.Reparent(horizontalPanelWidget5);
let fluffNameL = new inkText();
fluffNameL.SetName(n"fluff_name-l");
fluffNameL.SetText("TRN_TCLAS_800095");
fluffNameL.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
fluffNameL.SetFontStyle(n"Medium");
fluffNameL.SetFontSize(20);
fluffNameL.SetLetterCase(textLetterCase.UpperCase);
fluffNameL.SetTintColor(new Color(Cast(255u), Cast(97u), Cast(89u), Cast(255u)));
fluffNameL.SetAnchor(inkEAnchor.TopRight);
fluffNameL.SetHAlign(inkEHorizontalAlign.Left);
fluffNameL.SetVAlign(inkEVerticalAlign.Top);
fluffNameL.SetMargin(new inkMargin(0.0, -20.0, 0.0, 0.0));
fluffNameL.SetSize(new Vector2(100.0, 32.0));
fluffNameL.SetFitToContent(true);
fluffNameL.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
fluffNameL.BindProperty(n"fontStyle", n"MainColors.BodyFontWeight");
fluffNameL.BindProperty(n"tintColor", n"MainColors.Red");
fluffNameL.Reparent(topHolder);
let fluffNameR = new inkText();
fluffNameR.SetName(n"fluff_name-r");
fluffNameR.SetText("VER_M6A6T6I");
fluffNameR.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
fluffNameR.SetFontStyle(n"Medium");
fluffNameR.SetFontSize(20);
fluffNameR.SetLetterCase(textLetterCase.UpperCase);
fluffNameR.SetTintColor(new Color(Cast(255u), Cast(97u), Cast(89u), Cast(255u)));
fluffNameR.SetAnchor(inkEAnchor.TopRight);
fluffNameR.SetHAlign(inkEHorizontalAlign.Right);
fluffNameR.SetVAlign(inkEVerticalAlign.Bottom);
fluffNameR.SetMargin(new inkMargin(0.0, 0.0, 269.00, 10.00));
fluffNameR.SetRenderTransformPivot(new Vector2(1, 0.5));
fluffNameR.SetSize(new Vector2(100.0, 32.0));
fluffNameR.SetFitToContent(true);
fluffNameR.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
fluffNameR.BindProperty(n"fontStyle", n"MainColors.BodyFontWeight");
fluffNameR.BindProperty(n"tintColor", n"MainColors.Red");
fluffNameR.Reparent(topHolder);
// Widgets under Root/wrapper
let rootWrapper = new inkVerticalPanel();
rootWrapper.SetName(n"wrapper");
rootWrapper.SetMargin(new inkMargin(100.0, 50.0, 0.0, 0.0));
rootWrapper.SetFitToContent(true);
rootWrapper.Reparent(modMessengerSlotRoot);
let wrapperContent = new inkFlex();
wrapperContent.SetName(n"content");
wrapperContent.SetAnchor(inkEAnchor.BottomLeft);
wrapperContent.SetHAlign(inkEHorizontalAlign.Left);
wrapperContent.SetVAlign(inkEVerticalAlign.Top);
wrapperContent.SetMargin(new inkMargin(120.0, 0.0, 0.0, 0.0));
wrapperContent.SetSizeRule(inkESizeRule.Stretch);
wrapperContent.SetSize(new Vector2(100.0, 100.0));
wrapperContent.SetAffectsLayoutWhenHidden(true);
wrapperContent.Reparent(rootWrapper);
let innerWrapper = new inkVerticalPanel();
innerWrapper.SetName(n"wrapper");
innerWrapper.SetMargin(new inkMargin(0.0, 0.0, 24.0, 0.0));
innerWrapper.SetFitToContent(false);
innerWrapper.Reparent(wrapperContent);
let conversation = new inkCanvas();
conversation.SetName(n"Conversation");
conversation.SetSizeRule(inkESizeRule.Stretch);
conversation.SetSize(new Vector2(1300.0, 1400.0));
conversation.SetAffectsLayoutWhenHidden(true);
conversation.SetChildOrder(inkEChildOrder.Backward);
conversation.SetInteractive(true);
conversation.Reparent(innerWrapper);
let messageScrollArea = new inkScrollArea();
messageScrollArea.SetName(n"MessagesScrollArea");
messageScrollArea.SetMargin(new inkMargin(20.0, 0.0, 35.0, 0.0));
messageScrollArea.SetAnchor(inkEAnchor.Fill);
messageScrollArea.SetUseInternalMask(false);
messageScrollArea.SetSize(new Vector2(600.0, 600.0));
messageScrollArea.Reparent(conversation);
let scrollAreaWrapper = new inkFlex();
scrollAreaWrapper.SetName(n"wrapper");
scrollAreaWrapper.SetSize(new Vector2(100.0, 100.0));
scrollAreaWrapper.Reparent(messageScrollArea);
let scrollAreaContainer = new inkVerticalPanel();
scrollAreaContainer.SetName(n"container");
scrollAreaContainer.SetHAlign(inkEHorizontalAlign.Left);
scrollAreaContainer.SetVAlign(inkEVerticalAlign.Top);
scrollAreaContainer.SetFitToContent(true);
scrollAreaContainer.Reparent(scrollAreaWrapper);
let messagesList = new inkVerticalPanel();
messagesList.SetName(n"MessagesList");
messagesList.SetHAlign(inkEHorizontalAlign.Left);
messagesList.SetVAlign(inkEVerticalAlign.Top);
messagesList.SetFitToContent(true);
messagesList.SetMargin(new inkMargin(0.0, 40.0, 0.0, 40.0));
messagesList.SetChildMargin(new inkMargin(0.0, 5.0, 0.0, 0.0));
messagesList.Reparent(scrollAreaContainer);
this.messageParent = messagesList;
let typingIndicator = new inkFlex();
typingIndicator.SetName(n"typing_indicator");
typingIndicator.SetVAlign(inkEVerticalAlign.Bottom);
typingIndicator.SetSize(new Vector2(100.0, 100.0));
typingIndicator.SetVisible(false);
typingIndicator.Reparent(scrollAreaContainer);
this.typingIndicator = typingIndicator;
let indicatorContainer = new inkFlex();
indicatorContainer.SetName(n"container");
indicatorContainer.SetVAlign(inkEVerticalAlign.Top);
indicatorContainer.SetMargin(new inkMargin(0.0, 0.0, 0.0, 25.0));
indicatorContainer.SetSize(new Vector2(100.0, 100.0));
indicatorContainer.Reparent(typingIndicator);
let indicatorContainer2 = new inkVerticalPanel();
indicatorContainer2.SetName(n"container");
indicatorContainer2.SetHAlign(inkEHorizontalAlign.Left);
indicatorContainer2.SetVAlign(inkEVerticalAlign.Top);
indicatorContainer2.SetFitToContent(true);
indicatorContainer2.SetStyle(r"base\\gameplay\\gui\\fullscreen\\phone_quest_menu\\messenger.inkstyle");
indicatorContainer2.Reparent(indicatorContainer);
let horizontalPanelWidget16 = new inkHorizontalPanel();
horizontalPanelWidget16.SetName(n"inkHorizontalPanelWidget16");
horizontalPanelWidget16.SetHAlign(inkEHorizontalAlign.Left);
horizontalPanelWidget16.SetFitToContent(true);
horizontalPanelWidget16.SetChildMargin(new inkMargin(0.0, 0.0, 4.0, 0.0));
horizontalPanelWidget16.Reparent(indicatorContainer2);
let isTyping = new inkText();
isTyping.SetName(n"isTyping");
isTyping.SetText(GetCharacterLocalizedName(this.character) + " is typing");
isTyping.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
isTyping.SetFontStyle(n"Medium");
isTyping.SetFontSize(38);
isTyping.SetLetterCase(textLetterCase.OriginalCase);
isTyping.SetContentVAlign(inkEVerticalAlign.Top);
isTyping.SetWrappingAtPosition(800);
isTyping.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
isTyping.SetHAlign(inkEHorizontalAlign.Left);
isTyping.SetVAlign(inkEVerticalAlign.Top);
isTyping.SetSize(new Vector2(0.0, 32.0));
isTyping.SetFitToContent(true);
isTyping.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
isTyping.BindProperty(n"tintColor", n"Message.TextColor");
isTyping.BindProperty(n"fontSize", n"MainColors.ReadableSmall");
isTyping.BindProperty(n"fontStyle", n"MainColors.BodyFontWeight");
isTyping.Reparent(horizontalPanelWidget16);
let dot1 = new inkText();
dot1.SetName(n"isTyping");
dot1.SetText(".");
dot1.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
dot1.SetFontStyle(n"Semi-Bold");
dot1.SetFontSize(38);
dot1.SetLetterCase(textLetterCase.OriginalCase);
dot1.SetContentVAlign(inkEVerticalAlign.Top);
dot1.SetWrappingAtPosition(800);
dot1.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
dot1.SetHAlign(inkEHorizontalAlign.Left);
dot1.SetVAlign(inkEVerticalAlign.Top);
dot1.SetSize(new Vector2(0.0, 32.0));
dot1.SetFitToContent(true);
dot1.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
dot1.BindProperty(n"tintColor", n"Message.TextColor");
dot1.BindProperty(n"fontSize", n"MainColors.ReadableSmall");
dot1.BindProperty(n"fontStyle", n"MainColors.HeaderFontWeight");
dot1.Reparent(horizontalPanelWidget16);
let dot2 = new inkText();
dot2.SetName(n"isTyping");
dot2.SetText(".");
dot2.SetFontFamily("base\\gameplay\\gui\\fonts\\raj\\raj.inkfontfamily");
dot2.SetFontStyle(n"Semi-Bold");
dot2.SetFontSize(38);
dot2.SetLetterCase(textLetterCase.OriginalCase);
dot2.SetContentVAlign(inkEVerticalAlign.Top);
dot2.SetWrappingAtPosition(800);
dot2.SetTintColor(new Color(Cast(94u), Cast(246u), Cast(255u), Cast(255u)));
dot2.SetHAlign(inkEHorizontalAlign.Left);
dot2.SetVAlign(inkEVerticalAlign.Top);
dot2.SetSize(new Vector2(0.0, 32.0));
dot2.SetFitToContent(true);
dot2.SetStyle(r"base\\gameplay\\gui\\common\\main_colors.inkstyle");
dot2.BindProperty(n"tintColor", n"Message.TextColor");
dot2.BindProperty(n"fontSize", n"MainColors.ReadableSmall");
dot2.BindProperty(n"fontStyle", n"MainColors.HeaderFontWeight");