40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using Stary.Evo.Editor;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Stary.Evo
|
|
{
|
|
[CustomEditor(typeof(MainDomainAll))]
|
|
public class MainDomainAllEditor : UnityEditor.Editor
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
base.OnInspectorGUI();
|
|
if (GUILayout.Button("生成点位集合数据"))
|
|
{
|
|
var domainAll = CreatAssetWindow.GetCreatDomainAll();
|
|
List<VideoDomainEntity> videoDomainEntities = new List<VideoDomainEntity>();
|
|
for (int i = 0; i < domainAll.Count; i++)
|
|
{
|
|
if (domainAll[i].DomainName != "Main")
|
|
videoDomainEntities.Add(new VideoDomainEntity()
|
|
{
|
|
domainName = domainAll[i].DomainName,
|
|
});
|
|
}
|
|
|
|
// string configPath = $"Assets/Main/Resources/MainDomainAll.asset";
|
|
// MainDomainAll targetComponent =
|
|
// AssetDatabase.LoadAssetAtPath<MainDomainAll>(configPath);
|
|
var targetComponent = target as MainDomainAll;
|
|
if (targetComponent != null)
|
|
{
|
|
targetComponent.domainAll = videoDomainEntities.ToArray();
|
|
}
|
|
EditorUtility.SetDirty(targetComponent);
|
|
AssetDatabase.SaveAssets();
|
|
}
|
|
}
|
|
}
|
|
} |