com.soviby.unity.ui.ugui-to.../Assets/Editor/ScriptObject/SettingScriptObject.cs

58 lines
1.6 KiB
C#
Raw Normal View History

2024-10-23 17:30:59 +00:00
#if UNITY_EDITOR
using Sirenix.OdinInspector;
2024-12-02 14:14:39 +00:00
using System;
2024-12-03 05:05:13 +00:00
using System.Collections;
2024-12-02 14:14:39 +00:00
using System.Collections.Generic;
2024-12-03 05:05:13 +00:00
using System.Linq;
using TMPro.EditorUtilities;
2024-12-02 14:14:39 +00:00
using Unity.Mathematics;
2024-10-08 15:19:05 +00:00
using UnityEngine;
namespace UguiToolkit.Editor
{
2024-12-02 14:14:39 +00:00
public class SettingScriptObject : SerializedScriptableObject
2024-10-08 15:19:05 +00:00
{
[LabelText("ui预制体存放的路径"), FolderPath]
public string prefabForUIDirPath;
2024-11-07 16:16:28 +00:00
public float distanceDifference = 0.2f;
2024-11-28 10:34:17 +00:00
public bool useTMP;
2024-12-02 14:14:39 +00:00
// 项目配置
public List <TextFontPresetOfUnity> textFontList = new ();
}
[Serializable]
public class TextFontPresetOfUnity
{
[Title("Ps属性")]
public string name;
public List<string> fontNameOfPsd;
public bool stroke; // 使用描边
public Color strokeColor;
2024-12-03 05:05:13 +00:00
public float strokeColorThreshold;
2024-12-02 14:14:39 +00:00
public bool allStrokeColor;
public bool shadow; // 使用阴影
public Color shadowColor;
2024-12-03 05:05:13 +00:00
public float shadowColorThreshold;
2024-12-02 14:14:39 +00:00
public bool allShadowColor;
[Title("Unity属性")]
public float2 sizeOffset;
public TMPro.TMP_FontAsset tmpAsset;
2024-12-03 05:05:13 +00:00
[ShowIf(nameof(ShowMaterialPreset)), ValueDropdown(nameof(GetAllMaterialPreset), IsUniqueList = true)]
2024-12-02 14:14:39 +00:00
public string materialPreset;
2024-12-03 05:05:13 +00:00
private bool ShowMaterialPreset => tmpAsset;
private IEnumerable GetAllMaterialPreset()
{
if (tmpAsset != null)
return TMP_EditorUtility.FindMaterialReferences(tmpAsset)
.Select(x => new ValueDropdownItem(x.name, x.name));
return null;
}
2024-10-08 15:19:05 +00:00
}
2024-10-23 17:30:59 +00:00
}
#endif