Пример #1
0
        private ACSingleModule(string prefabFile, ACScene parentScene)
            : base(ModuleType.Single, parentScene)
        {
            _modulePath = prefabFile;

            ChildPrefab = new ACPrefab(prefabFile, this);
            _name       = ChildPrefab.Name;
        }
Пример #2
0
        /// <summary>
        /// 更新引用
        /// </summary>
        public void UpdateReference(ACPrefab referencePrefab)
        {
            var refModule = referencePrefab.ParentModule;
            var refScene  = refModule.ParentScene;

            HashSet <ACModule> refModules;

            if (!_spriteRefDic.TryGetValue(refScene, out refModules))
            {
                refModules = new HashSet <ACModule>();
                _spriteRefDic[refScene] = refModules;
            }

            if (!refModules.Contains(refModule))
            {
                refModules.Add(refModule);
            }

            _allReferencePrefabs.Add(referencePrefab);
        }
Пример #3
0
        /// <summary>
        /// 收集该预制所引用的所有图片
        /// </summary>
        /// <param name="acPrefab"></param>
        private void CollectPrefabAllSpritesByDependencies(ACPrefab acPrefab)
        {
            Object uiPrefab = AssetDatabase.LoadAssetAtPath <Object>(acPrefab.AssetFile);

            Object[] allResObjects = EditorUtility.CollectDependencies(new Object[] { uiPrefab });

            for (int i = 0; i < allResObjects.Length; i++)
            {
                Sprite sprite = allResObjects[i] as Sprite;
                if (sprite == null)
                {
                    continue;
                }

                string spriteFilePath = AssetDatabase.GetAssetPath(sprite.GetInstanceID());
                if (!IsSpriteCanCollect(spriteFilePath))
                {
                    // 更新非关联目录被引用的Sprite个数
                    ACSprite tempSprite;
                    if (!_allUnReferenceFolderSpritesDic.TryGetValue(sprite, out tempSprite))
                    {
                        tempSprite = new ACSprite(sprite, spriteFilePath);
                        _allUnReferenceFolderSpritesDic[sprite] = tempSprite;
                    }

                    tempSprite.UpdateReference(acPrefab);
                    continue;
                }

                // 更新关联目录里被引用到的Sprite个数
                ACSprite acSprite;
                if (!_allReferenceFolderSpritesDic.TryGetValue(sprite, out acSprite))
                {
                    acSprite = new ACSprite(sprite, spriteFilePath);
                    _allReferenceFolderSpritesDic[sprite] = acSprite;
                }

                acPrefab.AddACSprite(acSprite);
                acSprite.UpdateReference(acPrefab);
            }
        }
Пример #4
0
 protected void OnSelectPrefab(ACPrefab selectPrefab)
 {
     Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(selectPrefab.AssetFile);
     EditorGUIUtility.PingObject(Selection.activeObject);
 }
Пример #5
0
        private void AddAcPrefab(string file)
        {
            ACPrefab prefab = new ACPrefab(file, this);

            _childPrefabs.Add(prefab);
        }