Files
plugin-library/Assets/00.StaryEvo/Runtime/PlayerSettings/DomainConfig.cs

70 lines
1.9 KiB
C#
Raw Normal View History

2025-04-11 09:56:06 +08:00
using System;
using Sirenix.OdinInspector;
2025-10-24 19:08:10 +08:00
using UnityEditor;
2025-03-31 11:16:52 +08:00
using UnityEngine;
2025-06-17 11:05:53 +08:00
using UnityEngine.SceneManagement;
2025-10-24 19:08:10 +08:00
using UnityEngine.Serialization;
2025-03-31 11:16:52 +08:00
namespace Stary.Evo
{
2025-04-11 09:56:06 +08:00
[Serializable]
2025-03-31 11:16:52 +08:00
[CreateAssetMenu(fileName = "DomainConfig", menuName = "Evo/Create DomainConfig")]
2025-04-11 09:56:06 +08:00
public class DomainConfig : SerializedScriptableObject
2025-03-31 11:16:52 +08:00
{
/// <summary>
/// 域id
/// </summary>
2025-04-11 09:56:06 +08:00
[Sirenix.OdinInspector.ReadOnly] public string domain;
2025-03-31 11:16:52 +08:00
/// <summary>
/// 入口命名空间
/// </summary>
2025-04-11 09:56:06 +08:00
[Sirenix.OdinInspector.ReadOnly] public string @namespace;
2025-03-31 11:16:52 +08:00
/// <summary>
/// 入口类
/// </summary>
2025-04-11 09:56:06 +08:00
[Sirenix.OdinInspector.ReadOnly] public string className;
2025-03-31 11:16:52 +08:00
2025-04-11 09:56:06 +08:00
public LoadResType loadResType;
2025-06-17 10:58:37 +08:00
2025-03-31 11:16:52 +08:00
2025-04-11 09:56:06 +08:00
[Sirenix.OdinInspector.ReadOnly] [ShowIf("loadResType", LoadResType.Prefab)]
/// <summary>
/// 入口预制体
/// </summary>
public string mainPrefab;
2025-10-24 19:08:10 +08:00
#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;
2025-06-17 10:58:37 +08:00
[ShowIf("loadResType", LoadResType.Scene)]
public LoadSceneMode loadSceneMode;
2025-10-24 19:08:10 +08:00
public void LoadScenePath()
{
if (sceneAsset == null)
{
Debug.LogError($"Scene {scenePath} 资源不存在,请检查!");
return;
}
scenePath = AssetDatabase.GetAssetPath(sceneAsset);
sceneIdentifier= $"Scenes_{sceneAsset.name}" ;
}
2025-04-11 09:56:06 +08:00
public enum LoadResType
{
Prefab,
Scene
}
2025-06-17 11:05:53 +08:00
2025-04-11 09:56:06 +08:00
}
2025-03-31 11:16:52 +08:00
}