Browse Source

Fixed compiler warnings in Untity2017.3

Retains backwards compatibility with Unity 2017.1
master
Chris Gregan 7 years ago
parent
commit
b2ff80220e
  1. 8
      Assets/Fungus/Scripts/Editor/BlockEditor.cs
  2. 4
      Assets/Fungus/Scripts/Editor/BlockInspector.cs
  3. 5
      Assets/Fungus/Scripts/Editor/EnumFlagDrawer.cs
  4. 7
      Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs
  5. 6
      Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs
  6. 7
      Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs
  7. 4
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs
  8. 4
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs
  9. 2
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs
  10. 2
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestLine.cs
  11. 2
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs
  12. 2
      ProjectSettings/ProjectVersion.txt

8
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 // 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. // 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) Event.current.button == 1)
{ {
ShowContextMenu(); ShowContextMenu();
@ -290,7 +290,7 @@ namespace Fungus.EditorUtils
//handle movement along our selection grid before something else eats our inputs //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 //up down to change selection / esc to clear field
if (Event.current.keyCode == KeyCode.UpArrow) if (Event.current.keyCode == KeyCode.UpArrow)
@ -315,14 +315,14 @@ namespace Fungus.EditorUtils
} }
// Previous Command // 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(); SelectPrevious();
GUI.FocusControl("dummycontrol"); GUI.FocusControl("dummycontrol");
Event.current.Use(); Event.current.Use();
} }
// Next Command // 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(); SelectNext();
GUI.FocusControl("dummycontrol"); GUI.FocusControl("dummycontrol");

4
Assets/Fungus/Scripts/Editor/BlockInspector.cs

@ -214,7 +214,7 @@ namespace Fungus.EditorUtils
EditorGUIUtility.AddCursorRect(cursorChangeRect, MouseCursor.ResizeVertical); 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; resize = true;
} }
@ -229,7 +229,7 @@ namespace Fungus.EditorUtils
// Stop resizing if mouse is outside inspector window. // Stop resizing if mouse is outside inspector window.
// This isn't standard Unity UI behavior but it is robust and safe. // 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); Rect windowRect = new Rect(0, 0, Screen.width, Screen.height);
if (!windowRect.Contains(Event.current.mousePosition)) if (!windowRect.Contains(Event.current.mousePosition))

5
Assets/Fungus/Scripts/Editor/EnumFlagDrawer.cs

@ -22,7 +22,12 @@ namespace Fungus
propName = property.name; propName = property.name;
EditorGUI.BeginProperty(position, label, property); 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); Enum enumNew = EditorGUI.EnumMaskField(position, propName, targetEnum);
#endif
property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType()); property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType());
EditorGUI.EndProperty(); EditorGUI.EndProperty();
} }

7
Assets/Fungus/Thirdparty/FungusLua/Scripts/Editor/ExecuteHandlerEditor.cs vendored

@ -37,9 +37,16 @@ namespace Fungus
var executeHandler = (ExecuteHandler)target; var executeHandler = (ExecuteHandler)target;
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel(new GUIContent("On Event")); 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, executeHandler.ExecuteMethods = (ExecuteMethod)EditorGUILayout.EnumMaskField(executeHandler.ExecuteMethods,
EditorStyles.popup, EditorStyles.popup,
GUILayout.ExpandWidth(false)); GUILayout.ExpandWidth(false));
#endif
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
if (executeHandler.IsExecuteMethodSelected(ExecuteMethod.AfterPeriodOfTime)) if (executeHandler.IsExecuteMethodSelected(ExecuteMethod.AfterPeriodOfTime))

6
Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs

@ -41,9 +41,15 @@ namespace UnityTest
var script = (AssertionComponent)target; var script = (AssertionComponent)target;
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
var obj = DrawComparerSelection(script); 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, script.checkMethods = (CheckMethod)EditorGUILayout.EnumMaskField(script.checkMethods,
EditorStyles.popup, EditorStyles.popup,
GUILayout.ExpandWidth(false)); GUILayout.ExpandWidth(false));
#endif
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
if (script.IsCheckMethodSelected(CheckMethod.AfterPeriodOfTime)) if (script.IsCheckMethodSelected(CheckMethod.AfterPeriodOfTime))

7
Assets/UnityTestTools/Assertions/Editor/AssertionListRenderer.cs

@ -197,9 +197,16 @@ namespace UnityTest
EditorGUILayout.BeginVertical(GUILayout.MaxWidth(250)); 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, EditorGUILayout.EnumMaskField(assertionComponent.checkMethods,
EditorStyles.popup, EditorStyles.popup,
GUILayout.MaxWidth(150)); GUILayout.MaxWidth(150));
#endif
EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical();

4
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunner.cs

@ -116,7 +116,11 @@ namespace UnityTest.IntegrationTests
case RuntimePlatform.WindowsPlayer: case RuntimePlatform.WindowsPlayer:
return BuildTarget.StandaloneWindows; return BuildTarget.StandaloneWindows;
case RuntimePlatform.OSXPlayer: case RuntimePlatform.OSXPlayer:
#if UNITY_2017_3_OR_NEWER
return BuildTarget.StandaloneOSX;
#else
return BuildTarget.StandaloneOSXIntel; return BuildTarget.StandaloneOSXIntel;
#endif
case RuntimePlatform.LinuxPlayer: case RuntimePlatform.LinuxPlayer:
return BuildTarget.StandaloneLinux; return BuildTarget.StandaloneLinux;
} }

4
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerConfiguration.cs

@ -55,8 +55,12 @@ public class PlatformRunnerConfiguration
case BuildTarget.StandaloneWindows: case BuildTarget.StandaloneWindows:
case BuildTarget.StandaloneWindows64: case BuildTarget.StandaloneWindows64:
return path + ".exe"; return path + ".exe";
#if UNITY_2017_3_OR_NEWER
case BuildTarget.StandaloneOSX:
#else
case BuildTarget.StandaloneOSXIntel: case BuildTarget.StandaloneOSXIntel:
case BuildTarget.StandaloneOSXIntel64: case BuildTarget.StandaloneOSXIntel64:
#endif
case BuildTarget.StandaloneLinuxUniversal: case BuildTarget.StandaloneLinuxUniversal:
return path + ".app"; return path + ".app";
case BuildTarget.Android: case BuildTarget.Android:

2
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/PlatformRunner/PlatformRunnerSettingsWindow.cs

@ -193,7 +193,7 @@ namespace UnityTest.IntegrationTests
var rect = GUILayoutUtility.GetRect(guiContent, EditorStyles.label); var rect = GUILayoutUtility.GetRect(guiContent, EditorStyles.label);
if (rect.Contains(Event.current.mousePosition)) 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; selectString = scenePath;
Event.current.Use(); Event.current.Use();

2
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) 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; return;
Styles.testName.Draw (rect, label, false, false, false, isSelected); Styles.testName.Draw (rect, label, false, false, false, isSelected);

2
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Renderer/IntegrationTestRendererBase.cs

@ -91,7 +91,7 @@ namespace UnityTest
protected void OnLeftMouseButtonClick(Rect rect) 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; rect.width = 20;
if (rect.Contains(Event.current.mousePosition)) return; if (rect.Contains(Event.current.mousePosition)) return;

2
ProjectSettings/ProjectVersion.txt

@ -1 +1 @@
m_EditorVersion: 2017.1.0f3 m_EditorVersion: 2017.1.1f1

Loading…
Cancel
Save