From 736072845ff231bc1744c5e5e2e7823dbef80a8a Mon Sep 17 00:00:00 2001 From: uurha Date: Sat, 14 Dec 2024 17:22:26 +0000 Subject: [PATCH] Merge pull request #64 from techno-dwarf-works/feature/refactoring Version 0.0.61 --- Editor/Helpers/StyleContainer.cs | 64 +++++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/Editor/Helpers/StyleContainer.cs b/Editor/Helpers/StyleContainer.cs index 7dd40d8..0fd780d 100644 --- a/Editor/Helpers/StyleContainer.cs +++ b/Editor/Helpers/StyleContainer.cs @@ -91,6 +91,11 @@ public class StyleContainer : IStyle private StyleProperty _unitySliceScale; #endif +#if UNITY_6000_0_OR_NEWER + private StyleProperty> _unityTextGenerator; + private StyleProperty> _unityEditorTextRenderingMode; +#endif + private IStyle _cachedStyle; public StyleEnum alignContent @@ -1632,7 +1637,6 @@ public StyleEnum unityTextAlign _unityTextAlign.Value = value; } } - public StyleColor unityTextOutlineColor { get @@ -1899,6 +1903,52 @@ public StyleFloat unitySliceScale } #endif +#if UNITY_6000_0_OR_NEWER + public StyleEnum unityTextGenerator + { + get + { + if (_unitySliceScale.HasValue || _cachedStyle == null) + { + return _unityTextGenerator.Value; + } + + return _cachedStyle.unityTextGenerator; + } + set + { + if (_cachedStyle != null) + { + _cachedStyle.unityTextGenerator = value; + } + + _unityTextGenerator.Value = value; + } + } + + public StyleEnum unityEditorTextRenderingMode + { + get + { + if (_unitySliceScale.HasValue || _cachedStyle == null) + { + return _unityEditorTextRenderingMode.Value; + } + + return _cachedStyle.unityEditorTextRenderingMode; + } + set + { + if (_cachedStyle != null) + { + _cachedStyle.unityEditorTextRenderingMode = value; + } + + _unityEditorTextRenderingMode.Value = value; + } + } +#endif + public void Setup(IStyle style) { //TODO: Add validation for style @@ -2324,6 +2374,18 @@ private void ForceApply() _cachedStyle.unitySliceScale = _unitySliceScale.Value; } #endif + +#if UNITY_6000_0_OR_NEWER + if (_unityTextGenerator.HasValue) + { + _cachedStyle.unityTextGenerator = _unityTextGenerator.Value; + } + + if (_unityEditorTextRenderingMode.HasValue) + { + _cachedStyle.unityEditorTextRenderingMode = _unityEditorTextRenderingMode.Value; + } +#endif } } } \ No newline at end of file diff --git a/package.json b/package.json index 94dcb78..313b45f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.tdw.better.commons", "displayName": "Better Commons", - "version": "0.0.60", + "version": "0.0.61", "unity": "2021.3", "description": " ", "dependencies": {