Skip to content

Commit

Permalink
Merge pull request #64 from techno-dwarf-works/feature/refactoring
Browse files Browse the repository at this point in the history
Version 0.0.61
  • Loading branch information
uurha committed Dec 14, 2024
1 parent 85a503a commit 7360728
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
64 changes: 63 additions & 1 deletion Editor/Helpers/StyleContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public class StyleContainer : IStyle
private StyleProperty<StyleFloat> _unitySliceScale;
#endif

#if UNITY_6000_0_OR_NEWER
private StyleProperty<StyleEnum<TextGeneratorType>> _unityTextGenerator;
private StyleProperty<StyleEnum<EditorTextRenderingMode>> _unityEditorTextRenderingMode;
#endif

private IStyle _cachedStyle;

public StyleEnum<Align> alignContent
Expand Down Expand Up @@ -1632,7 +1637,6 @@ public StyleEnum<TextAnchor> unityTextAlign
_unityTextAlign.Value = value;
}
}

public StyleColor unityTextOutlineColor
{
get
Expand Down Expand Up @@ -1899,6 +1903,52 @@ public StyleFloat unitySliceScale
}
#endif

#if UNITY_6000_0_OR_NEWER
public StyleEnum<TextGeneratorType> 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<EditorTextRenderingMode> 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
Expand Down Expand Up @@ -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
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 7360728

Please sign in to comment.