实例节点的显示隐藏
This commit is contained in:
parent
7fe83e3342
commit
285bd5511d
@ -52,10 +52,10 @@ namespace UguiToolkit.Editor
|
|||||||
|
|
||||||
public void ApplyData(T1 ui)
|
public void ApplyData(T1 ui)
|
||||||
{
|
{
|
||||||
OnApplyData(ui, m_elementInfo);
|
OnApplyData(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnApplyData(T1 ui, T2 elementInfo) { }
|
protected virtual void OnApplyData(T1 ui) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -8,9 +8,9 @@ public class ImageEntity : BaseEntity<Image, LayoutInfo.ImageInfo>
|
|||||||
{
|
{
|
||||||
private Image m_previewImage;
|
private Image m_previewImage;
|
||||||
|
|
||||||
protected override void OnApplyData(Image ui, LayoutInfo.ImageInfo elementInfo)
|
protected override void OnApplyData(Image ui)
|
||||||
{
|
{
|
||||||
|
ApplyTransform(ui.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitPreviewImage() {
|
public void InitPreviewImage() {
|
||||||
|
@ -7,11 +7,30 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class TextEntity : BaseEntity<Text, LayoutInfo.TextInfo>
|
public class TextEntity : BaseEntity<Text, LayoutInfo.TextInfo>
|
||||||
{
|
{
|
||||||
protected override void OnApplyData(Text ui, LayoutInfo.TextInfo elementInfo)
|
private Text m_previewText;
|
||||||
|
|
||||||
|
protected override void OnApplyData(Text ui)
|
||||||
{
|
{
|
||||||
ui.text = elementInfo.text;
|
ui.text = ElementInfo.text;
|
||||||
ui.fontSize = (int)elementInfo.size;
|
ui.fontSize = (int)ElementInfo.size;
|
||||||
ui.color = elementInfo.color;
|
ui.color = ElementInfo.color;
|
||||||
|
ui.alignment = TextAnchor.MiddleCenter;
|
||||||
|
|
||||||
|
var rectTransform = ui.rectTransform;
|
||||||
|
rectTransform.sizeDelta = new Vector2(ElementInfo.w + 10, ElementInfo.h + 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitPreviewText()
|
||||||
|
{
|
||||||
|
if (ElementInfo == null) return;
|
||||||
|
|
||||||
|
if (!TryGetComponent<Text>(out m_previewText))
|
||||||
|
{
|
||||||
|
m_previewText = gameObject.AddComponent<Text>();
|
||||||
|
}
|
||||||
|
OnApplyData(m_previewText);
|
||||||
|
|
||||||
|
ApplyTransform(transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
24
Assets/Editor/Helper/EntityHelper.cs
Normal file
24
Assets/Editor/Helper/EntityHelper.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public static class EntityHelper
|
||||||
|
{
|
||||||
|
public static void UpdateHierarchyOfEntity(in bool show, in GameObject entity)
|
||||||
|
{
|
||||||
|
entity.hideFlags = show ? HideFlags.DontSave : HideFlags.HideAndDontSave;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateSceneVisibilityOfEntity(in bool show, in GameObject entity)
|
||||||
|
{
|
||||||
|
if (show)
|
||||||
|
{
|
||||||
|
SceneVisibilityManager.instance.EnablePicking(entity, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SceneVisibilityManager.instance.DisablePicking(entity, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Editor/Helper/EntityHelper.cs.meta
Normal file
11
Assets/Editor/Helper/EntityHelper.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1dd0298466fd10844a9ab92180a42e18
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -36,7 +36,7 @@ namespace UguiToolkit.Editor
|
|||||||
}
|
}
|
||||||
else if (layoutElementJsonData.type == "Text")
|
else if (layoutElementJsonData.type == "Text")
|
||||||
{
|
{
|
||||||
ColorUtility.TryParseHtmlString(layoutElementJsonData.color, out var color);
|
ColorUtility.TryParseHtmlString("#" + layoutElementJsonData.color, out var color);
|
||||||
|
|
||||||
elementInfos.Add(new LayoutInfo.TextInfo()
|
elementInfos.Add(new LayoutInfo.TextInfo()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using Sirenix.OdinInspector.Editor;
|
||||||
using UguiToolkit.Editor.Windows;
|
using UguiToolkit.Editor.Windows;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.SceneManagement;
|
using UnityEditor.SceneManagement;
|
||||||
@ -13,24 +14,25 @@ namespace UguiToolkit.Editor
|
|||||||
{
|
{
|
||||||
PrefabStage.prefabStageOpened += OnPrefabStageOpened;
|
PrefabStage.prefabStageOpened += OnPrefabStageOpened;
|
||||||
PrefabStage.prefabStageClosing += OnPrefabStageClosing;
|
PrefabStage.prefabStageClosing += OnPrefabStageClosing;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnPrefabStageOpened(PrefabStage stage)
|
private static void OnPrefabStageOpened(PrefabStage stage)
|
||||||
{
|
{
|
||||||
var setting = GlobalManager.Instance.setting;
|
var setting = GlobalManager.Instance.setting;
|
||||||
Debug.Log(stage.assetPath);
|
|
||||||
Debug.Log(setting.prefabForUIDirPath);
|
|
||||||
if (!stage.assetPath.StartsWith(setting.prefabForUIDirPath)) return;
|
if (!stage.assetPath.StartsWith(setting.prefabForUIDirPath)) return;
|
||||||
|
|
||||||
// 打开配置界面
|
// 打开配置界面
|
||||||
PanelCacheWindow.ShowWindow(stage);
|
PanelCacheWindow.ShowWindow(new PanelCacheWindow.PanelCacheWindowArgs
|
||||||
|
{
|
||||||
|
stage = stage,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnPrefabStageClosing(PrefabStage stage)
|
private static void OnPrefabStageClosing(PrefabStage stage)
|
||||||
{
|
{
|
||||||
// 关闭配置界面
|
// 关闭界面
|
||||||
PanelCacheWindow.CloseWindow();
|
PanelCacheWindow.CloseWindow();
|
||||||
|
EditWindow.CloseWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,28 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UguiToolkit.Editor
|
namespace UguiToolkit.Editor
|
||||||
{
|
{
|
||||||
|
[ExecuteAlways]
|
||||||
public class EntityManager : MonoBehaviour, IManager
|
public class EntityManager : MonoBehaviour, IManager
|
||||||
{
|
{
|
||||||
private PanelCache m_panelCache;
|
private PanelCache m_panelCache;
|
||||||
private Transform entityRoot;
|
private Transform entityRoot;
|
||||||
|
|
||||||
|
private List<ImageEntity> imageEntities;
|
||||||
|
private List<TextEntity> textEntities;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
GlobalManager.Instance.OnShowHierarchyOfEntityChange += UpdateHierarchyOfEntityAllEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
GlobalManager.Instance.OnShowHierarchyOfEntityChange -= UpdateHierarchyOfEntityAllEntity;
|
||||||
|
}
|
||||||
|
|
||||||
public void InitAllEntity(PanelCache panelCache)
|
public void InitAllEntity(PanelCache panelCache)
|
||||||
{
|
{
|
||||||
this.m_panelCache = panelCache;
|
this.m_panelCache = panelCache;
|
||||||
@ -16,29 +31,67 @@ namespace UguiToolkit.Editor
|
|||||||
CreateAllEntity();
|
CreateAllEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateHierarchyOfEntityAllEntity(bool show)
|
||||||
|
{
|
||||||
|
UpdateHierarchyOfEntity(show, entityRoot.gameObject);
|
||||||
|
foreach (var entity in imageEntities) UpdateHierarchyOfEntity(show, entity.gameObject);
|
||||||
|
foreach (var entity in textEntities) UpdateHierarchyOfEntity(show, entity.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateHierarchyOfEntity(in bool show, in GameObject entity)
|
||||||
|
{
|
||||||
|
EntityHelper.UpdateHierarchyOfEntity(show, entity.gameObject);
|
||||||
|
EntityHelper.UpdateSceneVisibilityOfEntity(show, entity.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
private void CreateAllEntity()
|
private void CreateAllEntity()
|
||||||
{
|
{
|
||||||
if (this.m_panelCache == null) return;
|
if (this.m_panelCache == null) return;
|
||||||
var go = new GameObject();
|
var go = new GameObject();
|
||||||
|
UpdateHierarchyOfEntity(false, go);
|
||||||
entityRoot = go.transform;
|
entityRoot = go.transform;
|
||||||
entityRoot.SetParent(transform);
|
entityRoot.SetParent(transform);
|
||||||
entityRoot.localPosition = Vector3.zero;
|
entityRoot.localPosition = Vector3.zero;
|
||||||
entityRoot.localRotation = Quaternion.identity;
|
entityRoot.localRotation = Quaternion.identity;
|
||||||
entityRoot.localScale = Vector3.one;
|
entityRoot.localScale = Vector3.one;
|
||||||
|
|
||||||
// Image
|
imageEntities = new(m_panelCache.layoutInfo.Count);
|
||||||
foreach (var elementInfo in m_panelCache.GetLayoutElementInfos<LayoutInfo.ImageInfo>())
|
textEntities = new(m_panelCache.layoutInfo.Count);
|
||||||
|
|
||||||
|
foreach (var elementInfo in m_panelCache.GetLayoutElementInfos<LayoutInfo.ElementInfo>())
|
||||||
{
|
{
|
||||||
go = new GameObject();
|
var imgInfo = elementInfo as LayoutInfo.ImageInfo;
|
||||||
var entity = go.AddComponent<ImageEntity>();
|
if (imgInfo != null) // Image
|
||||||
entity.transform.SetParent(entityRoot);
|
{
|
||||||
entity.transform.SetSiblingIndex(0);
|
go = new GameObject();
|
||||||
|
var entity = go.AddComponent<ImageEntity>();
|
||||||
|
entity.transform.SetParent(entityRoot);
|
||||||
|
entity.transform.SetSiblingIndex(0);
|
||||||
|
|
||||||
|
entity.SetData(imgInfo);
|
||||||
|
entity.InitPreviewImage();
|
||||||
|
|
||||||
|
imageEntities.Add(entity);
|
||||||
|
UpdateHierarchyOfEntity(false, entity.gameObject);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var textInfo = elementInfo as LayoutInfo.TextInfo;
|
||||||
|
if (textInfo != null) // Text
|
||||||
|
{
|
||||||
|
go = new GameObject();
|
||||||
|
var entity = go.AddComponent<TextEntity>();
|
||||||
|
entity.transform.SetParent(entityRoot);
|
||||||
|
entity.transform.SetSiblingIndex(0);
|
||||||
|
|
||||||
|
entity.SetData(textInfo);
|
||||||
|
entity.InitPreviewText();
|
||||||
|
|
||||||
|
textEntities.Add(entity);
|
||||||
|
UpdateHierarchyOfEntity(false, entity.gameObject);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
entity.SetData(elementInfo);
|
|
||||||
entity.InitPreviewImage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
|
using System;
|
||||||
using UguiToolkit.Editor;
|
using UguiToolkit.Editor;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|
||||||
@ -24,6 +25,12 @@ namespace UguiToolkit
|
|||||||
public SettingScriptObject setting;
|
public SettingScriptObject setting;
|
||||||
public CacheScriptObject cache;
|
public CacheScriptObject cache;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当是否显示预览实例发生改变时
|
||||||
|
/// </summary>
|
||||||
|
public Action<bool> OnShowHierarchyOfEntityChange;
|
||||||
|
|
||||||
|
|
||||||
public void SaveCache()
|
public void SaveCache()
|
||||||
{
|
{
|
||||||
EditorUtility.SetDirty(cache);
|
EditorUtility.SetDirty(cache);
|
||||||
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace UguiToolkit
|
namespace UguiToolkit
|
||||||
{
|
{
|
||||||
|
[ExecuteAlways]
|
||||||
public class StageManager : MonoBehaviour
|
public class StageManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
@ -30,6 +31,21 @@ namespace UguiToolkit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
GlobalManager.Instance.OnShowHierarchyOfEntityChange += UpdateHierarchy;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
GlobalManager.Instance.OnShowHierarchyOfEntityChange -= UpdateHierarchy;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateHierarchy(bool show)
|
||||||
|
{
|
||||||
|
EntityHelper.UpdateHierarchyOfEntity(show, m_instance.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
public static StageManager CreateStageManager(Scene scene, GameObject prefabContentsRoot)
|
public static StageManager CreateStageManager(Scene scene, GameObject prefabContentsRoot)
|
||||||
{
|
{
|
||||||
var go = new GameObject();
|
var go = new GameObject();
|
||||||
@ -45,6 +61,7 @@ namespace UguiToolkit
|
|||||||
|
|
||||||
go.hideFlags = HideFlags.DontSave;
|
go.hideFlags = HideFlags.DontSave;
|
||||||
|
|
||||||
|
m_instance.UpdateHierarchy(false);
|
||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ namespace UguiToolkit.Editor
|
|||||||
|
|
||||||
public float W => m_w;
|
public float W => m_w;
|
||||||
public float H => m_h;
|
public float H => m_h;
|
||||||
|
public int Count => m_elementInfos == null ? 0 : m_elementInfos.Count;
|
||||||
|
|
||||||
public LayoutInfo(List<ElementInfo> elementInfos, float w, float h)
|
public LayoutInfo(List<ElementInfo> elementInfos, float w, float h)
|
||||||
{
|
{
|
||||||
|
34
Assets/Editor/Windows/EditWindow.cs
Normal file
34
Assets/Editor/Windows/EditWindow.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using Sirenix.OdinInspector.Editor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UguiToolkit.Editor.Windows
|
||||||
|
{
|
||||||
|
public class EditWindow : BaseWindow<EditWindow>
|
||||||
|
{
|
||||||
|
[SerializeField, HideInInspector]
|
||||||
|
private bool m_showHierarchyOfEntityChange = false;
|
||||||
|
|
||||||
|
[LabelText("实例Hierarchy是否显示"), ShowInInspector]
|
||||||
|
public bool ShowHierarchyOfEntity
|
||||||
|
{
|
||||||
|
get => m_showHierarchyOfEntityChange;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_showHierarchyOfEntityChange = value;
|
||||||
|
|
||||||
|
GlobalManager.Instance.OnShowHierarchyOfEntityChange?.Invoke(m_showHierarchyOfEntityChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GettitleContent()
|
||||||
|
{
|
||||||
|
return "助手编辑界面";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Init(WindowArgs args = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Editor/Windows/EditWindow.cs.meta
Normal file
11
Assets/Editor/Windows/EditWindow.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f1d07ee52aac57747b133eff2f1972b8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
47
Assets/Editor/Windows/IWindow.cs
Normal file
47
Assets/Editor/Windows/IWindow.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using Sirenix.OdinInspector.Editor;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UguiToolkit.Editor.Windows
|
||||||
|
{
|
||||||
|
public abstract class BaseWindow <T>: OdinEditorWindow, IWindow where T : OdinEditorWindow, IWindow
|
||||||
|
{
|
||||||
|
private static T m_window;
|
||||||
|
public static T Window => m_window;
|
||||||
|
|
||||||
|
public static T ShowWindow(WindowArgs args = null)
|
||||||
|
{
|
||||||
|
if (m_window) m_window.Close();
|
||||||
|
m_window = CreateWindow<T>();
|
||||||
|
m_window.titleContent = new(m_window.GettitleContent());
|
||||||
|
|
||||||
|
m_window.Show();
|
||||||
|
m_window.Init(args);
|
||||||
|
|
||||||
|
return m_window;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CloseWindow()
|
||||||
|
{
|
||||||
|
if (m_window)
|
||||||
|
{
|
||||||
|
m_window.Close();
|
||||||
|
m_window = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string GettitleContent() => "";
|
||||||
|
public virtual void Init(WindowArgs args = null) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IWindow
|
||||||
|
{
|
||||||
|
string GettitleContent();
|
||||||
|
void Init(WindowArgs args = null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WindowArgs
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Editor/Windows/IWindow.cs.meta
Normal file
11
Assets/Editor/Windows/IWindow.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 86f25c7cb7d8d6446bdc67f8081fd688
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -11,10 +11,8 @@ using UnityEngine.Serialization;
|
|||||||
|
|
||||||
namespace UguiToolkit.Editor.Windows
|
namespace UguiToolkit.Editor.Windows
|
||||||
{
|
{
|
||||||
public class PanelCacheWindow : OdinEditorWindow
|
public class PanelCacheWindow : BaseWindow<PanelCacheWindow>
|
||||||
{
|
{
|
||||||
private static PanelCacheWindow _window;
|
|
||||||
|
|
||||||
|
|
||||||
[LabelText("源图片文件夹路径"), FolderPath, SerializeField]
|
[LabelText("源图片文件夹路径"), FolderPath, SerializeField]
|
||||||
private string m_srcImgDirPath;
|
private string m_srcImgDirPath;
|
||||||
@ -27,7 +25,7 @@ namespace UguiToolkit.Editor.Windows
|
|||||||
private PanelCache panelCache;
|
private PanelCache panelCache;
|
||||||
|
|
||||||
[Button("开启助手", ButtonSizes.Medium)]
|
[Button("开启助手", ButtonSizes.Medium)]
|
||||||
private void Start()
|
private void DoStart()
|
||||||
{
|
{
|
||||||
panelCache.srcImgDirPath = m_srcImgDirPath;
|
panelCache.srcImgDirPath = m_srcImgDirPath;
|
||||||
panelCache.layoutInfoFilePath = m_layoutInfoFilePath;
|
panelCache.layoutInfoFilePath = m_layoutInfoFilePath;
|
||||||
@ -45,6 +43,9 @@ namespace UguiToolkit.Editor.Windows
|
|||||||
var entityManager = stageManager.CreateSubManager<EntityManager>();
|
var entityManager = stageManager.CreateSubManager<EntityManager>();
|
||||||
entityManager.InitAllEntity(panelCache);
|
entityManager.InitAllEntity(panelCache);
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
|
|
||||||
|
// 打开编辑界面
|
||||||
|
EditWindow.ShowWindow(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Button("解析Layout.txt", ButtonSizes.Medium), ShowIf(nameof(m_cacheExist))]
|
[Button("解析Layout.txt", ButtonSizes.Medium), ShowIf(nameof(m_cacheExist))]
|
||||||
@ -99,8 +100,17 @@ namespace UguiToolkit.Editor.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Init()
|
public override string GettitleContent()
|
||||||
{
|
{
|
||||||
|
return "请选择信息后开启助手";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Init(WindowArgs args = null)
|
||||||
|
{
|
||||||
|
var _args = args as PanelCacheWindowArgs;
|
||||||
|
m_prefabStage = _args.stage;
|
||||||
|
m_prefab = AssetDatabase.LoadAssetAtPath<GameObject>(_args.stage.assetPath);
|
||||||
|
|
||||||
var cache = GlobalManager.Instance.cache;
|
var cache = GlobalManager.Instance.cache;
|
||||||
if (cache.panelCaches.TryGetValue(m_prefab, out panelCache))
|
if (cache.panelCaches.TryGetValue(m_prefab, out panelCache))
|
||||||
{
|
{
|
||||||
@ -115,29 +125,10 @@ namespace UguiToolkit.Editor.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PanelCacheWindow ShowWindow(PrefabStage stage)
|
public class PanelCacheWindowArgs : WindowArgs
|
||||||
{
|
{
|
||||||
if (_window) _window.Close();
|
public PrefabStage stage;
|
||||||
_window = CreateWindow<PanelCacheWindow>();
|
|
||||||
_window.titleContent = new ("请选择信息后开启助手");
|
|
||||||
_window.m_prefabStage = stage;
|
|
||||||
_window.m_prefab = AssetDatabase.LoadAssetAtPath<GameObject>(stage.assetPath);
|
|
||||||
|
|
||||||
_window.Show();
|
|
||||||
_window.Init();
|
|
||||||
|
|
||||||
return _window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CloseWindow()
|
|
||||||
{
|
|
||||||
if (_window)
|
|
||||||
{
|
|
||||||
_window.Close();
|
|
||||||
_window = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user