Skip to content

Commit 9de94a0

Browse files
authored
fix datetime & timespan (#14)
1 parent 1c6db8b commit 9de94a0

6 files changed

Lines changed: 22 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All package updates & migration steps will be listed in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [3.8.6] - 2024-06-06
8+
### Fixed
9+
- Missing `using` for `DateTime` & `TimeSpan` usage in structs
10+
- `DateTime` & `TimeSpan` drawer rendering when nested in structs
11+
712
## [3.8.5] - 2024-05-28
813
### Fixed
914
- `ParameterStructReference<>.Struct` to be thread safe.

Editor/Editor/SerializableDateTimeDrawer.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
1919
var labelWidth = EditorGUIUtility.labelWidth + 20.0f;
2020
rect.x = labelWidth;
2121

22-
const float componentLabelPadding = 4.0f;
22+
const float componentLabelPadding = 2.0f;
2323
var floatFieldStyle = new GUIStyle(GUI.skin.textField);
2424
float digitWidth = EditorStyles.label.CalcSize(new GUIContent("0")).x * 1.5f;
2525
floatFieldStyle.alignment = TextAnchor.MiddleRight;
26+
floatFieldStyle.padding = new RectOffset();
27+
floatFieldStyle.margin = new RectOffset();
2628

2729
int DrawComponent(string componentLabel, int componentDigits, int componentValue)
2830
{
@@ -33,7 +35,10 @@ int DrawComponent(string componentLabel, int componentDigits, int componentValue
3335

3436
var componentLabelWidth = EditorStyles.label.CalcSize(new GUIContent(componentLabel)).x;
3537
rect.width = componentLabelWidth;
36-
EditorGUI.LabelField(rect, componentLabel);
38+
GUIStyle labelStyle = GUI.skin.label;
39+
labelStyle.padding = new RectOffset();
40+
labelStyle.margin = new RectOffset();
41+
GUI.Label(rect, componentLabel, labelStyle);
3742
rect.x += componentLabelWidth + componentLabelPadding;
3843

3944
return intComponentValue;

Editor/Editor/SerializableTimeSpanDrawer.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
1919
var labelWidth = EditorGUIUtility.labelWidth + 20.0f;
2020
rect.x = labelWidth;
2121

22-
const float componentLabelPadding = 4.0f;
22+
const float componentLabelPadding = 2.0f;
2323
var floatFieldStyle = new GUIStyle(GUI.skin.textField);
2424
float digitWidth = EditorStyles.label.CalcSize(new GUIContent("0")).x * 1.5f;
2525
floatFieldStyle.alignment = TextAnchor.MiddleRight;
26+
floatFieldStyle.padding = new RectOffset();
27+
floatFieldStyle.margin = new RectOffset();
2628

2729
float DrawComponent(string componentLabel, int componentDigits, int componentValue)
2830
{
@@ -33,7 +35,10 @@ float DrawComponent(string componentLabel, int componentDigits, int componentVal
3335

3436
var componentLabelWidth = EditorStyles.label.CalcSize(new GUIContent(componentLabel)).x;
3537
rect.width = componentLabelWidth;
36-
EditorGUI.LabelField(rect, componentLabel);
38+
GUIStyle labelStyle = GUI.skin.label;
39+
labelStyle.padding = new RectOffset();
40+
labelStyle.margin = new RectOffset();
41+
GUI.Label(rect, componentLabel, labelStyle);
3742
rect.x += componentLabelWidth + componentLabelPadding;
3843

3944
return floatComponentValue;

Editor/EditorParameterConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal static class EditorParameterConstants
1818
/// Ideally it would be the most convenient to use the package version but that requires file I/O to
1919
/// the package.json which can be costly if we're doing it all of the time.
2020
/// </summary>
21-
public const string InterfaceHashSalt = "383a77c7-da21-469c-880d-d8aa0a64faf2";
21+
public const string InterfaceHashSalt = "7e10aadc-9b6c-41a7-9c7e-ee672e5a21c8";
2222

2323
public static string SanitizedDataPath()
2424
{

Editor/Templates/Struct.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using System;
44
using System.Collections.Generic;
55
using System.Linq;
66
using PocketGems.Parameters;
7+
using PocketGems.Parameters.DataTypes;
78
using PocketGems.Parameters.Interface;
89
using PocketGems.Parameters.Types;
910
using PocketGems.Parameters.Validation;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.pocketgems.scriptableobject.flatbuffer",
3-
"version": "3.8.5",
3+
"version": "3.8.6",
44
"displayName": "Scriptable Object - FlatBuffer",
55
"description": "Seamless syncing between Scriptable Objects and CSVs. Scriptable Object data built to Google FlatBuffers for optimal runtime loading & access.",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)