forked from angturil/SongRequestManager
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path1.12.2-update.diff
More file actions
1368 lines (1249 loc) · 67.9 KB
/
1.12.2-update.diff
File metadata and controls
1368 lines (1249 loc) · 67.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
diff --git a/EnhancedTwitchIntegration/Bot/ChatCommands.cs b/EnhancedTwitchIntegration/Bot/ChatCommands.cs
index fd4966c..c1b28df 100644
--- a/EnhancedTwitchIntegration/Bot/ChatCommands.cs
+++ b/EnhancedTwitchIntegration/Bot/ChatCommands.cs
@@ -7,7 +7,7 @@ using System.Text;
using UnityEngine;
using System.Threading.Tasks;
using ChatCore.Models.Twitch;
-using ChatCore.SimpleJSON;
+using ChatCore.Utilities;
namespace SongRequestManager
{
@@ -24,7 +24,7 @@ namespace SongRequestManager
static public StringBuilder SongHintText=new StringBuilder ("Requested by %user%%LF%Status: %Status%%Info%%LF%%PP%%LF%<size=60%>Request Time: %RequestTime%</size>");
static StringBuilder QueueTextFileFormat=new StringBuilder ("%songName%%LF%"); // Don't forget to include %LF% for these.
- static public StringBuilder QueueListRow2 = new StringBuilder("%authorName% (%id%) <color=white>%songlength%</color>");
+ static public StringBuilder QueueListRow2 = new StringBuilder("%authorName%");
static StringBuilder BanSongDetail = new StringBuilder("Blocking %songName%/%authorName% (%version%)");
diff --git a/EnhancedTwitchIntegration/Bot/Keyboard.cs b/EnhancedTwitchIntegration/Bot/Keyboard.cs
index b58bd6d..fe15f09 100644
--- a/EnhancedTwitchIntegration/Bot/Keyboard.cs
+++ b/EnhancedTwitchIntegration/Bot/Keyboard.cs
@@ -79,13 +79,13 @@ namespace SongRequestManager
}
- public void SetButtonType(string ButtonName= "KeyboardButton")
+ public void SetButtonType(string ButtonName = "Q")
{
- BaseButton = Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == ButtonName));
- if (BaseButton==null) BaseButton = Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == "KeyboardButton"));
+ BaseButton = Resources.FindObjectsOfTypeAll<Button>().Last(x => string.Equals(x.name, ButtonName, StringComparison.OrdinalIgnoreCase));
+ if (BaseButton == null) BaseButton = Resources.FindObjectsOfTypeAll<Button>().Last(x => string.Equals(x.name, "Q", StringComparison.OrdinalIgnoreCase));
}
- public void SetValue (string keylabel, string value)
+ public void SetValue(string keylabel, string value)
{
bool found = false;
foreach (KEY key in keys) if (key.name == keylabel)
@@ -384,9 +384,9 @@ namespace SongRequestManager
void Search(KEY key)
{
if (key.kb.KeyboardText.text.StartsWith("!"))
- {
+ {
Enter(key);
- }
+ }
#if UNRELEASED
ClearSearches();
@@ -510,12 +510,13 @@ namespace SongRequestManager
// This key is not intialized at all
}
- public KEY(KEYBOARD kb, Vector2 position, string text, float width,float height, Color color)
+ public KEY(KEYBOARD kb, Vector2 position, string text, float width, float height, Color color)
{
value = text;
this.kb = kb;
name = text;
+
mybutton = Button.Instantiate(kb.BaseButton, kb.container, false);
(mybutton.transform as RectTransform).anchorMin = new Vector2(0.5f,0.5f);
@@ -527,6 +528,7 @@ namespace SongRequestManager
mybutton.transform.localScale = new Vector3(kb.scale, kb.scale, 1.0f);
mybutton.SetButtonTextSize(5f);
mybutton.SetButtonText(text);
+ mybutton.name = $"SRM_{text}";
mybutton.GetComponentInChildren<Image>().color = color;
if (width == 0)
@@ -539,7 +541,7 @@ namespace SongRequestManager
// Adjust starting position so button aligns to upper left of current drawing position
- position.x += kb.scale*width / 2 ;
+ position.x += kb.scale * width / 2 ;
position.y -= kb.scale * height / 2;
(mybutton.transform as RectTransform).anchoredPosition = position;
diff --git a/EnhancedTwitchIntegration/Bot/ListManager.cs b/EnhancedTwitchIntegration/Bot/ListManager.cs
index eb2e9f9..27ae8bd 100644
--- a/EnhancedTwitchIntegration/Bot/ListManager.cs
+++ b/EnhancedTwitchIntegration/Bot/ListManager.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using ChatCore.Models.Twitch;
-using ChatCore.SimpleJSON;
+using ChatCore.Utilities;
using UnityEngine;
namespace SongRequestManager
diff --git a/EnhancedTwitchIntegration/Bot/RequestBot.cs b/EnhancedTwitchIntegration/Bot/RequestBot.cs
index 4be9cb1..444d60e 100644
--- a/EnhancedTwitchIntegration/Bot/RequestBot.cs
+++ b/EnhancedTwitchIntegration/Bot/RequestBot.cs
@@ -20,7 +20,8 @@ using BeatSaberMarkupLanguage;
using System.Threading.Tasks;
using System.IO.Compression;
using ChatCore.Models.Twitch;
-using ChatCore.SimpleJSON;
+using ChatCore.Utilities;
+using HMUI;
namespace SongRequestManager
{
@@ -78,7 +79,7 @@ namespace SongRequestManager
internal static void SRMButtonPressed()
{
var soloFlow = Resources.FindObjectsOfTypeAll<SoloFreePlayFlowCoordinator>().First();
- soloFlow.InvokeMethod<object, SoloFreePlayFlowCoordinator>("PresentFlowCoordinator", _flowCoordinator, null, false, false);
+ soloFlow.InvokeMethod<object, SoloFreePlayFlowCoordinator>("PresentFlowCoordinator", _flowCoordinator, null, ViewController.AnimationDirection.Horizontal, false, false);
}
internal static void SetTitle(string title)
@@ -90,17 +91,27 @@ namespace SongRequestManager
{
try
{
- var _levelListViewController = Resources.FindObjectsOfTypeAll<LevelCollectionViewController>().First();
+ var _levelListViewController = Resources.FindObjectsOfTypeAll<SelectLevelCategoryViewController>().Last();
+
if (_levelListViewController)
- {
- _requestButton = UIHelper.CreateUIButton(_levelListViewController.rectTransform, "OkButton", new Vector2(66, -3.5f),
- new Vector2(9f, 5.5f), () => { _requestButton.interactable = false; SRMButtonPressed(); _requestButton.interactable = true; }, "SRM");
+ {
+ // move the icon control
+ var iconSegmentedControl = _levelListViewController.GetField<IconSegmentedControl, SelectLevelCategoryViewController>("_levelFilterCategoryIconSegmentedControl");
+ ((RectTransform)iconSegmentedControl.transform).anchoredPosition = new Vector2(0, 4.5f);
+
+ _requestButton = _levelListViewController.CreateUIButton("SRMButton", "PracticeButton", new Vector2(14, -4.5f), new Vector2(15f, 105f),
+ () =>
+ {
+ _requestButton.interactable = false;
+ SRMButtonPressed();
+ _requestButton.interactable = true;
+ },
+ "SRM");
- (_requestButton.transform as RectTransform).anchorMin = new Vector2(1, 1);
- (_requestButton.transform as RectTransform).anchorMax = new Vector2(1, 1);
_requestButton.ToggleWordWrapping(false);
- _requestButton.SetButtonTextSize(3.5f);
+ _requestButton.SetButtonTextSize(5f);
+
UIHelper.AddHintText(_requestButton.transform as RectTransform, "Manage the current request queue");
UpdateRequestUI();
@@ -917,11 +928,11 @@ namespace SongRequestManager
if (RequestQueue.Songs.Count == 0)
{
- _requestButton.gameObject.GetComponentInChildren<Image>().color = Color.red;
+ _requestButton.SetButtonUnderlineColor(Color.red);
}
else
{
- _requestButton.gameObject.GetComponentInChildren<Image>().color = Color.green;
+ _requestButton.SetButtonUnderlineColor(Color.green);
}
}
}
@@ -931,7 +942,6 @@ namespace SongRequestManager
}
}
-
public static void DequeueRequest(SongRequest request, bool updateUI = true)
{
if (request.status!=RequestStatus.Wrongsong && request.status!=RequestStatus.SongSearch) RequestHistory.Songs.Insert(0, request); // Wrong song requests are not logged into history, is it possible that other status states shouldn't be moved either?
diff --git a/EnhancedTwitchIntegration/Bot/RequestBotListViewController.cs b/EnhancedTwitchIntegration/Bot/RequestBotListViewController.cs
index d2579c8..fb787b8 100644
--- a/EnhancedTwitchIntegration/Bot/RequestBotListViewController.cs
+++ b/EnhancedTwitchIntegration/Bot/RequestBotListViewController.cs
@@ -10,6 +10,9 @@ using SongRequestManager.UI;
using IPA.Utilities;
using BeatSaberMarkupLanguage;
using System.Threading.Tasks;
+using System.Collections.Concurrent;
+using VRUIControls;
+using Object = System.Object;
namespace SongRequestManager
{
@@ -35,6 +38,9 @@ namespace SongRequestManager
private TextMeshProUGUI _CurrentSongName;
private TextMeshProUGUI _CurrentSongName2;
+ private RequestFlowCoordinator RequestFlowCoordinator;
+ private SimpleDialogPromptViewController _dialog;
+
private HoverHint _historyHintText;
private SongPreviewPlayer _songPreviewPlayer;
@@ -99,7 +105,7 @@ namespace SongRequestManager
static public SongRequest currentsong = null;
- protected override void DidActivate(bool firstActivation, ActivationType type)
+ protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
{
if (firstActivation)
{
@@ -118,13 +124,16 @@ namespace SongRequestManager
RectTransform container = new GameObject("RequestBotContainer", typeof(RectTransform)).transform as RectTransform;
container.SetParent(rectTransform, false);
- container.sizeDelta = new Vector2(60f, 0f);
#region TableView Setup and Initialization
var go = new GameObject("SongRequestTableView", typeof(RectTransform));
go.SetActive(false);
+
+ go.AddComponent<ScrollRect>();
+ go.AddComponent<Touchable>();
+
_songListTableView = go.AddComponent<TableView>();
- _songListTableView.gameObject.AddComponent<RectMask2D>();
+ go.AddComponent<RectMask2D>();
_songListTableView.transform.SetParent(container, false);
_songListTableView.SetField("_preallocatedCells", new TableView.CellsGroup[0]);
@@ -132,42 +141,38 @@ namespace SongRequestManager
var viewport = new GameObject("Viewport").AddComponent<RectTransform>();
viewport.SetParent(go.GetComponent<RectTransform>(), false);
- (viewport.transform as RectTransform).sizeDelta = new Vector2(0, 0);
- (viewport.transform as RectTransform).anchorMin = new Vector2(0, 0);
- (viewport.transform as RectTransform).anchorMax = new Vector2(1, 1);
go.GetComponent<ScrollRect>().viewport = viewport;
- _songListTableView.InvokeMethod<object, TableView>("Init");
+ (viewport.transform as RectTransform).sizeDelta = new Vector2(70f, 70f);
- _songListTableView.dataSource = this;
+ _songListTableView.SetDataSource(this, false);
+
+ _songListTableView.LazyInit();
go.SetActive(true);
- (_songListTableView.transform as RectTransform).anchorMin = new Vector2(0f, 0f);
- (_songListTableView.transform as RectTransform).anchorMax = new Vector2(1f, 1f);
- (_songListTableView.transform as RectTransform).sizeDelta = new Vector2(0f, 60f);
- (_songListTableView.transform as RectTransform).anchoredPosition = new Vector2(0f, -3f);
+ (_songListTableView.transform as RectTransform).sizeDelta = new Vector2(70f, 70f);
+ (_songListTableView.transform as RectTransform).anchoredPosition = new Vector2(3f, 0f);
_songListTableView.didSelectCellWithIdxEvent += DidSelectRow;
- rectTransform.anchorMin = new Vector2(0.5f, 0f);
- rectTransform.anchorMax = new Vector2(0.5f, 1f);
- rectTransform.sizeDelta = new Vector2(74f, 0f);
- rectTransform.pivot = new Vector2(0.4f, 0.5f);
-
- var _songListTableViewScroller = _songListTableView.GetField<TableViewScroller, TableView>("_scroller");
+ var _songListTableViewScroller = _songListTableView.GetField<TableViewScroller, TableView>("scroller");
_pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().Last(x => (x.name == "PageUpButton")), container, false);
- (_pageUpButton.transform as RectTransform).anchoredPosition = new Vector2(0f, 35f);
+ (_pageUpButton.transform as RectTransform).anchoredPosition = new Vector2(3f, -14f);
+ (_pageUpButton.transform as RectTransform).sizeDelta = new Vector2(-30f, 6f);
_pageUpButton.interactable = true;
+ _pageUpButton.name = "SRMPageUpButton";
_pageUpButton.onClick.AddListener(delegate ()
{
_songListTableViewScroller.PageScrollUp();
});
_pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == "PageDownButton")), container, false);
- (_pageDownButton.transform as RectTransform).anchoredPosition = new Vector2(0f, -41f);
+ (_pageDownButton.transform as RectTransform).anchoredPosition = new Vector2(3f, 14f);
+ (_pageDownButton.transform as RectTransform).sizeDelta = new Vector2(-30f, 6f);
_pageDownButton.interactable = true;
+ _pageDownButton.name = "SRMPageDownButton";
_pageDownButton.onClick.AddListener(delegate ()
{
_songListTableViewScroller.PageScrollDown();
@@ -209,154 +214,151 @@ namespace SongRequestManager
#region History button
// History button
- _historyButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().First(o => (o.name == "OkButton")), container, false);
+ _historyButton = UIHelper.CreateUIButton("SRMHistory", container, "PracticeButton", new Vector2(53f, 30f),
+ new Vector2(25f, 15f),
+ () =>
+ {
+ isShowingHistory = !isShowingHistory;
+ RequestBot.SetTitle(isShowingHistory ? "Song Request History" : "Song Request Queue");
+ UpdateRequestUI(true);
+ SetUIInteractivity();
+ _lastSelection = -1;
+ if (NumberOfCells() > 0)
+ {
+ _songListTableView.ScrollToCellWithIdx(0, TableViewScroller.ScrollPositionType.Beginning, false);
+ _songListTableView.SelectCellWithIdx(0);
+ }
+ }, "History");
+
_historyButton.ToggleWordWrapping(false);
- (_historyButton.transform as RectTransform).anchoredPosition = new Vector2(90f, 30f);
- _historyButton.SetButtonText("History");
- _historyButton.onClick.RemoveAllListeners();
- _historyButton.onClick.AddListener(delegate ()
- {
- isShowingHistory = !isShowingHistory;
- RequestBot.SetTitle(isShowingHistory ? "Song Request History" : "Song Request Queue");
- UpdateRequestUI(true);
- SetUIInteractivity();
- _lastSelection = -1;
- });
_historyHintText = UIHelper.AddHintText(_historyButton.transform as RectTransform, "");
#endregion
#region Blacklist button
// Blacklist button
- _blacklistButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().First(o => (o.name == "OkButton")), container, false);
- _blacklistButton.ToggleWordWrapping(false);
- (_blacklistButton.transform as RectTransform).anchoredPosition = new Vector2(90f, 10f);
- _blacklistButton.SetButtonText("Blacklist");
- //_blacklistButton.GetComponentInChildren<Image>().color = Color.red;
- _blacklistButton.onClick.RemoveAllListeners();
- _blacklistButton.onClick.AddListener(delegate ()
- {
- if (NumberOfCells() > 0)
+ _blacklistButton = UIHelper.CreateUIButton("SRMBlacklist", container, "PracticeButton", new Vector2(53f, 10f),
+ new Vector2(25f, 15f),
+ () =>
{
- void _onConfirm()
+ if (NumberOfCells() > 0)
{
- RequestBot.Blacklist(_selectedRow, isShowingHistory, true);
- if (_selectedRow > 0)
- _selectedRow--;
- confirmDialogActive = false;
- }
+ void _onConfirm()
+ {
+ RequestBot.Blacklist(_selectedRow, isShowingHistory, true);
+ if (_selectedRow > 0)
+ _selectedRow--;
+ confirmDialogActive = false;
+ }
- // get song
- var song = SongInfoForRow(_selectedRow).song;
+ // get song
+ var song = SongInfoForRow(_selectedRow).song;
- // indicate dialog is active
- confirmDialogActive = true;
+ // indicate dialog is active
+ confirmDialogActive = true;
- // show dialog
- YesNoModal.instance.ShowDialog("Blacklist Song Warning", $"Blacklisting {song["songName"].Value} by {song["authorName"].Value}\r\nDo you want to continue?", _onConfirm, () => { confirmDialogActive = false; });
- }
- });
+ // show dialog
+ YesNoModal.instance.ShowDialog("Blacklist Song Warning", $"Blacklisting {song["songName"].Value} by {song["authorName"].Value}\r\nDo you want to continue?", _onConfirm, () => { confirmDialogActive = false; });
+ }
+ }, "Blacklist");
+
+ _blacklistButton.ToggleWordWrapping(false);
UIHelper.AddHintText(_blacklistButton.transform as RectTransform, "Block the selected request from being queued in the future.");
#endregion
#region Skip button
// Skip button
- _skipButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().First(o => (o.name == "OkButton")), container, false);
- _skipButton.ToggleWordWrapping(false);
- (_skipButton.transform as RectTransform).anchoredPosition = new Vector2(90f, 0f);
- _skipButton.SetButtonText("Skip");
- //_skipButton.GetComponentInChildren<Image>().color = Color.yellow;
- _skipButton.onClick.RemoveAllListeners();
- _skipButton.onClick.AddListener(delegate ()
- {
- if (NumberOfCells() > 0)
+ _skipButton = UIHelper.CreateUIButton("SRMSkip", container, "PracticeButton", new Vector2(53f, 0f),
+ new Vector2(25f, 15f),
+ () =>
{
- void _onConfirm()
+ if (NumberOfCells() > 0)
{
- // get selected song
- currentsong = SongInfoForRow(_selectedRow);
-
- // skip it
- RequestBot.Skip(_selectedRow);
+ // get song
+ var song = SongInfoForRow(_selectedRow).song;
- // select previous song if not first song
- if (_selectedRow > 0)
+ void _onConfirm()
{
- _selectedRow--;
- }
+ // get selected song
+ currentsong = SongInfoForRow(_selectedRow);
- // indicate dialog is no longer active
- confirmDialogActive = false;
- }
+ // skip it
+ RequestBot.Skip(_selectedRow);
- // get song
- var song = SongInfoForRow(_selectedRow).song;
+ // select previous song if not first song
+ if (_selectedRow > 0)
+ {
+ _selectedRow--;
+ }
- // indicate dialog is active
- confirmDialogActive = true;
+ // indicate dialog is no longer active
+ confirmDialogActive = false;
+ }
- // show dialog
- YesNoModal.instance.ShowDialog("Skip Song Warning", $"Skipping {song["songName"].Value} by {song["authorName"].Value}\r\nDo you want to continue?", _onConfirm, () => { confirmDialogActive = false; });
- }
- });
+ // indicate dialog is active
+ confirmDialogActive = true;
+
+ // show dialog
+ YesNoModal.instance.ShowDialog("Skip Song Warning", $"Skipping {song["songName"].Value} by {song["authorName"].Value}\r\nDo you want to continue?", _onConfirm, () => { confirmDialogActive = false; });
+ }
+ }, "Skip");
+
+ _skipButton.ToggleWordWrapping(false);
UIHelper.AddHintText(_skipButton.transform as RectTransform, "Remove the selected request from the queue.");
#endregion
#region Play button
// Play button
- _playButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().First(o => (o.name == "OkButton")), container, false);
- _playButton.ToggleWordWrapping(false);
- (_playButton.transform as RectTransform).anchoredPosition = new Vector2(90f, -10f);
- _playButton.SetButtonText("Play");
- _playButton.GetComponentInChildren<Image>().color = Color.green;
- _playButton.onClick.RemoveAllListeners();
- _playButton.onClick.AddListener(delegate ()
- {
- if (NumberOfCells() > 0)
+ _playButton = UIHelper.CreateUIButton("SRMPlay", container, "ActionButton", new Vector2(53f, -10f),
+ new Vector2(25f, 15f),
+ () =>
{
- currentsong = SongInfoForRow(_selectedRow);
- RequestBot.played.Add(currentsong.song);
- RequestBot.WriteJSON(RequestBot.playedfilename, ref RequestBot.played);
-
- SetUIInteractivity(false);
- RequestBot.Process(_selectedRow, isShowingHistory);
- _selectedRow = -1;
- }
- });
+ if (NumberOfCells() > 0)
+ {
+ currentsong = SongInfoForRow(_selectedRow);
+ RequestBot.played.Add(currentsong.song);
+ RequestBot.WriteJSON(RequestBot.playedfilename, ref RequestBot.played);
+
+ SetUIInteractivity(false);
+ RequestBot.Process(_selectedRow, isShowingHistory);
+ _selectedRow = -1;
+ }
+ }, "Play");
+
+ _playButton.ToggleWordWrapping(false);
+ _playButton.interactable = ((isShowingHistory && RequestHistory.Songs.Count > 0) || (!isShowingHistory && RequestQueue.Songs.Count > 0));
UIHelper.AddHintText(_playButton.transform as RectTransform, "Download and scroll to the currently selected request.");
#endregion
#region Queue button
// Queue button
- _queueButton = Instantiate(Resources.FindObjectsOfTypeAll<Button>().First(o => (o.name == "OkButton")), container, false);
- _queueButton.ToggleWordWrapping(false);
+ _queueButton = UIHelper.CreateUIButton("SRMQueue", container, "PracticeButton", new Vector2(53f, -30f),
+ new Vector2(25f, 15f),
+ () =>
+ {
+ RequestBotConfig.Instance.RequestQueueOpen = !RequestBotConfig.Instance.RequestQueueOpen;
+ RequestBotConfig.Instance.Save();
+ RequestBot.WriteQueueStatusToFile(RequestBotConfig.Instance.RequestQueueOpen ? "Queue is open." : "Queue is closed.");
+ RequestBot.Instance.QueueChatMessage(RequestBotConfig.Instance.RequestQueueOpen ? "Queue is open." : "Queue is closed.");
+ UpdateRequestUI();
+ }, RequestBotConfig.Instance.RequestQueueOpen ? "Queue Open" : "Queue Closed");
+
+ _queueButton.ToggleWordWrapping(true);
+ _queueButton.SetButtonUnderlineColor(RequestBotConfig.Instance.RequestQueueOpen ? Color.green : Color.red);
_queueButton.SetButtonTextSize(3.5f);
- (_queueButton.transform as RectTransform).anchoredPosition = new Vector2(90f, -30f);
- _queueButton.SetButtonText(RequestBotConfig.Instance.RequestQueueOpen ? "Queue Open" : "Queue Closed");
- _queueButton.GetComponentInChildren<Image>().color = RequestBotConfig.Instance.RequestQueueOpen ? Color.green : Color.red; ;
- _queueButton.interactable = true;
- _queueButton.onClick.RemoveAllListeners();
- _queueButton.onClick.AddListener(delegate ()
- {
- RequestBotConfig.Instance.RequestQueueOpen = !RequestBotConfig.Instance.RequestQueueOpen;
- RequestBotConfig.Instance.Save();
- RequestBot.WriteQueueStatusToFile(RequestBotConfig.Instance.RequestQueueOpen ? "Queue is open." : "Queue is closed.");
- RequestBot.Instance.QueueChatMessage(RequestBotConfig.Instance.RequestQueueOpen ? "Queue is open." : "Queue is closed.");
- UpdateRequestUI();
- });
UIHelper.AddHintText(_queueButton.transform as RectTransform, "Open/Close the queue.");
#endregion
// Set default RequestFlowCoordinator title
RequestBot.SetTitle(isShowingHistory ? "Song Request History" : "Song Request Queue");
}
- base.DidActivate(firstActivation, type);
+ base.DidActivate(firstActivation, addedToHierarchy, screenSystemEnabling);
UpdateRequestUI();
SetUIInteractivity(true);
}
- protected override void DidDeactivate(DeactivationType type)
+ protected override void DidDeactivate(bool addedToHierarchy, bool screenSystemEnabling)
{
- base.DidDeactivate(type);
+ base.DidDeactivate(addedToHierarchy, screenSystemEnabling);
if (!confirmDialogActive)
{
isShowingHistory = false;
@@ -391,9 +393,11 @@ namespace SongRequestManager
public void UpdateRequestUI(bool selectRowCallback = false)
{
- _playButton.GetComponentInChildren<Image>().color = ((isShowingHistory && RequestHistory.Songs.Count > 0) || (!isShowingHistory && RequestQueue.Songs.Count > 0)) ? Color.green : Color.red;
+ _playButton.interactable = ((isShowingHistory && RequestHistory.Songs.Count > 0) || (!isShowingHistory && RequestQueue.Songs.Count > 0));
+
_queueButton.SetButtonText(RequestBotConfig.Instance.RequestQueueOpen ? "Queue Open" : "Queue Closed");
- _queueButton.GetComponentInChildren<Image>().color = RequestBotConfig.Instance.RequestQueueOpen ? Color.green : Color.red; ;
+ _queueButton.SetButtonUnderlineColor(RequestBotConfig.Instance.RequestQueueOpen ? Color.green : Color.red);
+
_historyHintText.text = isShowingHistory ? "Go back to your current song request queue." : "View the history of song requests from the current session.";
_historyButton.SetButtonText(isShowingHistory ? "Requests" : "History");
_playButton.SetButtonText(isShowingHistory ? "Replay" : "Play");
@@ -432,7 +436,7 @@ namespace SongRequestManager
SetUIInteractivity();
}
- private void SongLoader_SongsLoadedEvent(SongCore.Loader arg1, Dictionary <string,CustomPreviewBeatmapLevel> arg2)
+ private void SongLoader_SongsLoadedEvent(SongCore.Loader arg1, ConcurrentDictionary <string,CustomPreviewBeatmapLevel> arg2)
{
_songListTableView?.ReloadData();
}
@@ -518,8 +522,8 @@ namespace SongRequestManager
public TableCell CellForIdx(TableView tableView, int row)
{
LevelListTableCell _tableCell = Instantiate(_requestListTableCellInstance);
- _tableCell.reuseIdentifier = "RequestBotFriendCell";
- _tableCell.SetField("_bought", true);
+ _tableCell.reuseIdentifier = "RequestBotSongCell";
+ _tableCell.SetField("_notOwned", false);
SongRequest request = SongInfoForRow(row);
SetDataFromLevelAsync(request, _tableCell, row);
@@ -530,7 +534,7 @@ namespace SongRequestManager
private async void SetDataFromLevelAsync(SongRequest request, LevelListTableCell _tableCell, int row)
{
- var favouritesBadge = _tableCell.GetField<RawImage, LevelListTableCell>("_favoritesBadgeImage");
+ var favouritesBadge = _tableCell.GetField<Image, LevelListTableCell>("_favoritesBadgeImage");
favouritesBadge.enabled = false;
bool highlight = (request.requestInfo.Length > 0) && (request.requestInfo[0] == '!');
@@ -540,28 +544,6 @@ namespace SongRequestManager
var hasMessage = (request.requestInfo.Length > 0) && (request.requestInfo[0] == '!');
var isChallenge = request.requestInfo.IndexOf("!challenge", StringComparison.OrdinalIgnoreCase) >= 0;
- var beatmapCharacteristicImages = _tableCell.GetField<UnityEngine.UI.Image[], LevelListTableCell>("_beatmapCharacteristicImages"); // NEW VERSION
- foreach (var i in beatmapCharacteristicImages) i.enabled = false;
-
- // causing a nullex?
- //_tableCell.SetField("_beatmapCharacteristicAlphas", new float[5] { 1f, 1f, 1f, 1f, 1f });
-
- // set message icon if request has a message // NEW VERSION
- if (hasMessage)
- {
- beatmapCharacteristicImages.Last().sprite = Base64Sprites.InfoIcon;
- beatmapCharacteristicImages.Last().enabled = true;
- }
-
- // set challenge icon if song is a challenge
- if (isChallenge)
- {
- var el = beatmapCharacteristicImages.ElementAt(beatmapCharacteristicImages.Length - 2);
-
- el.sprite = Base64Sprites.VersusChallengeIcon;
- el.enabled = true;
- }
-
string pp = "";
int ppvalue = request.song["pp"].AsInt;
if (ppvalue > 0) pp = $" {ppvalue} PP";
@@ -571,15 +553,34 @@ namespace SongRequestManager
dt.Add("Info", (request.requestInfo != "") ? " / " + request.requestInfo : "");
dt.Add("RequestTime", request.requestTime.ToLocalTime().ToString("hh:mm"));
- var songName = _tableCell.GetField<TextMeshProUGUI, LevelListTableCell>("_songNameText");
- //songName.text = $"{request.song["songName"].Value} <size=50%>{RequestBot.GetRating(ref request.song)} <color=#3fff3f>{pp}</color></size> <color=#ff00ff>{msg}</color>";
- songName.text = $"{request.song["songName"].Value} <size=50%>{RequestBot.GetRating(ref request.song)} <color=#3fff3f>{pp}</color></size>"; // NEW VERSION
+ var songDurationText = _tableCell.GetField<TextMeshProUGUI, LevelListTableCell>("_songDurationText");
+ songDurationText.text = request.song["songlength"].Value;
+
+ var songBpm = _tableCell.GetField<TextMeshProUGUI, LevelListTableCell>("_songBpmText");
+ (songBpm.transform as RectTransform).anchoredPosition = new Vector2(-2.5f, -1.8f);
+ (songBpm.transform as RectTransform).sizeDelta += new Vector2(15f, 0f);
+
+ var k = new List<string>();
+ if (hasMessage) k.Add("MSG");
+ if (isChallenge) k.Add("VS");
+ k.Add(request.song["id"]);
+ songBpm.text = string.Join(" - ", k);
- var author = _tableCell.GetField<TextMeshProUGUI, LevelListTableCell>("_authorText");
+ var songBmpIcon = _tableCell.GetComponentsInChildren<Image>().LastOrDefault(c => string.Equals(c.name, "BpmIcon", StringComparison.OrdinalIgnoreCase));
+ if (songBmpIcon != null)
+ {
+ Destroy(songBmpIcon);
+ }
+
+ var songName = _tableCell.GetField<TextMeshProUGUI, LevelListTableCell>("_songNameText");
+ songName.richText = true;
+ songName.text = $"{request.song["songName"].Value} <size=50%>{RequestBot.GetRating(ref request.song)} <color=#3fff3f>{pp}</color></size>";
+ var author = _tableCell.GetField<TextMeshProUGUI, LevelListTableCell>("_songAuthorText");
+ author.richText = true;
author.text = dt.Parse(RequestBot.QueueListRow2);
- var image = _tableCell.GetField<RawImage, LevelListTableCell>("_coverRawImage");
+ var image = _tableCell.GetField<Image, LevelListTableCell>("_coverImage");
var imageSet = false;
if (SongCore.Loader.AreSongsLoaded)
@@ -589,8 +590,8 @@ namespace SongRequestManager
{
//Plugin.Log("custom level found");
// set image from song's cover image
- var tex = await level.GetCoverImageTexture2DAsync(System.Threading.CancellationToken.None);
- image.texture = tex;
+ var sprite = await level.GetCoverImageAsync(System.Threading.CancellationToken.None);
+ image.sprite = sprite;
imageSet = true;
}
}
@@ -616,7 +617,7 @@ namespace SongRequestManager
}
}
- image.texture = tex;
+ image.sprite = Base64Sprites.Texture2DToSprite(tex);
}
UIHelper.AddHintText(_tableCell.transform as RectTransform, dt.Parse(RequestBot.SongHintText));
diff --git a/EnhancedTwitchIntegration/Bot/RequestFlowCoordinator.cs b/EnhancedTwitchIntegration/Bot/RequestFlowCoordinator.cs
index ebebb4c..9981b0c 100644
--- a/EnhancedTwitchIntegration/Bot/RequestFlowCoordinator.cs
+++ b/EnhancedTwitchIntegration/Bot/RequestFlowCoordinator.cs
@@ -21,11 +21,11 @@ namespace SongRequestManager
}
}
- protected override void DidActivate(bool firstActivation, ActivationType activationType)
+ protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
{
if (firstActivation)
{
- title = "Song Request Manager";
+ SetTitle("Song Request Manager");
showBackButton = true;
ProvideInitialViewControllers(_requestBotListViewController, rightScreenViewController: _keyboardViewController);
@@ -36,7 +36,7 @@ namespace SongRequestManager
{
// dismiss ourselves
var soloFlow = Resources.FindObjectsOfTypeAll<SoloFreePlayFlowCoordinator>().First();
- soloFlow.InvokeMethod<object, SoloFreePlayFlowCoordinator>("DismissFlowCoordinator", this, null, false);
+ soloFlow.InvokeMethod<object, SoloFreePlayFlowCoordinator>("DismissFlowCoordinator", this, ViewController.AnimationDirection.Horizontal, null, false);
}
public void Dismiss()
@@ -46,7 +46,7 @@ namespace SongRequestManager
public void SetTitle(string newTitle)
{
- title = newTitle;
+ base.SetTitle(newTitle);
}
}
}
diff --git a/EnhancedTwitchIntegration/Bot/RequestManager.cs b/EnhancedTwitchIntegration/Bot/RequestManager.cs
index 712f0c2..ef676a2 100644
--- a/EnhancedTwitchIntegration/Bot/RequestManager.cs
+++ b/EnhancedTwitchIntegration/Bot/RequestManager.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
-using ChatCore.SimpleJSON;
+using ChatCore.Utilities;
namespace SongRequestManager
{
diff --git a/EnhancedTwitchIntegration/Bot/SongRequest.cs b/EnhancedTwitchIntegration/Bot/SongRequest.cs
index 3ddfc06..d008fa9 100644
--- a/EnhancedTwitchIntegration/Bot/SongRequest.cs
+++ b/EnhancedTwitchIntegration/Bot/SongRequest.cs
@@ -1,6 +1,6 @@
using System;
using ChatCore.Models.Twitch;
-using ChatCore.SimpleJSON;
+using ChatCore.Utilities;
using static SongRequestManager.RequestBot;
namespace SongRequestManager
diff --git a/EnhancedTwitchIntegration/Bot/UnreleasedCode.cs b/EnhancedTwitchIntegration/Bot/UnreleasedCode.cs
index bf3798b..35c76c4 100644
--- a/EnhancedTwitchIntegration/Bot/UnreleasedCode.cs
+++ b/EnhancedTwitchIntegration/Bot/UnreleasedCode.cs
@@ -10,7 +10,7 @@ using UnityEngine.Networking;
using TMPro;
using System.Threading.Tasks;
using ChatCore.Models.Twitch;
-using ChatCore.SimpleJSON;
+using ChatCore.Utilities;
//using BeatBits;
diff --git a/EnhancedTwitchIntegration/Bot/songdatabase.cs b/EnhancedTwitchIntegration/Bot/songdatabase.cs
index 461558b..1c50ed5 100644
--- a/EnhancedTwitchIntegration/Bot/songdatabase.cs
+++ b/EnhancedTwitchIntegration/Bot/songdatabase.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
using UnityEngine;
using System.Collections.Concurrent;
using System.Security.Cryptography;
-using ChatCore.SimpleJSON;
+using ChatCore.Utilities;
// Feature requests: Add Reason for being banned to banlist
//
diff --git a/EnhancedTwitchIntegration/Config/RequestBotConfig.cs b/EnhancedTwitchIntegration/Config/RequestBotConfig.cs
index 1033db5..27e4cc8 100644
--- a/EnhancedTwitchIntegration/Config/RequestBotConfig.cs
+++ b/EnhancedTwitchIntegration/Config/RequestBotConfig.cs
@@ -2,6 +2,7 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
+using IPA.Utilities;
namespace SongRequestManager
{
@@ -47,7 +48,7 @@ namespace SongRequestManager
public int maximumlookupmessages = 1;
public string LastBackup = DateTime.MinValue.ToString();
- public string backuppath = Path.Combine(Environment.CurrentDirectory, "userdata", "backup");
+ public string backuppath = Path.Combine(UnityGame.UserDataPath, "backup");
public bool OfflineMode = false;
public bool SavedatabaseOnNewest=false;
diff --git a/EnhancedTwitchIntegration/Plugin.cs b/EnhancedTwitchIntegration/Plugin.cs
index 59100bd..e4c760a 100644
--- a/EnhancedTwitchIntegration/Plugin.cs
+++ b/EnhancedTwitchIntegration/Plugin.cs
@@ -25,9 +25,10 @@ namespace SongRequestManager
public bool IsApplicationExiting = false;
public static Plugin Instance { get; private set; }
- private readonly RequestBotConfig RequestBotConfig = new RequestBotConfig();
+ private RequestBotConfig RequestBotConfig;
- public static string DataPath = Path.Combine(Environment.CurrentDirectory, "UserData", "StreamCore");
+ public static string DataPath = Path.Combine(UnityGame.UserDataPath, "SRM");
+ public static string OldDataPath = Path.Combine(UnityGame.UserDataPath, "StreamCore");
public static bool SongBrowserPluginPresent;
[Init]
@@ -41,7 +42,7 @@ namespace SongRequestManager
[CallerMemberName] string member = "",
[CallerLineNumber] int line = 0)
{
- Logger.Info($"[SongRequestManager] {Path.GetFileName(file)}->{member}({line}): {text}");
+ Logger.Info($"{Path.GetFileName(file)}->{member}({line}): {text}");
}
[OnStart]
@@ -50,12 +51,22 @@ namespace SongRequestManager
if (Instance != null) return;
Instance = this;
- // create playlists folder if needed
+ // create SRM UserDataFolder folder if needed, or rename old streamcore folder
if (!Directory.Exists(DataPath))
{
- Directory.CreateDirectory(DataPath);
+ if (Directory.Exists(OldDataPath))
+ {
+ Directory.Move(OldDataPath, DataPath);
+ }
+ else
+ {
+ Directory.CreateDirectory(DataPath);
+ }
}
+ // initialize config
+ RequestBotConfig = new RequestBotConfig();
+
Dispatcher.Initialize();
// create our internal webclient
@@ -68,7 +79,7 @@ namespace SongRequestManager
// setup handle for fresh menu scene changes
BS_Utils.Utilities.BSEvents.OnLoad();
- BS_Utils.Utilities.BSEvents.menuSceneLoadedFresh += OnMenuSceneLoadedFresh;
+ BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += OnLateMenuSceneLoadedFresh;
// keep track of active scene
BS_Utils.Utilities.BSEvents.menuSceneActive += () => { IsAtMainMenu = true; };
@@ -78,7 +89,7 @@ namespace SongRequestManager
Base64Sprites.Init();
}
- private void OnMenuSceneLoadedFresh()
+ private void OnLateMenuSceneLoadedFresh(ScenesTransitionSetupDataSO scenesTransitionSetupData)
{
// setup settings ui
BSMLSettings.instance.AddSettingsMenu("SRM", "SongRequestManager.Views.SongRequestManagerSettings.bsml", SongRequestManagerSettings.instance);
diff --git a/EnhancedTwitchIntegration/Properties/AssemblyInfo.cs b/EnhancedTwitchIntegration/Properties/AssemblyInfo.cs
index c4c2b29..67bab06 100644
--- a/EnhancedTwitchIntegration/Properties/AssemblyInfo.cs
+++ b/EnhancedTwitchIntegration/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.11.3.0")]
-[assembly: AssemblyFileVersion("2.11.3.0")]
+[assembly: AssemblyVersion("2.12.2.0")]
+[assembly: AssemblyFileVersion("2.12.2.0")]
diff --git a/EnhancedTwitchIntegration/SongRequestManager.csproj b/EnhancedTwitchIntegration/SongRequestManager.csproj
index e04ffba..3c48d01 100644
--- a/EnhancedTwitchIntegration/SongRequestManager.csproj
+++ b/EnhancedTwitchIntegration/SongRequestManager.csproj
@@ -44,7 +44,10 @@
<HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Plugins\BS_Utils.dll</HintPath>
</Reference>
<Reference Include="ChatCore">
- <HintPath>..\..\..\..\..\..\steam\steamapps\common\Beat Saber\Libs\ChatCore.dll</HintPath>
+ <HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Libs\ChatCore.dll</HintPath>
+ </Reference>
+ <Reference Include="GameplayCore">
+ <HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\GameplayCore.dll</HintPath>
</Reference>
<Reference Include="HMLib">
<HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\HMLib.dll</HintPath>
@@ -59,12 +62,15 @@
<Reference Include="Main">
<HintPath>C:\Games\steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Main.dll</HintPath>
</Reference>
+ <Reference Include="Polyglot, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Polyglot.dll</HintPath>
+ </Reference>
<Reference Include="SemVer">
<HintPath>C:\Games\steam\steamapps\common\Beat Saber\Libs\SemVer.dll</HintPath>
</Reference>
- <Reference Include="SongBrowser, Version=6.0.3.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>C:\Games\steam\steamapps\common\Beat Saber\Plugins\SongBrowser.dll</HintPath>
+ <Reference Include="SongBrowser">
+ <HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Plugins\SongBrowser.dll</HintPath>
</Reference>
<Reference Include="SongCore, Version=2.7.5.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -106,9 +112,6 @@
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.JSONSerializeModule.dll</HintPath>
</Reference>
- <Reference Include="UnityEngine.Networking">
- <HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.Networking.dll</HintPath>
- </Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
@@ -127,6 +130,10 @@
<Reference Include="UnityEngine.VRModule">
<HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.VRModule.dll</HintPath>
</Reference>
+ <Reference Include="VRUI, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Games\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\VRUI.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Bot\ChatCommands.cs" />
\ No newline at end of file
diff --git a/EnhancedTwitchIntegration/UI/Base64Sprites.cs b/EnhancedTwitchIntegration/UI/Base64Sprites.cs
index 607d499..ab9b160 100644
--- a/EnhancedTwitchIntegration/UI/Base64Sprites.cs
+++ b/EnhancedTwitchIntegration/UI/Base64Sprites.cs
@@ -66,6 +66,22 @@ namespace SongRequestManager.UI
return texture;
}
+ public static Sprite Texture2DToSprite(Texture2D tex)
+ {
+ Sprite s = null;
+ try
+ {
+ s = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), (Vector2.one / 2f));
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("Exception loading texture from base64 data.");
+ s = null;
+ }
+
+ return s;
+ }
+
private static void GetImageSize(byte[] imageData, out int width, out int height)
{
width = ReadInt(imageData, 3 + 15);
diff --git a/EnhancedTwitchIntegration/UI/KeyboardViewController.cs b/EnhancedTwitchIntegration/UI/KeyboardViewController.cs
index 32f4f3c..f21408b 100644
--- a/EnhancedTwitchIntegration/UI/KeyboardViewController.cs
+++ b/EnhancedTwitchIntegration/UI/KeyboardViewController.cs
@@ -5,7 +5,7 @@ namespace SongRequestManager.UI
{
public class KeyboardViewController : ViewController
{
- protected override void DidActivate(bool firstActivation, ActivationType type)
+ protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
{
if (firstActivation)
{
@@ -34,7 +34,7 @@ namespace SongRequestManager.UI
#endif
- mykeyboard.SetButtonType("OkButton"); // Adding this alters button positions??! Why?
+ mykeyboard.SetButtonType("Q"); // Adding this alters button positions??! Why?
mykeyboard.AddKeys(SEARCH, 0.75f);
mykeyboard.SetAction("CLEAR SEARCH", RequestBot.ClearSearch);
diff --git a/EnhancedTwitchIntegration/UI/SongListUtils.cs b/EnhancedTwitchIntegration/UI/SongListUtils.cs
index a68201b..0886670 100644
--- a/EnhancedTwitchIntegration/UI/SongListUtils.cs
+++ b/EnhancedTwitchIntegration/UI/SongListUtils.cs
@@ -1,12 +1,9 @@
-using BeatSaverDownloader.UI;
-using HMUI;
+using HMUI;
+using IPA.Utilities;
using System;
using System.Collections;
using System.Linq;
using UnityEngine;
-using IPA.Utilities;
-using IPA.Loader;
-using SongCore;
namespace SongRequestManager
{
@@ -111,42 +108,69 @@ namespace SongRequestManager
// ScrollToLevel(selectedLevelId);
}
- private static int SelectCustomSongPack()
+ private static IEnumerator SelectCustomSongPack()
{
- // get the Level Filtering Nav Controller, the top bar
- var _levelFilteringNavigationController = Resources.FindObjectsOfTypeAll<LevelFilteringNavigationController>().First();
+ // get the select Level category view controller
+ var selectLevelCategoryViewController = Resources.FindObjectsOfTypeAll<SelectLevelCategoryViewController>().First();