115 lines
2.8 KiB
C#
115 lines
2.8 KiB
C#
#if UNITY_EDITOR
|
|
|
|
using Sirenix.OdinInspector;
|
|
using Sirenix.OdinInspector.Editor;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace UguiToolkit.Editor.Windows
|
|
{
|
|
public class EditWindow : BaseWindow<EditWindow>
|
|
{
|
|
/// <summary>
|
|
/// 当是否显示预览实例发生改变时
|
|
/// </summary>
|
|
public event Action<bool> showHierarchyOfEntityChanged;
|
|
|
|
/// <summary>
|
|
/// 背景显示发生改变
|
|
/// </summary>
|
|
public event Action<bool> showBackgroundChanged;
|
|
|
|
/// <summary>
|
|
/// 创建所有TextEntity
|
|
/// </summary>
|
|
public event Action createAllTextEntity;
|
|
|
|
/// <summary>
|
|
/// 创建所有PrefabEntity
|
|
/// </summary>
|
|
public event Action createAllPrefabEntity;
|
|
|
|
/// <summary>
|
|
/// 应用上次变换
|
|
/// </summary>
|
|
public event Action<Transform> effectLastApplyTransform;
|
|
|
|
/// <summary>
|
|
/// 应用上次变换
|
|
/// </summary>
|
|
public event Action recoverDataSelectionObjCache;
|
|
|
|
|
|
[SerializeField, HideInInspector]
|
|
private bool m_showHierarchyOfEntityChange = false;
|
|
|
|
[SerializeField, HideInInspector]
|
|
private bool m_showBackground = true;
|
|
|
|
[LabelText("Hierarchy是否显示"), ShowInInspector]
|
|
private bool ShowHierarchyOfEntity
|
|
{
|
|
get => m_showHierarchyOfEntityChange;
|
|
set
|
|
{
|
|
m_showHierarchyOfEntityChange = value;
|
|
showHierarchyOfEntityChanged?.Invoke(m_showHierarchyOfEntityChange);
|
|
}
|
|
}
|
|
|
|
[LabelText("背景是否显示"), ShowInInspector]
|
|
private bool ShowBackground
|
|
{
|
|
get => m_showBackground;
|
|
set
|
|
{
|
|
m_showBackground = value;
|
|
showBackgroundChanged?.Invoke(m_showBackground);
|
|
}
|
|
}
|
|
|
|
[Button("创建所有Text")]
|
|
private void CreateAllTextEntity()
|
|
{
|
|
createAllTextEntity?.Invoke();
|
|
}
|
|
|
|
[Button("创建所有通用预制体")]
|
|
private void CreateAllPrefabEntity()
|
|
{
|
|
createAllPrefabEntity?.Invoke();
|
|
}
|
|
|
|
|
|
[Title("工具")]
|
|
[LabelText("需要应用变换的对象"), SerializeField]
|
|
private Transform m_targetTransform;
|
|
|
|
[Button("应用上次变换 (SPACE)")]
|
|
private void EffectLastApplyTransform()
|
|
{
|
|
if (m_targetTransform)
|
|
{
|
|
effectLastApplyTransform?.Invoke(m_targetTransform);
|
|
}
|
|
}
|
|
|
|
[Button("恢复子节点位置 (CTRL + SPACE)")]
|
|
private void RecoverDataSelectionObjCache()
|
|
{
|
|
recoverDataSelectionObjCache?.Invoke();
|
|
}
|
|
|
|
public override string GettitleContent()
|
|
{
|
|
return "助手编辑界面";
|
|
}
|
|
|
|
public override void Init(WindowArgs args = null)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif |