From b2ff80220e47938cafdb8f699ae3a1f24315c398 Mon Sep 17 00:00:00 2001 From: Chris Gregan Date: Sun, 14 Jan 2018 21:57:54 +0000 Subject: [PATCH] Fixed compiler warnings in Untity2017.3 Retains backwards compatibility with Unity 2017.1 --- Assets/Fungus/Scripts/Editor/BlockEditor.cs | 8 ++++---- Assets/Fungus/Scripts/Editor/BlockInspector.cs | 4 ++-- Assets/Fungus/Scripts/Editor/EnumFlagDrawer.cs | 5 +++++ .../FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs | 7 +++++++ .../Assertions/Editor/AssertionComponentEditor.cs | 6 ++++++ .../Assertions/Editor/AssertionListRenderer.cs | 7 +++++++ .../TestRunner/Editor/PlatformRunner/PlatformRunner.cs | 4 ++++ .../Editor/PlatformRunner/PlatformRunnerConfiguration.cs | 4 ++++ .../Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs | 2 +- .../TestRunner/Editor/Renderer/IntegrationTestLine.cs | 2 +- .../Editor/Renderer/IntegrationTestRendererBase.cs | 2 +- ProjectSettings/ProjectVersion.txt | 2 +- 12 files changed, 43 insertions(+), 10 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/BlockEditor.cs b/Assets/Fungus/Scripts/Editor/BlockEditor.cs index 626b2b8a..055f9a9c 100644 --- a/Assets/Fungus/Scripts/Editor/BlockEditor.cs +++ b/Assets/Fungus/Scripts/Editor/BlockEditor.cs @@ -167,7 +167,7 @@ namespace Fungus.EditorUtils // EventType.contextClick doesn't register since we moved the Block Editor to be inside // a GUI Area, no idea why. As a workaround we just check for right click instead. - if (Event.current.type == EventType.mouseUp && + if (Event.current.type == EventType.MouseUp && Event.current.button == 1) { ShowContextMenu(); @@ -290,7 +290,7 @@ namespace Fungus.EditorUtils //handle movement along our selection grid before something else eats our inputs - if (Event.current.type == EventType.keyDown) + if (Event.current.type == EventType.KeyDown) { //up down to change selection / esc to clear field if (Event.current.keyCode == KeyCode.UpArrow) @@ -315,14 +315,14 @@ namespace Fungus.EditorUtils } // Previous Command - if ((Event.current.type == EventType.keyDown) && (Event.current.keyCode == KeyCode.PageUp)) + if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageUp)) { SelectPrevious(); GUI.FocusControl("dummycontrol"); Event.current.Use(); } // Next Command - if ((Event.current.type == EventType.keyDown) && (Event.current.keyCode == KeyCode.PageDown)) + if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageDown)) { SelectNext(); GUI.FocusControl("dummycontrol"); diff --git a/Assets/Fungus/Scripts/Editor/BlockInspector.cs b/Assets/Fungus/Scripts/Editor/BlockInspector.cs index cfce2dbf..c27bb949 100644 --- a/Assets/Fungus/Scripts/Editor/BlockInspector.cs +++ b/Assets/Fungus/Scripts/Editor/BlockInspector.cs @@ -214,7 +214,7 @@ namespace Fungus.EditorUtils EditorGUIUtility.AddCursorRect(cursorChangeRect, MouseCursor.ResizeVertical); - if (Event.current.type == EventType.mouseDown && cursorChangeRect.Contains(Event.current.mousePosition)) + if (Event.current.type == EventType.MouseDown && cursorChangeRect.Contains(Event.current.mousePosition)) { resize = true; } @@ -229,7 +229,7 @@ namespace Fungus.EditorUtils // Stop resizing if mouse is outside inspector window. // This isn't standard Unity UI behavior but it is robust and safe. - if (resize && Event.current.type == EventType.mouseDrag) + if (resize && Event.current.type == EventType.MouseDrag) { Rect windowRect = new Rect(0, 0, Screen.width, Screen.height); if (!windowRect.Contains(Event.current.mousePosition)) diff --git a/Assets/Fungus/Scripts/Editor/EnumFlagDrawer.cs b/Assets/Fungus/Scripts/Editor/EnumFlagDrawer.cs index d38aa663..28e1fb7f 100644 --- a/Assets/Fungus/Scripts/Editor/EnumFlagDrawer.cs +++ b/Assets/Fungus/Scripts/Editor/EnumFlagDrawer.cs @@ -22,7 +22,12 @@ namespace Fungus propName = property.name; EditorGUI.BeginProperty(position, label, property); +#if UNITY_2017_3_OR_NEWER + + Enum enumNew = EditorGUI.EnumFlagsField(position, propName, targetEnum); +#else Enum enumNew = EditorGUI.EnumMaskField(position, propName, targetEnum); +#endif property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType()); EditorGUI.EndProperty(); } diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs b/Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs index 27ad3ba5..aec4ee42 100644 --- a/Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs +++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs @@ -37,9 +37,16 @@ namespace Fungus var executeHandler = (ExecuteHandler)target; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(new GUIContent("On Event")); +#if UNITY_2017_3_OR_NEWER + executeHandler.ExecuteMethods = (ExecuteMethod)EditorGUILayout.EnumFlagsField(executeHandler.ExecuteMethods, + EditorStyles.popup, + GUILayout.ExpandWidth(false)); +#else executeHandler.ExecuteMethods = (ExecuteMethod)EditorGUILayout.EnumMaskField(executeHandler.ExecuteMethods, EditorStyles.popup, GUILayout.ExpandWidth(false)); +#endif + EditorGUILayout.EndHorizontal(); if (executeHandler.IsExecuteMethodSelected(ExecuteMethod.AfterPeriodOfTime)) diff --git a/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs b/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs index 71307e48..d88732ee 100644 --- a/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs +++ b/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs @@ -41,9 +41,15 @@ namespace UnityTest var script = (AssertionComponent)target; EditorGUILayout.BeginHorizontal(); var obj = DrawComparerSelection(script); +#if UNITY_2017_3_OR_NEWER + script.checkMethods = (CheckMethod)EditorGUILayout.EnumFlagsField(script.checkMethods, + EditorStyles.popup, + GUILayout.ExpandWidth(false)); +#else script.checkMethods = (CheckMethod)EditorGUILayout.EnumMaskField(script.checkMethods, EditorStyles.popup, GUILayout.ExpandWidth(false)); +#endif EditorGUILayout.EndHorizontal(); if (script.IsCheckMethodSelected(CheckMethod.AfterPeriodOfTime)) diff --git a/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs b/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs index 31e1b1e5..f1c8ab48 100644 --- a/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs +++ b/Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs @@ -197,9 +197,16 @@ namespace UnityTest EditorGUILayout.BeginVertical(GUILayout.MaxWidth(250)); + +#if UNITY_2017_3_OR_NEWER + EditorGUILayout.EnumFlagsField(assertionComponent.checkMethods, + EditorStyles.popup, + GUILayout.MaxWidth(150)); +#else EditorGUILayout.EnumMaskField(assertionComponent.checkMethods, EditorStyles.popup, GUILayout.MaxWidth(150)); +#endif EditorGUILayout.EndVertical(); diff --git a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs index 5c548bfc..d6fc755b 100644 --- a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs +++ b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs @@ -116,7 +116,11 @@ namespace UnityTest.IntegrationTests case RuntimePlatform.WindowsPlayer: return BuildTarget.StandaloneWindows; case RuntimePlatform.OSXPlayer: +#if UNITY_2017_3_OR_NEWER + return BuildTarget.StandaloneOSX; +#else return BuildTarget.StandaloneOSXIntel; +#endif case RuntimePlatform.LinuxPlayer: return BuildTarget.StandaloneLinux; } diff --git a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs index ee17648a..c7aa80da 100644 --- a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs +++ b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs @@ -55,8 +55,12 @@ public class PlatformRunnerConfiguration case BuildTarget.StandaloneWindows: case BuildTarget.StandaloneWindows64: return path + ".exe"; +#if UNITY_2017_3_OR_NEWER + case BuildTarget.StandaloneOSX: +#else case BuildTarget.StandaloneOSXIntel: case BuildTarget.StandaloneOSXIntel64: +#endif case BuildTarget.StandaloneLinuxUniversal: return path + ".app"; case BuildTarget.Android: diff --git a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs index 7bca8514..bd7e21a9 100644 --- a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs +++ b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs @@ -193,7 +193,7 @@ namespace UnityTest.IntegrationTests var rect = GUILayoutUtility.GetRect(guiContent, EditorStyles.label); if (rect.Contains(Event.current.mousePosition)) { - if (Event.current.type == EventType.mouseDown && Event.current.button == 0) + if (Event.current.type == EventType.MouseDown && Event.current.button == 0) { selectString = scenePath; Event.current.Use(); diff --git a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs index 9f4f35db..906e5429 100644 --- a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs +++ b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs @@ -17,7 +17,7 @@ namespace UnityTest protected internal override void DrawLine(Rect rect, GUIContent label, bool isSelected, RenderingOptions options) { - if(Event.current.type != EventType.repaint) + if(Event.current.type != EventType.Repaint) return; Styles.testName.Draw (rect, label, false, false, false, isSelected); diff --git a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs index 0ab3125a..323400b2 100644 --- a/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs +++ b/Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs @@ -91,7 +91,7 @@ namespace UnityTest protected void OnLeftMouseButtonClick(Rect rect) { - if (rect.Contains(Event.current.mousePosition) && Event.current.type == EventType.mouseDown && Event.current.button == 0) + if (rect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseDown && Event.current.button == 0) { rect.width = 20; if (rect.Contains(Event.current.mousePosition)) return; diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index ca1aa057..a211ccd3 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.1.0f3 +m_EditorVersion: 2017.1.1f1