74 lines
2.6 KiB
C#
74 lines
2.6 KiB
C#
|
|
using AlicizaX.Editor;
|
|||
|
|
using AlicizaX.Scene.Runtime;
|
|||
|
|
using UnityEditor;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
namespace AlicizaX.Scene.Editor
|
|||
|
|
{
|
|||
|
|
[CustomEditor(typeof(SceneComponent))]
|
|||
|
|
internal sealed class SceneComponentInspector : ComponentTypeComponentInspector
|
|||
|
|
{
|
|||
|
|
private SerializedProperty m_EnableLoadSceneUpdateEvent = null;
|
|||
|
|
private SerializedProperty m_EnableLoadSceneDependencyAssetEvent = null;
|
|||
|
|
|
|||
|
|
public override void OnInspectorGUI()
|
|||
|
|
{
|
|||
|
|
base.OnInspectorGUI();
|
|||
|
|
|
|||
|
|
serializedObject.Update();
|
|||
|
|
|
|||
|
|
SceneComponent t = (SceneComponent)target;
|
|||
|
|
|
|||
|
|
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
|
|||
|
|
{
|
|||
|
|
EditorGUILayout.PropertyField(m_EnableLoadSceneUpdateEvent);
|
|||
|
|
EditorGUILayout.PropertyField(m_EnableLoadSceneDependencyAssetEvent);
|
|||
|
|
}
|
|||
|
|
EditorGUI.EndDisabledGroup();
|
|||
|
|
|
|||
|
|
serializedObject.ApplyModifiedProperties();
|
|||
|
|
|
|||
|
|
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
|||
|
|
{
|
|||
|
|
EditorGUILayout.LabelField("Loaded Scene Asset Names", GetSceneNameString(t.GetLoadedSceneAssetNames()));
|
|||
|
|
EditorGUILayout.LabelField("Loading Scene Asset Names", GetSceneNameString(t.GetLoadingSceneAssetNames()));
|
|||
|
|
EditorGUILayout.LabelField("Unloading Scene Asset Names", GetSceneNameString(t.GetUnloadingSceneAssetNames()));
|
|||
|
|
EditorGUILayout.ObjectField("Main Camera", t.MainCamera, typeof(Camera), true);
|
|||
|
|
|
|||
|
|
Repaint();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void Enable()
|
|||
|
|
{
|
|||
|
|
m_EnableLoadSceneUpdateEvent = serializedObject.FindProperty("m_EnableLoadSceneUpdateEvent");
|
|||
|
|
m_EnableLoadSceneDependencyAssetEvent = serializedObject.FindProperty("m_EnableLoadSceneDependencyAssetEvent");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void RefreshTypeNames()
|
|||
|
|
{
|
|||
|
|
RefreshComponentTypeNames(typeof(IGameSceneManager));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string GetSceneNameString(string[] sceneAssetNames)
|
|||
|
|
{
|
|||
|
|
if (sceneAssetNames == null || sceneAssetNames.Length <= 0)
|
|||
|
|
{
|
|||
|
|
return "<Empty>";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string sceneNameString = string.Empty;
|
|||
|
|
foreach (string sceneAssetName in sceneAssetNames)
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(sceneNameString))
|
|||
|
|
{
|
|||
|
|
sceneNameString += ", ";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
sceneNameString += SceneComponent.GetSceneName(sceneAssetName);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return sceneNameString;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|