/// <summary> /// 设置本地项目资源导入检查开启状态 /// </summary> /// <param name="_open"></param> public static void SetOwnCheckOpenState(bool _open) { var currentDir = BuildUtils.GetUnityPath(Path.GetFullPath(Directory.GetCurrentDirectory())); EditorPrefs.SetBool(currentDir, _open); }
private void OnGUI() { //Unable to use a named GUIStyle without a current skin. //Most likely you need to move your GUIStyle initialization code to OnGUI //GUI风格元素需要在OnGUI方法里初始化,否则会报以上错误,界面也会发生显示错误 if (checkStyle == null) { checkStyle = new CheckStyle(); } GUILayout.BeginHorizontal(checkStyle.ToolBar, new GUILayoutOption[] { GUILayout.Width(this.position.width) }); { EditorGUI.BeginChangeCheck(); checkTypeMix = (CheckEnumType)EditorGUILayout.EnumMaskPopup(new GUIContent(titleStr), checkTypeMix, checkStyle.TE_ToolBarBtn, new GUILayoutOption[] { GUILayout.Width(600) }); if (EditorGUI.EndChangeCheck()) { //检查类型分类 OnCheckTypeSelect(checkTypeMix); } EditorGUI.BeginChangeCheck(); if (GUILayout.Button(string.Format("当前目录{0}", filePath), checkStyle.TE_ToolBarBtn)) { filePath = EditorUtility.OpenFolderPanel("选择筛选目录{0}", Application.dataPath, string.Empty); var currentDir = BuildUtils.GetUnityPath(Path.GetFullPath(Directory.GetCurrentDirectory())); filePath = filePath.Replace(string.Format("{0}/", currentDir), ""); } if (EditorGUI.EndChangeCheck()) { checkManager.SetFilePath(filePath); Debug.Log(string.Format("当前选择目录:{0}", filePath)); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Check")) { //检查 if (checkManager.GetPathListByFilePath()) { checkManager.OnCheck(); } } if (GUILayout.Button("Format")) { //处理 checkManager.OnFormat(); } } GUILayout.EndHorizontal(); #region 表格GUI绘制 //表格 GUI 绘制 Rect viewRect = new Rect(border * 2 + this.position.width * percet, offset * 2, this.position.width * (1 - percet) - border * 3, this.position.height - offset * 2 - border); if (table != null) { table.Draw(viewRect); } #endregion #region 检查项GUI绘制 //检查项 itemlist 绘制 Rect itemViewRect = new Rect(border, offset * 2, this.position.width * percet, this.position.height - offset * 2 - border); GUILayout.BeginArea(itemViewRect, checkStyle.WindowBackground); scrollview = GUILayout.BeginScrollView(scrollview, GUIStyle.none, GUI.skin.verticalScrollbar); DrawItemWind(itemViewRect); GUILayout.EndScrollView(); GUILayout.EndArea(); #endregion }
/// <summary> /// 获得资源导入开启状态 /// </summary> /// <returns></returns> public static bool OwnCheckOpen() { var currentDir = BuildUtils.GetUnityPath(Path.GetFullPath(Directory.GetCurrentDirectory())); return(EditorPrefs.GetBool(currentDir)); }