-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathBeatSaberUI.hpp
1114 lines (966 loc) · 66.8 KB
/
BeatSaberUI.hpp
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
#pragma once
#include "beatsaber-hook/shared/utils/utils.h"
#include "beatsaber-hook/shared/utils/utils-functions.h"
#include "cppcodec/base64_rfc4648.hpp"
#include "ArrayUtil.hpp"
#include "CustomTypes/Components/FloatingScreen/FloatingScreen.hpp"
#include "CustomTypes/Components/Settings/IncrementSetting.hpp"
#include "CustomTypes/Components/Settings/SliderSetting.hpp"
#include "CustomTypes/Components/Settings/ColorSetting.hpp"
#include "CustomTypes/Components/List/CustomListTableData.hpp"
#include "CustomTypes/Components/SegmentedControl/CustomTextSegmentedControlData.hpp"
#include "CustomTypes/Components/ModalColorPicker.hpp"
#include "CustomTypes/Components/ClickableText.hpp"
#include "CustomTypes/Components/ClickableImage.hpp"
#include "CustomTypes/Components/ProgressBar/ProgressBar.hpp"
#include "GlobalNamespace/MainFlowCoordinator.hpp"
#include "GlobalNamespace/GameplayModifierToggle.hpp"
#include "GlobalNamespace/ColorChangeUIEventType.hpp"
#include "GlobalNamespace/IVRPlatformHelper.hpp"
#include "UnityEngine/GameObject.hpp"
#include "UnityEngine/RectTransform.hpp"
#include "UnityEngine/Vector2.hpp"
#include "UnityEngine/Sprite.hpp"
#include "UnityEngine/UI/Button.hpp"
#include "UnityEngine/UI/Button_ButtonClickedEvent.hpp"
#include "UnityEngine/UI/Image.hpp"
#include "UnityEngine/UI/Toggle.hpp"
#include "UnityEngine/UI/LayoutElement.hpp"
#include "UnityEngine/UI/Toggle_ToggleEvent.hpp"
#include "UnityEngine/UI/GridLayoutGroup.hpp"
#include "UnityEngine/UI/HorizontalLayoutGroup.hpp"
#include "UnityEngine/UI/VerticalLayoutGroup.hpp"
#include "UnityEngine/UI/ContentSizeFitter.hpp"
#include "HMUI/ViewController.hpp"
#include "HMUI/FlowCoordinator.hpp"
#include "HMUI/HoverHint.hpp"
#include "HMUI/InputFieldView.hpp"
#include "HMUI/ModalView.hpp"
#include "HMUI/ImageView.hpp"
#include "HMUI/SimpleTextDropdown.hpp"
#include "TMPro/TextMeshProUGUI.hpp"
#include "TMPro/TMP_FontAsset.hpp"
#include "VRUIControls/PhysicsRaycasterWithCache.hpp"
#include <concepts>
#include <type_traits>
namespace QuestUI::BeatSaberUI {
/// @brief gets the main flow coordinator
GlobalNamespace::MainFlowCoordinator* GetMainFlowCoordinator();
/// @brief gets main ui text font, used internally mostly
TMPro::TMP_FontAsset* GetMainTextFont();
/// @brief gets main ui font material, used internally mostly
UnityEngine::Material* GetMainUIFontMaterial();
/// @brief gets edit icon, used internally mostly
UnityEngine::Sprite* GetEditIcon();
/// @brief gets the PhysicsRaycasterWithCache used internally mostly
VRUIControls::PhysicsRaycasterWithCache* GetPhysicsRaycasterWithCache();
/// @brief gets the IVR platform helper used internally mostly
GlobalNamespace::IVRPlatformHelper* GetIVRPlatformHelper();
/// @brief clears cached objects
void ClearCache();
/// @brief creates a canvas to attach things to
/// @return gameobject which you can parent things to
UnityEngine::GameObject* CreateCanvas();
/// @brief Creates a viewcontroller
/// @param type type of the viewcontroller
/// @return Created viewcontroller as HMUI::ViewController*
HMUI::ViewController* CreateViewController(System::Type* type);
/// @brief Creates a viewcontroller of type T
/// @tparam T viewcontroller Type
/// @return Created viewcontroller as T
template<class T = HMUI::ViewController*>
requires(std::is_convertible_v<T, HMUI::ViewController*>)
T CreateViewController() {
return reinterpret_cast<T>(CreateViewController(reinterpret_cast<System::Type*>(csTypeOf(T))));
}
/// @brief Creates a flowcoordinator
/// @param type type of the flowcoordinator
/// @return Created flowcoordinator as HMUI::FlowCoordinator*
HMUI::FlowCoordinator* CreateFlowCoordinator(System::Type* type);
/// @brief Creates a flowcoordinator of type T
/// @tparam T flowcoordinator Type
/// @return Created flowcoordinator as T
template<class T = HMUI::FlowCoordinator*>
requires(std::is_convertible_v<T, HMUI::FlowCoordinator*>)
T CreateFlowCoordinator() {
return (T)CreateFlowCoordinator(reinterpret_cast<System::Type*>(csTypeOf(T)));
}
template<typename T, typename U>
concept QuestUIConvertible = std::is_convertible_v<T, U>;
template<typename T>
concept HasTransform = requires (T a) { {a->get_transform() } -> QuestUIConvertible<UnityEngine::Transform*>; };
template<typename T>
concept HasGameObject = requires (T a) { {a->get_gameObject() } -> QuestUIConvertible<UnityEngine::GameObject*>; };
/// @brief Creates a text object
/// @param parent what to parent it to
/// @param text the string to display
/// @param italic should the text be italic
TMPro::TextMeshProUGUI* CreateText(UnityEngine::Transform* parent, StringW text, bool italic = true);
/// @brief Creates a text object
/// @param parent what to parent it to
/// @param text the string to display
/// @param anchoredPosition the location of the text
/// @param sizeDelta the size of the text
TMPro::TextMeshProUGUI* CreateText(UnityEngine::Transform* parent, StringW text, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta);
/// @brief Creates a text object
/// @param parent what to parent it to
/// @param text the string to display
/// @param anchoredPosition the location of the text
TMPro::TextMeshProUGUI* CreateText(UnityEngine::Transform* parent, StringW text, UnityEngine::Vector2 anchoredPosition);
/// @brief Creates a text object
/// @param parent what to parent it to
/// @param text the string to display
/// @param italic should the text be italic
/// @param anchoredPosition the location of the text
TMPro::TextMeshProUGUI* CreateText(UnityEngine::Transform* parent, StringW text, bool italic, UnityEngine::Vector2 anchoredPosition);
/// @brief Creates a text object
/// @param parent what to parent it to
/// @param text the string to display
/// @param italicc should the text be italic
/// @param anchoredPosition the location of the text
/// @param sizeDelta the size of the text
TMPro::TextMeshProUGUI* CreateText(UnityEngine::Transform* parent, StringW text, bool italic, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta);
/// @brief Overload for creating a text object that allows you to pass in anything that has a ->get_transform() method
/// @param parent what to parent it to
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline TMPro::TextMeshProUGUI* CreateText(T parent, TArgs...args) {
return CreateText(parent->get_transform(), args...);
}
/// @brief Creates clickable text, almost like a URL
/// @param parent what to parent it to
/// @param text the text to display
/// @param anchoredPosition position of the text
/// @param onClick what to run when clicked
/// @return created clickable text
ClickableText* CreateClickableText(UnityEngine::Transform* parent, StringW text, UnityEngine::Vector2 anchoredPosition, std::function<void()> onClick = nullptr);
/// @brief Creates clickable text, almost like a URL
/// @param parent what to parent it to
/// @param text the text to display
/// @param anchoredPosition position of the text
/// @param sizeDelta size of the object
/// @param onClick what to run when clicked
/// @return created clickable text
ClickableText* CreateClickableText(UnityEngine::Transform* parent, StringW text, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void()> onClick = nullptr);
/// @brief Creates clickable text, almost like a URL
/// @param parent what to parent it to
/// @param text the text to display
/// @param italic is the text italic?
/// @param onClick what to run when clicked
/// @return created clickable text
ClickableText* CreateClickableText(UnityEngine::Transform* parent, StringW text, bool italic = true, std::function<void()> onClick = nullptr);
/// @brief Creates clickable text, almost like a URL
/// @param parent what to parent it to
/// @param text the text to display
/// @param italic is the text italic?
/// @param anchoredPosition position of the text
/// @param onClick what to run when clicked
/// @return created clickable text
ClickableText* CreateClickableText(UnityEngine::Transform* parent, StringW text, bool italic, UnityEngine::Vector2 anchoredPosition, std::function<void()> onClick = nullptr);
/// @brief Creates clickable text, almost like a URL
/// @param parent what to parent it to
/// @param text the text to display
/// @param italic is the text italic?
/// @param anchoredPosition position of the text
/// @param sizeDelta size of the object
/// @param onClick what to run when clicked
/// @return created clickable text
ClickableText* CreateClickableText(UnityEngine::Transform* parent, StringW text, bool italic, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void()> onClick = nullptr);
/// @brief Overload for creating a Clickable Text object that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline ClickableText* CreateClickableText(T parent, TArgs...args) {
return CreateClickableText(parent->get_transform(), args...);
}
/// @brief set the button text on the passed in button
/// @param button the button to change the text on
/// @param text the text to set
void SetButtonText(UnityEngine::UI::Button* button, StringW text);
/// @brief set the button text size on the passed in button
/// @param button the button to change the text size on
/// @param fontSize the font size to change the text to
void SetButtonTextSize(UnityEngine::UI::Button* button, float fontSize);
/// @brief set the button wordwrapping on the passed in button
/// @param button the button to change the text size on
/// @param enableWordWrapping whether to allow wordwrapping
void ToggleButtonWordWrapping(UnityEngine::UI::Button* button, bool enableWordWrapping);
/// @brief set the icon on the passed in button
/// @param button the button to change icon of
/// @param icon the icon to set
void SetButtonIcon(UnityEngine::UI::Button* button, UnityEngine::Sprite* icon);
/// @brief set the background on the passed in button
/// @param button the button to change the background on
/// @param icon the background to set
void SetButtonBackground(UnityEngine::UI::Button* button, UnityEngine::Sprite* background);
/// @brief sets the sprites for a given button
/// @param button the button to swap sprites for
/// @param inactive, for when not hovering over the button
/// @param active for when hovering over the button
void SetButtonSprites(UnityEngine::UI::Button* button, UnityEngine::Sprite* inactive, UnityEngine::Sprite* active);
/// @brief Creates a button to click and have an action happen
/// @param parent what to parent it to
/// @param buttonText the text the butotn displays
/// @param onClick callback to run when the button is clicked
UnityEngine::UI::Button* CreateUIButton(UnityEngine::Transform* parent, StringW buttonText, std::function<void()> onClick = nullptr);
/// @brief Creates a button to click and have an action happen
/// @param parent what to parent it to
/// @param buttonText the text the butotn displays
/// @param buttonTemplate the name of a button to use as a base
/// @param onClick callback to run when the button is clicked
UnityEngine::UI::Button* CreateUIButton(UnityEngine::Transform* parent, StringW buttonText, std::string_view buttonTemplate, std::function<void()> onClick = nullptr);
/// @brief Creates a button to click and have an action happen
/// @param parent what to parent it to
/// @param buttonText the text the butotn displays
/// @param buttonTemplate the name of a button to use as a base
/// @param anchoredPosition position of the button
/// @param onClick callback to run when the button is clicked
UnityEngine::UI::Button* CreateUIButton(UnityEngine::Transform* parent, StringW buttonText, std::string_view buttonTemplate, UnityEngine::Vector2 anchoredPosition, std::function<void()> onClick = nullptr);
/// @brief Creates a button to click and have an action happen
/// @param parent what to parent it to
/// @param buttonText the text the butotn displays
/// @param buttonTemplate the name of a button to use as a base
/// @param anchoredPosition position of the button
/// @param sizeDelta size of the button
/// @param onClick callback to run when the button is clicked
UnityEngine::UI::Button* CreateUIButton(UnityEngine::Transform* parent, StringW buttonText, std::string_view buttonTemplate, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void()> onClick = nullptr);
/// @brief Creates a button to click and have an action happen
/// @param parent what to parent it to
/// @param buttonText the text the butotn displays
/// @param anchoredPosition position of the button
/// @param onClick callback to run when the button is clicked
UnityEngine::UI::Button* CreateUIButton(UnityEngine::Transform* parent, StringW buttonText, UnityEngine::Vector2 anchoredPosition, std::function<void()> onClick = nullptr);
/// @brief Creates a button to click and have an action happen
/// @param parent what to parent it to
/// @param buttonText the text the butotn displays
/// @param anchoredPosition position of the button
/// @param sizeDelta size of the button
/// @param onClick callback to run when the button is clicked
UnityEngine::UI::Button* CreateUIButton(UnityEngine::Transform* parent, StringW buttonText, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void()> onClick = nullptr);
/// @brief Overload for creating a UI Button that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::UI::Button* CreateUIButton(T parent, TArgs...args) {
return CreateUIButton(parent->get_transform(), args...);
}
/// @brief Creates clickable text, almost like a URL
/// @param parent what to parent it to
/// @param sprite the image to use
/// @param anchoredPosition position of the image
/// @param sizeDelta size of the object
/// @param onClick what to run when clicked
/// @return created clickable image
QuestUI::ClickableImage* CreateClickableImage(UnityEngine::Transform* parent, UnityEngine::Sprite* sprite, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void()> onClick = nullptr);
/// @brief Creates clickable text, almost like a URL
/// @param parent what to parent it to
/// @param sprite the image to use
/// @param onClick what to run when clicked
/// @return created clickable image
QuestUI::ClickableImage* CreateClickableImage(UnityEngine::Transform* parent, UnityEngine::Sprite* sprite, std::function<void()> onClick = nullptr);
/// @brief Overload for creating a Clickable image that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline ClickableImage* CreateClickableImage(T parent, TArgs...args) {
return CreateClickableImage(parent->get_transform(), args...);
}
/// @brief Creates an image
/// @param parent what to parent it to
/// @param sprite the sprite to display
/// @param anchoredPosition the position of the image
/// @param sizeDelta the size of the image
HMUI::ImageView* CreateImage(UnityEngine::Transform* parent, UnityEngine::Sprite* sprite, UnityEngine::Vector2 anchoredPosition = {}, UnityEngine::Vector2 sizeDelta = {});
/// @brief Overload for creating an Image that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline HMUI::ImageView* CreateImage(T parent, TArgs...args) {
return CreateImage(parent->get_transform(), args...);
}
/// @brief loads an image from a file path
/// @param filePath the path to load the image from
UnityEngine::Sprite* FileToSprite(std::string_view filePath);
/// @brief loads an image from a file path [[deprecated]]
/// @param filePath the path to load the image from
/// @param width the width of the image
/// @param height the height of the image
[[deprecated]] inline UnityEngine::Sprite* FileToSprite(std::string_view filePath, int width, int height)
{ return FileToSprite(filePath); }
/// @brief loads an image from the provided vector byte data
/// @param bytes the bytedata
/// @return loaded image
UnityEngine::Sprite* VectorToSprite(std::vector<uint8_t> bytes);
/// @brief loads an image from the provided ArrayW byte data
/// @param bytes the bytedata
/// @return loaded image
UnityEngine::Sprite* ArrayToSprite(ArrayW<uint8_t> bytes);
/// @brief decodes a base64 string to turn it into an image
/// @param base64Str the base64 encoded image data
/// @return loaded image
static UnityEngine::Sprite* Base64ToSprite(std::string_view base64Str) {
using base64 = cppcodec::base64_rfc4648;
ArrayW<uint8_t> bytes(base64::decoded_max_size(base64Str.size()));
base64::decode(bytes.begin(), bytes.size(), base64Str.data(), base64Str.size());
return ArrayToSprite(bytes);
}
/// @brief decodes a base64 string to turn it into an image [[deprecated]]
/// @param base64Str the base64 encoded image data
/// @return loaded image
[[deprecated]] inline UnityEngine::Sprite* Base64ToSprite(std::string_view base64, int width, int height)
{ return Base64ToSprite(base64); }
/// @brief Creates a grid layout group for you
/// @param parent what to parent it to
/// @return the grid layout object
UnityEngine::UI::GridLayoutGroup* CreateGridLayoutGroup(UnityEngine::Transform* parent);
/// @brief Overload for creating a Grid layout that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
template<HasTransform T>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::UI::GridLayoutGroup* CreateGridLayoutGroup(T parent) {
return CreateGridLayoutGroup(parent->get_transform());
}
/// @brief Creates a horizontal layout group for you
/// @param parent what to parent it to
/// @return the horizontal layout object
UnityEngine::UI::HorizontalLayoutGroup* CreateHorizontalLayoutGroup(UnityEngine::Transform* parent);
/// @brief Overload for creating a Horizontal layout group that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the horizontal layout object
template<HasTransform T>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::UI::HorizontalLayoutGroup* CreateHorizontalLayoutGroup(T parent) {
return CreateHorizontalLayoutGroup(parent->get_transform());
}
/// @brief Creates a vertical layout group for you
/// @param parent what to parent it to
/// @return the vertical layout object
UnityEngine::UI::VerticalLayoutGroup* CreateVerticalLayoutGroup(UnityEngine::Transform* parent);
/// @brief Overload for creating a Vertical layout group that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the vertical layout object
template<HasTransform T>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::UI::VerticalLayoutGroup* CreateVerticalLayoutGroup(T parent) {
return CreateVerticalLayoutGroup(parent->get_transform());
}
// https://github.com/monkeymanboy/BeatSaberMarkupLanguage/blob/master/BeatSaberMarkupLanguage/Tags/ModifierContainerTag.cs
/// @brief Creates a container used to put modifier buttons in
/// @param parent what to parent it to
/// @return vertical layout group to parent a modifier button to
UnityEngine::UI::VerticalLayoutGroup* CreateModifierContainer(UnityEngine::Transform* parent);
/// @brief Overload for creating a Modifier Container that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return vertical layout group to parent a modifier button to
template<HasTransform T>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::UI::VerticalLayoutGroup* CreateModifierContainer(T parent) {
return CreateModifierContainer(parent->get_transform());
}
/// @brief Creates a toggle that looks like the modifier buttons seen in the gameplay setup menu
/// @param parent what to parent it to
/// @param buttonText the text to display on the button
/// @param currentValue is the toggle true or false at this moment
/// @param iconSprite the sprite for the icon
/// @param onClick what to run when the button is clicked
/// @param anchoredPosition the position of the button
UnityEngine::UI::Toggle* CreateModifierButton(UnityEngine::Transform* parent, StringW buttonText, bool currentValue, UnityEngine::Sprite* iconSprite, std::function<void(bool)> const& onClick = nullptr, UnityEngine::Vector2 anchoredPosition = {0,0});
/// @brief Creates a toggle that looks like the modifier buttons seen in the gameplay setup menu
/// @param parent what to parent it to
/// @param buttonText the text to display on the button
/// @param currentValue is the toggle true or false at this moment
/// @param onClick what to run when the button is clicked
/// @param anchoredPosition the position of the button
inline UnityEngine::UI::Toggle* CreateModifierButton(UnityEngine::Transform* parent, StringW buttonText, bool currentValue, std::function<void(bool)> const& onClick = nullptr, UnityEngine::Vector2 anchoredPosition = {0,0}) {
return CreateModifierButton(parent, buttonText, currentValue, nullptr, onClick, anchoredPosition);
}
/// @brief Overload for creating a modifier button that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the created toggle
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::UI::Toggle* CreateModifierButton(T parent, TArgs...args) {
return CreateModifierButton(parent->get_transform(), args...);
}
/// @brief creates a toggle to turn things off / on
/// @param parent what to parent it to
/// @param text the label to give to the toggle
/// @param onToggle what to do when the toggle is clicked
UnityEngine::UI::Toggle* CreateToggle(UnityEngine::Transform* parent, StringW text, std::function<void(bool)> onToggle = nullptr);
/// @brief creates a toggle to turn things off / on
/// @param parent what to parent it to
/// @param text the label to give to the toggle
/// @param currentValue the current value of the toggle
/// @param onToggle what to do when the toggle is clicked
UnityEngine::UI::Toggle* CreateToggle(UnityEngine::Transform* parent, StringW text, bool currentValue, std::function<void(bool)> onToggle = nullptr);
/// @brief creates a toggle to turn things off / on
/// @param parent what to parent it to
/// @param text the label to give to the toggle
/// @param anchoredPosition the position of the toggle
/// @param onToggle what to do when the toggle is clicked
UnityEngine::UI::Toggle* CreateToggle(UnityEngine::Transform* parent, StringW text, UnityEngine::Vector2 anchoredPosition, std::function<void(bool)> onToggle = nullptr);
/// @brief creates a toggle to turn things off / on
/// @param parent what to parent it to
/// @param text the label to give to the toggle
/// @param currentValue the current value of the toggle
/// @param anchoredPosition the position of the toggle
/// @param onToggle what to do when the toggle is clicked
UnityEngine::UI::Toggle* CreateToggle(UnityEngine::Transform* parent, StringW text, bool currentValue, UnityEngine::Vector2 anchoredPosition, std::function<void(bool)> onToggle = nullptr);
/// @brief Overload for creating a toggle that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the created toggle
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::UI::Toggle* CreateToggle(T parent, TArgs...args) {
return CreateToggle(parent->get_transform(), args...);
}
//UnityEngine::GameObject* CreateLoadingIndicator(UnityEngine::Transform* parent, UnityEngine::Vector2 anchoredPosition);
/// @brief Adds a hover hint to an object so that when it is hovered a message displays
/// @param gameObject the object to add it to
/// @param text the text to display
/// @return the created hoverhint
HMUI::HoverHint* AddHoverHint(UnityEngine::GameObject* gameObject, StringW text);
/// @brief Overload for creating a toggle that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param gameObject the object to add it to
/// @return the created hoverhint
template<HasGameObject T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::GameObject*>)
inline HMUI::HoverHint* AddHoverHint(T obj, TArgs...args) {
return AddHoverHint(obj->get_gameObject(), args...);
}
/// @brief Creates an incerement setting, meaning a float value with arrows to go up and down
/// @param parent what to parent it to
/// @param text label to give to the setting
/// @param decimals amount of decimals to show
/// @param increment what to increment/decrement the value by
/// @param currentValue the starting value
/// @param onValueChange what to run when the value is changed
/// @return the created increment setting
QuestUI::IncrementSetting* CreateIncrementSetting(UnityEngine::Transform* parent, StringW text, int decimals, float increment, float currentValue, std::function<void(float)> onValueChange = nullptr);
/// @brief Creates an incerement setting, meaning a float value with arrows to go up and down
/// @param parent what to parent it to
/// @param text label to give to the setting
/// @param decimals amount of decimals to show
/// @param increment what to increment/decrement the value by
/// @param currentValue the starting value
/// @param anchoredPosition the position of the setting
/// @param onValueChange what to run when the value is changed
/// @return the created increment setting
QuestUI::IncrementSetting* CreateIncrementSetting(UnityEngine::Transform* parent, StringW text, int decimals, float increment, float currentValue, UnityEngine::Vector2 anchoredPosition, std::function<void(float)> onValueChange = nullptr);
/// @brief Creates an incerement setting, meaning a float value with arrows to go up and down
/// @param parent what to parent it to
/// @param text label to give to the setting
/// @param decimals amount of decimals to show
/// @param increment what to increment/decrement the value by
/// @param minValue the minimum value the setting is allowed to be
/// @param maxValue the maximum value the setting is allowed to be
/// @param currentValue the starting value
/// @param onValueChange what to run when the value is changed
/// @return the created increment setting
QuestUI::IncrementSetting* CreateIncrementSetting(UnityEngine::Transform* parent, StringW text, int decimals, float increment, float currentValue, float minValue, float maxValue, std::function<void(float)> onValueChange = nullptr);
/// @brief Creates an incerement setting, meaning a float value with arrows to go up and down
/// @param parent what to parent it to
/// @param text label to give to the setting
/// @param decimals amount of decimals to show
/// @param increment what to increment/decrement the value by
/// @param currentValue the starting value
/// @param minValue the minimum value the setting is allowed to be
/// @param maxValue the maximum value the setting is allowed to be
/// @param anchoredPosition the position of the setting
/// @param onValueChange what to run when the value is changed
/// @return the created increment setting
QuestUI::IncrementSetting* CreateIncrementSetting(UnityEngine::Transform* parent, StringW text, int decimals, float increment, float currentValue, float minValue, float maxValue, UnityEngine::Vector2 anchoredPosition, std::function<void(float)> onValueChange = nullptr);
/// @brief Creates an incerement setting, meaning a float value with arrows to go up and down
/// @param parent what to parent it to
/// @param text label to give to the setting
/// @param decimals amount of decimals to show
/// @param increment what to increment/decrement the value by
/// @param currentValue the starting value
/// @param hasMin whether or not the minimum value should be enforced
/// @param hasMax whether or not the maximum value should be enforced
/// @param minValue the minimum value the setting is allowed to be
/// @param maxValue the maximum value the setting is allowed to be
/// @param anchoredPosition the position of the setting
/// @param onValueChange what to run when the value is changed
/// @return the created increment setting
QuestUI::IncrementSetting* CreateIncrementSetting(UnityEngine::Transform* parent, StringW text, int decimals, float increment, float currentValue, bool hasMin, bool hasMax, float minValue, float maxValue, UnityEngine::Vector2 anchoredPosition, std::function<void(float)> onValueChange = nullptr);
/// @brief Overload for creating an increment setting that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the created increment setting
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline QuestUI::IncrementSetting* CreateIncrementSetting(T parent, TArgs...args) {
return CreateIncrementSetting(parent->get_transform(), args...);
}
/// @brief Creates a slider setting
/// @param parent what to parent it to
/// @param text the text displayed in front to let the user know what they are editing
/// @param increment the increment each "tick" should do
/// @param value the initial value it should be
/// @param minValue the minimum value for the slider
/// @param maxValue the maximum value for the slider
/// @param onValueChange callback called after the user has not interacted with the slider for 1 second
QuestUI::SliderSetting* CreateSliderSetting(UnityEngine::Transform* parent, StringW text, float increment, float value, float minValue, float maxValue, std::function<void(float)> onValueChange = nullptr);
/// @brief Creates a slider setting
/// @param parent what to parent it to
/// @param text the text displayed in front to let the user know what they are editing
/// @param increment the increment each "tick" should do
/// @param value the initial value it should be
/// @param minValue the minimum value for the slider
/// @param maxValue the maximum value for the slider
/// @param applyValueTime the amount of seconds to wait after the user stopped interacting to call the callback
/// @param onValueChange callback called after the user has not interacted with the slider for 1 second
QuestUI::SliderSetting* CreateSliderSetting(UnityEngine::Transform* parent, StringW text, float increment, float value, float minValue, float maxValue, float applyValueTime, std::function<void(float)> onValueChange = nullptr);
/// @brief Creates a slider setting
/// @param parent what to parent it to
/// @param text the text displayed in front to let the user know what they are editing
/// @param increment the increment each "tick" should do
/// @param value the initial value it should be
/// @param minValue the minimum value for the slider
/// @param maxValue the maximum value for the slider
/// @param anchoredPosition the position
/// @param onValueChange callback called after the user has not interacted with the slider for 1 second
QuestUI::SliderSetting* CreateSliderSetting(UnityEngine::Transform* parent, StringW text, float increment, float value, float minValue, float maxValue, UnityEngine::Vector2 anchoredPosition, std::function<void(float)> onValueChange = nullptr);
/// @brief Creates a slider setting
/// @param parent what to parent it to
/// @param text the text displayed in front to let the user know what they are editing
/// @param increment the increment each "tick" should do
/// @param value the initial value it should be
/// @param minValue the minimum value for the slider
/// @param maxValue the maximum value for the slider
/// @param applyValueTime the amount of seconds to wait after the user stopped interacting to call the callback
/// @param anchoredPosition the position
/// @param onValueChange callback called after the user has not interacted with the slider for 1 second
QuestUI::SliderSetting* CreateSliderSetting(UnityEngine::Transform* parent, StringW text, float increment, float value, float minValue, float maxValue, float applyValueTime, UnityEngine::Vector2 anchoredPosition, std::function<void(float)> onValueChange = nullptr);
/// @brief Overload for creating a slider setting that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the created slider setting
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline QuestUI::SliderSetting* CreateSliderSetting(T parent, TArgs...args) {
return CreateSliderSetting(parent->get_transform(), args...);
}
/// @brief Creates a scroll view
/// @param parent what to parent it to
/// @return created container which you should add your content to
UnityEngine::GameObject* CreateScrollView(UnityEngine::Transform* parent);
/// @brief Overload for creating a scroll view that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return created container which you should add your content to
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::GameObject* CreateScrollView(T parent) {
return CreateScrollView(parent->get_transform());
}
/// @brief Overload for creating a scrollable settings container that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return created container which you should add your content to
UnityEngine::GameObject* CreateScrollableSettingsContainer(UnityEngine::Transform* parent);
/// @brief Overload for creating a scrollable settings container that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return created container which you should add your content to
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline UnityEngine::GameObject* CreateScrollableSettingsContainer(T parent) {
return CreateScrollableSettingsContainer(parent->get_transform());
}
/// @brief creates a string setting allowing users to input a string with a keyboard
/// @param parent what to parent it to
/// @param settingsName the label to give to the setting
/// @param currentValue the current string value it is
/// @param onValueChange callback ran when the value changes
/// @return the created string setting
HMUI::InputFieldView* CreateStringSetting(UnityEngine::Transform* parent, StringW settingsName, StringW currentValue, std::function<void(StringW)> onValueChange = nullptr);
/// @brief creates a string setting allowing users to input a string with a keyboard
/// @param parent what to parent it to
/// @param settingsName the label to give to the setting
/// @param currentValue the current string value it is
/// @param anchoredPosition position of the string setting
/// @param onValueChange callback ran when the value changes
/// @return the created string setting
HMUI::InputFieldView* CreateStringSetting(UnityEngine::Transform* parent, StringW settingsName, StringW currentValue, UnityEngine::Vector2 anchoredPosition, std::function<void(StringW)> onValueChange = nullptr);
/// @brief creates a string setting allowing users to input a string with a keyboard
/// @param parent what to parent it to
/// @param settingsName the label to give to the setting
/// @param currentValue the current string value it is
/// @param anchoredPosition position of the string setting
/// @param keyboardPositionOffset offset of the keyboard in 3d space
/// @param onValueChange callback ran when the value changes
/// @return the created string setting
HMUI::InputFieldView* CreateStringSetting(UnityEngine::Transform* parent, StringW settingsName, StringW currentValue, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector3 keyboardPositionOffset, std::function<void(StringW)> onValueChange = nullptr);
/// @brief Overload for creating a string setting that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the created string setting
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline HMUI::InputFieldView* CreateStringSetting(T parent, TArgs...args) {
return CreateStringSetting(parent->get_transform(), args...);
}
/// @brief creates a dropwdown menu to select from a set of pre-known strings (like an enum)
/// @param parent what to parent it to
/// @param dropdownName label of the setting
/// @param currentValue what to display as currently selected
/// @param values the possible string values that can be displayed
/// @param onValueChange callback ran when the value changes
/// @return the created dropdown
HMUI::SimpleTextDropdown* CreateDropdown(UnityEngine::Transform* parent, StringW dropdownName, StringW currentValue, std::vector<StringW> values, std::function<void(StringW)> onValueChange = nullptr);
/// @brief Overload for creating a dropdown menu that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @param dropdownName label of the setting
/// @param currentValue what to display as currently selected
/// @param values the possible string values that can be displayed
/// @param onValueChange callback ran when the value changes
/// @return the created dropdown
template<HasTransform T>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline HMUI::SimpleTextDropdown* CreateDropdown(T parent, StringW dropdownName, StringW currentValue, std::vector<StringW> values, std::function<void(StringW)> onValueChange = nullptr) {
return CreateDropdown(parent->get_transform(), dropdownName, currentValue, values, onValueChange);
}
/// @brief creates a floating screen
/// @param screenSize the size of the screen
/// @param position where to place it
/// @param rotation how to rotate it
/// @param curvatureRadius how curved is it?
/// @param hasBackground does it have a background?
/// @param createHandle should questui create a handle?
/// @param handleSide which side should have a handle? 0 = left, 1 = right, 2 = bottom, 3 = top, 4 = all
/// @return gameobject to parent your content to
UnityEngine::GameObject* CreateFloatingScreen(UnityEngine::Vector2 screenSize, UnityEngine::Vector3 position, UnityEngine::Vector3 rotation, float curvatureRadius = 0, bool hasBackground = true, bool createHandle = true, int handleSide = 4);
/// @brief creates a color picker
/// @param parent what to parent it to
/// @param text the label to display
/// @param defaultColor the starting color
/// @param onDone the callback to call when color picking is done
/// @param onCancel the callback to call when the user cancels
/// @param onChange the callback to call when the color changes at all
/// @return the created color picker object
ColorSetting* CreateColorPicker(UnityEngine::Transform* parent, StringW text, UnityEngine::Color defaultColor, std::function<void(UnityEngine::Color)> onDone = nullptr, std::function<void()> onCancel = nullptr, std::function<void(UnityEngine::Color)> onChange = nullptr);
/// @brief Overload for creating a color picker that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @param text the label to display
/// @param defaultColor the starting color
/// @param onDone the callback to call when color picking is done
/// @param onCancel the callback to call when the user cancels
/// @param onChange the callback to call when the color changes at all
/// @return the created color picker object
template<HasTransform T>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline ColorSetting* CreateColorPicker(T parent, StringW text, UnityEngine::Color defaultColor, std::function<void(UnityEngine::Color)> onDone = nullptr, std::function<void()> onCancel = nullptr, std::function<void(UnityEngine::Color)> onChange = nullptr) {
return CreateColorPicker(parent->get_transform(), text, defaultColor, onCancel, onDone, onChange);
}
/// @brief Creates a color picker modal
/// @param parent what to parent it to
/// @param name the text to display
/// @param defaultColor the color to start off with
/// @param onDone the callback to call when color picking is done
/// @param onCancel the callback to call when the user cancels
/// @param onChange the callback to call when the color changes at all
/// @return the created color picker modal object
QuestUI::ModalColorPicker* CreateColorPickerModal(UnityEngine::Transform* parent, StringW name, UnityEngine::Color defaultColor, std::function<void(UnityEngine::Color)> onDone = nullptr, std::function<void()> onCancel = nullptr, std::function<void(UnityEngine::Color)> onChange = nullptr);
/// @brief Overload for creating a color picker modal that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @param text the label to display
/// @param defaultColor the color to start off with
/// @param onDone the callback to call when color picking is done
/// @param onCancel the callback to call when the user cancels
/// @param onChange the callback to call when the color changes at all
/// @return the created color picker modal object
template<HasTransform T>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline QuestUI::ModalColorPicker* CreateColorPickerModal(T parent, StringW name, UnityEngine::Color defaultColor, std::function<void(UnityEngine::Color)> onDone = nullptr, std::function<void()> onCancel = nullptr, std::function<void(UnityEngine::Color)> onChange = nullptr) {
return CreateColorPickerModal(parent->get_transform(), name, defaultColor, onDone, onCancel, onChange);
}
/// @brief creates a modal that can be used to display information
/// @param parent what to parent it to
/// @param onBlockerClicked callback that gets called when clicking next to the modal, leaving it empty makes it just dismiss the modal
/// @param sizeDelta size of the object
/// @param anchoredPosition position of the modal
/// @param dismissOnBlockerClicked whether to auto dismiss when the blocker (outside) is clicked
/// @return created modal
HMUI::ModalView* CreateModal(UnityEngine::Transform* parent, UnityEngine::Vector2 sizeDelta, UnityEngine::Vector2 anchoredPosition, std::function<void(HMUI::ModalView*)> onBlockerClicked, bool dismissOnBlockerClicked = true);
/// @brief creates a modal that can be used to display information
/// @param parent what to parent it to
/// @param onBlockerClicked callback that gets called when clicking next to the modal, leaving it empty makes it just dismiss the modal
/// @param sizeDelta size of the object
/// @param dismissOnBlockerClicked whether to auto dismiss when the blocker (outside) is clicked
/// @return created modal
HMUI::ModalView* CreateModal(UnityEngine::Transform* parent, UnityEngine::Vector2 sizeDelta, std::function<void(HMUI::ModalView*)> onBlockerClicked, bool dismissOnBlockerClicked = true);
/// @brief creates a modal that can be used to display information
/// @param parent what to parent it to
/// @param onBlockerClicked callback that gets called when clicking next to the modal, leaving it empty makes it just dismiss the modal
/// @param dismissOnBlockerClicked whether to auto dismiss when the blocker (outside) is clicked
/// @return created modal
HMUI::ModalView* CreateModal(UnityEngine::Transform* parent, std::function<void(HMUI::ModalView*)> onBlockerClicked, bool dismissOnBlockerClicked = true);
/// @brief creates a modal that can be used to display information
/// @param parent what to parent it to
/// @param dismissOnBlockerClicked whether to auto dismiss when the blocker (outside) is clicked
/// @return created modal
HMUI::ModalView* CreateModal(UnityEngine::Transform* parent, bool dismissOnBlockerClicked = true);
/// @brief Overload for creating a modal that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return the created modal
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline HMUI::ModalView* CreateModal(T parent, TArgs...args) {
return CreateModal(parent->get_transform(), args...);
}
/// @brief creates a scrollable container for the given modal, with exact fit
/// @param modal the modal to create a container for
/// @return GameObject container
UnityEngine::GameObject* CreateScrollableModalContainer(HMUI::ModalView* modal);
/// @brief creates a custom list based on the level/pack/simple lists
/// @param parent what to parent it to
/// @param onCellWithIdxClicked the callback called when a cell is clicked
/// @return CustomListTableData* so you can add your data to the list
CustomListTableData* CreateList(UnityEngine::Transform* parent, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief creates a custom list based on the level/pack/simple lists
/// @param parent what to parent it to
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
/// @return CustomListTableData* so you can add your data to the list
CustomListTableData* CreateList(UnityEngine::Transform* parent, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief creates a custom list based on the level/pack/simple lists
/// @param parent what to parent it to
/// @param anchoredPosition the position
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
/// @return CustomListTableData* so you can add your data to the list
CustomListTableData* CreateList(UnityEngine::Transform* parent, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief Overload for creating a list that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return CustomListTableData* so you can add your data to the list
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline CustomListTableData* CreateList(T parent, TArgs...args) {
return CreateList(parent->get_transform(), args...);
}
/// @brief creates a custom list based on the level/pack/simple lists
/// @param parent what to parent it to
/// @param onCellWithIdxClicked the callback called when a cell is clicked
/// @return CustomListTableData* so you can add your data to the list
CustomListTableData* CreateScrollableList(UnityEngine::Transform* parent, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief creates a custom list based on the level/pack/simple lists
/// @param parent what to parent it to
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
/// @return CustomListTableData* so you can add your data to the list
CustomListTableData* CreateScrollableList(UnityEngine::Transform* parent, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief creates a custom list based on the level/pack/simple lists
/// @param parent what to parent it to
/// @param anchoredPosition the position
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
/// @return CustomListTableData* so you can add your data to the list
CustomListTableData* CreateScrollableList(UnityEngine::Transform* parent, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief Overload for creating a scrollable list that allows you to pass in anything that has a ->get_transform() method for the parent
/// @param parent what to parent it to
/// @return CustomListTableData* so you can add your data to the list
template<HasTransform T, typename ...TArgs>
requires(!std::is_convertible_v<T, UnityEngine::Transform*>)
inline CustomListTableData* CreateScrollableList(T parent, TArgs...args) {
return CreateScrollableList(parent->get_transform(), args...);
}
/// @brief creates a List with a custom HMUI::TableView::IDataSource
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param anchoredPosition the position
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
HMUI::TableView::IDataSource* CreateCustomSourceList(System::Type* type, UnityEngine::Transform* parent, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T>
requires (std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateCustomSourceList(UnityEngine::Transform* parent, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent, {0.0f, 0.0f}, {35.0f, 60.0f}, onCellWithIdxClicked);
}
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T>
requires (std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateCustomSourceList(UnityEngine::Transform* parent, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent, {0.0f, 0.0f}, sizeDelta, onCellWithIdxClicked);
}
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param anchoredPosition the position
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T>
requires (std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateCustomSourceList(UnityEngine::Transform* parent, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent, anchoredPosition, sizeDelta, onCellWithIdxClicked);
}
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T, HasTransform U>
requires (!std::is_convertible_v<U, UnityEngine::Transform*>, std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateCustomSourceList(U parent, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent->get_transform(), {0.0f, 0.0f}, {35.0f, 60.0f}, onCellWithIdxClicked);
}
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T, HasTransform U>
requires (!std::is_convertible_v<U, UnityEngine::Transform*>, std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateCustomSourceList(U parent, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent->get_transform(), {0.0f, 0.0f}, sizeDelta, onCellWithIdxClicked);
}
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param anchoredPosition the position
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T, HasTransform U>
requires (!std::is_convertible_v<U, UnityEngine::Transform*>, std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateCustomSourceList(U parent, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent->get_transform(), anchoredPosition, sizeDelta, onCellWithIdxClicked);
}
/// @brief creates a List with a custom IDataSource
/// @param type type of class that implements HMUI::TableView::IDataSource
/// @param parent what to parent it to
/// @param anchoredPosition the position
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
HMUI::TableView::IDataSource* CreateScrollableCustomSourceList(System::Type* type, UnityEngine::Transform* parent, UnityEngine::Vector2 anchoredPosition, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr);
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T>
requires (std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateScrollableCustomSourceList(UnityEngine::Transform* parent, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateScrollableCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent, {0.0f, 0.0f}, {35.0f, 60.0f}, onCellWithIdxClicked);
}
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)
/// @param parent what to parent it to
/// @param sizeDelta the sizeDelta
/// @param onCellWithIdxClicked the callback called when a cell is clicked
template<typename T>
requires (std::is_convertible_v<T, UnityEngine::MonoBehaviour*>)
T CreateScrollableCustomSourceList(UnityEngine::Transform* parent, UnityEngine::Vector2 sizeDelta, std::function<void(int)> onCellWithIdxClicked = nullptr)
{
return (T)CreateScrollableCustomSourceList(reinterpret_cast<System::Type*>(csTypeOf(T)), parent, {0.0f, 0.0f}, sizeDelta, onCellWithIdxClicked);
}
/// @brief creates a list with a custom data source passed in by the modder
/// @tparam T class that implements HMUI::TableView::IDataSource & is a component (Monobehaviour)