コード例 #1
0
        /// <summary>
        /// 资源导入后处理
        /// </summary>
        /// <param name="importedAssets"></param>
        /// <param name="deletedAssets"></param>
        /// <param name="movedAssets"></param>
        /// <param name="movedFromAssetPaths"></param>
        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            bool checkOpen = AssetCheckTool.OwnCheckOpen();

            if (!checkOpen)
            {
                return;
            }

            List <string> pathList = new List <string>();

            pathList.AddRange(importedAssets);
            pathList.AddRange(movedAssets);

            int pathCount = pathList.Count;

            if (pathCount > 0)
            {
                AssetCheckManager manager = new AssetCheckManager();
                manager.OnEnable();

                manager.SetPathList(pathList);
                manager.SetIncludeCheckTypeList(manager.allEnumArr.ToList());
                manager.SetIncludeOptionList(manager.allOptionArr.ToList());
                manager.onCheckEndCallBack = (() =>
                {
                    int dataCount = manager.GetCheckDataList().Count;
                    if (dataCount > 0)
                    {
                        LogTableViewWindow.OpenTableViewWindow(manager.GetCheckDataList());
                    }
                });
                manager.OnCheck();
            }
        }
コード例 #2
0
        /// <summary>
        /// Jenkins 资源检查调用此接口
        /// </summary>
        public static void JenkinsCheck()
        {
            AssetCheckManager manager = new AssetCheckManager();

            manager.OnEnable();

            //检查类型list
            List <CheckEnumType> checkTypeList = new List <CheckEnumType>
            {
                CheckEnumType.UnKnow
            };
            //检查项list
            List <CheckOption> checkOptionList = new List <CheckOption>();

            //解析jenkins检查项
            //GetEnvironmentVariable("变量名")
            string[] checkTypeArr = GetOptionArr("AssetCheckType");
            if (checkTypeArr != null && checkTypeArr.Length != 0)
            {
                int arrLen = checkTypeArr.Length;
                for (int i = 0; i < arrLen; i++)
                {
                    CheckEnumType checkType = (CheckEnumType)System.Enum.Parse(typeof(CheckEnumType), checkTypeArr[i]);

                    checkTypeList.Add(checkType);
                }

                //收集具体检查项列表
                arrLen = checkTypeList.Count;
                for (int i = 0; i < arrLen; i++)
                {
                    var checkType = checkTypeList[i];

                    string[] strArr = GetOptionArr(checkType.ToString());

                    if (strArr == null || strArr.Length == 0)
                    {
                        continue;
                    }

                    GetOptionMix(manager, strArr, checkOptionList);
                }
            }

            //获得资源文件夹路径
            string filePath = System.Environment.GetEnvironmentVariable("AssetPath");

            manager.SetIncludeCheckTypeList(checkTypeList);
            manager.SetIncludeOptionList(checkOptionList);

            manager.SetFilePath(filePath);

            if (manager.GetPathListByFilePath())
            {
                //Check
                manager.OnCheck();
            }
        }
コード例 #3
0
        /// <summary>
        /// 收集具体检查项
        /// </summary>
        /// <param name="_manager"></param>
        /// <param name="_strArr"></param>
        private static void GetOptionMix(AssetCheckManager _manager, string[] _strArr, List <CheckOption> _optionList)
        {
            if (_manager == null)
            {
                return;
            }

            int arrLen = _strArr.Length;

            for (int i = 0; i < arrLen; i++)
            {
                CheckOption option = (CheckOption)System.Enum.Parse(typeof(CheckOption), _strArr[i]);
                _optionList.Add(option);
            }
        }
コード例 #4
0
        private void OnEnable()
        {
            checkManager = new AssetCheckManager();
            checkManager.OnEnable();
            checkManager.onCheckEndCallBack  = OnCheckEndCallBack;
            checkManager.onFormatEndCallBack = OnFormatEndCallBack;
            checkManager.SetFilePath(filePath);

            table = new TableView(this, typeof(AssetCheckData));
            table.AddColum("resourcePath", "Path", 0.5f, TextAnchor.MiddleLeft);
            table.AddColum("logMsg", "CheckFailMsg", 0.5f, TextAnchor.MiddleLeft);
            table.onSelected += TableOnSelected;

            //checkWinItemList.Add(new AssetCheckWinItem(this,this,"Texture"));
            //checkWinItemList.Add(new AssetCheckWinItem(this, this, "Model"));

            //对Option检查项做区分
            var typeArr         = System.Reflection.Assembly.GetExecutingAssembly().GetTypes();
            int typeCount       = typeArr.Length;
            int attributeArrLen = 0;

            for (int i = 0; i < typeCount; i++)
            {
                var type         = typeArr[i];
                var attributeArr = type.GetCustomAttributes(typeof(AssetCheckAttribute), false) as AssetCheckAttribute[];
                attributeArrLen = attributeArr.Length;
                for (int j = 0; j < attributeArrLen; j++)
                {
                    var attribute = attributeArr[j];
                    List <AssetItemWinData> optionList;
                    if (!checkOptionDic.TryGetValue(attribute.checkType, out optionList))
                    {
                        optionList = new List <AssetItemWinData>();
                        checkOptionDic.Add(attribute.checkType, optionList);
                    }
                    AssetItemWinData itemData = new AssetItemWinData();
                    itemData.checkOption = attribute.option;
                    itemData.desc        = attribute.desc;
                    itemData.select      = false;
                    optionList.Add(itemData);
                }
            }
        }