55 lines
2.0 KiB
C#
55 lines
2.0 KiB
C#
using UnityEngine;
|
|
using UnityEditor;
|
|
using UEObject = UnityEngine.Object;
|
|
|
|
namespace BFEditor.Resource
|
|
{
|
|
public class ResourceWhiteWindow : EditorWindow
|
|
{
|
|
Vector2 scrollPos;
|
|
|
|
ResourceWhiteWindow()
|
|
{
|
|
titleContent = new GUIContent("资源白名单");
|
|
}
|
|
|
|
void OnGUI()
|
|
{
|
|
GUILayout.Space(10);
|
|
if (ResourceProcessConfig.whiteResList.Count == 0)
|
|
{
|
|
var style = new GUIStyle(GUI.skin.label);
|
|
style.normal.textColor = Color.black;
|
|
style.fontSize = 19;
|
|
style.alignment = TextAnchor.MiddleCenter;
|
|
GUILayout.Label("没有白名单,可在ResourceProcessConfig.cs中添加", style);
|
|
}
|
|
else
|
|
{
|
|
scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Width(600), GUILayout.Height(380));
|
|
for (int i = 0; i < ResourceProcessConfig.whiteResList.Count; i++)
|
|
{
|
|
var obj = AssetDatabase.LoadAssetAtPath<UEObject>(ResourceProcessConfig.whiteResList[i]);
|
|
if (obj == null)
|
|
{
|
|
continue;
|
|
}
|
|
GUILayout.BeginHorizontal();
|
|
EditorGUILayout.ObjectField("", obj, typeof(UEObject), true, GUILayout.Width(180));
|
|
GUILayout.Label("path: " + ResourceProcessConfig.whiteResList[i]);
|
|
GUILayout.EndHorizontal();
|
|
}
|
|
GUILayout.EndScrollView();
|
|
}
|
|
}
|
|
|
|
public static void OpenWindow()
|
|
{
|
|
var rect = ResourceProcessConfig.whiteResList.Count == 0 ? new Rect(Screen.width / 2, Screen.height / 2, 450, 150) :
|
|
new Rect(Screen.width / 2, Screen.height / 2, 600, 400);
|
|
var window = (ResourceWhiteWindow)GetWindowWithRect(typeof(ResourceWhiteWindow), rect);
|
|
window.Show();
|
|
}
|
|
}
|
|
}
|