【m】修改框架編輯器

This commit is contained in:
2025-10-24 19:08:10 +08:00
parent e62fb387d6
commit ae6e7c804b
12 changed files with 116 additions and 9 deletions

View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEditor;
using UnityEngine;
namespace Stary.Evo.Editor
{
[CreateAssetMenu(fileName = "ArtSceneData", menuName = "Evo/ArtSceneData")]
public class ArtSceneData : ScriptableObject
{
[ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false)]
public List<ArtScene> artScenes = new List<ArtScene>();
}
[System.Serializable]
public class ArtScene
{
[LabelText("场景名称")]
public string sceneName;
#if UNITY_EDITOR
[LabelText("场景实例")][OnValueChanged("LoadScenePath")]
public SceneAsset sceneAsset;
#endif
[LabelText("场景路径")][ReadOnly]
public string scenePath;
[LabelText("场景标识符")][ReadOnly]
public string sceneIdentifier;
public void LoadScenePath()
{
if (sceneAsset == null)
{
Debug.LogError($"ArtScene {sceneName} 资源不存在,请检查!");
return;
}
scenePath = AssetDatabase.GetAssetPath(sceneAsset);
sceneIdentifier= $"Scenes_{sceneAsset.name}" ;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4b27116732b54ea498248a5e81c5d0a3
timeCreated: 1761299598

View File

@@ -1,7 +1,9 @@
using System;
using Sirenix.OdinInspector;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
namespace Stary.Evo
{
@@ -35,10 +37,29 @@ namespace Stary.Evo
/// </summary>
public string mainPrefab;
[ShowIf("loadResType", LoadResType.Scene)]
public string mainScene;
#if UNITY_EDITOR
[ShowIf("loadResType", LoadResType.Scene)][OnValueChanged("LoadScenePath")]
public SceneAsset sceneAsset;
#endif
[ShowIf("loadResType", LoadResType.Scene)][ReadOnly]
public string scenePath;
[ShowIf("loadResType", LoadResType.Scene)][ReadOnly]
public string sceneIdentifier;
[ShowIf("loadResType", LoadResType.Scene)]
public LoadSceneMode loadSceneMode;
public void LoadScenePath()
{
if (sceneAsset == null)
{
Debug.LogError($"Scene {scenePath} 资源不存在,请检查!");
return;
}
scenePath = AssetDatabase.GetAssetPath(sceneAsset);
sceneIdentifier= $"Scenes_{sceneAsset.name}" ;
}
public enum LoadResType
{
Prefab,