[unity] Fixed compile error on Unity 2018.3+.

This commit is contained in:
Harald Csaszar 2019-10-20 18:43:15 +02:00
parent c96b426364
commit 24d4185016
2 changed files with 9 additions and 7 deletions

View File

@ -176,7 +176,7 @@ namespace Spine.Unity.Editor {
newPreferences.atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING); newPreferences.atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING); newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
newPreferences.timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION); newPreferences.timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION);
newPreferences.handleScale = EditorPrefs.GetBool(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE); newPreferences.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE);
} }
public static void SaveToEditorPrefs(SpinePreferences preferences) { public static void SaveToEditorPrefs(SpinePreferences preferences) {
@ -191,7 +191,7 @@ namespace Spine.Unity.Editor {
EditorPrefs.SetBool(ATLASTXT_WARNING_KEY, preferences.atlasTxtImportWarning); EditorPrefs.SetBool(ATLASTXT_WARNING_KEY, preferences.atlasTxtImportWarning);
EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning); EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning);
EditorPrefs.SetBool(TIMELINE_USE_BLEND_DURATION_KEY, preferences.timelineUseBlendDuration); EditorPrefs.SetBool(TIMELINE_USE_BLEND_DURATION_KEY, preferences.timelineUseBlendDuration);
EditorPrefs.SetBool(SCENE_ICONS_SCALE_KEY, preferences.handleScale); EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, preferences.handleScale);
} }
#endif #endif

View File

@ -86,8 +86,10 @@ namespace Spine.Unity.Editor {
public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true; public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true;
public bool autoReloadSceneSkeletons = DEFAULT_AUTO_RELOAD_SCENESKELETONS; public bool autoReloadSceneSkeletons = DEFAULT_AUTO_RELOAD_SCENESKELETONS;
public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
internal const float DEFAULT_SCENE_ICONS_SCALE = 1f; internal const float DEFAULT_SCENE_ICONS_SCALE = 1f;
public static float handleScale = DEFAULT_SCENE_ICONS_SCALE; [Range(0.01f, 2f)]
public float handleScale = DEFAULT_SCENE_ICONS_SCALE;
public const bool DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME = true; public const bool DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME = true;
public bool mecanimEventIncludeFolderName = DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME; public bool mecanimEventIncludeFolderName = DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME;
@ -95,7 +97,7 @@ namespace Spine.Unity.Editor {
// Timeline extension module // Timeline extension module
public const bool DEFAULT_TIMELINE_USE_BLEND_DURATION = true; public const bool DEFAULT_TIMELINE_USE_BLEND_DURATION = true;
public bool timelineUseBlendDuration = DEFAULT_TIMELINE_USE_BLEND_DURATION; public bool timelineUseBlendDuration = DEFAULT_TIMELINE_USE_BLEND_DURATION;
#if NEW_PREFERENCES_SETTINGS_PROVIDER #if NEW_PREFERENCES_SETTINGS_PROVIDER
public static void Load () { public static void Load () {
GetOrCreateSettings(); GetOrCreateSettings();
@ -171,10 +173,10 @@ namespace Spine.Unity.Editor {
EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel); EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel);
{ {
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
handleScale = EditorGUILayout.Slider("Editor Bone Scale", handleScale, 0.01f, 2f); var scaleProperty = settings.FindProperty("handleScale");
handleScale = Mathf.Max(0.01f, handleScale); EditorGUILayout.PropertyField(scaleProperty, new GUIContent("Editor Bone Scale"));
if (EditorGUI.EndChangeCheck()) { if (EditorGUI.EndChangeCheck()) {
EditorPrefs.SetFloat(SpinePreferences.SCENE_ICONS_SCALE_KEY, handleScale); EditorPrefs.SetFloat(SpinePreferences.SCENE_ICONS_SCALE_KEY, scaleProperty.floatValue);
SceneView.RepaintAll(); SceneView.RepaintAll();
} }
} }