예제 #1
0
 void ToTypeCheckState()
 {
     //得到所有已经提交资源的列表
     Data.SubmitAssetsList = DJAssetsDataManager.GetInstance().GetAssetsByState(AssetState.Submit);
     //清除索引
     Data.CheckingIndex = 0;
     //初始化状态
     Data.mTypeCheckState = TypeCheckState.Proc;
 }
예제 #2
0
    void Init()
    {
        //编辑器数据
        Data = (target as DJAssetsCheckTools).Data;

        //初始化表
        DJAssetsDataManager.GetInstance().LoadData();

        isInit = true;
    }
예제 #3
0
    public override bool LoadAsset(int _id)
    {
        id = _id;
        myEditorInfos.Add("资源id:" + _id + " 名称:" + DJAssetsDataManager.GetInstance().AssetsDict[_id].name);
        myAsset = DJAssetsManager.GetInstance().Load <AudioClip>(_id);
        bool isPass = true;

        if (myAsset == null)
        {
            myEditorInfos.Add("[Error]路径失效或类型错误");
            isPass = false;
        }
        return(isPass);
    }
예제 #4
0
    /// <summary>
    /// 得改成异步的啊
    /// </summary>
    void ToAutoCheckState()
    {
        //锁定编辑窗口
        //代码偷自:http://www.xuanyusong.com/archives/3796
        var        type   = typeof(EditorWindow).Assembly.GetType("UnityEditor.InspectorWindow");
        var        window = EditorWindow.GetWindow(type);
        MethodInfo info   = type.GetMethod("FlipLocked", BindingFlags.NonPublic | BindingFlags.Instance);

        info.Invoke(window, null);

        var allAssets = DJAssetsDataManager.GetInstance().AssetsDict;

        Data.CheckingIndex = 0;
        Data.CheckingkeyList.Clear();
        ErrorList.Clear();
        foreach (var _key in allAssets.Keys)
        {
            Data.CheckingkeyList.Add(_key);
        }
    }
예제 #5
0
    void OnAutoCheckGUI()
    {
        EditorGUILayout.LabelField("检测结束前,请不要取消锁定");
        if (Data.CheckingIndex < Data.CheckingkeyList.Count)
        {
            TopTips = "自动检测进度:(" + Data.CheckingIndex + "/" + Data.CheckingkeyList.Count + ")";

            //循环所有资源,并进行检查
            var allAssets = DJAssetsDataManager.GetInstance().AssetsDict;
            var _config   = allAssets[Data.CheckingkeyList[Data.CheckingIndex]];

            //设计中的资源就不检测了
            if (_config.state == DJAssetsDefine.AssetState.Designing)
            {
                Data.CheckingIndex += 1;
                return;
            }

            var testUnit = DJAssetsCheckFactory.GetCheckUnit(_config.type);
            //得到对应的检测脚本

            if (testUnit == null)
            {
                //这里就不写出所有类型的测试脚本了
                Data.CheckingIndex += 1;
                return;
            }

            if (testUnit.LoadAsset(_config.id) == false ||
                testUnit.CheckAsset() == false)
            {
                ErrorList.Add(testUnit);
                Data.CheckingIndex += 1;
                return;
            }

            Data.CheckingIndex += 1;


            return;
        }

        if (ErrorList.Count > 0)
        {
            EditorGUILayout.BeginScrollView(new Vector2(300, 1200));
            //执行到这里检测已经完毕了,就打印结果
            for (int i = 0; i < ErrorList.Count; i++)
            {
                var _data = ErrorList[i];
                for (int j = 0; j < _data.EditorInfos.Count; j++)
                {
                    EditorGUILayout.LabelField(_data.EditorInfos[j]);
                }
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndScrollView();
            TopTips = "共有" + ErrorList.Count + "份资源没有通过自动检查.注意,当退出检测模式时,未通过的资源会被设置为错误状态。";
        }
        else
        {
            TopTips = "所有资源通过检查";
        }


        if (ErrorList.Count > 0)
        {
            //方便将错误列表转发给各个负责人
            if (GUILayout.Button("将错误列表复制到剪切板中"))
            {
                string errorListStr = "";
                for (int i = 0; i < ErrorList.Count; i++)
                {
                    var _config = DJAssetsDataManager.GetInstance().AssetsDict[ErrorList[i].id];
                    errorListStr += _config.id + " " + _config.type + " " + _config.name + "\n";
                }

                var te = new TextEditor();
                te.text = errorListStr;
                te.OnFocus();
                te.Copy();
            }
        }


        if (GUILayout.Button("退出检查模式"))
        {
            for (int i = 0; i < ErrorList.Count; i++)
            {
                var _data = ErrorList[i];
                DJAssetsDataManager.GetInstance().SetAssetState(_data.id, AssetState.Error);
            }
            ChangeState(CheckType.None);
        }
    }
예제 #6
0
    /// <summary>
    /// 人工检测结果页面
    /// </summary>
    void OnManualCheckGUI_Result()
    {
        //打印成功检测的清单
        EditorGUILayout.LabelField("检测成功的资源清单,共" + Data.PassList.Count + "个");
        for (int i = 0; i < Data.PassList.Count; i++)
        {
            var _config = Data.PassList[i];
            EditorGUILayout.LabelField(i + ": " + _config.id + " " + _config.type + " " + _config.name);
        }

        EditorGUILayout.Space();

        //打印检测失败的清单
        EditorGUILayout.LabelField("检测失败的资源清单,共" + Data.RefuseList.Count + "个");
        for (int j = 0; j < Data.RefuseList.Count; j++)
        {
            var _config = Data.RefuseList[j];
            EditorGUILayout.LabelField(j + ": " + _config.id + " " + _config.type + " " + _config.name);
        }

        //功能
        if (GUILayout.Button("复制失败清单"))
        {
            string errorListStr = "";
            for (int i = 0; i < Data.RefuseList.Count; i++)
            {
                var _config = Data.RefuseList[i];
                errorListStr += _config.id + " " + _config.type + " " + _config.name + "\n";
            }

            var te = new TextEditor();
            te.text = errorListStr;
            te.OnFocus();
            te.Copy();
        }

        if (GUILayout.Button("保存审查结果并退出"))
        {
            if (currentCheckUnit != null)
            {
                currentCheckUnit.Quit();
            }

            //保存没有通过的
            for (int j = 0; j < Data.RefuseList.Count; j++)
            {
                var _config = Data.RefuseList[j];
                DJAssetsDataManager.GetInstance().SetAssetState(_config.id, AssetState.Designing);
            }

            //保存通过审核的
            for (int i = 0; i < Data.PassList.Count; i++)
            {
                var _config = Data.PassList[i];
                DJAssetsDataManager.GetInstance().SetAssetState(_config.id, AssetState.Approved);
            }

            //退回普通模式中
            ChangeState(CheckType.None);
        }
    }