@@ -13,6 +13,18 @@ public class MenuController : BaseScript
1313 public static List < Menu > Menus { get ; protected set ; } = new List < Menu > ( ) ;
1414 public const string _texture_dict = "commonmenu" ;
1515 public const string _header_texture = "interaction_bgd" ;
16+ private static List < string > menuTextureAssets = new List < string > ( )
17+ {
18+ "commonmenu" ,
19+ "commonmenutu" ,
20+ "mpleaderboard" ,
21+ "mphud" ,
22+ "mpshopsale" ,
23+ "mpinventory" ,
24+ "mprankbadge" ,
25+ "mpcarhud" ,
26+ "mpcarhud2" ,
27+ } ;
1628
1729 private static float AspectRatio => GetScreenAspectRatio ( false ) ;
1830 public static float ScreenWidth => 1080 * AspectRatio ;
@@ -130,21 +142,23 @@ public static void AddSubmenu(Menu parent, Menu child)
130142 child . ParentMenu = parent ;
131143 }
132144
145+
133146 /// <summary>
134147 /// Loads the texture dict for the common menu sprites.
135148 /// </summary>
136149 /// <returns></returns>
137150 private static async Task LoadAssets ( )
138151 {
139- if ( ! HasStreamedTextureDictLoaded ( _texture_dict ) || ! HasStreamedTextureDictLoaded ( "mpleaderboard" ) || ! HasStreamedTextureDictLoaded ( "commonmenutu" ) )
152+ menuTextureAssets . ForEach ( asset =>
140153 {
141- RequestStreamedTextureDict ( _texture_dict , false ) ;
142- RequestStreamedTextureDict ( "mpleaderboard" , false ) ;
143- RequestStreamedTextureDict ( "commonmenutu" , false ) ;
144- while ( ! HasStreamedTextureDictLoaded ( _texture_dict ) || ! HasStreamedTextureDictLoaded ( "mpleaderboard" ) || ! HasStreamedTextureDictLoaded ( "commonmenutu" ) )
154+ if ( ! HasStreamedTextureDictLoaded ( asset ) )
145155 {
146- await Delay ( 0 ) ;
156+ RequestStreamedTextureDict ( asset , false ) ;
147157 }
158+ } ) ;
159+ while ( menuTextureAssets . Any ( asset => { return ! HasStreamedTextureDictLoaded ( asset ) ; } ) )
160+ {
161+ await Delay ( 0 ) ;
148162 }
149163 }
150164
@@ -153,18 +167,7 @@ private static async Task LoadAssets()
153167 /// </summary>
154168 private static void UnloadAssets ( )
155169 {
156- if ( HasStreamedTextureDictLoaded ( _texture_dict ) )
157- {
158- SetStreamedTextureDictAsNoLongerNeeded ( _texture_dict ) ;
159- }
160- if ( HasStreamedTextureDictLoaded ( "mpleaderboard" ) )
161- {
162- SetStreamedTextureDictAsNoLongerNeeded ( "mpleaderboard" ) ;
163- }
164- if ( HasStreamedTextureDictLoaded ( "commonmenutu" ) )
165- {
166- SetStreamedTextureDictAsNoLongerNeeded ( "commonmenutu" ) ;
167- }
170+ menuTextureAssets . ForEach ( asset => { if ( HasStreamedTextureDictLoaded ( asset ) ) { SetStreamedTextureDictAsNoLongerNeeded ( asset ) ; } } ) ;
168171 }
169172
170173 /// <summary>
0 commit comments