11using Distance . CustomCar . Data . Materials ;
2- using Reactor . API ;
3- using Reactor . API . Storage ;
42using System ;
53using System . Collections . Generic ;
64using System . IO ;
@@ -24,7 +22,7 @@ public void CreateCars(CarInfos infos)
2422 {
2523 try
2624 {
27- Mod . Instance . Logger . Info ( $ "Creating car prefab for { car . Key } ...") ;
25+ Mod . Log . LogInfo ( $ "Creating car prefab for { car . Key } ...") ;
2826 CreateCarReturnInfos data = CreateCar ( car . Value ) ;
2927
3028 string fileName = Path . GetFileNameWithoutExtension ( car . Key . Substring ( 0 , car . Key . LastIndexOf ( '(' ) - 1 ) ) ;
@@ -34,6 +32,7 @@ public void CreateCars(CarInfos infos)
3432 }
3533 catch ( Exception ex )
3634 {
35+ Mod . Log . LogInfo ( $ "Could not load car prefab: { car . Key } ") ;
3736 Mod . Instance . Errors . Add ( $ "Could not load car prefab: { car . Key } ") ;
3837 Mod . Instance . Errors . Add ( ex ) ;
3938 }
@@ -44,7 +43,7 @@ public void CreateCars(CarInfos infos)
4443
4544 private void RegisterCars ( List < CreateCarReturnInfos > carsInfos )
4645 {
47- Mod . Instance . Logger . Info ( $ "Registering { carsInfos . Count } car(s)...") ;
46+ Mod . Log . LogInfo ( $ "Registering { carsInfos . Count } car(s)...") ;
4847
4948 ProfileManager profileManager = G . Sys . ProfileManager_ ;
5049 CarInfo [ ] oldCars = profileManager . carInfos_ . ToArray ( ) ;
@@ -81,10 +80,10 @@ private void RegisterCars(List<CreateCarReturnInfos> carsInfos)
8180 else
8281 {
8382 Mod . Instance . Errors . Add ( $ "A car with the name { car . name_ } is already registered, rename the car file if they're the same.") ;
84- Mod . Instance . Logger . Warning ( $ "Generating unique name for car { car . name_ } ") ;
83+ Mod . Log . LogInfo ( $ "Generating unique name for car { car . name_ } ") ;
8584
8685 string uniqueID = $ "#{ Guid . NewGuid ( ) : B} ";
87- Mod . Instance . Logger . Info ( $ "Using GUID: { uniqueID } ") ;
86+ Mod . Log . LogInfo ( $ "Using GUID: { uniqueID } ") ;
8887
8988 car . name_ = $ "[FFFF00]![-] { car . name_ } { uniqueID } ";
9089
@@ -118,7 +117,7 @@ private void RegisterCars(List<CreateCarReturnInfos> carsInfos)
118117 private Dictionary < string , GameObject > LoadAssetsBundles ( )
119118 {
120119 Dictionary < string , GameObject > assetsList = new Dictionary < string , GameObject > ( ) ;
121- DirectoryInfo assetsDirectory = GetLocalFolder ( Defaults . PrivateAssetsDirectory ) ;
120+ DirectoryInfo assetsDirectory = GetLocalFolder ( "Assets" ) ;
122121 DirectoryInfo globalCarsDirectory = new DirectoryInfo ( Path . Combine ( Resource . personalDistanceDirPath_ , "CustomCars" ) ) ;
123122
124123 if ( ! globalCarsDirectory . Exists )
@@ -130,7 +129,9 @@ private Dictionary<string, GameObject> LoadAssetsBundles()
130129 catch ( Exception ex )
131130 {
132131 Mod . Instance . Errors . Add ( $ "Could not create the following folder: { globalCarsDirectory . FullName } ") ;
132+ Mod . Log . LogInfo ( $ "Could not create the following folder: { globalCarsDirectory . FullName } ") ;
133133 Mod . Instance . Errors . Add ( ex ) ;
134+ Mod . Log . LogInfo ( ex ) ;
134135 }
135136 }
136137
@@ -140,6 +141,7 @@ private Dictionary<string, GameObject> LoadAssetsBundles()
140141 {
141142 Assets assets = Assets . FromUnsafePath ( assetsFile . FullName ) ;
142143 AssetBundle bundle = assets . Bundle as AssetBundle ;
144+
143145
144146 int foundPrefabCount = 0 ;
145147
@@ -159,12 +161,15 @@ private Dictionary<string, GameObject> LoadAssetsBundles()
159161 if ( foundPrefabCount == 0 )
160162 {
161163 Mod . Instance . Errors . Add ( $ "Can't find a prefab in the asset bundle: { assetsFile . FullName } ") ;
164+ Mod . Log . LogInfo ( $ "Can't find a prefab in the asset bundle: { assetsFile . FullName } ") ;
162165 }
163166 }
164167 catch ( Exception ex )
165168 {
166169 Mod . Instance . Errors . Add ( $ "Could not load assets file: { assetsFile . FullName } ") ;
170+ Mod . Log . LogInfo ( $ "Could not load assets file: { assetsFile . FullName } ") ;
167171 Mod . Instance . Errors . Add ( ex ) ;
172+ Mod . Log . LogInfo ( ex ) ;
168173 }
169174 }
170175
@@ -211,12 +216,14 @@ private void RemoveOldCar(GameObject obj)
211216 if ( wheelsToRemove . Count != 4 )
212217 {
213218 Mod . Instance . Errors . Add ( $ "Found { wheelsToRemove . Count } wheels on base prefabs, expected 4") ;
219+ Mod . Log . LogInfo ( $ "Found { wheelsToRemove . Count } wheels on base prefabs, expected 4") ;
214220 }
215221
216222 Transform refractor = obj . transform . Find ( "Refractor" ) ;
217223 if ( refractor == null )
218224 {
219225 Mod . Instance . Errors . Add ( "Can't find the Refractor object on the base car prefab" ) ;
226+ Mod . Log . LogInfo ( "Can't find the Refractor object on the base car prefab" ) ;
220227 return ;
221228 }
222229
@@ -243,6 +250,7 @@ private void SetColorChanger(ColorChanger colorChanger, GameObject car)
243250 if ( colorChanger == null )
244251 {
245252 Mod . Instance . Errors . Add ( "Can't find the ColorChanger component on the base car" ) ;
253+ Mod . Log . LogInfo ( "Can't find the ColorChanger component on the base car" ) ;
246254 return ;
247255 }
248256
@@ -280,6 +288,7 @@ private void ReplaceMaterials(Renderer renderer)
280288 if ( ! infos_ . materials . TryGetValue ( materialNames [ materialIndex ] , out MaterialInfos materialInfo ) )
281289 {
282290 Mod . Instance . Errors . Add ( $ "Can't find the material { materialNames [ materialIndex ] } on { renderer . gameObject . FullName ( ) } ") ;
291+ Mod . Log . LogInfo ( $ "Can't find the material { materialNames [ materialIndex ] } on { renderer . gameObject . FullName ( ) } ") ;
283292 continue ;
284293 }
285294
@@ -339,12 +348,14 @@ private void FillMaterialInfos(Renderer renderer, string[] matNames, List<Materi
339348 if ( arguments . Length != 3 )
340349 {
341350 Mod . Instance . Errors . Add ( $ "{ arguments [ 0 ] } property on { renderer . gameObject . FullName ( ) } must have 2 arguments") ;
351+ Mod . Log . LogInfo ( $ "{ arguments [ 0 ] } property on { renderer . gameObject . FullName ( ) } must have 2 arguments") ;
342352 continue ;
343353 }
344354
345355 if ( ! int . TryParse ( arguments [ 1 ] , out int index ) )
346356 {
347357 Mod . Instance . Errors . Add ( $ "First argument of { arguments [ 0 ] } on { renderer . gameObject . FullName ( ) } property must be a number") ;
358+ Mod . Log . LogInfo ( $ "First argument of { arguments [ 0 ] } on { renderer . gameObject . FullName ( ) } property must be a number") ;
348359 continue ;
349360 }
350361
@@ -358,12 +369,14 @@ private void FillMaterialInfos(Renderer renderer, string[] matNames, List<Materi
358369 if ( arguments . Length != 5 )
359370 {
360371 Mod . Instance . Errors . Add ( $ "{ arguments [ 0 ] } property on { renderer . gameObject . FullName ( ) } must have 4 arguments") ;
372+ Mod . Log . LogInfo ( $ "{ arguments [ 0 ] } property on { renderer . gameObject . FullName ( ) } must have 4 arguments") ;
361373 continue ;
362374 }
363375
364376 if ( ! int . TryParse ( arguments [ 1 ] , out int index ) )
365377 {
366378 Mod . Instance . Errors . Add ( $ "First argument of { arguments [ 0 ] } on { renderer . gameObject . FullName ( ) } property must be a number") ;
379+ Mod . Log . LogInfo ( $ "First argument of { arguments [ 0 ] } on { renderer . gameObject . FullName ( ) } property must be a number") ;
367380 continue ;
368381 }
369382
@@ -388,6 +401,7 @@ private void FillMaterialInfos(Renderer renderer, string[] matNames, List<Materi
388401 if ( ! found )
389402 {
390403 Mod . Instance . Errors . Add ( $ "The property { arguments [ 2 ] } on { renderer . gameObject . FullName ( ) } is not valid") ;
404+ Mod . Log . LogInfo ( $ "The property { arguments [ 2 ] } on { renderer . gameObject . FullName ( ) } is not valid") ;
391405 continue ;
392406 }
393407
@@ -490,6 +504,7 @@ private void AddMaterialColorChanger(ColorChanger colorChanger, Transform transf
490504 if ( arguments . Length != 6 )
491505 {
492506 Mod . Instance . Errors . Add ( $ "{ arguments [ 0 ] } property on { transform . gameObject . FullName ( ) } must have 5 arguments") ;
507+ Mod . Log . LogInfo ( $ "{ arguments [ 0 ] } property on { transform . gameObject . FullName ( ) } must have 5 arguments") ;
493508 continue ;
494509 }
495510
@@ -565,6 +580,7 @@ private void SetCarVisuals(CarVisuals visuals, GameObject car)
565580 if ( visuals == null )
566581 {
567582 Mod . Instance . Errors . Add ( "Can't find the CarVisuals component on the base car" ) ;
583+ Mod . Log . LogInfo ( "Can't find the CarVisuals component on the base car" ) ;
568584 return ;
569585 }
570586
@@ -591,12 +607,14 @@ private void MakeMeshSkinned(SkinnedMeshRenderer renderer)
591607 if ( mesh == null )
592608 {
593609 Mod . Instance . Errors . Add ( $ "The mesh on { renderer . gameObject . FullName ( ) } is null") ;
610+ Mod . Log . LogInfo ( $ "The mesh on { renderer . gameObject . FullName ( ) } is null") ;
594611 return ;
595612 }
596613
597614 if ( ! mesh . isReadable )
598615 {
599616 Mod . Instance . Errors . Add ( $ "Can't read the car mesh { mesh . name } on { renderer . gameObject . FullName ( ) } You must allow reading on it's unity inspector !") ;
617+ Mod . Log . LogInfo ( $ "Can't read the car mesh { mesh . name } on { renderer . gameObject . FullName ( ) } You must allow reading on it's unity inspector !") ;
600618 return ;
601619 }
602620
0 commit comments