54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEditor;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
public class NormalConvertWarning : EditorWindow
|
|
{
|
|
private static List<string> normalList;
|
|
private static List<string> fullList;
|
|
private static UnityAction<List<string>> confirmCallback;
|
|
|
|
public static void OpenWindow(List<string> normalList, List<string> fullList, UnityAction<List<string>> confirmCallback)
|
|
{
|
|
NormalConvertWarning.normalList = normalList;
|
|
NormalConvertWarning.fullList = fullList;
|
|
NormalConvertWarning.confirmCallback = confirmCallback;
|
|
var window = GetWindow<NormalConvertWarning>();
|
|
window.Show();
|
|
}
|
|
private void OnGUI()
|
|
{
|
|
GUILayout.Label("警告:以下图片不是法线贴图", EditorStyles.boldLabel);
|
|
var exceptList = fullList.Except(normalList).OrderBy(a => a);
|
|
foreach (var except in exceptList)
|
|
GUILayout.Label(" " + except);
|
|
GUILayout.Space(20f);
|
|
if (fullList.Count > 0)
|
|
{
|
|
GUILayout.Label("强制转换为法线贴图?");
|
|
GUILayout.BeginHorizontal();
|
|
if (GUILayout.Button("全部转换", GUILayout.Width(100f)))
|
|
{
|
|
confirmCallback(fullList);
|
|
Close();
|
|
}
|
|
GUILayout.Space(30f);
|
|
if (GUILayout.Button("仅法线贴图", GUILayout.Width(100f)))
|
|
{
|
|
confirmCallback(normalList);
|
|
Close();
|
|
}
|
|
GUILayout.Space(30f);
|
|
if (GUILayout.Button("取消转换", GUILayout.Width(100f)))
|
|
Close();
|
|
GUILayout.EndHorizontal();
|
|
}
|
|
}
|
|
private void OnDisable()
|
|
{
|
|
normalList = null;
|
|
fullList = null;
|
|
confirmCallback = null;
|
|
}
|
|
} |