@@ -40,89 +40,81 @@ public IEnumerator VRChat_OnUiManagerInit()
40
40
41
41
public IEnumerator DelayedUIInit ( )
42
42
{
43
- //Get All Fav Lists
44
- var AvatarFavsArea =
45
- GameObject . Find ( "UserInterface/MenuContent/Screens/Avatar/Vertical Scroll View/Viewport/Content/" ) ;
43
+ MelonLogger . Msg ( "Init!" ) ;
46
44
47
- while ( AvatarFavsArea == null || ! AvatarFavsArea . active )
45
+ while ( true )
48
46
{
49
- yield return new WaitForSeconds ( 1f ) ;
47
+ //Get All Fav Lists
48
+ var AvatarFavsArea =
49
+ GameObject . Find ( "UserInterface/MenuContent/Screens/Avatar/Vertical Scroll View/Viewport/Content/" ) ;
50
50
51
- AvatarFavsArea = GameObject . Find ( "UserInterface/MenuContent/Screens/Avatar/Vertical Scroll View/Viewport/Content/" ) ;
52
- }
51
+ while ( AvatarFavsArea == null || ! AvatarFavsArea . active )
52
+ {
53
+ yield return new WaitForSeconds ( 1f ) ;
53
54
54
- for ( var i = 0 ; i < AvatarFavsArea . transform . childCount ; i ++ )
55
- {
56
- var Child = AvatarFavsArea . transform . GetChild ( i ) ;
55
+ AvatarFavsArea = GameObject . Find ( "UserInterface/MenuContent/Screens/Avatar/Vertical Scroll View/Viewport/Content/" ) ;
56
+ }
57
57
58
- if ( Child . GetComponent < UiAvatarList > ( ) != null ) // Is A Avi List
58
+ var Lists = Resources . FindObjectsOfTypeAll < UiAvatarList > ( ) . Select ( o => o . transform ) . ToList ( ) ;
59
+
60
+ for ( var i = 0 ; i < Lists . Count ; i ++ )
59
61
{
60
- //Make Button
61
- var Dupe = UnityEngine . Object . Instantiate ( GameObject . Find ( "UserInterface/MenuContent/Screens/Avatar/Change Button" ) , Child . Find ( "Button" ) ) ;
62
+ var Child = Lists [ i ] ;
62
63
63
- Dupe . GetComponent < RectTransform > ( ) . sizeDelta = new Vector2 ( 30f , 80f ) ;
64
+ if ( Child . GetComponent < UiAvatarList > ( ) != null && Child . Find ( "Button/TitleText/FavsExporter" ) == null ) // Is A Avi List
65
+ {
66
+ //Make Button
67
+ var Dupe = UnityEngine . Object . Instantiate ( GameObject . Find ( "UserInterface/MenuContent/Screens/Avatar/Change Button" ) , Child . Find ( "Button" ) ) ;
64
68
65
- //This Is Done To Fix Positioning
66
- Dupe . transform . localPosition = new Vector3 ( 115f , 0f , 0f ) ;
67
- Dupe . transform . SetParent ( Child . Find ( "Button/TitleText" ) ) ;
69
+ Dupe . name = "FavsExporter" ;
70
+ Dupe . GetComponent < RectTransform > ( ) . sizeDelta = new Vector2 ( 30f , 80f ) ;
68
71
69
- Dupe . GetComponentInChildren < Text > ( true ) . text = "E" ;
70
- Dupe . GetComponent < Button > ( ) . onClick = new Button . ButtonClickedEvent ( ) ;
71
- Dupe . GetComponent < Button > ( ) . onClick . AddListener ( DelegateSupport . ConvertDelegate < UnityAction > (
72
- new Action ( ( ) =>
73
- {
74
- var FavsInList = Child . GetComponentsInChildren < VRCUiContentButton > ( true )
75
- . Select ( o => o . field_Public_String_0 ) . Where ( p => p != null ) . ToList ( ) ;
72
+ //This Is Done To Fix Positioning
73
+ Dupe . transform . localPosition = new Vector3 ( 115f , 0f , 0f ) ;
74
+ Dupe . transform . SetParent ( Child . Find ( "Button/TitleText" ) ) ;
76
75
77
- if ( FavsInList . Count > 0 )
76
+ Dupe . GetComponentInChildren < Text > ( true ) . text = "E" ;
77
+ Dupe . GetComponent < Button > ( ) . onClick = new Button . ButtonClickedEvent ( ) ;
78
+ Dupe . GetComponent < Button > ( ) . onClick . AddListener ( DelegateSupport . ConvertDelegate < UnityAction > (
79
+ new Action ( ( ) =>
78
80
{
79
- var Json = JsonConvert . SerializeObject ( FavsInList ) ;
81
+ var FavsInList = Child . GetComponentsInChildren < VRCUiContentButton > ( true )
82
+ . Select ( o => o . field_Public_String_0 ) . Where ( p => p != null ) . ToList ( ) ;
80
83
81
- if ( ! Directory . Exists ( Environment . CurrentDirectory + " \\ ExportedFavs" ) )
84
+ if ( FavsInList . Count > 0 )
82
85
{
83
- Directory . CreateDirectory ( Environment . CurrentDirectory + "\\ ExportedFavs" ) ;
84
- }
86
+ var Json = JsonConvert . SerializeObject ( FavsInList ) ;
85
87
86
- var FilePath = Environment . CurrentDirectory + "\\ ExportedFavs\\ " +
87
- MakeValidFileName ( Child . Find ( "Button/TitleText" ) . GetComponent < Text > ( ) . text ) + ".json" ;
88
+ if ( ! Directory . Exists ( Environment . CurrentDirectory + "\\ ExportedFavs" ) )
89
+ {
90
+ Directory . CreateDirectory ( Environment . CurrentDirectory + "\\ ExportedFavs" ) ;
91
+ }
88
92
89
- File . WriteAllText ( FilePath , Json ) ;
93
+ var FilePath = Environment . CurrentDirectory + "\\ ExportedFavs\\ " +
94
+ MakeValidFileName ( Child . Find ( "Button/TitleText" ) . GetComponent < Text > ( ) . text ) + ".json" ;
90
95
91
- ChillOkayPopup ( "Alert" ,
92
- "Your Fav List Was Exported To: " + FilePath + "\n \n You Can Move It To " +
93
- Environment . CurrentDirectory +
94
- "\\ UserData\\ FavCatImport\\ To Import The Fav List Into Plague's Modpack.\n \n Modpack Discord Invite: https://plague.cx" ,
95
- PopupType . FullScreen ) ;
96
- }
97
- else
98
- {
99
- ChillOkayPopup ( "Error" ,
100
- "No Favs In List To Export!" ,
101
- PopupType . FullScreen ) ;
102
- }
103
- } ) ) ) ;
104
-
105
- Dupe . SetActive ( Child . gameObject . active ) ;
96
+ File . WriteAllText ( FilePath , Json ) ;
106
97
107
- EnableDisableListener Listener = null ;
98
+ ChillOkayPopup ( "Alert" ,
99
+ "Your Fav List Was Exported To: " + FilePath + "\n \n You Can Move It To " +
100
+ Environment . CurrentDirectory +
101
+ "\\ UserData\\ FavCatImport\\ To Import The Fav List Into Plague's Modpack.\n \n Modpack Discord Invite: https://plague.cx" ,
102
+ PopupType . FullScreen ) ;
103
+ }
104
+ else
105
+ {
106
+ ChillOkayPopup ( "Error" ,
107
+ "No Favs In List To Export!" ,
108
+ PopupType . FullScreen ) ;
109
+ }
110
+ } ) ) ) ;
108
111
109
- Listener = Child . gameObject . GetComponent < EnableDisableListener > ( ) == null ? Child . gameObject . AddComponent < EnableDisableListener > ( ) : Child . gameObject . GetComponent < EnableDisableListener > ( ) ;
110
-
111
- Listener . OnEnabled += ( ) =>
112
- {
113
112
Dupe . SetActive ( true ) ;
114
- } ;
115
-
116
- Listener . OnDisabled += ( ) =>
117
- {
118
- Dupe . SetActive ( false ) ;
119
- } ;
113
+ }
120
114
}
121
- }
122
-
123
- MelonLogger . Msg ( "Init!" ) ;
124
115
125
- yield break ;
116
+ yield return new WaitForSeconds ( 5f ) ;
117
+ }
126
118
}
127
119
128
120
static char [ ] _invalids ;
0 commit comments