コード例 #1
0
ファイル: ACSprite.cs プロジェクト: abc674999722/excel-Lua-
        /// <summary>
        /// 获取场景目录名字
        /// </summary>
        /// <param name="sceneCommonFolderName"></param>
        /// <param name="sceneFolderName"></param>
        public void GetNewFolderName(string sceneCommonFolderName, string moduleCommonFolder,
                                     out string sceneFolderName, out string moduleFolerName)
        {
            sceneFolderName = string.Empty;
            moduleFolerName = string.Empty;

            if (_spriteRefDic.Count == 1)
            {
                var                firstKeyValue = _spriteRefDic.First();
                ACScene            acScene       = firstKeyValue.Key;
                HashSet <ACModule> acModules     = firstKeyValue.Value;

                sceneFolderName = acScene.Name;

                if (acModules.Count == 1)
                {
                    moduleFolerName = acModules.First().Name;
                }
                else
                {
                    moduleFolerName = acScene.Name + moduleCommonFolder;
                }
            }
            else
            {
                sceneFolderName = sceneCommonFolderName;
            }
        }
コード例 #2
0
        private void DrawAcScenes()
        {
            GUILayout.BeginVertical(GUILayout.Width(ACStyles.SceneViewWidth));
            GUILayout.Label("SCENES " + _allAcScenes.Count);
            _scrollPos = GUILayout.BeginScrollView(_scrollPos);

            TryInitDrawAcScenesParams();

            for (int i = 0; i < _allAcScenes.Count; i++)
            {
                var acScene = _allAcScenes[i];

                bool lastToggle = _toggleStates[i];
                _toggleStates[i] = GUILayout.Toggle(_toggleStates[i], acScene.Name, ACWindow.ACStyles.SceneButton);

                if (!lastToggle && _toggleStates[i])
                {
                    EditorWindowHelper.ResetToggleStates(_toggleStates, i);
                    _curSelectScene = acScene;
                }
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();

            if (_curSelectScene != null)
            {
                _curSelectScene.DrawAcModules();
            }
        }
コード例 #3
0
 private void CollectAllPrefabs(ACScene acScene)
 {
     for (int i = 0; i < acScene.ChildModules.Count; i++)
     {
         CollectAllPrefabs(acScene.ChildModules[i]);
     }
 }
コード例 #4
0
        private ACSingleModule(string prefabFile, ACScene parentScene)
            : base(ModuleType.Single, parentScene)
        {
            _modulePath = prefabFile;

            ChildPrefab = new ACPrefab(prefabFile, this);
            _name       = ChildPrefab.Name;
        }
コード例 #5
0
        public static ACSingleModule CreateAcSingleModule(string prefabFile, ACScene parentScene)
        {
            var singleModuleConfig = new ACSingleModule(prefabFile, parentScene);

            singleModuleConfig.TryInitDrawAcPrefabsParams();

            return(singleModuleConfig);
        }
コード例 #6
0
 private void TryInitDrawAcScenesParams()
 {
     if (_toggleStates.Count == 0)
     {
         int sceneCount = _allAcScenes.Count;
         if (sceneCount > 0)
         {
             _curSelectScene = _allAcScenes[0];
             _toggleStates   = EditorWindowHelper.InitToggleStates(sceneCount);
         }
     }
 }
コード例 #7
0
        /// <summary>
        /// 根据目标路径,初始化配置数据
        /// </summary>
        /// <param name="prefabTargetFolder">
        /// UI Prefab所在的目录,结构必须为2层结构
        /// e.g: Login/UI_Login, Battle/Battle/UI_Battle 场景/.prefab 或者 场景/模块/.prefab
        /// </param>
        private void InitAllAcScenes(string prefabTargetFolder)
        {
            var sceneFolders = Directory.GetDirectories(prefabTargetFolder);

            for (int i = 0; i < sceneFolders.Length; i++)
            {
                ACScene scene;
                if (ACScene.CreateAcScene(sceneFolders[i], out scene))
                {
                    _allAcScenes.Add(scene);
                }
            }
        }
コード例 #8
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);
        }
コード例 #9
0
ファイル: ACScene.cs プロジェクト: abc674999722/excel-Lua-
        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);
            }
        }
コード例 #10
0
 public ACModule(ModuleType moduleType, ACScene parentScene)
 {
     _moduleType   = moduleType;
     _parecntScene = parentScene;
 }
コード例 #11
0
 private ACMultiMoudle(string modulePath, ACScene parentScene)
     : base(ModuleType.Multi, parentScene)
 {
     _modulePath = modulePath;
     _name       = Path.GetFileName(modulePath);
 }