Ejemplo n.º 1
0
 private void CollectAllPrefabs(ACModule acModel)
 {
     if (acModel.ModuleType == ModuleType.Single)
     {
         ACSingleModule acSingleModule = acModel as ACSingleModule;
         if (acSingleModule != null)
         {
             _allAcPrefabs.Add(acSingleModule.ChildPrefab);
         }
     }
     else
     {
         ACMultiMoudle acMultiMoudle = acModel as ACMultiMoudle;
         if (acMultiMoudle != null)
         {
             _allAcPrefabs.AddRange(acMultiMoudle.ChildPrefabs);
         }
     }
 }
Ejemplo n.º 2
0
        public static bool CreateAcMultiModule(string moduleFolder, ACScene parentScene, out ACMultiMoudle acMultiModule)
        {
            acMultiModule = null;

            var allPrefabFiles = Directory.GetFiles(moduleFolder, "*.prefab", SearchOption.AllDirectories);

            if (allPrefabFiles.Length == 0)
            {
                Debug.LogError(moduleFolder + "下未找到prefab类型的文件");
                return(false);
            }

            acMultiModule = new ACMultiMoudle(moduleFolder, parentScene);
            for (int i = 0; i < allPrefabFiles.Length; i++)
            {
                acMultiModule.AddAcPrefab(allPrefabFiles[i]);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public static bool CreateAcScene(string folderPath, out ACScene acScene)
        {
            acScene = new ACScene(folderPath);

            // 初始化子文件夹下的配置(子文件夹的Prefab)
            var moduleFolders = Directory.GetDirectories(folderPath);

            for (int i = 0; i < moduleFolders.Length; i++)
            {
                ACMultiMoudle multiModule;
                if (ACMultiMoudle.CreateAcMultiModule(moduleFolders[i], acScene, out multiModule))
                {
                    acScene.AddAcModule(multiModule);
                }
            }

            // 初始化当前文件夹下的配置(非子文件夹的Prefab)
            var singlePrefabFiles = Directory.GetFiles(folderPath, "*.prefab", SearchOption.TopDirectoryOnly);

            if (singlePrefabFiles.Length >= 0)
            {
                for (int i = 0; i < singlePrefabFiles.Length; i++)
                {
                    ACSingleModule singleModule = ACSingleModule.CreateAcSingleModule(singlePrefabFiles[i], acScene);
                    acScene.AddAcModule(singleModule);
                }
            }

            if (acScene._childModules.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }