#if UNITY_EDITOR using Sirenix.OdinInspector; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using TMPro.EditorUtilities; using Unity.Mathematics; using UnityEngine; namespace UguiToolkit.Editor { public class SettingScriptObject : SerializedScriptableObject { [LabelText("ui预制体存放的路径"), FolderPath] public string prefabForUIDirPath; public float distanceDifference = 0.2f; public bool useTMP; // 项目配置 public List textFontList = new (); } [Serializable] public class TextFontPresetOfUnity { [Title("Ps属性")] public string name; public List fontNameOfPsd; public bool stroke; // 使用描边 public Color strokeColor; public float strokeColorThreshold; public bool allStrokeColor; public bool shadow; // 使用阴影 public Color shadowColor; public float shadowColorThreshold; public bool allShadowColor; [Title("Unity属性")] public float2 sizeOffset; public TMPro.TMP_FontAsset tmpAsset; [ShowIf(nameof(ShowMaterialPreset)), ValueDropdown(nameof(GetAllMaterialPreset), IsUniqueList = true)] public string materialPreset; 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; } } } #endif