174 lines
7.1 KiB
C#
174 lines
7.1 KiB
C#
using LunaWolfStudiosEditor.ScriptableSheets.Layout;
|
|
using LunaWolfStudiosEditor.ScriptableSheets.Scanning;
|
|
using LunaWolfStudiosEditor.ScriptableSheets.Shared;
|
|
using LunaWolfStudiosEditor.ScriptableSheets.Tables;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace LunaWolfStudiosEditor.ScriptableSheets
|
|
{
|
|
[System.Serializable]
|
|
public class UserInterfaceSettings : AbstractBaseSettings, IScriptableSettings
|
|
{
|
|
private const int MaxArraySize = 5000;
|
|
|
|
[SerializeField]
|
|
private SheetAsset m_DefaultSheetAssets;
|
|
public SheetAsset DefaultSheetAssets { get => m_DefaultSheetAssets; set => m_DefaultSheetAssets = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_AutoPin;
|
|
public bool AutoPin { get => m_AutoPin; set => m_AutoPin = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ConfirmDelete;
|
|
public bool ConfirmDelete { get => m_ConfirmDelete; set => m_ConfirmDelete = value; }
|
|
|
|
[SerializeField]
|
|
private HeaderFormat m_HeaderFormat;
|
|
public HeaderFormat HeaderFormat { get => m_HeaderFormat; set => m_HeaderFormat = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_LockNames;
|
|
public bool LockNames { get => m_LockNames; set => m_LockNames = value; }
|
|
|
|
[SerializeField]
|
|
private int m_RowLineHeight;
|
|
public int RowLineHeight { get => m_RowLineHeight; set => m_RowLineHeight = value; }
|
|
|
|
[SerializeField]
|
|
private AssetPreviewSettings m_AssetPreview;
|
|
public AssetPreviewSettings AssetPreview { get => m_AssetPreview; set => m_AssetPreview = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ShowRowIndex;
|
|
public bool ShowRowIndex { get => m_ShowRowIndex; set => m_ShowRowIndex = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ShowColumnIndex;
|
|
public bool ShowColumnIndex { get => m_ShowColumnIndex; set => m_ShowColumnIndex = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ShowChildren;
|
|
public bool ShowChildren { get => m_ShowChildren; set => m_ShowChildren = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ShowArrays;
|
|
public bool ShowArrays { get => m_ShowArrays; set => m_ShowArrays = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_OverrideArraySize;
|
|
public bool OverrideArraySize { get => m_OverrideArraySize; set => m_OverrideArraySize = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_BestFitArraySize;
|
|
public bool BestFitArraySize { get => m_BestFitArraySize; set => m_BestFitArraySize = value; }
|
|
|
|
[SerializeField]
|
|
private int m_ArraySize;
|
|
public int ArraySize { get => m_ArraySize; set => m_ArraySize = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ShowAssetPath;
|
|
public bool ShowAssetPath { get => m_ShowAssetPath; set => m_ShowAssetPath = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ShowGuid;
|
|
public bool ShowGuid { get => m_ShowGuid; set => m_ShowGuid = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_ShowReadOnly;
|
|
public bool ShowReadOnly { get => m_ShowReadOnly; set => m_ShowReadOnly = value; }
|
|
|
|
[SerializeField]
|
|
private bool m_SubAssetFilters = true;
|
|
public bool SubAssetFilters { get => m_SubAssetFilters; set => m_SubAssetFilters = value; }
|
|
|
|
[SerializeField]
|
|
private TableNavSettings m_TableNav;
|
|
public TableNavSettings TableNav { get => m_TableNav; set => m_TableNav = value; }
|
|
|
|
public override GUIContent FoldoutContent => SettingsContent.Foldouts.UserInterface;
|
|
|
|
public bool IsBestFitArraySize => m_OverrideArraySize && m_BestFitArraySize;
|
|
|
|
public UserInterfaceSettings()
|
|
{
|
|
Foldout = true;
|
|
m_DefaultSheetAssets = SheetAsset.ScriptableObject;
|
|
m_AutoPin = true;
|
|
m_ConfirmDelete = true;
|
|
m_HeaderFormat = HeaderFormat.Friendly;
|
|
m_LockNames = false;
|
|
m_RowLineHeight = 1;
|
|
m_AssetPreview = new AssetPreviewSettings();
|
|
m_ShowRowIndex = false;
|
|
m_ShowColumnIndex = false;
|
|
m_ShowChildren = true;
|
|
m_ShowArrays = true;
|
|
m_OverrideArraySize = true;
|
|
m_BestFitArraySize = true;
|
|
m_ArraySize = 0;
|
|
m_ShowAssetPath = false;
|
|
m_ShowGuid = false;
|
|
m_ShowReadOnly = false;
|
|
m_SubAssetFilters = true;
|
|
m_TableNav = new TableNavSettings();
|
|
}
|
|
|
|
protected override void DrawProperties(SerializedObject target)
|
|
{
|
|
m_DefaultSheetAssets = (SheetAsset) EditorGUILayout.EnumFlagsField(SettingsContent.Dropdown.DefaultSheetAssets, m_DefaultSheetAssets);
|
|
if (m_DefaultSheetAssets == SheetAsset.Default)
|
|
{
|
|
m_DefaultSheetAssets = SheetAsset.ScriptableObject;
|
|
}
|
|
m_AutoPin = EditorGUILayout.Toggle(SettingsContent.Toggle.AutoPin, m_AutoPin);
|
|
m_ConfirmDelete = EditorGUILayout.Toggle(SettingsContent.Toggle.ConfirmDelete, m_ConfirmDelete);
|
|
m_HeaderFormat = (HeaderFormat) EditorGUILayout.EnumPopup(SettingsContent.Dropdown.HeaderFormat, m_HeaderFormat);
|
|
m_LockNames = EditorGUILayout.Toggle(SettingsContent.Toggle.LockNames, m_LockNames);
|
|
m_RowLineHeight = EditorGUILayout.IntSlider(SettingsContent.DigitField.RowLineHeight, m_RowLineHeight, 1, 10);
|
|
m_AssetPreview.Show = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowAssetPreviews, m_AssetPreview.Show);
|
|
if (m_AssetPreview.Show)
|
|
{
|
|
SheetLayout.Indent();
|
|
m_AssetPreview.ScaleMode = (ScaleMode) EditorGUILayout.EnumPopup(SettingsContent.Dropdown.PreviewScaleMode, m_AssetPreview.ScaleMode);
|
|
SheetLayout.Unindent();
|
|
}
|
|
m_ShowRowIndex = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowRowIndex, m_ShowRowIndex);
|
|
m_ShowColumnIndex = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowColumnIndex, m_ShowColumnIndex);
|
|
m_ShowChildren = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowChildren, m_ShowChildren);
|
|
if (m_ShowChildren)
|
|
{
|
|
SheetLayout.Indent();
|
|
m_ShowArrays = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowArrays, m_ShowArrays);
|
|
if (m_ShowArrays)
|
|
{
|
|
SheetLayout.Indent();
|
|
m_OverrideArraySize = EditorGUILayout.Toggle(SettingsContent.Toggle.OverrideArraySize, m_OverrideArraySize);
|
|
if (m_OverrideArraySize)
|
|
{
|
|
SheetLayout.Indent();
|
|
m_BestFitArraySize = EditorGUILayout.Toggle(SettingsContent.Toggle.BestFitArraySize, m_BestFitArraySize);
|
|
m_ArraySize = Mathf.Clamp(EditorGUILayout.IntField(SettingsContent.DigitField.ArraySize, m_ArraySize), 0, MaxArraySize);
|
|
SheetLayout.Unindent();
|
|
}
|
|
SheetLayout.Unindent();
|
|
}
|
|
SheetLayout.Unindent();
|
|
}
|
|
m_ShowAssetPath = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowAssetPath, m_ShowAssetPath);
|
|
m_ShowGuid = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowGuid, m_ShowGuid);
|
|
m_ShowReadOnly = EditorGUILayout.Toggle(SettingsContent.Toggle.ShowReadOnly, m_ShowReadOnly);
|
|
m_SubAssetFilters = EditorGUILayout.Toggle(SettingsContent.Toggle.SubAssetFilters, m_SubAssetFilters);
|
|
EditorGUILayout.Space();
|
|
EditorGUILayout.LabelField(SettingsContent.Label.TableNav, EditorStyles.boldLabel);
|
|
m_TableNav.AutoScroll = EditorGUILayout.Toggle(SettingsContent.Toggle.AutoScroll, m_TableNav.AutoScroll);
|
|
m_TableNav.AutoSelect = EditorGUILayout.Toggle(SettingsContent.Toggle.AutoSelect, m_TableNav.AutoSelect);
|
|
m_TableNav.HighlightAlpha = EditorGUILayout.Slider(SettingsContent.DigitField.HighlightAlpha, m_TableNav.HighlightAlpha, 0.0f, 0.25f);
|
|
m_TableNav.HighlightSelectedRow = EditorGUILayout.Toggle(SettingsContent.Toggle.HighlightSelectedRow, m_TableNav.HighlightSelectedRow);
|
|
m_TableNav.HighlightSelectedColumn = EditorGUILayout.Toggle(SettingsContent.Toggle.HighlightSelectedColumn, m_TableNav.HighlightSelectedColumn);
|
|
}
|
|
}
|
|
}
|