@@ -69,7 +69,7 @@ public static bool IsProp()
6969 public int LastLoadedType ;
7070
7171 //Local
72- List < string > LoadedEnvPaths = new List < string > ( ) ;
72+ List < string > LoadedEnvPaths = new List < string > ( 24 ) ;
7373 const string LocalPath = "env/" ;
7474 static string [ ] CategoryPaths = new string [ ] { "layers/" , "splats/" , "decals/" , "Props/" } ;
7575 string SelectedObject = "" ;
@@ -127,7 +127,7 @@ void ReadAllFolders()
127127
128128 EnvType . ClearOptions ( ) ;
129129
130- LoadedEnvPaths = new List < string > ( ) ;
130+ LoadedEnvPaths . Clear ( ) ;
131131 List < Dropdown . OptionData > NewOptions = new List < Dropdown . OptionData > ( ) ;
132132
133133 if ( ! EnvPaths . GamedataExist )
@@ -222,28 +222,18 @@ void ReadAllFolders()
222222
223223 string [ ] files = GetGamedataFile . GetFilesInPath ( "env/" ) ;
224224
225+ char Separator = '/' ;
225226 for ( int f = 0 ; f < files . Length ; f ++ )
226227 {
227228 string LocalName = files [ f ] . Replace ( "env/" , "" ) ;
228229
229230 if ( string . IsNullOrEmpty ( LocalName ) )
230231 continue ;
231232
232- int ContSeparators = 0 ;
233- char Separator = ( "/" ) [ 0 ] ;
234- for ( int i = 0 ; i < LocalName . Length ; i ++ )
235- {
236- if ( LocalName [ i ] == Separator )
237- {
238- ContSeparators ++ ;
239- if ( ContSeparators > 1 )
240- break ;
241- }
242- }
243- if ( ContSeparators > 1 )
244- continue ;
233+ LocalName = LocalName . Split ( Separator ) [ 0 ] ;
245234
246- LocalName = LocalName . Replace ( "/" , "" ) ;
235+ if ( LoadedEnvPaths . Contains ( LocalName ) )
236+ continue ;
247237
248238 LoadedEnvPaths . Add ( LocalName ) ;
249239 Dropdown . OptionData NewOptionInstance = new Dropdown . OptionData ( LocalName ) ;
@@ -291,10 +281,7 @@ public void LoadStratumTexture(string path)
291281 int LastEnvType = EnvType . value ;
292282
293283 CustomLoading = true ;
294- //Debug.Log ("Load browser for: " + path);
295284 string BeginPath = path ;
296- //SRect.normalizedPosition = Vector2.zero;
297-
298285
299286 path = path . Replace ( "env/" , "" ) ;
300287
@@ -506,19 +493,18 @@ IEnumerator GenerateList()
506493 SizeFitter . enabled = true ;
507494
508495 LastLoadedType = Category . value ;
509-
510496 if ( LoadedEnvPaths [ EnvType . value ] == CurrentMapFolderPath )
511497 {
512498 if ( MapLuaParser . IsMapLoaded )
513499 {
514500
515501 string LoadPath = MapLuaParser . LoadedMapFolderPath + "env/" + CategoryPaths [ LastLoadedType ] ;
516- Debug . Log ( "Try load assets from: " + LoadPath ) ;
502+ // Debug.Log("Try load assets from: " + LoadPath);
517503 if ( Directory . Exists ( LoadPath ) )
518504 {
519505
520506 string [ ] AllFiles = Directory . GetFiles ( LoadPath , "*" , SearchOption . AllDirectories ) ;
521- Debug . Log ( "Found " + AllFiles . Length + " files in map folder" ) ;
507+ // Debug.Log("Found " + AllFiles.Length + " files in map folder");
522508
523509 for ( int i = 0 ; i < AllFiles . Length ; i ++ )
524510 {
@@ -564,7 +550,7 @@ IEnumerator GenerateList()
564550 if ( LastLoadedType == 3 )
565551 {
566552 int Count = EditMap . PropsInfo . AllPropsTypes . Count ;
567- Debug . Log ( "Found props: " + Count ) ;
553+ // Debug.Log("Found props: " + Count);
568554
569555 for ( int i = 0 ; i < Count ; i ++ )
570556 {
@@ -688,17 +674,17 @@ IEnumerator GenerateList()
688674
689675 SelectedDirectory = ( "env/" + EnvType . options [ EnvType . value ] . text + "/" + CategoryPaths [ LastLoadedType ] ) . ToLower ( ) ;
690676
691- string [ ] files = GetGamedataFile . GetFilesInPath ( " SelectedDirectory" ) ;
677+ string [ ] files = GetGamedataFile . GetFilesInPath ( SelectedDirectory ) ;
692678 bool Breaked = false ;
693679
694680 for ( int f = 0 ; f < files . Length ; f ++ )
695681 {
696- string LocalName = files [ f ] . Replace ( "env/" , "" ) ;
682+ string LocalName = files [ f ] ;
697683
698684 if ( ! IsProperFile ( LocalName ) )
699685 continue ;
700686
701- if ( LoadZipEntry ( files [ f ] , out Breaked ) )
687+ if ( LoadZipEntry ( LocalName , out Breaked ) )
702688 {
703689 continue ;
704690 }
@@ -743,7 +729,6 @@ bool LoadZipEntry(string localPath, out bool Breaked)
743729 {
744730 string LocalName = localPath . Remove ( 0 , LocalPath . Length ) ;
745731
746-
747732 LoadAtPath ( localPath , LocalName ) ;
748733 }
749734 return false ;
@@ -752,20 +737,19 @@ bool LoadZipEntry(string localPath, out bool Breaked)
752737 bool IsProperFile ( string LocalName )
753738 {
754739 LocalName = LocalName . ToLower ( ) ;
755-
756740 if ( ! LocalName . StartsWith ( SelectedDirectory ) )
757741 return false ;
758742
759743 switch ( Category . value )
760744 {
761745 case 0 :
762- return LocalName . ToLower ( ) . EndsWith ( ".dds" ) ;
746+ return LocalName . EndsWith ( ".dds" ) ;
763747 case 1 :
764- return LocalName . ToLower ( ) . EndsWith ( ".dds" ) ;
748+ return LocalName . EndsWith ( ".dds" ) ;
765749 case 2 :
766- return LocalName . ToLower ( ) . EndsWith ( ".dds" ) ;
750+ return LocalName . EndsWith ( ".dds" ) ;
767751 case 3 :
768- return LocalName . ToLower ( ) . EndsWith ( ".bp" ) ;
752+ return LocalName . EndsWith ( ".bp" ) ;
769753 }
770754 return false ;
771755 }
0 commit comments