【m】修改框架編輯器
This commit is contained in:
39
Assets/00.StaryEvo/Editor/ArtBuild/ArtSceneDataEditor.cs
Normal file
39
Assets/00.StaryEvo/Editor/ArtBuild/ArtSceneDataEditor.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
using Stary.Evo;
|
||||
using Stary.Evo.Editor;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ArtSceneData))]
|
||||
public class ArtSceneDataEditor : OdinEditor
|
||||
{
|
||||
// /// <summary>
|
||||
// /// 序列化属性,在OnEnable中获取
|
||||
// /// </summary>
|
||||
// [HideInInspector] private SerializedProperty artScenes;
|
||||
private void OnEnable()
|
||||
{
|
||||
//artScenes = serializedObject.FindProperty("artScenes");
|
||||
ArtSceneData artSceneData = (ArtSceneData)target;
|
||||
List<ArtScene> artScenesList = artSceneData.artScenes;
|
||||
List<int> removeIndexList = new List<int>();
|
||||
for (int i = 0; i < artScenesList.Count; i++)
|
||||
{
|
||||
ArtScene artScene = artScenesList[i];
|
||||
if (artScene.sceneAsset==null)
|
||||
{
|
||||
removeIndexList.Add(i);
|
||||
}
|
||||
}
|
||||
for (int i = removeIndexList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
int index = removeIndexList[i];
|
||||
artScenesList.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5762b2ce1b7e4184afd8785c147d42da
|
||||
timeCreated: 1761301851
|
||||
@@ -27,7 +27,7 @@ namespace Stary.Evo.Editor
|
||||
public static OdinEditorWindow window;
|
||||
private HotfixMainResDomain hotfixMainResDomain;
|
||||
|
||||
[MenuItem("Evo/Art/Art资源打包工具")]
|
||||
[MenuItem("Evo/Art/Art资源打包工具",false, 1)]
|
||||
static void ShowWindows()
|
||||
{
|
||||
if (CreatAssetWindow.GetCreatDomainAll().Count <= 0)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
public class CreatArtAssetWindow : OdinEditorWindow
|
||||
{
|
||||
[MenuItem("Evo/Art/创建Art作用域")]
|
||||
[MenuItem("Evo/Art/创建Art作用域",false, 0)]
|
||||
static void Init()
|
||||
{
|
||||
// Get existing open window or if none, make a new one:
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
public static OdinEditorWindow window;
|
||||
|
||||
[MenuItem("Evo/Dev/Apk打包工具")]
|
||||
[MenuItem("Evo/Dev/Apk打包工具",false, 4)]
|
||||
static void ShowWindows()
|
||||
{
|
||||
window = (BuildApkWindow)EditorWindow.GetWindow(typeof(BuildApkWindow));
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Stary.Evo.Editor
|
||||
public static OdinEditorWindow window;
|
||||
private HotfixMainResDomain hotfixMainResDomain;
|
||||
|
||||
[MenuItem("Evo/Dev/资源打包工具")]
|
||||
[MenuItem("Evo/Dev/资源打包工具",false, 2)]
|
||||
static void ShowWindows()
|
||||
{
|
||||
#if NotUpdate
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
public class CreatAssetWindow : OdinEditorWindow
|
||||
{
|
||||
[MenuItem("Evo/Dev/创建Domain作用域")]
|
||||
[MenuItem("Evo/Dev/创建Domain作用域",false, 1)]
|
||||
static void Init()
|
||||
{
|
||||
// Get existing open window or if none, make a new one:
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
public class OneKeyBuildWindow : OdinEditorWindow
|
||||
{
|
||||
[MenuItem("Evo/Dev/(一键)打包工具")]
|
||||
[MenuItem("Evo/Dev/(一键)打包工具",false, 3)]
|
||||
static void Init()
|
||||
{
|
||||
#if NotUpdate
|
||||
|
||||
41
Assets/00.StaryEvo/Runtime/PlayerSettings/ArtSceneData.cs
Normal file
41
Assets/00.StaryEvo/Runtime/PlayerSettings/ArtSceneData.cs
Normal 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}" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b27116732b54ea498248a5e81c5d0a3
|
||||
timeCreated: 1761299598
|
||||
@@ -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,
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Stary.Evo
|
||||
|
||||
var sceneMode = domainConfig.loadSceneMode;
|
||||
var physicsMode = LocalPhysicsMode.None;
|
||||
SceneHandle handle = package.LoadSceneAsync(domainConfig.mainScene, sceneMode, physicsMode);
|
||||
SceneHandle handle = package.LoadSceneAsync(domainConfig.sceneIdentifier, sceneMode, physicsMode);
|
||||
await handle;
|
||||
|
||||
Scene targetScene = SceneManager.GetSceneByName(handle.SceneName);
|
||||
|
||||
Reference in New Issue
Block a user