diff --git a/UnityDecompiled.sln b/UnityDecompiled.sln index c24d879e..506ee4cc 100644 --- a/UnityDecompiled.sln +++ b/UnityDecompiled.sln @@ -1,18 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEngine", "UnityEngine\UnityEngine.csproj", "{45BFEA31-16C1-4F6A-AC9B-EFA7A5449446}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEngine", "UnityEngine\UnityEngine.csproj", "{87EA7A76-1542-4CAA-B07E-3DABE44E610B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEditor", "UnityEditor\UnityEditor.csproj", "{5905B295-D0F8-4B28-92B8-DF4FB546261A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEditor", "UnityEditor\UnityEditor.csproj", "{393C16E7-D08F-4507-BD5D-768479734462}" ProjectSection(ProjectDependencies) = postProject - {45BFEA31-16C1-4F6A-AC9B-EFA7A5449446} = {45BFEA31-16C1-4F6A-AC9B-EFA7A5449446} + {87EA7A76-1542-4CAA-B07E-3DABE44E610B} = {87EA7A76-1542-4CAA-B07E-3DABE44E610B} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEditor.UI", "UnityEditor.UI\UnityEditor.UI.csproj", "{0202EE81-8DBB-4C49-9668-2AC7F15E1A1D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEditor.UI", "UnityEditor.UI\UnityEditor.UI.csproj", "{04B72AAC-C806-40B8-AFF3-50C3F0355A11}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEngine.UI", "UnityEngine.UI\UnityEngine.UI.csproj", "{F7CDA827-F65F-486A-80A6-948FDDD88300}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEngine.UI", "UnityEngine.UI\UnityEngine.UI.csproj", "{A2D84E72-888B-43DE-B8E8-42CE1813FC15}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -20,22 +20,22 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0202EE81-8DBB-4C49-9668-2AC7F15E1A1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0202EE81-8DBB-4C49-9668-2AC7F15E1A1D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0202EE81-8DBB-4C49-9668-2AC7F15E1A1D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0202EE81-8DBB-4C49-9668-2AC7F15E1A1D}.Release|Any CPU.Build.0 = Release|Any CPU - {45BFEA31-16C1-4F6A-AC9B-EFA7A5449446}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {45BFEA31-16C1-4F6A-AC9B-EFA7A5449446}.Debug|Any CPU.Build.0 = Debug|Any CPU - {45BFEA31-16C1-4F6A-AC9B-EFA7A5449446}.Release|Any CPU.ActiveCfg = Release|Any CPU - {45BFEA31-16C1-4F6A-AC9B-EFA7A5449446}.Release|Any CPU.Build.0 = Release|Any CPU - {5905B295-D0F8-4B28-92B8-DF4FB546261A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5905B295-D0F8-4B28-92B8-DF4FB546261A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5905B295-D0F8-4B28-92B8-DF4FB546261A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5905B295-D0F8-4B28-92B8-DF4FB546261A}.Release|Any CPU.Build.0 = Release|Any CPU - {F7CDA827-F65F-486A-80A6-948FDDD88300}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F7CDA827-F65F-486A-80A6-948FDDD88300}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F7CDA827-F65F-486A-80A6-948FDDD88300}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F7CDA827-F65F-486A-80A6-948FDDD88300}.Release|Any CPU.Build.0 = Release|Any CPU + {87EA7A76-1542-4CAA-B07E-3DABE44E610B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87EA7A76-1542-4CAA-B07E-3DABE44E610B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87EA7A76-1542-4CAA-B07E-3DABE44E610B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87EA7A76-1542-4CAA-B07E-3DABE44E610B}.Release|Any CPU.Build.0 = Release|Any CPU + {393C16E7-D08F-4507-BD5D-768479734462}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {393C16E7-D08F-4507-BD5D-768479734462}.Debug|Any CPU.Build.0 = Debug|Any CPU + {393C16E7-D08F-4507-BD5D-768479734462}.Release|Any CPU.ActiveCfg = Release|Any CPU + {393C16E7-D08F-4507-BD5D-768479734462}.Release|Any CPU.Build.0 = Release|Any CPU + {04B72AAC-C806-40B8-AFF3-50C3F0355A11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04B72AAC-C806-40B8-AFF3-50C3F0355A11}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04B72AAC-C806-40B8-AFF3-50C3F0355A11}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04B72AAC-C806-40B8-AFF3-50C3F0355A11}.Release|Any CPU.Build.0 = Release|Any CPU + {A2D84E72-888B-43DE-B8E8-42CE1813FC15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2D84E72-888B-43DE-B8E8-42CE1813FC15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2D84E72-888B-43DE-B8E8-42CE1813FC15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2D84E72-888B-43DE-B8E8-42CE1813FC15}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UnityEditor.UI/UnityEditor.UI.csproj b/UnityEditor.UI/UnityEditor.UI.csproj index e9b719a9..fc5b5578 100644 --- a/UnityEditor.UI/UnityEditor.UI.csproj +++ b/UnityEditor.UI/UnityEditor.UI.csproj @@ -1,7 +1,7 @@ - + - {0202EE81-8DBB-4C49-9668-2AC7F15E1A1D} + {04B72AAC-C806-40B8-AFF3-50C3F0355A11} Debug AnyCPU Library diff --git a/UnityEditor.UI/UnityEditor.UI/HorizontalOrVerticalLayoutGroupEditor.cs b/UnityEditor.UI/UnityEditor.UI/HorizontalOrVerticalLayoutGroupEditor.cs index 15774236..d694f493 100644 --- a/UnityEditor.UI/UnityEditor.UI/HorizontalOrVerticalLayoutGroupEditor.cs +++ b/UnityEditor.UI/UnityEditor.UI/HorizontalOrVerticalLayoutGroupEditor.cs @@ -39,7 +39,7 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(this.m_Spacing, true, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_ChildAlignment, true, new GUILayoutOption[0]); Rect rect = EditorGUILayout.GetControlRect(new GUILayoutOption[0]); - rect = EditorGUI.PrefixLabel(rect, -1, new GUIContent("Child Control Size")); + rect = EditorGUI.PrefixLabel(rect, -1, new GUIContent("Control Child Size")); rect.width = Mathf.Max(50f, (rect.width - 4f) / 3f); EditorGUIUtility.labelWidth = 50f; this.ToggleLeft(rect, this.m_ChildControlWidth, new GUIContent("Width")); diff --git a/UnityEditor/DesktopStandalonePostProcessor.cs b/UnityEditor/DesktopStandalonePostProcessor.cs index 32f58a33..67573f74 100644 --- a/UnityEditor/DesktopStandalonePostProcessor.cs +++ b/UnityEditor/DesktopStandalonePostProcessor.cs @@ -252,7 +252,7 @@ protected virtual void SetupStagingArea() string text4 = text2 + "/Metadata"; IL2CPPUtils.RunIl2Cpp(text, this.GetPlatformProvider(this.m_PostProcessArgs.target), delegate(string s) { - }, this.m_PostProcessArgs.usedClassRegistry, this.Development); + }, this.m_PostProcessArgs.usedClassRegistry, false); FileUtil.CreateOrCleanDirectory(text3); IL2CPPUtils.CopyEmbeddedResourceFiles(text, text3); FileUtil.CreateOrCleanDirectory(text4); diff --git a/UnityEditor/UnityEditor.Modules/DefaultTextureImportSettingsExtension.cs b/UnityEditor/UnityEditor.Modules/DefaultTextureImportSettingsExtension.cs index e5f837df..8cad0fa8 100644 --- a/UnityEditor/UnityEditor.Modules/DefaultTextureImportSettingsExtension.cs +++ b/UnityEditor/UnityEditor.Modules/DefaultTextureImportSettingsExtension.cs @@ -204,7 +204,7 @@ public virtual void ShowImportSettings(Editor baseEditor, TextureImportPlatformS } bool flag2 = TextureImporter.IsETC1SupportedByBuildTarget(BuildPipeline.GetBuildTargetByName(platformSettings.name)); bool flag3 = textureImporterInspector.spriteImportMode != SpriteImportMode.None; - bool flag4 = platformSettings.textureCompression != TextureImporterCompression.Uncompressed || TextureImporter.IsTextureFormatETC1Compression((TextureFormat)num); + bool flag4 = TextureImporter.IsTextureFormatETC1Compression((TextureFormat)num); if (flag2 && flag3 && flag4) { EditorGUI.BeginChangeCheck(); diff --git a/UnityEditor/UnityEditor.Modules/ModuleManager.cs b/UnityEditor/UnityEditor.Modules/ModuleManager.cs index 1d9be90d..e49af133 100644 --- a/UnityEditor/UnityEditor.Modules/ModuleManager.cs +++ b/UnityEditor/UnityEditor.Modules/ModuleManager.cs @@ -184,7 +184,7 @@ private static string CombinePaths(params string[] paths) private static void LoadUnityExtensions() { - foreach (PackageInfo current in ModuleManager.s_PackageManager.get_unityExtensions()) + foreach (Unity.DataContract.PackageInfo current in ModuleManager.s_PackageManager.unityExtensions) { Console.WriteLine("Setting {0} v{1} for Unity v{2} to {3}", new object[] { @@ -193,8 +193,8 @@ private static void LoadUnityExtensions() current.unityVersion, current.basePath }); - foreach (KeyValuePair current2 in from f in current.get_files() - where f.Value.type == 3 + foreach (KeyValuePair current2 in from f in current.files + where f.Value.type == PackageFileType.Dll select f) { string text = Path.Combine(current.basePath, current2.Key).NormalizePath(); @@ -313,13 +313,13 @@ where a.GetName().Name == "Unity.Locator" Console.WriteLine("Error scanning for packages. {0}", arg2); return; } - PackageInfo packageInfo; + Unity.DataContract.PackageInfo packageInfo; try { packageInfo = (type.InvokeMember("GetPackageManager", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, new string[] { Application.unityVersion - }) as PackageInfo); + }) as Unity.DataContract.PackageInfo); if (packageInfo == null) { Console.WriteLine("No package manager found!"); @@ -345,10 +345,10 @@ where a.GetName().Name == "Unity.Locator" } } - private static bool InitializePackageManager(PackageInfo package) + private static bool InitializePackageManager(Unity.DataContract.PackageInfo package) { - string text = (from x in package.get_files() - where x.Value.type == 3 + string text = (from x in package.files + where x.Value.type == PackageFileType.Dll select x.Key).FirstOrDefault(); bool result; if (text == null || !File.Exists(Path.Combine(package.basePath, text))) @@ -364,7 +364,7 @@ private static bool InitializePackageManager(PackageInfo package) return result; } - private static bool InitializePackageManager(Assembly assembly, PackageInfo package) + private static bool InitializePackageManager(Assembly assembly, Unity.DataContract.PackageInfo package) { ModuleManager.s_PackageManager = AssemblyHelper.FindImplementors(assembly).FirstOrDefault(); bool result; @@ -381,16 +381,16 @@ private static bool InitializePackageManager(Assembly assembly, PackageInfo pack } else { - package = new PackageInfo + package = new Unity.DataContract.PackageInfo { basePath = Path.GetDirectoryName(location) }; } - ModuleManager.s_PackageManager.set_moduleInfo(package); - ModuleManager.s_PackageManager.set_editorInstallPath(EditorApplication.applicationContentsPath); - ModuleManager.s_PackageManager.set_unityVersion(new PackageVersion(Application.unityVersion)); + ModuleManager.s_PackageManager.moduleInfo = package; + ModuleManager.s_PackageManager.editorInstallPath = EditorApplication.applicationContentsPath; + ModuleManager.s_PackageManager.unityVersion = new PackageVersion(Application.unityVersion); ModuleManager.s_PackageManager.Initialize(); - foreach (PackageInfo current in ModuleManager.s_PackageManager.get_playbackEngines()) + foreach (Unity.DataContract.PackageInfo current in ModuleManager.s_PackageManager.playbackEngines) { BuildTarget buildTarget = BuildTarget.StandaloneWindows; if (ModuleManager.TryParseBuildTarget(current.name, out buildTarget)) @@ -402,8 +402,8 @@ private static bool InitializePackageManager(Assembly assembly, PackageInfo pack current.unityVersion, current.basePath }); - foreach (KeyValuePair current2 in from f in current.get_files() - where f.Value.type == 3 + foreach (KeyValuePair current2 in from f in current.files + where f.Value.type == PackageFileType.Dll select f) { string path = Path.Combine(current.basePath, current2.Key).NormalizePath(); diff --git a/UnityEditor/UnityEditor.Scripting.Compilers/CSharpLanguage.cs b/UnityEditor/UnityEditor.Scripting.Compilers/CSharpLanguage.cs index 0f7fac72..04f3ae71 100644 --- a/UnityEditor/UnityEditor.Scripting.Compilers/CSharpLanguage.cs +++ b/UnityEditor/UnityEditor.Scripting.Compilers/CSharpLanguage.cs @@ -29,7 +29,7 @@ private class NamespaceVisitor : AbstractAstVisitor public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) { CSharpLanguage.VisitorData visitorData = (CSharpLanguage.VisitorData)data; - visitorData.CurrentNamespaces.Push(namespaceDeclaration.get_Name()); + visitorData.CurrentNamespaces.Push(namespaceDeclaration.Name); namespaceDeclaration.AcceptChildren(this, visitorData); visitorData.CurrentNamespaces.Pop(); return null; @@ -38,7 +38,7 @@ public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceD public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) { CSharpLanguage.VisitorData visitorData = (CSharpLanguage.VisitorData)data; - if (typeDeclaration.get_Name() == visitorData.TargetClassName) + if (typeDeclaration.Name == visitorData.TargetClassName) { string text = string.Empty; foreach (string current in visitorData.CurrentNamespaces) @@ -104,18 +104,18 @@ public override string GetNamespace(string fileName, string definedSymbols) }, StringSplitOptions.RemoveEmptyEntries)); foreach (string current in hashSet) { - parser.get_Lexer().get_ConditionalCompilationSymbols().Add(current, string.Empty); + parser.Lexer.ConditionalCompilationSymbols.Add(current, string.Empty); } - parser.get_Lexer().set_EvaluateConditionalCompilation(true); + parser.Lexer.EvaluateConditionalCompilation = true; parser.Parse(); try { - CSharpLanguage.NamespaceVisitor namespaceVisitor = new CSharpLanguage.NamespaceVisitor(); + CSharpLanguage.NamespaceVisitor visitor = new CSharpLanguage.NamespaceVisitor(); CSharpLanguage.VisitorData visitorData = new CSharpLanguage.VisitorData { TargetClassName = Path.GetFileNameWithoutExtension(fileName) }; - parser.get_CompilationUnit().AcceptVisitor(namespaceVisitor, visitorData); + parser.CompilationUnit.AcceptVisitor(visitor, visitorData); result = ((!string.IsNullOrEmpty(visitorData.DiscoveredNamespace)) ? visitorData.DiscoveredNamespace : string.Empty); return result; } diff --git a/UnityEditor/UnityEditor.Scripting.Compilers/MicrosoftCSharpCompiler.cs b/UnityEditor/UnityEditor.Scripting.Compilers/MicrosoftCSharpCompiler.cs index 050e8fbc..9a24c8e2 100644 --- a/UnityEditor/UnityEditor.Scripting.Compilers/MicrosoftCSharpCompiler.cs +++ b/UnityEditor/UnityEditor.Scripting.Compilers/MicrosoftCSharpCompiler.cs @@ -11,8 +11,6 @@ namespace UnityEditor.Scripting.Compilers { internal class MicrosoftCSharpCompiler : ScriptCompilerBase { - private static string[] _uwpReferences; - internal static string WindowsDirectory { get @@ -278,6 +276,11 @@ private void FillNETCoreCompilerOptions(WSASDK wsaSDK, List arguments, r } } + private static void ThrowCompilerNotFoundException(string path) + { + throw new Exception(string.Format("'{0}' not found. Is your Unity installation corrupted?", path)); + } + private Program StartCompilerImpl(List arguments, string argsPrefix, bool msBuildCompiler) { string[] references = this._island._references; @@ -296,24 +299,41 @@ private Program StartCompilerImpl(List arguments, string argsPrefix, boo string fileName2 = files[j]; arguments.Add(ScriptCompilerBase.PrepareFileName(fileName2).Replace('/', '\\')); } - string text; - if (msBuildCompiler) + string text = Paths.Combine(new string[] { - text = Path.Combine(MicrosoftCSharpCompiler.ProgramFilesDirectory, "MSBuild\\14.0\\Bin\\csc.exe"); - } - else + EditorApplication.applicationContentsPath, + "Tools", + "Roslyn", + "CoreRun.exe" + }).Replace('/', '\\'); + string text2 = Paths.Combine(new string[] { - text = Path.Combine(MicrosoftCSharpCompiler.WindowsDirectory, "Microsoft.NET\\Framework\\v4.0.30319\\Csc.exe"); - } + EditorApplication.applicationContentsPath, + "Tools", + "Roslyn", + "csc.exe" + }).Replace('/', '\\'); if (!File.Exists(text)) { - throw new Exception("'" + text + "' not found, either .NET 4.5 is not installed or your OS is not Windows 8/8.1."); + MicrosoftCSharpCompiler.ThrowCompilerNotFoundException(text); + } + if (!File.Exists(text2)) + { + MicrosoftCSharpCompiler.ThrowCompilerNotFoundException(text2); } base.AddCustomResponseFileIfPresent(arguments, "csc.rsp"); - string str = CommandLineFormatter.GenerateResponseFile(arguments); + string text3 = CommandLineFormatter.GenerateResponseFile(arguments); ProcessStartInfo si = new ProcessStartInfo { - Arguments = argsPrefix + "@" + str, + Arguments = string.Concat(new string[] + { + "\"", + text2, + "\" ", + argsPrefix, + "@", + text3 + }), FileName = text, CreateNoWindow = true }; @@ -402,14 +422,9 @@ internal static string[] GetAdditionalReferences(WSASDK wsaSDK) { result = null; } - else if (MicrosoftCSharpCompiler._uwpReferences != null) - { - result = MicrosoftCSharpCompiler._uwpReferences; - } else { - MicrosoftCSharpCompiler._uwpReferences = UWPReferences.GetReferences(); - result = MicrosoftCSharpCompiler._uwpReferences; + result = UWPReferences.GetReferences(UWPReferences.GetDesiredSDKVersion()); } return result; } @@ -420,7 +435,19 @@ internal static string GetPlatformAssemblyPath(WSASDK wsaSDK) string result; if (wsaSDK == WSASDK.UWP) { - result = Path.Combine(windowsKitDirectory, "UnionMetadata\\Facade\\Windows.winmd"); + string text = Paths.Combine(new string[] + { + windowsKitDirectory, + "UnionMetadata", + UWPReferences.SdkVersionToString(UWPReferences.GetDesiredSDKVersion()), + "Facade", + "Windows.winmd" + }); + if (!File.Exists(text)) + { + text = Path.Combine(windowsKitDirectory, "UnionMetadata\\Facade\\Windows.winmd"); + } + result = text; } else { diff --git a/UnityEditor/UnityEditor.Scripting.Compilers/UWPReferences.cs b/UnityEditor/UnityEditor.Scripting.Compilers/UWPReferences.cs index febf07d7..ad4e06b4 100644 --- a/UnityEditor/UnityEditor.Scripting.Compilers/UWPReferences.cs +++ b/UnityEditor/UnityEditor.Scripting.Compilers/UWPReferences.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Xml.Linq; +using UnityEditor.Utils; using UnityEditorInternal; namespace UnityEditor.Scripting.Compilers @@ -23,7 +24,7 @@ public string[] References private set; } - public UWPExtension(string manifest, string referencesFolder) + public UWPExtension(string manifest, string windowsKitsFolder, string sdkVersion) { XDocument xDocument = XDocument.Load(manifest); XElement xElement = xDocument.Element("FileList"); @@ -33,68 +34,204 @@ public UWPExtension(string manifest, string referencesFolder) } this.Name = xElement.Attribute("DisplayName").Value; XElement containedApiContractsElement = xElement.Element("ContainedApiContracts"); - this.References = UWPReferences.GetReferences(referencesFolder, containedApiContractsElement); + this.References = UWPReferences.GetReferences(windowsKitsFolder, sdkVersion, containedApiContractsElement); } } - public static string[] GetReferences() + public static string[] GetReferences(Version sdkVersion) { - string text; - string version; - UWPReferences.GetSDKFolderAndVersion(out text, out version); - HashSet hashSet = new HashSet(StringComparer.InvariantCultureIgnoreCase); - string item = Path.Combine(text, "UnionMetadata\\Facade\\Windows.winmd"); - hashSet.Add(item); - string[] platform = UWPReferences.GetPlatform(text, version); - for (int i = 0; i < platform.Length; i++) - { - string item2 = platform[i]; - hashSet.Add(item2); - } - UWPReferences.UWPExtension[] extensions = UWPReferences.GetExtensions(text, version); - for (int j = 0; j < extensions.Length; j++) - { - UWPReferences.UWPExtension uWPExtension = extensions[j]; - string[] references = uWPExtension.References; - for (int k = 0; k < references.Length; k++) + string windowsKit = UWPReferences.GetWindowsKit10(); + string[] result; + if (string.IsNullOrEmpty(windowsKit)) + { + result = new string[0]; + } + else + { + string text = UWPReferences.SdkVersionToString(sdkVersion); + HashSet hashSet = new HashSet(StringComparer.InvariantCultureIgnoreCase); + string text2 = UWPReferences.CombinePaths(new string[] { - string item3 = references[k]; - hashSet.Add(item3); + windowsKit, + "UnionMetadata", + text, + "Facade", + "Windows.winmd" + }); + if (!File.Exists(text2)) + { + text2 = UWPReferences.CombinePaths(new string[] + { + windowsKit, + "UnionMetadata", + "Facade", + "Windows.winmd" + }); } + hashSet.Add(text2); + string[] platform = UWPReferences.GetPlatform(windowsKit, text); + for (int i = 0; i < platform.Length; i++) + { + string item = platform[i]; + hashSet.Add(item); + } + UWPReferences.UWPExtension[] extensions = UWPReferences.GetExtensions(windowsKit, text); + for (int j = 0; j < extensions.Length; j++) + { + UWPReferences.UWPExtension uWPExtension = extensions[j]; + string[] references = uWPExtension.References; + for (int k = 0; k < references.Length; k++) + { + string item2 = references[k]; + hashSet.Add(item2); + } + } + result = hashSet.ToArray(); } - return hashSet.ToArray(); + return result; } - public static IEnumerable GetExtensionSDKs() + public static IEnumerable GetExtensionSDKs(Version sdkVersion) { - string sdkFolder; - string sdkVersion; - UWPReferences.GetSDKFolderAndVersion(out sdkFolder, out sdkVersion); - return UWPReferences.GetExtensionSDKs(sdkFolder, sdkVersion); + string windowsKit = UWPReferences.GetWindowsKit10(); + IEnumerable result; + if (string.IsNullOrEmpty(windowsKit)) + { + result = new UWPExtensionSDK[0]; + } + else + { + result = UWPReferences.GetExtensionSDKs(windowsKit, UWPReferences.SdkVersionToString(sdkVersion)); + } + return result; } - private static void GetSDKFolderAndVersion(out string sdkFolder, out string sdkVersion) + internal static string SdkVersionToString(Version version) { - Version version; - UWPReferences.GetWindowsKit10(out sdkFolder, out version); - sdkVersion = version.ToString(); + string text = version.ToString(); if (version.Minor == -1) { - sdkVersion += ".0"; + text += ".0"; } if (version.Build == -1) { - sdkVersion += ".0"; + text += ".0"; } if (version.Revision == -1) { - sdkVersion += ".0"; + text += ".0"; } + return text; + } + + public static IEnumerable GetInstalledSDKVersions() + { + string windowsKit = UWPReferences.GetWindowsKit10(); + IEnumerable result; + if (string.IsNullOrEmpty(windowsKit)) + { + result = new Version[0]; + } + else + { + string[] files = Directory.GetFiles(UWPReferences.CombinePaths(new string[] + { + windowsKit, + "Platforms", + "UAP" + }), "*", SearchOption.AllDirectories); + IEnumerable enumerable = from f in files + where string.Equals("Platform.xml", Path.GetFileName(f), StringComparison.OrdinalIgnoreCase) + select f; + List list = new List(); + foreach (string current in enumerable) + { + XDocument xDocument; + try + { + xDocument = XDocument.Load(current); + } + catch + { + continue; + } + foreach (XNode current2 in xDocument.Nodes()) + { + XElement xElement = current2 as XElement; + if (xElement != null) + { + Version item; + if (UWPReferences.FindVersionInNode(xElement, out item)) + { + list.Add(item); + } + } + } + } + result = list; + } + return result; + } + + public static Version GetDesiredSDKVersion() + { + Version[] array = UWPReferences.GetInstalledSDKVersions().ToArray(); + Version result; + if (array.Length == 0) + { + result = new Version(10, 0, 10240, 0); + } + else + { + Version version = array.Max(); + string wsaUWPSDK = EditorUserBuildSettings.wsaUWPSDK; + if (string.IsNullOrEmpty(wsaUWPSDK)) + { + result = version; + } + else + { + Version[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + Version version2 = array2[i]; + if (version2.ToString() == wsaUWPSDK) + { + result = version2; + return result; + } + } + result = version; + } + } + return result; + } + + private static bool FindVersionInNode(XElement node, out Version version) + { + bool result; + for (XAttribute xAttribute = node.FirstAttribute; xAttribute != null; xAttribute = xAttribute.NextAttribute) + { + if (string.Equals(xAttribute.Name.LocalName, "version", StringComparison.OrdinalIgnoreCase)) + { + try + { + version = new Version(xAttribute.Value); + result = true; + return result; + } + catch + { + } + } + } + version = null; + result = false; + return result; } private static string[] GetPlatform(string folder, string version) { - string referencesFolder = Path.Combine(folder, "References"); string text = FileUtil.CombinePaths(new string[] { folder, @@ -109,59 +246,67 @@ private static string[] GetPlatform(string folder, string version) throw new Exception(string.Format("Invalid platform manifest at \"{0}\".", text)); } XElement containedApiContractsElement = xElement.Element("ContainedApiContracts"); - return UWPReferences.GetReferences(referencesFolder, containedApiContractsElement); + return UWPReferences.GetReferences(folder, version, containedApiContractsElement); } private static string CombinePaths(params string[] paths) { - return FileUtil.CombinePaths(paths); + return Paths.Combine(paths); } private static IEnumerable GetExtensionSDKs(string sdkFolder, string sdkVersion) { List list = new List(); string path = Path.Combine(sdkFolder, "Extension SDKs"); - string[] directories = Directory.GetDirectories(path); - for (int i = 0; i < directories.Length; i++) + IEnumerable result; + if (!Directory.Exists(path)) { - string text = directories[i]; - string text2 = UWPReferences.CombinePaths(new string[] - { - text, - sdkVersion, - "SDKManifest.xml" - }); - string fileName = Path.GetFileName(text); - if (File.Exists(text2)) - { - list.Add(new UWPExtensionSDK(fileName, sdkVersion, text2)); - } - else if (fileName == "XboxLive") + result = new UWPExtensionSDK[0]; + } + else + { + string[] directories = Directory.GetDirectories(path); + for (int i = 0; i < directories.Length; i++) { - text2 = UWPReferences.CombinePaths(new string[] + string text = directories[i]; + string text2 = UWPReferences.CombinePaths(new string[] { text, - "1.0", + sdkVersion, "SDKManifest.xml" }); + string fileName = Path.GetFileName(text); if (File.Exists(text2)) { - list.Add(new UWPExtensionSDK(fileName, "1.0", text2)); + list.Add(new UWPExtensionSDK(fileName, sdkVersion, text2)); + } + else if (fileName == "XboxLive") + { + text2 = UWPReferences.CombinePaths(new string[] + { + text, + "1.0", + "SDKManifest.xml" + }); + if (File.Exists(text2)) + { + list.Add(new UWPExtensionSDK(fileName, "1.0", text2)); + } } } + result = list; } - return list; + return result; } - private static UWPReferences.UWPExtension[] GetExtensions(string folder, string version) + private static UWPReferences.UWPExtension[] GetExtensions(string windowsKitsFolder, string version) { List list = new List(); - string referencesFolder = Path.Combine(folder, "References"); - foreach (UWPExtensionSDK current in UWPReferences.GetExtensionSDKs(folder, version)) + foreach (UWPExtensionSDK current in UWPReferences.GetExtensionSDKs(windowsKitsFolder, version)) { try { - UWPReferences.UWPExtension item = new UWPReferences.UWPExtension(current.ManifestPath, referencesFolder); + UWPReferences.UWPExtension item = new UWPReferences.UWPExtension(current.ManifestPath, windowsKitsFolder, version); list.Add(item); } catch @@ -171,42 +316,63 @@ private static UWPReferences.UWPExtension[] GetExtensions(string folder, string return list.ToArray(); } - private static string[] GetReferences(string referencesFolder, XElement containedApiContractsElement) + private static string[] GetReferences(string windowsKitsFolder, string sdkVersion, XElement containedApiContractsElement) { List list = new List(); foreach (XElement current in containedApiContractsElement.Elements("ApiContract")) { string value = current.Attribute("name").Value; string value2 = current.Attribute("version").Value; - string text = FileUtil.CombinePaths(new string[] + string text = UWPReferences.CombinePaths(new string[] { - referencesFolder, + windowsKitsFolder, + "References", + sdkVersion, value, value2, value + ".winmd" }); - if (File.Exists(text)) + if (!File.Exists(text)) { - list.Add(text); + text = UWPReferences.CombinePaths(new string[] + { + windowsKitsFolder, + "References", + value, + value2, + value + ".winmd" + }); + if (!File.Exists(text)) + { + continue; + } } + list.Add(text); } return list.ToArray(); } - private static void GetWindowsKit10(out string folder, out Version version) + private static string GetWindowsKit10() { string environmentVariable = Environment.GetEnvironmentVariable("ProgramFiles(x86)"); - folder = Path.Combine(environmentVariable, "Windows Kits\\10\\"); - version = new Version(10, 0, 10240); + string text = Path.Combine(environmentVariable, "Windows Kits\\10\\"); try { - folder = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "InstallationFolder", folder); - string registryStringValue = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "ProductVersion", version.ToString()); - version = new Version(registryStringValue); + text = RegistryUtil.GetRegistryStringValue32("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v10.0", "InstallationFolder", text); } catch { } + string result; + if (!Directory.Exists(text)) + { + result = string.Empty; + } + else + { + result = text; + } + return result; } } } diff --git a/UnityEditor/UnityEditor.Scripting.Serialization/Weaver.cs b/UnityEditor/UnityEditor.Scripting.Serialization/Weaver.cs index 80047476..59bfed07 100644 --- a/UnityEditor/UnityEditor.Scripting.Serialization/Weaver.cs +++ b/UnityEditor/UnityEditor.Scripting.Serialization/Weaver.cs @@ -123,7 +123,7 @@ where 0 < i._files.Length { Weaver.<>f__mg$cache1 = new Action(Debug.LogError); } - if (!Program.Process(unityEngine, unityUNet, arg_151_2, expr_10A, arg_151_4, assemblyResolver, arg_151_6, Weaver.<>f__mg$cache1)) + if (!Unity.UNetWeaver.Program.Process(unityEngine, unityUNet, arg_151_2, expr_10A, arg_151_4, assemblyResolver, arg_151_6, Weaver.<>f__mg$cache1)) { Debug.LogError("Failure generating network code."); result = false; diff --git a/UnityEditor/UnityEditor.Scripting/APIUpdaterHelper.cs b/UnityEditor/UnityEditor.Scripting/APIUpdaterHelper.cs index 607aa07c..8c1f582e 100644 --- a/UnityEditor/UnityEditor.Scripting/APIUpdaterHelper.cs +++ b/UnityEditor/UnityEditor.Scripting/APIUpdaterHelper.cs @@ -191,10 +191,10 @@ private static string AssemblySearchPathArgument() private static string ConfigurationProviderAssembliesPathArgument() { StringBuilder stringBuilder = new StringBuilder(); - foreach (PackageInfo current in ModuleManager.packageManager.get_unityExtensions()) + foreach (Unity.DataContract.PackageInfo current in ModuleManager.packageManager.unityExtensions) { - foreach (string current2 in from f in current.get_files() - where f.Value.type == 3 + foreach (string current2 in from f in current.files + where f.Value.type == PackageFileType.Dll select f into pi select pi.Key) { @@ -289,7 +289,7 @@ internal static bool MayContainUpdatableReferences(string assemblyPath) using (FileStream fileStream = File.Open(assemblyPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(fileStream); - if (assemblyDefinition.get_Name().get_IsWindowsRuntime()) + if (assemblyDefinition.Name.IsWindowsRuntime) { result = false; return result; @@ -310,9 +310,9 @@ private static bool IsTargetFrameworkValidOnCurrentOS(AssemblyDefinition assembl if (Environment.OSVersion.Platform != PlatformID.Win32NT) { int arg_48_0; - if (assembly.get_HasCustomAttributes()) + if (assembly.HasCustomAttributes) { - arg_48_0 = (assembly.get_CustomAttributes().Any((CustomAttribute attr) => APIUpdaterHelper.TargetsWindowsSpecificFramework(attr)) ? 1 : 0); + arg_48_0 = (assembly.CustomAttributes.Any((CustomAttribute attr) => APIUpdaterHelper.TargetsWindowsSpecificFramework(attr)) ? 1 : 0); } else { @@ -330,14 +330,14 @@ private static bool IsTargetFrameworkValidOnCurrentOS(AssemblyDefinition assembl private static bool TargetsWindowsSpecificFramework(CustomAttribute targetFrameworkAttr) { bool result; - if (!targetFrameworkAttr.get_AttributeType().get_FullName().Contains("System.Runtime.Versioning.TargetFrameworkAttribute")) + if (!targetFrameworkAttr.AttributeType.FullName.Contains("System.Runtime.Versioning.TargetFrameworkAttribute")) { result = false; } else { Regex regex = new Regex("\\.NETCore|\\.NETPortable"); - bool flag = targetFrameworkAttr.get_ConstructorArguments().Any((CustomAttributeArgument arg) => arg.get_Type().get_FullName() == typeof(string).FullName && regex.IsMatch((string)arg.get_Value())); + bool flag = targetFrameworkAttr.ConstructorArguments.Any((CustomAttributeArgument arg) => arg.Type.FullName == typeof(string).FullName && regex.IsMatch((string)arg.Value)); result = flag; } return result; diff --git a/UnityEditor/UnityEditor.Sprites/Packer.cs b/UnityEditor/UnityEditor.Sprites/Packer.cs index b60a45b1..3bca0a51 100644 --- a/UnityEditor/UnityEditor.Sprites/Packer.cs +++ b/UnityEditor/UnityEditor.Sprites/Packer.cs @@ -167,7 +167,7 @@ internal static void SaveUnappliedTextureImporterSettings() for (int i = 0; i < allInspectorWindows.Length; i++) { InspectorWindow inspectorWindow = allInspectorWindows[i]; - ActiveEditorTracker tracker = inspectorWindow.GetTracker(); + ActiveEditorTracker tracker = inspectorWindow.tracker; Editor[] activeEditors = tracker.activeEditors; for (int j = 0; j < activeEditors.Length; j++) { diff --git a/UnityEditor/UnityEditor.VisualStudioIntegration/DefaultSolutionSynchronizationSettings.cs b/UnityEditor/UnityEditor.VisualStudioIntegration/DefaultSolutionSynchronizationSettings.cs index d8c19628..b578a162 100644 --- a/UnityEditor/UnityEditor.VisualStudioIntegration/DefaultSolutionSynchronizationSettings.cs +++ b/UnityEditor/UnityEditor.VisualStudioIntegration/DefaultSolutionSynchronizationSettings.cs @@ -18,22 +18,22 @@ public virtual string SolutionTemplate { return string.Join("\r\n", new string[] { - "Microsoft Visual Studio Solution File, Format Version {0}", - "# Visual Studio 2008", "", - "{1}", + "Microsoft Visual Studio Solution File, Format Version {0}", + "# Visual Studio {1}", + "{2}", "Global", " GlobalSection(SolutionConfigurationPlatforms) = preSolution", " Debug|Any CPU = Debug|Any CPU", " Release|Any CPU = Release|Any CPU", " EndGlobalSection", " GlobalSection(ProjectConfigurationPlatforms) = postSolution", - "{2}", + "{3}", " EndGlobalSection", " GlobalSection(SolutionProperties) = preSolution", " HideSolutionNode = FALSE", " EndGlobalSection", - "{3}", + "{4}", "EndGlobal", "" }).Replace(" ", "\t"); diff --git a/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionGuidGenerator.cs b/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionGuidGenerator.cs index 5e5fdd9d..ba8c8fbf 100644 --- a/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionGuidGenerator.cs +++ b/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionGuidGenerator.cs @@ -13,7 +13,7 @@ public static string GuidForProject(string projectName) public static string GuidForSolution(string projectName) { - return SolutionGuidGenerator.ComputeGuidHashFor(projectName); + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; } private static string ComputeGuidHashFor(string input) diff --git a/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionSynchronizer.cs b/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionSynchronizer.cs index 275cb405..df8ddc7e 100644 --- a/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionSynchronizer.cs +++ b/UnityEditor/UnityEditor.VisualStudioIntegration/SolutionSynchronizer.cs @@ -235,7 +235,7 @@ private static void SyncFileIfNotChanged(string filename, string newContents) { if (!File.Exists(filename) || !(newContents == File.ReadAllText(filename))) { - File.WriteAllText(filename, newContents); + File.WriteAllText(filename, newContents, Encoding.UTF8); } } @@ -412,19 +412,22 @@ private static SolutionSynchronizer.Mode ModeForCurrentExternalEditor() private string SolutionText(IEnumerable islands, SolutionSynchronizer.Mode mode) { string text = "11.00"; + string text2 = "2010"; if (this._settings.VisualStudioVersion == 9) { text = "10.00"; + text2 = "2008"; } IEnumerable enumerable = SolutionSynchronizer.RelevantIslandsForMode(islands, mode); string projectEntries = this.GetProjectEntries(enumerable); - string text2 = string.Join(SolutionSynchronizer.WindowsNewline, (from i in enumerable + string text3 = string.Join(SolutionSynchronizer.WindowsNewline, (from i in enumerable select this.GetProjectActiveConfigurations(this.ProjectGuid(i._output))).ToArray()); return string.Format(this._settings.SolutionTemplate, new object[] { text, - projectEntries, text2, + projectEntries, + text3, this.ReadExistingMonoDevelopSolutionProperties() }); } diff --git a/UnityEditor/UnityEditor.csproj b/UnityEditor/UnityEditor.csproj index 5fb6dc75..04257c10 100644 --- a/UnityEditor/UnityEditor.csproj +++ b/UnityEditor/UnityEditor.csproj @@ -1,7 +1,7 @@ - + - {5905B295-D0F8-4B28-92B8-DF4FB546261A} + {393C16E7-D08F-4507-BD5D-768479734462} Debug AnyCPU Library @@ -473,6 +473,7 @@ + @@ -507,6 +508,8 @@ + + @@ -530,6 +533,7 @@ + @@ -931,6 +935,7 @@ + @@ -992,6 +997,7 @@ + diff --git a/UnityEditor/UnityEditor/AssemblyHelper.cs b/UnityEditor/UnityEditor/AssemblyHelper.cs index 7dfad637..2059f754 100644 --- a/UnityEditor/UnityEditor/AssemblyHelper.cs +++ b/UnityEditor/UnityEditor/AssemblyHelper.cs @@ -79,7 +79,7 @@ public static Assembly FindLoadedAssemblyWithName(string s) public static string ExtractInternalAssemblyName(string path) { AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(path); - return assemblyDefinition.get_Name().get_Name(); + return assemblyDefinition.Name.Name; } private static AssemblyDefinition GetAssemblyDefinitionCached(string path, Dictionary cache) @@ -131,20 +131,20 @@ private static void AddReferencedAssembliesRecurse(string assemblyPath, List(); - using (Collection.Enumerator enumerator = assemblyDefinitionCached.get_MainModule().get_AssemblyReferences().GetEnumerator()) + using (Collection.Enumerator enumerator = assemblyDefinitionCached.MainModule.AssemblyReferences.GetEnumerator()) { while (enumerator.MoveNext()) { - AssemblyNameReference referencedAssembly = enumerator.get_Current(); - if (!(referencedAssembly.get_Name() == "BridgeInterface")) + AssemblyNameReference referencedAssembly = enumerator.Current; + if (!(referencedAssembly.Name == "BridgeInterface")) { - if (!(referencedAssembly.get_Name() == "WinRTBridge")) + if (!(referencedAssembly.Name == "WinRTBridge")) { - if (!(referencedAssembly.get_Name() == "UnityEngineProxy")) + if (!(referencedAssembly.Name == "UnityEngineProxy")) { - if (!AssemblyHelper.IgnoreAssembly(referencedAssembly.get_Name() + ".dll", target)) + if (!AssemblyHelper.IgnoreAssembly(referencedAssembly.Name + ".dll", target)) { - string text = AssemblyHelper.FindAssemblyName(referencedAssembly.get_FullName(), referencedAssembly.get_Name(), allAssemblyPaths, foldersToSearch, cache); + string text = AssemblyHelper.FindAssemblyName(referencedAssembly.FullName, referencedAssembly.Name, allAssemblyPaths, foldersToSearch, cache); if (text == "") { bool flag = false; @@ -156,7 +156,7 @@ private static void AddReferencedAssembliesRecurse(string assemblyPath, List string.Equals(p, referencedAssembly.get_Name() + extension, StringComparison.InvariantCultureIgnoreCase))) + if (source.Any((string p) => string.Equals(p, referencedAssembly.Name + extension, StringComparison.InvariantCultureIgnoreCase))) { flag = true; break; @@ -164,7 +164,7 @@ private static void AddReferencedAssembliesRecurse(string assemblyPath, List.Enumerator enumerator = assemblyDefinition.get_Modules().GetEnumerator()) + foreach (ModuleDefinition current in assemblyDefinition.Modules) { - while (enumerator.MoveNext()) + foreach (TypeDefinition current2 in current.Types) { - ModuleDefinition current = enumerator.get_Current(); - using (Collection.Enumerator enumerator2 = current.get_Types().GetEnumerator()) + TypeReference baseType = current2.BaseType; + try { - while (enumerator2.MoveNext()) + if (AssemblyHelper.IsTypeMonoBehaviourOrScriptableObject(assemblyDefinition, baseType)) { - TypeDefinition current2 = enumerator2.get_Current(); - TypeReference baseType = current2.get_BaseType(); - try - { - if (AssemblyHelper.IsTypeMonoBehaviourOrScriptableObject(assemblyDefinition, baseType)) - { - list.Add(current2.get_Name()); - list2.Add(current2.get_Namespace()); - } - } - catch (Exception) - { - UnityEngine.Debug.LogError(string.Concat(new string[] - { - "Failed to extract ", - current2.get_FullName(), - " class of base type ", - baseType.get_FullName(), - " when inspecting ", - path - })); - } + list.Add(current2.Name); + list2.Add(current2.Namespace); } } + catch (Exception) + { + UnityEngine.Debug.LogError(string.Concat(new string[] + { + "Failed to extract ", + current2.FullName, + " class of base type ", + baseType.FullName, + " when inspecting ", + path + })); + } } } classNamesArray = list.ToArray(); diff --git a/UnityEditor/UnityEditor/AssemblyReferenceChecker.cs b/UnityEditor/UnityEditor/AssemblyReferenceChecker.cs index 65acbd98..a018acad 100644 --- a/UnityEditor/UnityEditor/AssemblyReferenceChecker.cs +++ b/UnityEditor/UnityEditor/AssemblyReferenceChecker.cs @@ -1,6 +1,5 @@ using Mono.Cecil; using Mono.Cecil.Cil; -using Mono.Collections.Generic; using System; using System.Collections.Generic; using System.IO; @@ -14,6 +13,8 @@ internal class AssemblyReferenceChecker private HashSet _referencedTypes = new HashSet(); + private readonly HashSet _userReferencedMethods = new HashSet(); + private readonly HashSet _definedMethods = new HashSet(); private HashSet _assemblyDefinitions = new HashSet(); @@ -51,30 +52,26 @@ private void CollectReferencesFromRootsRecursive(string dir, IEnumerable DefaultAssemblyResolver assemblyResolver = AssemblyReferenceChecker.AssemblyResolverFor(dir); foreach (string current in roots) { - string text = Path.Combine(dir, current); + string fileName = Path.Combine(dir, current); if (!this._assemblyFileNames.Contains(current)) { - string arg_4D_0 = text; - ReaderParameters readerParameters = new ReaderParameters(); - readerParameters.set_AssemblyResolver(assemblyResolver); - AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(arg_4D_0, readerParameters); - if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.get_Name().get_Name())) + AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(fileName, new ReaderParameters + { + AssemblyResolver = assemblyResolver + }); + if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.Name.Name)) { this._assemblyFileNames.Add(current); this._assemblyDefinitions.Add(assemblyDefinition); - using (Collection.Enumerator enumerator2 = assemblyDefinition.get_MainModule().get_AssemblyReferences().GetEnumerator()) + foreach (AssemblyNameReference current2 in assemblyDefinition.MainModule.AssemblyReferences) { - while (enumerator2.MoveNext()) + string text = current2.Name + ".dll"; + if (!this._assemblyFileNames.Contains(text)) { - AssemblyNameReference current2 = enumerator2.get_Current(); - string text2 = current2.get_Name() + ".dll"; - if (!this._assemblyFileNames.Contains(text2)) + this.CollectReferencesFromRootsRecursive(dir, new string[] { - this.CollectReferencesFromRootsRecursive(dir, new string[] - { - text2 - }, ignoreSystemDlls); - } + text + }, ignoreSystemDlls); } } } @@ -106,11 +103,11 @@ public void CollectReferences(string path, bool collectMethods, float progressVa string text = array2[i]; if (!(Path.GetExtension(text) != ".dll")) { - string arg_74_0 = text; - ReaderParameters readerParameters = new ReaderParameters(); - readerParameters.set_AssemblyResolver(assemblyResolver); - AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(arg_74_0, readerParameters); - if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.get_Name().get_Name())) + AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(text, new ReaderParameters + { + AssemblyResolver = assemblyResolver + }); + if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(assemblyDefinition.Name.Name)) { this._assemblyFileNames.Add(Path.GetFileName(text)); this._assemblyDefinitions.Add(assemblyDefinition); @@ -129,72 +126,67 @@ private void CollectReferencedAndDefinedMethods(IEnumerable { foreach (AssemblyDefinition current in assemblyDefinitions) { - using (Collection.Enumerator enumerator2 = current.get_MainModule().get_Types().GetEnumerator()) + bool isSystem = AssemblyReferenceChecker.IsIgnoredSystemDll(current.Name.Name); + foreach (TypeDefinition current2 in current.MainModule.Types) { - while (enumerator2.MoveNext()) - { - TypeDefinition current2 = enumerator2.get_Current(); - this.CollectReferencedAndDefinedMethods(current2); - } + this.CollectReferencedAndDefinedMethods(current2, isSystem); } } } internal void CollectReferencedAndDefinedMethods(TypeDefinition type) + { + this.CollectReferencedAndDefinedMethods(type, false); + } + + internal void CollectReferencedAndDefinedMethods(TypeDefinition type, bool isSystem) { if (this._updateProgressAction != null) { this._updateProgressAction(); } - using (Collection.Enumerator enumerator = type.get_NestedTypes().GetEnumerator()) + foreach (TypeDefinition current in type.NestedTypes) { - while (enumerator.MoveNext()) - { - TypeDefinition current = enumerator.get_Current(); - this.CollectReferencedAndDefinedMethods(current); - } + this.CollectReferencedAndDefinedMethods(current, isSystem); } - using (Collection.Enumerator enumerator2 = type.get_Methods().GetEnumerator()) + foreach (MethodDefinition current2 in type.Methods) { - while (enumerator2.MoveNext()) + if (current2.HasBody) { - MethodDefinition current2 = enumerator2.get_Current(); - if (current2.get_HasBody()) + foreach (Instruction current3 in current2.Body.Instructions) { - using (Collection.Enumerator enumerator3 = current2.get_Body().get_Instructions().GetEnumerator()) + if (OpCodes.Call == current3.OpCode) { - while (enumerator3.MoveNext()) + string item = current3.Operand.ToString(); + if (!isSystem) { - Instruction current3 = enumerator3.get_Current(); - if (OpCodes.Call == current3.get_OpCode()) - { - this._referencedMethods.Add(current3.get_Operand().ToString()); - } + this._userReferencedMethods.Add(item); } + this._referencedMethods.Add(item); } - this._definedMethods.Add(current2.ToString()); - this.HasMouseEvent |= this.MethodIsMouseEvent(current2); } + this._definedMethods.Add(current2.ToString()); + this.HasMouseEvent |= this.MethodIsMouseEvent(current2); } } } private bool MethodIsMouseEvent(MethodDefinition method) { - return (method.get_Name() == "OnMouseDown" || method.get_Name() == "OnMouseDrag" || method.get_Name() == "OnMouseEnter" || method.get_Name() == "OnMouseExit" || method.get_Name() == "OnMouseOver" || method.get_Name() == "OnMouseUp" || method.get_Name() == "OnMouseUpAsButton") && method.get_Parameters().get_Count() == 0 && this.InheritsFromMonoBehaviour(method.get_DeclaringType()); + return (method.Name == "OnMouseDown" || method.Name == "OnMouseDrag" || method.Name == "OnMouseEnter" || method.Name == "OnMouseExit" || method.Name == "OnMouseOver" || method.Name == "OnMouseUp" || method.Name == "OnMouseUpAsButton") && method.Parameters.Count == 0 && this.InheritsFromMonoBehaviour(method.DeclaringType); } private bool InheritsFromMonoBehaviour(TypeReference type) { bool result; - if (type.get_Namespace() == "UnityEngine" && type.get_Name() == "MonoBehaviour") + if (type.Namespace == "UnityEngine" && type.Name == "MonoBehaviour") { result = true; } else { TypeDefinition typeDefinition = type.Resolve(); - result = (typeDefinition.get_BaseType() != null && this.InheritsFromMonoBehaviour(typeDefinition.get_BaseType())); + result = (typeDefinition.BaseType != null && this.InheritsFromMonoBehaviour(typeDefinition.BaseType)); } return result; } @@ -219,7 +211,12 @@ private void DisplayProgress() public bool HasReferenceToMethod(string methodName) { - return this._referencedMethods.Any((string item) => item.Contains(methodName)); + return this.HasReferenceToMethod(methodName, false); + } + + public bool HasReferenceToMethod(string methodName, bool ignoreSystemDlls) + { + return ignoreSystemDlls ? this._userReferencedMethods.Any((string item) => item.Contains(methodName)) : this._referencedMethods.Any((string item) => item.Contains(methodName)); } public bool HasDefinedMethod(string methodName) @@ -247,7 +244,7 @@ public string WhoReferencesClass(string klass, bool ignoreSystemDlls) string result; foreach (AssemblyDefinition current in this._assemblyDefinitions) { - if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(current.get_Name().get_Name())) + if (!ignoreSystemDlls || !AssemblyReferenceChecker.IsIgnoredSystemDll(current.Name.Name)) { AssemblyDefinition[] assemblies = new AssemblyDefinition[] { @@ -256,7 +253,7 @@ public string WhoReferencesClass(string klass, bool ignoreSystemDlls) HashSet source = MonoAOTRegistration.BuildReferencedTypeList(assemblies); if (source.Any((string item) => item.StartsWith(klass))) { - result = current.get_Name().get_Name(); + result = current.Name.Name; return result; } } diff --git a/UnityEditor/UnityEditor/AssemblyTypeInfoGenerator.cs b/UnityEditor/UnityEditor/AssemblyTypeInfoGenerator.cs index 68bf588f..f4b6d83f 100644 --- a/UnityEditor/UnityEditor/AssemblyTypeInfoGenerator.cs +++ b/UnityEditor/UnityEditor/AssemblyTypeInfoGenerator.cs @@ -43,8 +43,8 @@ public static IAssemblyResolver WithSearchDirs(params string[] searchDirs) AssemblyTypeInfoGenerator.AssemblyResolver assemblyResolver = new AssemblyTypeInfoGenerator.AssemblyResolver(); for (int i = 0; i < searchDirs.Length; i++) { - string text = searchDirs[i]; - assemblyResolver.AddSearchDirectory(text); + string directory = searchDirs[i]; + assemblyResolver.AddSearchDirectory(directory); } assemblyResolver.RemoveSearchDirectory("."); assemblyResolver.RemoveSearchDirectory("bin"); @@ -53,7 +53,7 @@ public static IAssemblyResolver WithSearchDirs(params string[] searchDirs) public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) { - AssemblyDefinition assemblyDefinition = (AssemblyDefinition)this.m_Assemblies[name.get_Name()]; + AssemblyDefinition assemblyDefinition = (AssemblyDefinition)this.m_Assemblies[name.Name]; AssemblyDefinition result; if (assemblyDefinition != null) { @@ -62,7 +62,7 @@ public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderPar else { assemblyDefinition = base.Resolve(name, parameters); - this.m_Assemblies[name.get_Name()] = assemblyDefinition; + this.m_Assemblies[name.Name] = assemblyDefinition; result = assemblyDefinition; } return result; @@ -85,33 +85,35 @@ public AssemblyTypeInfoGenerator.ClassInfo[] ClassInfoArray public AssemblyTypeInfoGenerator(string assembly, string[] searchDirs) { - ReaderParameters readerParameters = new ReaderParameters(); - readerParameters.set_AssemblyResolver(AssemblyTypeInfoGenerator.AssemblyResolver.WithSearchDirs(searchDirs)); - this.assembly_ = AssemblyDefinition.ReadAssembly(assembly, readerParameters); + this.assembly_ = AssemblyDefinition.ReadAssembly(assembly, new ReaderParameters + { + AssemblyResolver = AssemblyTypeInfoGenerator.AssemblyResolver.WithSearchDirs(searchDirs) + }); } public AssemblyTypeInfoGenerator(string assembly, IAssemblyResolver resolver) { - ReaderParameters readerParameters = new ReaderParameters(); - readerParameters.set_AssemblyResolver(resolver); - this.assembly_ = AssemblyDefinition.ReadAssembly(assembly, readerParameters); + this.assembly_ = AssemblyDefinition.ReadAssembly(assembly, new ReaderParameters + { + AssemblyResolver = resolver + }); } private string GetMonoEmbeddedFullTypeNameFor(TypeReference type) { TypeSpecification typeSpecification = type as TypeSpecification; string fullName; - if (typeSpecification != null && typeSpecification.get_IsRequiredModifier()) + if (typeSpecification != null && typeSpecification.IsRequiredModifier) { - fullName = typeSpecification.get_ElementType().get_FullName(); + fullName = typeSpecification.ElementType.FullName; } - else if (type.get_IsRequiredModifier()) + else if (type.IsRequiredModifier) { - fullName = type.GetElementType().get_FullName(); + fullName = type.GetElementType().FullName; } else { - fullName = type.get_FullName(); + fullName = type.FullName; } return fullName.Replace('/', '+').Replace('<', '[').Replace('>', ']'); } @@ -121,16 +123,16 @@ private TypeReference ResolveGenericInstanceType(TypeReference typeToResolve, Di ArrayType arrayType = typeToResolve as ArrayType; if (arrayType != null) { - typeToResolve = new ArrayType(this.ResolveGenericInstanceType(arrayType.get_ElementType(), genericInstanceTypeMap), arrayType.get_Rank()); + typeToResolve = new ArrayType(this.ResolveGenericInstanceType(arrayType.ElementType, genericInstanceTypeMap), arrayType.Rank); } while (genericInstanceTypeMap.ContainsKey(typeToResolve)) { typeToResolve = genericInstanceTypeMap[typeToResolve]; } - if (typeToResolve.get_IsGenericInstance()) + if (typeToResolve.IsGenericInstance) { GenericInstanceType genericInstanceType = (GenericInstanceType)typeToResolve; - typeToResolve = this.MakeGenericInstance(genericInstanceType.get_ElementType(), genericInstanceType.get_GenericArguments(), genericInstanceTypeMap); + typeToResolve = this.MakeGenericInstance(genericInstanceType.ElementType, genericInstanceType.GenericArguments, genericInstanceTypeMap); } return typeToResolve; } @@ -154,15 +156,15 @@ private void AddType(TypeReference typeRef, Dictionary genericArguments = ((GenericInstanceType)typeRef).get_GenericArguments(); - Collection genericParameters = typeDefinition.get_GenericParameters(); - for (int i = 0; i < genericArguments.get_Count(); i++) + Collection genericArguments = ((GenericInstanceType)typeRef).GenericArguments; + Collection genericParameters = typeDefinition.GenericParameters; + for (int i = 0; i < genericArguments.Count; i++) { - if (genericParameters.get_Item(i) != genericArguments.get_Item(i)) + if (genericParameters[i] != genericArguments[i]) { - genericInstanceTypeMap[genericParameters.get_Item(i)] = genericArguments.get_Item(i); + genericInstanceTypeMap[genericParameters[i]] = genericArguments[i]; } } this.typeResolver.Add((GenericInstanceType)typeRef); @@ -183,12 +185,12 @@ private void AddType(TypeReference typeRef, Dictionary genericInstanceTypeMap) { - using (Collection.Enumerator enumerator = type.get_NestedTypes().GetEnumerator()) + foreach (TypeDefinition current in type.NestedTypes) { - while (enumerator.MoveNext()) - { - TypeDefinition current = enumerator.get_Current(); - this.AddType(current, genericInstanceTypeMap); - } + this.AddType(current, genericInstanceTypeMap); } } private void AddBaseType(TypeReference typeRef, Dictionary genericInstanceTypeMap) { - TypeReference typeReference = typeRef.Resolve().get_BaseType(); + TypeReference typeReference = typeRef.Resolve().BaseType; if (typeReference != null) { - if (typeRef.get_IsGenericInstance() && typeReference.get_IsGenericInstance()) + if (typeRef.IsGenericInstance && typeReference.IsGenericInstance) { GenericInstanceType genericInstanceType = (GenericInstanceType)typeReference; - typeReference = this.MakeGenericInstance(genericInstanceType.get_ElementType(), genericInstanceType.get_GenericArguments(), genericInstanceTypeMap); + typeReference = this.MakeGenericInstance(genericInstanceType.ElementType, genericInstanceType.GenericArguments, genericInstanceTypeMap); } this.AddType(typeReference, genericInstanceTypeMap); } @@ -228,7 +226,7 @@ private TypeReference MakeGenericInstance(TypeReference genericClass, IEnumerabl foreach (TypeReference current in from x in arguments select this.ResolveGenericInstanceType(x, genericInstanceTypeMap)) { - genericInstanceType.get_GenericArguments().Add(current); + genericInstanceType.GenericArguments.Add(current); } return genericInstanceType; } @@ -236,16 +234,12 @@ select this.ResolveGenericInstanceType(x, genericInstanceTypeMap)) private AssemblyTypeInfoGenerator.FieldInfo[] GetFields(TypeDefinition type, bool isGenericInstance, Dictionary genericInstanceTypeMap) { List list = new List(); - using (Collection.Enumerator enumerator = type.get_Fields().GetEnumerator()) + foreach (FieldDefinition current in type.Fields) { - while (enumerator.MoveNext()) + AssemblyTypeInfoGenerator.FieldInfo? fieldInfo = this.GetFieldInfo(type, current, isGenericInstance, genericInstanceTypeMap); + if (fieldInfo.HasValue) { - FieldDefinition current = enumerator.get_Current(); - AssemblyTypeInfoGenerator.FieldInfo? fieldInfo = this.GetFieldInfo(type, current, isGenericInstance, genericInstanceTypeMap); - if (fieldInfo.HasValue) - { - list.Add(fieldInfo.Value); - } + list.Add(fieldInfo.Value); } } return list.ToArray(); @@ -261,15 +255,15 @@ private AssemblyTypeInfoGenerator.FieldInfo[] GetFields(TypeDefinition type, boo else { AssemblyTypeInfoGenerator.FieldInfo value = default(AssemblyTypeInfoGenerator.FieldInfo); - value.name = field.get_Name(); + value.name = field.Name; TypeReference type2; if (isDeclaringTypeGenericInstance) { - type2 = this.ResolveGenericInstanceType(field.get_FieldType(), genericInstanceTypeMap); + type2 = this.ResolveGenericInstanceType(field.FieldType, genericInstanceTypeMap); } else { - type2 = field.get_FieldType(); + type2 = field.FieldType; } value.type = this.GetMonoEmbeddedFullTypeNameFor(type2); result = new AssemblyTypeInfoGenerator.FieldInfo?(value); @@ -288,8 +282,8 @@ private bool WillSerialize(FieldDefinition field) { Debug.LogFormat("Field '{0}' from '{1}', exception {2}", new object[] { - field.get_FullName(), - field.get_Module().get_FullyQualifiedName(), + field.FullName, + field.Module.FullyQualifiedName, ex.Message }); result = false; @@ -299,21 +293,13 @@ private bool WillSerialize(FieldDefinition field) public AssemblyTypeInfoGenerator.ClassInfo[] GatherClassInfo() { - using (Collection.Enumerator enumerator = this.assembly_.get_Modules().GetEnumerator()) + foreach (ModuleDefinition current in this.assembly_.Modules) { - while (enumerator.MoveNext()) + foreach (TypeDefinition current2 in current.Types) { - ModuleDefinition current = enumerator.get_Current(); - using (Collection.Enumerator enumerator2 = current.get_Types().GetEnumerator()) + if (!(current2.Name == "")) { - while (enumerator2.MoveNext()) - { - TypeDefinition current2 = enumerator2.get_Current(); - if (!(current2.get_Name() == "")) - { - this.AddType(current2, new Dictionary()); - } - } + this.AddType(current2, new Dictionary()); } } } diff --git a/UnityEditor/UnityEditor/AvatarEditor.cs b/UnityEditor/UnityEditor/AvatarEditor.cs index 787c3cf8..935321a9 100644 --- a/UnityEditor/UnityEditor/AvatarEditor.cs +++ b/UnityEditor/UnityEditor/AvatarEditor.cs @@ -453,7 +453,7 @@ private void ChangeInspectorLock(bool locked) for (int i = 0; i < allInspectorWindows.Length; i++) { InspectorWindow inspectorWindow = allInspectorWindows[i]; - ActiveEditorTracker tracker = inspectorWindow.GetTracker(); + ActiveEditorTracker tracker = inspectorWindow.tracker; Editor[] activeEditors = tracker.activeEditors; for (int j = 0; j < activeEditors.Length; j++) { diff --git a/UnityEditor/UnityEditor/BuildPlayerWindow.cs b/UnityEditor/UnityEditor/BuildPlayerWindow.cs index 87b326ba..b339b289 100644 --- a/UnityEditor/UnityEditor/BuildPlayerWindow.cs +++ b/UnityEditor/UnityEditor/BuildPlayerWindow.cs @@ -1155,11 +1155,6 @@ private static bool IsColorSpaceValid(BuildPlayerWindow.BuildPlatform platform) flag = (graphicsAPIs3.Contains(GraphicsDeviceType.OpenGLES3) && !graphicsAPIs3.Contains(GraphicsDeviceType.OpenGLES2)); flag2 = (PlayerSettings.Android.minSdkVersion >= AndroidSdkVersions.AndroidApiLevel18); } - else if (platform.targetGroup == BuildTargetGroup.Standalone) - { - GraphicsDeviceType[] graphicsAPIs4 = PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows); - flag = (!graphicsAPIs4.Contains(GraphicsDeviceType.OpenGLES3) && !graphicsAPIs4.Contains(GraphicsDeviceType.OpenGLES2)); - } result = (flag && flag2); } else diff --git a/UnityEditor/UnityEditor/CacheServerPreferences.cs b/UnityEditor/UnityEditor/CacheServerPreferences.cs index a1cebfa0..022798f2 100644 --- a/UnityEditor/UnityEditor/CacheServerPreferences.cs +++ b/UnityEditor/UnityEditor/CacheServerPreferences.cs @@ -19,9 +19,9 @@ internal class Styles public static readonly GUIContent cleanCache = EditorGUIUtility.TextContent("Clean Cache"); - public static readonly GUIContent browseCacheLocation = EditorGUIUtility.TextContent("Browse for local asset cache server location"); + public static readonly GUIContent enumerateCache = EditorGUIUtility.TextContent("Check Cache Size|Check the size of the local asset cache server - can take a while"); - public static readonly GUIContent cacheSizeIs = EditorGUIUtility.TextContent("Cache size is"); + public static readonly GUIContent browseCacheLocation = EditorGUIUtility.TextContent("Browse for local asset cache server location"); } internal class Constants @@ -125,7 +125,7 @@ public static void WritePreferences() if (EditorUtility.DisplayDialog("Delete old Cache", text, "Delete", "Don't Delete")) { LocalCacheServer.Clear(); - CacheServerPreferences.s_LocalCacheServerUsedSize = 0L; + CacheServerPreferences.s_LocalCacheServerUsedSize = -1L; } } EditorPrefs.SetString("CacheServerIPAddress", CacheServerPreferences.s_CacheServerIPAddress); @@ -259,19 +259,39 @@ public static void OnGUI() { CacheServerPreferences.s_CachePath = ""; } - if (GUILayout.Button(CacheServerPreferences.Styles.cleanCache, new GUILayoutOption[] - { - GUILayout.Width(120f) - })) + bool flag = LocalCacheServer.CheckCacheLocationExists(); + if (flag) { - LocalCacheServer.Clear(); - CacheServerPreferences.s_LocalCacheServerUsedSize = 0L; + GUIContent label = EditorGUIUtility.TextContent("Cache size is unknown"); + if (CacheServerPreferences.s_LocalCacheServerUsedSize != -1L) + { + label = EditorGUIUtility.TextContent("Cache size is " + EditorUtility.FormatBytes(CacheServerPreferences.s_LocalCacheServerUsedSize)); + } + GUILayout.BeginHorizontal(new GUILayoutOption[0]); + GUIStyle miniButton = EditorStyles.miniButton; + EditorGUILayout.PrefixLabel(label, miniButton); + Rect rect2 = GUILayoutUtility.GetRect(GUIContent.none, miniButton); + if (EditorGUI.Button(rect2, CacheServerPreferences.Styles.enumerateCache, miniButton)) + { + CacheServerPreferences.s_LocalCacheServerUsedSize = ((!LocalCacheServer.CheckCacheLocationExists()) ? 0L : FileUtil.GetDirectorySize(LocalCacheServer.GetCacheLocation())); + } + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(new GUILayoutOption[0]); + GUIContent blankContent = EditorGUIUtility.blankContent; + EditorGUILayout.PrefixLabel(blankContent, miniButton); + Rect rect3 = GUILayoutUtility.GetRect(GUIContent.none, miniButton); + if (EditorGUI.Button(rect3, CacheServerPreferences.Styles.cleanCache, miniButton)) + { + LocalCacheServer.Clear(); + CacheServerPreferences.s_LocalCacheServerUsedSize = 0L; + } + GUILayout.EndHorizontal(); } - if (CacheServerPreferences.s_LocalCacheServerUsedSize == -1L) + else { - CacheServerPreferences.s_LocalCacheServerUsedSize = FileUtil.GetDirectorySize(LocalCacheServer.GetCacheLocation()); + EditorGUILayout.HelpBox("Local cache directory does not exist - please check that you can access the cache folder and are able to write to it", MessageType.Warning, false); + CacheServerPreferences.s_LocalCacheServerUsedSize = -1L; } - GUILayout.Label(CacheServerPreferences.Styles.cacheSizeIs.text + " " + EditorUtility.FormatBytes(CacheServerPreferences.s_LocalCacheServerUsedSize), new GUILayoutOption[0]); GUILayout.Label(CacheServerPreferences.Styles.cacheFolderLocation.text + ":", new GUILayoutOption[0]); GUILayout.Label(LocalCacheServer.GetCacheLocation(), CacheServerPreferences.s_Constants.cacheFolderLocation, new GUILayoutOption[0]); } diff --git a/UnityEditor/UnityEditor/CodeStrippingUtils.cs b/UnityEditor/UnityEditor/CodeStrippingUtils.cs index 77964c87..d115bccc 100644 --- a/UnityEditor/UnityEditor/CodeStrippingUtils.cs +++ b/UnityEditor/UnityEditor/CodeStrippingUtils.cs @@ -1,5 +1,4 @@ using Mono.Cecil; -using Mono.Collections.Generic; using System; using System.Collections; using System.Collections.Generic; @@ -471,24 +470,20 @@ private static HashSet CollectManagedTypeReferencesFromRoots(string dire for (int i = 0; i < array.Length; i++) { AssemblyDefinition assemblyDefinition = array[i]; - using (Collection.Enumerator enumerator = assemblyDefinition.get_MainModule().get_Types().GetEnumerator()) + foreach (TypeDefinition current in assemblyDefinition.MainModule.Types) { - while (enumerator.MoveNext()) + if (current.Namespace.StartsWith("UnityEngine")) { - TypeDefinition current = enumerator.get_Current(); - if (current.get_Namespace().StartsWith("UnityEngine")) + if (current.Fields.Count > 0 || current.Methods.Count > 0 || current.Properties.Count > 0) { - if (current.get_Fields().get_Count() > 0 || current.get_Methods().get_Count() > 0 || current.get_Properties().get_Count() > 0) + string name = current.Name; + hashSet.Add(name); + if (strippingInfo != null) { - string name = current.get_Name(); - hashSet.Add(name); - if (strippingInfo != null) + string name2 = assemblyDefinition.Name.Name; + if (!AssemblyReferenceChecker.IsIgnoredSystemDll(name2)) { - string name2 = assemblyDefinition.get_Name().get_Name(); - if (!AssemblyReferenceChecker.IsIgnoredSystemDll(name2)) - { - strippingInfo.RegisterDependency(name, "Required by Scripts"); - } + strippingInfo.RegisterDependency(name, "Required by Scripts"); } } } @@ -509,15 +504,15 @@ private static HashSet CollectManagedTypeReferencesFromRoots(string dire AssemblyDefinition assemblyDefinition3 = array2[k]; if (assemblyDefinition3 != assemblyDefinition2) { - foreach (TypeReference current2 in assemblyDefinition3.get_MainModule().GetTypeReferences()) + foreach (TypeReference current2 in assemblyDefinition3.MainModule.GetTypeReferences()) { - if (current2.get_Namespace().StartsWith("UnityEngine")) + if (current2.Namespace.StartsWith("UnityEngine")) { - string name3 = current2.get_Name(); + string name3 = current2.Name; hashSet.Add(name3); if (strippingInfo != null) { - string name4 = assemblyDefinition3.get_Name().get_Name(); + string name4 = assemblyDefinition3.Name.Name; if (!AssemblyReferenceChecker.IsIgnoredSystemDll(name4)) { strippingInfo.RegisterDependency(name3, "Required by Scripts"); diff --git a/UnityEditor/UnityEditor/CurveEditor.cs b/UnityEditor/UnityEditor/CurveEditor.cs index 1a01016d..335b1aa2 100644 --- a/UnityEditor/UnityEditor/CurveEditor.cs +++ b/UnityEditor/UnityEditor/CurveEditor.cs @@ -1427,16 +1427,16 @@ internal void TransformSelectedKeys(Matrix4x4 matrix, bool flipX, bool flipY) savedKeyFrame.key.time = Mathf.Clamp(v.x, this.hRangeMin, this.hRangeMax); if (flipX) { - savedKeyFrame.key.inTangent = -keyframe.key.outTangent; - savedKeyFrame.key.outTangent = -keyframe.key.inTangent; + savedKeyFrame.key.inTangent = ((keyframe.key.outTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-keyframe.key.outTangent)); + savedKeyFrame.key.outTangent = ((keyframe.key.inTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-keyframe.key.inTangent)); } if (savedKeyFrame.selected == CurveWrapper.SelectionMode.Selected) { savedKeyFrame.key.value = this.ClampVerticalValue(v.y, curve.curveId); if (flipY) { - savedKeyFrame.key.inTangent = -savedKeyFrame.key.inTangent; - savedKeyFrame.key.outTangent = -savedKeyFrame.key.outTangent; + savedKeyFrame.key.inTangent = ((savedKeyFrame.key.inTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-savedKeyFrame.key.inTangent)); + savedKeyFrame.key.outTangent = ((savedKeyFrame.key.outTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-savedKeyFrame.key.outTangent)); } } result = savedKeyFrame; @@ -1473,8 +1473,8 @@ internal void TransformRippleKeys(Matrix4x4 matrix, float t1, float t2, bool fli savedKeyFrame.key.time = this.SnapTime(Mathf.Clamp(num, this.hRangeMin, this.hRangeMax)); if (flipX) { - savedKeyFrame.key.inTangent = -keyframe.key.outTangent; - savedKeyFrame.key.outTangent = -keyframe.key.inTangent; + savedKeyFrame.key.inTangent = ((keyframe.key.outTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-keyframe.key.outTangent)); + savedKeyFrame.key.outTangent = ((keyframe.key.inTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-keyframe.key.inTangent)); } result = savedKeyFrame; } @@ -2484,11 +2484,13 @@ private void StartEditingSelectedPoints(Vector2 fieldPosition) this.focusedPointField = "pointValueField"; this.timeWasEdited = (this.valueWasEdited = false); this.editingPoints = true; + this.StartLiveEdit(); } private void FinishEditingPoints() { this.editingPoints = false; + this.EndLiveEdit(); } private void EditSelectedPoints() diff --git a/UnityEditor/UnityEditor/DockArea.cs b/UnityEditor/UnityEditor/DockArea.cs index d534c864..a5d3cd28 100644 --- a/UnityEditor/UnityEditor/DockArea.cs +++ b/UnityEditor/UnityEditor/DockArea.cs @@ -119,9 +119,17 @@ private void RemoveNullWindows() public new void OnEnable() { - if (this.m_Panes != null && this.m_Panes.Count > this.m_Selected) + if (this.m_Panes != null) { - base.actualView = this.m_Panes[this.m_Selected]; + if (this.m_Panes.Count == 0) + { + this.m_Selected = 0; + } + else + { + this.m_Selected = Math.Min(this.m_Selected, this.m_Panes.Count - 1); + base.actualView = this.m_Panes[this.m_Selected]; + } } base.OnEnable(); } @@ -137,7 +145,7 @@ public void AddTab(int idx, EditorWindow pane) this.m_Panes.Insert(idx, pane); this.m_ActualView = pane; this.m_Panes[idx] = pane; - this.m_Selected = idx; + this.selected = idx; base.RegisterSelectedPane(); SplitView splitView = base.parent as SplitView; if (splitView) @@ -166,18 +174,23 @@ public void RemoveTab(EditorWindow pane, bool killIfEmpty) { this.m_LastSelected = this.m_Panes.Count - 1; } - else if (num < this.m_LastSelected) + else if (num < this.m_LastSelected || this.m_LastSelected == this.m_Panes.Count) { this.m_LastSelected--; } + this.m_LastSelected = Mathf.Clamp(this.m_LastSelected, 0, this.m_Panes.Count - 1); if (num == this.m_Selected) { - this.selected = this.m_LastSelected; + this.m_Selected = this.m_LastSelected; } else { this.m_Selected = this.m_Panes.IndexOf(this.m_ActualView); } + if (this.m_Selected >= 0 && this.m_Selected < this.m_Panes.Count) + { + base.actualView = this.m_Panes[this.m_Selected]; + } base.Repaint(); pane.m_Parent = null; if (killIfEmpty) diff --git a/UnityEditor/UnityEditor/EditorUserBuildSettings.cs b/UnityEditor/UnityEditor/EditorUserBuildSettings.cs index 4f946371..d406b1c3 100644 --- a/UnityEditor/UnityEditor/EditorUserBuildSettings.cs +++ b/UnityEditor/UnityEditor/EditorUserBuildSettings.cs @@ -95,6 +95,14 @@ public static extern bool forceInstallation set; } + public static extern bool compressFilesInPackage + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + public static extern bool enableHeadlessMode { [MethodImpl(MethodImplOptions.InternalCall)] @@ -229,6 +237,14 @@ public static extern WSAUWPBuildType wsaUWPBuildType set; } + public static extern string wsaUWPSDK + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + public static extern WSABuildAndRunDeployTarget wsaBuildAndRunDeployTarget { [MethodImpl(MethodImplOptions.InternalCall)] diff --git a/UnityEditor/UnityEditor/GameObjectInspector.cs b/UnityEditor/UnityEditor/GameObjectInspector.cs index 9434eaf0..c01cdc8d 100644 --- a/UnityEditor/UnityEditor/GameObjectInspector.cs +++ b/UnityEditor/UnityEditor/GameObjectInspector.cs @@ -327,14 +327,7 @@ private void DoPrefabButtons(PrefabType prefabType, GameObject go) { if (GUILayout.Button("Revert", "MiniButtonMid", new GUILayoutOption[0])) { - List hierarchy2 = new List(); - this.GetObjectListFromHierarchy(hierarchy2, go); - Undo.RegisterFullObjectHierarchyUndo(go, "Revert Prefab Instance"); - PrefabUtility.RevertPrefabInstance(go); - this.CalculatePrefabStatus(); - List list2 = new List(); - this.GetObjectListFromHierarchy(list2, go); - this.RegisterNewComponents(list2, hierarchy2); + this.RevertAndCheckForNewComponents(go); } } if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance) @@ -373,6 +366,18 @@ private void DoPrefabButtons(PrefabType prefabType, GameObject go) } } + public void RevertAndCheckForNewComponents(GameObject gameObject) + { + List hierarchy = new List(); + this.GetObjectListFromHierarchy(hierarchy, gameObject); + Undo.RegisterFullObjectHierarchyUndo(gameObject, "Revert Prefab Instance"); + PrefabUtility.RevertPrefabInstance(gameObject); + this.CalculatePrefabStatus(); + List list = new List(); + this.GetObjectListFromHierarchy(list, gameObject); + this.RegisterNewComponents(list, hierarchy); + } + private void GetObjectListFromHierarchy(List hierarchy, GameObject gameObject) { Transform transform = null; @@ -401,7 +406,7 @@ private void GetObjectListFromHierarchy(List hierarchy, Game private void RegisterNewComponents(List newHierarchy, List hierarchy) { - for (int i = newHierarchy.Count - 1; i >= 0; i--) + for (int i = 0; i < newHierarchy.Count; i++) { bool flag = false; UnityEngine.Object @object = newHierarchy[i]; diff --git a/UnityEditor/UnityEditor/GraphicsJobMode.cs b/UnityEditor/UnityEditor/GraphicsJobMode.cs new file mode 100644 index 00000000..ac703ef4 --- /dev/null +++ b/UnityEditor/UnityEditor/GraphicsJobMode.cs @@ -0,0 +1,10 @@ +using System; + +namespace UnityEditor +{ + public enum GraphicsJobMode + { + Native, + Legacy + } +} diff --git a/UnityEditor/UnityEditor/InitialModuleUI.cs b/UnityEditor/UnityEditor/InitialModuleUI.cs index 73ff92ec..f0146d62 100644 --- a/UnityEditor/UnityEditor/InitialModuleUI.cs +++ b/UnityEditor/UnityEditor/InitialModuleUI.cs @@ -134,7 +134,7 @@ protected override void Init() this.m_PlayOnAwake = base.GetProperty0("playOnAwake"); this.m_SimulationSpace = base.GetProperty0("moveWithTransform"); this.m_CustomSimulationSpace = base.GetProperty0("moveWithCustomTransform"); - this.m_SimulationSpeed = base.GetProperty0("speed"); + this.m_SimulationSpeed = base.GetProperty0("simulationSpeed"); this.m_ScalingMode = base.GetProperty0("scalingMode"); this.m_AutoRandomSeed = base.GetProperty0("autoRandomSeed"); this.m_RandomSeed = base.GetProperty0("randomSeed"); diff --git a/UnityEditor/UnityEditor/InspectorWindow.cs b/UnityEditor/UnityEditor/InspectorWindow.cs index c69f19b9..94976455 100644 --- a/UnityEditor/UnityEditor/InspectorWindow.cs +++ b/UnityEditor/UnityEditor/InspectorWindow.cs @@ -126,13 +126,20 @@ public bool isLocked { get { - this.CreateTracker(); - return this.m_Tracker.isLocked; + return this.tracker.isLocked; } set + { + this.tracker.isLocked = value; + } + } + + public ActiveEditorTracker tracker + { + get { this.CreateTracker(); - this.m_Tracker.isLocked = value; + return this.m_Tracker; } } @@ -210,15 +217,11 @@ public static InspectorWindow[] GetAllInspectorWindows() private void OnInspectorUpdate() { - if (this.m_Tracker != null) + this.tracker.VerifyModifiedMonoBehaviours(); + if (this.tracker.isDirty && this.ReadyToRepaint()) { - this.m_Tracker.VerifyModifiedMonoBehaviours(); - if (!this.m_Tracker.isDirty || !this.ReadyToRepaint()) - { - return; - } + base.Repaint(); } - base.Repaint(); } public virtual void AddItemsToMenu(GenericMenu menu) @@ -230,7 +233,7 @@ public virtual void AddItemsToMenu(GenericMenu menu) menu.AddItem(new GUIContent("Debug-Internal"), this.m_InspectorMode == InspectorMode.DebugInternal, new GenericMenu.MenuFunction(this.SetDebugInternal)); } menu.AddSeparator(string.Empty); - menu.AddItem(new GUIContent("Lock"), this.m_Tracker != null && this.isLocked, new GenericMenu.MenuFunction(this.FlipLocked)); + menu.AddItem(new GUIContent("Lock"), this.isLocked, new GenericMenu.MenuFunction(this.FlipLocked)); } private void RefreshTitle() @@ -250,8 +253,7 @@ private void SetMode(InspectorMode mode) { this.m_InspectorMode = mode; this.RefreshTitle(); - this.CreateTracker(); - this.m_Tracker.inspectorMode = mode; + this.tracker.inspectorMode = mode; this.m_ResetKeyboardControl = true; } @@ -292,12 +294,6 @@ private static bool Dragging(Rect rect) return (Event.current.type == EventType.DragUpdated || Event.current.type == EventType.DragPerform) && rect.Contains(Event.current.mousePosition); } - public ActiveEditorTracker GetTracker() - { - this.CreateTracker(); - return this.m_Tracker; - } - protected virtual void CreateTracker() { if (this.m_Tracker != null) @@ -319,9 +315,9 @@ protected virtual void CreatePreviewables() if (this.m_Previews == null) { this.m_Previews = new List(); - if (this.m_Tracker.activeEditors.Length != 0) + if (this.tracker.activeEditors.Length != 0) { - Editor[] activeEditors = this.m_Tracker.activeEditors; + Editor[] activeEditors = this.tracker.activeEditors; for (int i = 0; i < activeEditors.Length; i++) { Editor editor = activeEditors[i]; @@ -376,31 +372,30 @@ protected virtual void ShowButton(Rect r) if (flag != this.isLocked) { this.isLocked = flag; - this.m_Tracker.RebuildIfNecessary(); + this.tracker.RebuildIfNecessary(); } } protected virtual void OnGUI() { Profiler.BeginSample("InspectorWindow.OnGUI"); - this.CreateTracker(); this.CreatePreviewables(); InspectorWindow.FlushAllOptimizedGUIBlocksIfNeeded(); this.ResetKeyboardControl(); this.m_ScrollPosition = EditorGUILayout.BeginVerticalScrollView(this.m_ScrollPosition, new GUILayoutOption[0]); if (Event.current.type == EventType.Repaint) { - this.m_Tracker.ClearDirty(); + this.tracker.ClearDirty(); } InspectorWindow.s_CurrentInspectorWindow = this; - Editor[] activeEditors = this.m_Tracker.activeEditors; + Editor[] activeEditors = this.tracker.activeEditors; this.AssignAssetEditor(activeEditors); Profiler.BeginSample("InspectorWindow.DrawEditors()"); this.DrawEditors(activeEditors); Profiler.EndSample(); - if (this.m_Tracker.hasComponentsWhichCannotBeMultiEdited) + if (this.tracker.hasComponentsWhichCannotBeMultiEdited) { - if (activeEditors.Length == 0 && !this.m_Tracker.isLocked && Selection.objects.Length > 0) + if (activeEditors.Length == 0 && !this.tracker.isLocked && Selection.objects.Length > 0) { this.DrawSelectionPickerList(); } @@ -417,15 +412,15 @@ protected virtual void OnGUI() } InspectorWindow.s_CurrentInspectorWindow = null; EditorGUI.indentLevel = 0; - this.AddComponentButton(this.m_Tracker.activeEditors); + this.AddComponentButton(this.tracker.activeEditors); GUI.enabled = true; - this.CheckDragAndDrop(this.m_Tracker.activeEditors); + this.CheckDragAndDrop(this.tracker.activeEditors); this.MoveFocusOnKeyPress(); EditorGUILayout.EndScrollView(); Profiler.BeginSample("InspectorWindow.DrawPreviewAndLabels"); this.DrawPreviewAndLabels(); Profiler.EndSample(); - if (this.m_Tracker.activeEditors.Length > 0) + if (this.tracker.activeEditors.Length > 0) { this.DrawVCSShortInfo(); } @@ -539,22 +534,15 @@ public IPreviewable[] GetEditorsWithPreviews(Editor[] editors) public UnityEngine.Object GetInspectedObject() { + Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.tracker.activeEditors); UnityEngine.Object result; - if (this.m_Tracker == null) + if (firstNonImportInspectorEditor == null) { result = null; } else { - Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.m_Tracker.activeEditors); - if (firstNonImportInspectorEditor == null) - { - result = null; - } - else - { - result = firstNonImportInspectorEditor.target; - } + result = firstNonImportInspectorEditor.target; } return result; } @@ -624,21 +612,18 @@ private void CheckDragAndDrop(Editor[] editors) private UnityEngine.Object[] GetInspectedAssets() { + Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.tracker.activeEditors); UnityEngine.Object[] result; - if (this.m_Tracker != null) + if (firstNonImportInspectorEditor != null) { - Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.m_Tracker.activeEditors); - if (firstNonImportInspectorEditor != null) + if (firstNonImportInspectorEditor != null && firstNonImportInspectorEditor.targets.Length == 1) { - if (firstNonImportInspectorEditor != null && firstNonImportInspectorEditor.targets.Length == 1) + string assetPath = AssetDatabase.GetAssetPath(firstNonImportInspectorEditor.target); + bool flag = assetPath.ToLower().StartsWith("assets") && !Directory.Exists(assetPath); + if (flag) { - string assetPath = AssetDatabase.GetAssetPath(firstNonImportInspectorEditor.target); - bool flag = assetPath.ToLower().StartsWith("assets") && !Directory.Exists(assetPath); - if (flag) - { - result = firstNonImportInspectorEditor.targets; - return result; - } + result = firstNonImportInspectorEditor.targets; + return result; } } } @@ -652,7 +637,7 @@ private void DrawPreviewAndLabels() { this.m_PreviewWindow.Repaint(); } - IPreviewable[] editorsWithPreviews = this.GetEditorsWithPreviews(this.m_Tracker.activeEditors); + IPreviewable[] editorsWithPreviews = this.GetEditorsWithPreviews(this.tracker.activeEditors); IPreviewable editorThatControlsPreview = this.GetEditorThatControlsPreview(editorsWithPreviews); bool flag = editorThatControlsPreview != null && editorThatControlsPreview.HasPreviewGUI() && this.m_PreviewWindow == null; UnityEngine.Object[] inspectedAssets = this.GetInspectedAssets(); @@ -787,7 +772,7 @@ private void DrawPreviewAndLabels() protected UnityEngine.Object[] GetTargetsForPreview(IPreviewable previewEditor) { Editor editor = null; - Editor[] activeEditors = this.m_Tracker.activeEditors; + Editor[] activeEditors = this.tracker.activeEditors; for (int i = 0; i < activeEditors.Length; i++) { Editor editor2 = activeEditors[i]; @@ -819,7 +804,7 @@ private void DetachPreview() protected virtual void DrawVCSSticky(float offset) { string text = ""; - Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.m_Tracker.activeEditors); + Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.tracker.activeEditors); if (!EditorPrefs.GetBool("vcssticky") && !Editor.IsAppropriateFileOpenForEdit(firstNonImportInspectorEditor.target, out text)) { Rect position = new Rect(10f, base.position.height - 94f, base.position.width - 20f, 80f); @@ -848,7 +833,7 @@ private void DrawVCSShortInfo() { GUILayout.Height(17f) }); - Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.m_Tracker.activeEditors); + Editor firstNonImportInspectorEditor = this.GetFirstNonImportInspectorEditor(this.tracker.activeEditors); UnityEngine.Object target = (!(firstNonImportInspectorEditor == null)) ? firstNonImportInspectorEditor.target : null; int controlID = GUIUtility.GetControlID(FocusType.Passive); GUILayout.FlexibleSpace(); @@ -858,7 +843,7 @@ private void DrawVCSShortInfo() } if (Provider.isActive && EditorSettings.externalVersionControl != ExternalVersionControl.Disabled && EditorSettings.externalVersionControl != ExternalVersionControl.AutoDetect && EditorSettings.externalVersionControl != ExternalVersionControl.Generic) { - Editor firstNonImportInspectorEditor2 = this.GetFirstNonImportInspectorEditor(this.m_Tracker.activeEditors); + Editor firstNonImportInspectorEditor2 = this.GetFirstNonImportInspectorEditor(this.tracker.activeEditors); string assetPath = AssetDatabase.GetAssetPath(firstNonImportInspectorEditor2.target); Asset assetByPath = Provider.GetAssetByPath(assetPath); if (assetByPath != null && (assetByPath.path.StartsWith("Assets") || assetByPath.path.StartsWith("ProjectSettings"))) @@ -1043,12 +1028,12 @@ private void DrawEditor(Editor editor, int editorIndex, bool rebuildOptimizedGUI GUIUtility.GetControlID(target.GetInstanceID(), FocusType.Passive); EditorGUIUtility.ResetGUIState(); GUILayoutGroup topLevel = GUILayoutUtility.current.topLevel; - int visible = this.m_Tracker.GetVisible(editorIndex); + int visible = this.tracker.GetVisible(editorIndex); bool flag; if (visible == -1) { flag = InternalEditorUtility.GetIsInspectorExpanded(target); - this.m_Tracker.SetVisible(editorIndex, (!flag) ? 0 : 1); + this.tracker.SetVisible(editorIndex, (!flag) ? 0 : 1); } else { @@ -1104,7 +1089,7 @@ private void DrawEditor(Editor editor, int editorIndex, bool rebuildOptimizedGUI bool flag5 = EditorGUILayout.InspectorTitlebar(flag, editor.targets, editor.CanBeExpandedViaAFoldout()); if (flag != flag5) { - this.m_Tracker.SetVisible(editorIndex, (!flag5) ? 0 : 1); + this.tracker.SetVisible(editorIndex, (!flag5) ? 0 : 1); InternalEditorUtility.SetIsInspectorExpanded(target, flag5); if (flag5) { @@ -1387,14 +1372,11 @@ private static void FlushAllOptimizedGUIBlocksIfNeeded() InspectorWindow.s_AllOptimizedGUIBlocksNeedsRebuild = false; foreach (InspectorWindow current in InspectorWindow.m_AllInspectors) { - if (current.m_Tracker != null) + Editor[] activeEditors = current.tracker.activeEditors; + for (int i = 0; i < activeEditors.Length; i++) { - Editor[] activeEditors = current.m_Tracker.activeEditors; - for (int i = 0; i < activeEditors.Length; i++) - { - Editor editor = activeEditors[i]; - InspectorWindow.FlushOptimizedGUIBlock(editor); - } + Editor editor = activeEditors[i]; + InspectorWindow.FlushOptimizedGUIBlock(editor); } } } @@ -1415,27 +1397,24 @@ private static void FlushOptimizedGUIBlock(Editor editor) private void Update() { - if (this.m_Tracker != null) + Editor[] activeEditors = this.tracker.activeEditors; + if (activeEditors != null) { - Editor[] activeEditors = this.m_Tracker.activeEditors; - if (activeEditors != null) + bool flag = false; + Editor[] array = activeEditors; + for (int i = 0; i < array.Length; i++) { - bool flag = false; - Editor[] array = activeEditors; - for (int i = 0; i < array.Length; i++) + Editor editor = array[i]; + if (editor.RequiresConstantRepaint() && !editor.hideInspector) { - Editor editor = array[i]; - if (editor.RequiresConstantRepaint() && !editor.hideInspector) - { - flag = true; - } - } - if (flag && this.m_lastRenderedTime + 0.032999999821186066 < EditorApplication.timeSinceStartup) - { - this.m_lastRenderedTime = EditorApplication.timeSinceStartup; - base.Repaint(); + flag = true; } } + if (flag && this.m_lastRenderedTime + 0.032999999821186066 < EditorApplication.timeSinceStartup) + { + this.m_lastRenderedTime = EditorApplication.timeSinceStartup; + base.Repaint(); + } } } } diff --git a/UnityEditor/UnityEditor/LabelGUI.cs b/UnityEditor/UnityEditor/LabelGUI.cs index 618f088c..003ec138 100644 --- a/UnityEditor/UnityEditor/LabelGUI.cs +++ b/UnityEditor/UnityEditor/LabelGUI.cs @@ -26,11 +26,13 @@ internal class LabelGUI public void OnEnable() { LabelGUI.s_AssetLabelsForObjectChangedDelegates = (Action)Delegate.Combine(LabelGUI.s_AssetLabelsForObjectChangedDelegates, new Action(this.AssetLabelsChangedForObject)); + EditorApplication.projectWindowChanged = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.projectWindowChanged, new EditorApplication.CallbackFunction(this.InvalidateLabels)); } public void OnDisable() { LabelGUI.s_AssetLabelsForObjectChangedDelegates = (Action)Delegate.Remove(LabelGUI.s_AssetLabelsForObjectChangedDelegates, new Action(this.AssetLabelsChangedForObject)); + EditorApplication.projectWindowChanged = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.projectWindowChanged, new EditorApplication.CallbackFunction(this.InvalidateLabels)); this.SaveLabels(); } @@ -39,6 +41,12 @@ public void OnLostFocus() this.SaveLabels(); } + public void InvalidateLabels() + { + this.m_AssetLabels = null; + this.m_CurrentAssetsSet = null; + } + public void AssetLabelsChangedForObject(UnityEngine.Object asset) { if (!this.m_IgnoreNextAssetLabelsChangedCall && this.m_CurrentAssetsSet != null && this.m_CurrentAssetsSet.Contains(asset)) diff --git a/UnityEditor/UnityEditor/LineRendererInspector.cs b/UnityEditor/UnityEditor/LineRendererInspector.cs index 67bdf8fd..8897d6d1 100644 --- a/UnityEditor/UnityEditor/LineRendererInspector.cs +++ b/UnityEditor/UnityEditor/LineRendererInspector.cs @@ -17,19 +17,7 @@ private class Styles public static GUIContent alignment = EditorGUIUtility.TextContent("Alignment|Lines can rotate to face their transform component or the camera."); - public static GUIContent[] alignmentOptions = new GUIContent[] - { - EditorGUIUtility.TextContent("View"), - EditorGUIUtility.TextContent("Local") - }; - public static GUIContent textureMode = EditorGUIUtility.TextContent("Texture Mode|Should the U coordinate be stretched or tiled?"); - - public static GUIContent[] textureModeOptions = new GUIContent[] - { - EditorGUIUtility.TextContent("Stretch"), - EditorGUIUtility.TextContent("Tile") - }; } private string[] m_ExcludedProperties; @@ -76,8 +64,8 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(this.m_ColorGradient, LineRendererInspector.Styles.colorGradient, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_NumCornerVertices, LineRendererInspector.Styles.numCornerVertices, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_NumCapVertices, LineRendererInspector.Styles.numCapVertices, new GUILayoutOption[0]); - this.m_Alignment.intValue = EditorGUILayout.Popup(LineRendererInspector.Styles.alignment, this.m_Alignment.intValue, LineRendererInspector.Styles.alignmentOptions, new GUILayoutOption[0]); - this.m_TextureMode.intValue = EditorGUILayout.Popup(LineRendererInspector.Styles.textureMode, this.m_TextureMode.intValue, LineRendererInspector.Styles.textureModeOptions, new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_Alignment, LineRendererInspector.Styles.alignment, new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_TextureMode, LineRendererInspector.Styles.textureMode, new GUILayoutOption[0]); this.m_Probes.OnGUI(base.targets, (Renderer)base.target, false); base.serializedObject.ApplyModifiedProperties(); } diff --git a/UnityEditor/UnityEditor/LocalCacheServer.cs b/UnityEditor/UnityEditor/LocalCacheServer.cs index 953401a4..5f946eff 100644 --- a/UnityEditor/UnityEditor/LocalCacheServer.cs +++ b/UnityEditor/UnityEditor/LocalCacheServer.cs @@ -45,10 +45,18 @@ public static string GetCacheLocation() "CacheServer" }); } - Directory.CreateDirectory(result); return result; } + public static void CreateCacheDirectory() + { + string cacheLocation = LocalCacheServer.GetCacheLocation(); + if (!Directory.Exists(cacheLocation)) + { + Directory.CreateDirectory(cacheLocation); + } + } + private void Create(int _port, ulong _size) { string text = Paths.Combine(new string[] @@ -74,6 +82,7 @@ private void Create(int _port, ulong _size) "node" }); } + LocalCacheServer.CreateCacheDirectory(); this.path = LocalCacheServer.GetCacheLocation(); string text2 = Paths.Combine(new string[] { @@ -86,8 +95,9 @@ private void Create(int _port, ulong _size) { Arguments = string.Concat(new object[] { + "\"", text2, - " --port ", + "\" --port ", _port, " --path ", this.path, @@ -184,6 +194,7 @@ public static void CreateIfNeeded() { if (ScriptableSingleton.instance.size == num && ScriptableSingleton.instance.path == LocalCacheServer.GetCacheLocation()) { + LocalCacheServer.CreateCacheDirectory(); return; } LocalCacheServer.Kill(); @@ -214,7 +225,16 @@ public static int GetLocalCacheServerPort() public static void Clear() { LocalCacheServer.Kill(); - Directory.Delete(LocalCacheServer.GetCacheLocation(), true); + string cacheLocation = LocalCacheServer.GetCacheLocation(); + if (Directory.Exists(cacheLocation)) + { + Directory.Delete(cacheLocation, true); + } + } + + public static bool CheckCacheLocationExists() + { + return Directory.Exists(LocalCacheServer.GetCacheLocation()); } public static bool CheckValidCacheLocation(string path) diff --git a/UnityEditor/UnityEditor/LookDevView.cs b/UnityEditor/UnityEditor/LookDevView.cs index 9085d4ac..52b8bdba 100644 --- a/UnityEditor/UnityEditor/LookDevView.cs +++ b/UnityEditor/UnityEditor/LookDevView.cs @@ -518,6 +518,7 @@ private Texture RenderScene(Rect previewRect, LookDevContext lookDevContext, Loo RenderSettings.customReflection = cubemap; if (cubemapInfo != null && !cubemapInfo.alreadyComputed && !flag) { + RenderSettings.ambientMode = AmbientMode.Skybox; RenderSettings.skybox = LookDevResources.m_SkyboxMaterial; DynamicGI.UpdateEnvironment(); cubemapInfo.ambientProbe = RenderSettings.ambientProbe; diff --git a/UnityEditor/UnityEditor/MaterialEditor.cs b/UnityEditor/UnityEditor/MaterialEditor.cs index ab93cf5c..8bab72c1 100644 --- a/UnityEditor/UnityEditor/MaterialEditor.cs +++ b/UnityEditor/UnityEditor/MaterialEditor.cs @@ -268,7 +268,7 @@ public void SetShader(Shader newShader, bool registerUndo) for (int j = 0; j < allInspectorWindows.Length; j++) { InspectorWindow inspectorWindow = allInspectorWindows[j]; - inspectorWindow.GetTracker().ForceRebuild(); + inspectorWindow.tracker.ForceRebuild(); } } } @@ -1264,7 +1264,7 @@ private static Renderer GetAssociatedRenderFromInspector() Renderer result; if (InspectorWindow.s_CurrentInspectorWindow) { - Editor[] activeEditors = InspectorWindow.s_CurrentInspectorWindow.GetTracker().activeEditors; + Editor[] activeEditors = InspectorWindow.s_CurrentInspectorWindow.tracker.activeEditors; Editor[] array = activeEditors; for (int i = 0; i < array.Length; i++) { diff --git a/UnityEditor/UnityEditor/ModelImporterRigEditor.cs b/UnityEditor/UnityEditor/ModelImporterRigEditor.cs index 02c56c24..8d557667 100644 --- a/UnityEditor/UnityEditor/ModelImporterRigEditor.cs +++ b/UnityEditor/UnityEditor/ModelImporterRigEditor.cs @@ -156,7 +156,7 @@ public bool isLocked for (int i = 0; i < allInspectorWindows.Length; i++) { InspectorWindow inspectorWindow = allInspectorWindows[i]; - ActiveEditorTracker tracker = inspectorWindow.GetTracker(); + ActiveEditorTracker tracker = inspectorWindow.tracker; Editor[] activeEditors = tracker.activeEditors; for (int j = 0; j < activeEditors.Length; j++) { diff --git a/UnityEditor/UnityEditor/MonoAOTRegistration.cs b/UnityEditor/UnityEditor/MonoAOTRegistration.cs index 7d146137..af79e700 100644 --- a/UnityEditor/UnityEditor/MonoAOTRegistration.cs +++ b/UnityEditor/UnityEditor/MonoAOTRegistration.cs @@ -1,5 +1,4 @@ using Mono.Cecil; -using Mono.Collections.Generic; using System; using System.Collections; using System.Collections.Generic; @@ -16,24 +15,20 @@ private static void ExtractNativeMethodsFromTypes(ICollection ty { foreach (TypeDefinition current in types) { - using (Collection.Enumerator enumerator2 = current.get_Methods().GetEnumerator()) + foreach (MethodDefinition current2 in current.Methods) { - while (enumerator2.MoveNext()) + if (current2.IsStatic && current2.IsPInvokeImpl && current2.PInvokeInfo.Module.Name.Equals("__Internal")) { - MethodDefinition current2 = enumerator2.get_Current(); - if (current2.get_IsStatic() && current2.get_IsPInvokeImpl() && current2.get_PInvokeInfo().get_Module().get_Name().Equals("__Internal")) + if (res.Contains(current2.Name)) { - if (res.Contains(current2.get_Name())) - { - throw new SystemException("Duplicate native method found : " + current2.get_Name() + ". Please check your source carefully."); - } - res.Add(current2.get_Name()); + throw new SystemException("Duplicate native method found : " + current2.Name + ". Please check your source carefully."); } + res.Add(current2.Name); } } - if (current.get_HasNestedTypes()) + if (current.HasNestedTypes) { - MonoAOTRegistration.ExtractNativeMethodsFromTypes(current.get_NestedTypes(), res); + MonoAOTRegistration.ExtractNativeMethodsFromTypes(current.NestedTypes, res); } } } @@ -44,9 +39,9 @@ private static ArrayList BuildNativeMethodList(AssemblyDefinition[] assemblies) for (int i = 0; i < assemblies.Length; i++) { AssemblyDefinition assemblyDefinition = assemblies[i]; - if (!"System".Equals(assemblyDefinition.get_Name().get_Name())) + if (!"System".Equals(assemblyDefinition.Name.Name)) { - MonoAOTRegistration.ExtractNativeMethodsFromTypes(assemblyDefinition.get_MainModule().get_Types(), arrayList); + MonoAOTRegistration.ExtractNativeMethodsFromTypes(assemblyDefinition.MainModule.Types, arrayList); } } return arrayList; @@ -58,11 +53,11 @@ public static HashSet BuildReferencedTypeList(AssemblyDefinition[] assem for (int i = 0; i < assemblies.Length; i++) { AssemblyDefinition assemblyDefinition = assemblies[i]; - if (!assemblyDefinition.get_Name().get_Name().StartsWith("System") && !assemblyDefinition.get_Name().get_Name().Equals("UnityEngine")) + if (!assemblyDefinition.Name.Name.StartsWith("System") && !assemblyDefinition.Name.Name.Equals("UnityEngine")) { - foreach (TypeReference current in assemblyDefinition.get_MainModule().GetTypeReferences()) + foreach (TypeReference current in assemblyDefinition.MainModule.GetTypeReferences()) { - hashSet.Add(current.get_FullName()); + hashSet.Add(current.FullName); } } } @@ -129,7 +124,7 @@ public static void WriteCPlusPlusFileForStaticAOTModuleRegistration(BuildTarget for (int i = 0; i < assemblyFileNames.Length; i++) { string arg = assemblyFileNames[i]; - string text2 = assemblyDefinitions[i].get_Name().get_Name(); + string text2 = assemblyDefinitions[i].Name.Name; text2 = text2.Replace(".", "_"); text2 = text2.Replace("-", "_"); text2 = text2.Replace(" ", "_"); @@ -166,7 +161,7 @@ public static void WriteCPlusPlusFileForStaticAOTModuleRegistration(BuildTarget for (int j = 0; j < array.Length; j++) { AssemblyDefinition assemblyDefinition = array[j]; - string text3 = assemblyDefinition.get_Name().get_Name(); + string text3 = assemblyDefinition.Name.Name; text3 = text3.Replace(".", "_"); text3 = text3.Replace("-", "_"); text3 = text3.Replace(" ", "_"); @@ -236,11 +231,11 @@ public static void ResolveReferencedUnityEngineClassesFromMono(AssemblyDefinitio AssemblyDefinition assemblyDefinition = assemblies[i]; if (assemblyDefinition != unityEngine) { - foreach (TypeReference current in assemblyDefinition.get_MainModule().GetTypeReferences()) + foreach (TypeReference current in assemblyDefinition.MainModule.GetTypeReferences()) { - if (current.get_Namespace().StartsWith("UnityEngine")) + if (current.Namespace.StartsWith("UnityEngine")) { - string name = current.get_Name(); + string name = current.Name; res.AddMonoClass(name); } } @@ -256,16 +251,12 @@ public static void ResolveDefinedNativeClassesFromMono(AssemblyDefinition[] asse for (int i = 0; i < assemblies.Length; i++) { AssemblyDefinition assemblyDefinition = assemblies[i]; - using (Collection.Enumerator enumerator = assemblyDefinition.get_MainModule().get_Types().GetEnumerator()) + foreach (TypeDefinition current in assemblyDefinition.MainModule.Types) { - while (enumerator.MoveNext()) + if (current.Fields.Count > 0 || current.Methods.Count > 0 || current.Properties.Count > 0) { - TypeDefinition current = enumerator.get_Current(); - if (current.get_Fields().get_Count() > 0 || current.get_Methods().get_Count() > 0 || current.get_Properties().get_Count() > 0) - { - string name = current.get_Name(); - res.AddMonoClass(name); - } + string name = current.Name; + res.AddMonoClass(name); } } } @@ -347,7 +338,7 @@ public static void GenerateRegisterInternalCalls(AssemblyDefinition[] assemblies for (int i = 0; i < assemblies.Length; i++) { AssemblyDefinition assemblyDefinition = assemblies[i]; - MonoAOTRegistration.GenerateRegisterInternalCallsForTypes(assemblyDefinition.get_MainModule().get_Types(), output); + MonoAOTRegistration.GenerateRegisterInternalCallsForTypes(assemblyDefinition.MainModule.Types, output); } output.Write("}\n\n"); } @@ -356,23 +347,19 @@ private static void GenerateRegisterInternalCallsForTypes(IEnumerable.Enumerator enumerator2 = current.get_Methods().GetEnumerator()) + foreach (MethodDefinition current2 in current.Methods) { - while (enumerator2.MoveNext()) - { - MethodDefinition current2 = enumerator2.get_Current(); - MonoAOTRegistration.GenerateInternalCallMethod(current, current2, output); - } + MonoAOTRegistration.GenerateInternalCallMethod(current, current2, output); } - MonoAOTRegistration.GenerateRegisterInternalCallsForTypes(current.get_NestedTypes(), output); + MonoAOTRegistration.GenerateRegisterInternalCallsForTypes(current.NestedTypes, output); } } private static void GenerateInternalCallMethod(TypeDefinition typeDefinition, MethodDefinition method, TextWriter output) { - if (method.get_IsInternalCall()) + if (method.IsInternalCall) { - string text = typeDefinition.get_FullName() + "_" + method.get_Name(); + string text = typeDefinition.FullName + "_" + method.Name; text = text.Replace('/', '_'); text = text.Replace('.', '_'); if (!text.Contains("UnityEngine_Serialization")) diff --git a/UnityEditor/UnityEditor/MonoAssemblyStripping.cs b/UnityEditor/UnityEditor/MonoAssemblyStripping.cs index fcc35a54..3f7d1d48 100644 --- a/UnityEditor/UnityEditor/MonoAssemblyStripping.cs +++ b/UnityEditor/UnityEditor/MonoAssemblyStripping.cs @@ -14,12 +14,12 @@ private class AssemblyDefinitionComparer : IEqualityComparer { public bool Equals(AssemblyDefinition x, AssemblyDefinition y) { - return x.get_FullName() == y.get_FullName(); + return x.FullName == y.FullName; } public int GetHashCode(AssemblyDefinition obj) { - return obj.get_FullName().GetHashCode(); + return obj.FullName.GetHashCode(); } } @@ -77,20 +77,19 @@ public static string GenerateBlackList(string librariesFolder, RuntimeClassRegis for (int i = 0; i < allAssemblies.Length; i++) { string path = allAssemblies[i]; - BaseAssemblyResolver arg_CB_0 = defaultAssemblyResolver; - string arg_CB_1 = Path.GetFileNameWithoutExtension(path); - ReaderParameters readerParameters = new ReaderParameters(); - readerParameters.set_AssemblyResolver(defaultAssemblyResolver); - AssemblyDefinition assemblyDefinition = arg_CB_0.Resolve(arg_CB_1, readerParameters); - textWriter.WriteLine("", assemblyDefinition.get_Name().get_Name()); - if (assemblyDefinition.get_Name().get_Name().StartsWith("UnityEngine.")) + AssemblyDefinition assemblyDefinition = defaultAssemblyResolver.Resolve(Path.GetFileNameWithoutExtension(path), new ReaderParameters + { + AssemblyResolver = defaultAssemblyResolver + }); + textWriter.WriteLine("", assemblyDefinition.Name.Name); + if (assemblyDefinition.Name.Name.StartsWith("UnityEngine.")) { foreach (string current2 in usedClasses.GetAllManagedClassesAsString()) { textWriter.WriteLine(string.Format("", current2, usedClasses.GetRetentionLevel(current2))); } } - MonoAssemblyStripping.GenerateBlackListTypeXML(textWriter, assemblyDefinition.get_MainModule().get_Types(), usedClasses.GetAllManagedBaseClassesAsString()); + MonoAssemblyStripping.GenerateBlackListTypeXML(textWriter, assemblyDefinition.MainModule.Types, usedClasses.GetAllManagedBaseClassesAsString()); textWriter.WriteLine(""); } textWriter.WriteLine(""); @@ -106,27 +105,24 @@ public static string GenerateLinkXmlToPreserveDerivedTypes(string stagingArea, s using (TextWriter textWriter = new StreamWriter(fullPath)) { textWriter.WriteLine(""); - foreach (AssemblyDefinition current in MonoAssemblyStripping.CollectAssembliesRecursive((from s in usedClasses.GetUserAssemblies() + foreach (AssemblyDefinition current in MonoAssemblyStripping.CollectAssembliesRecursive(from s in usedClasses.GetUserAssemblies() where usedClasses.IsDLLUsed(s) - select s).Select(delegate(string file) + select s into file + select resolver.Resolve(Path.GetFileNameWithoutExtension(file), new ReaderParameters { - BaseAssemblyResolver arg_1F_0 = resolver; - string arg_1F_1 = Path.GetFileNameWithoutExtension(file); - ReaderParameters readerParameters = new ReaderParameters(); - readerParameters.set_AssemblyResolver(resolver); - return arg_1F_0.Resolve(arg_1F_1, readerParameters); + AssemblyResolver = resolver }))) { - if (!(current.get_Name().get_Name() == "UnityEngine")) + if (!(current.Name.Name == "UnityEngine")) { HashSet hashSet = new HashSet(); - MonoAssemblyStripping.CollectBlackListTypes(hashSet, current.get_MainModule().get_Types(), usedClasses.GetAllManagedBaseClassesAsString()); + MonoAssemblyStripping.CollectBlackListTypes(hashSet, current.MainModule.Types, usedClasses.GetAllManagedBaseClassesAsString()); if (hashSet.Count != 0) { - textWriter.WriteLine("", current.get_Name().get_Name()); + textWriter.WriteLine("", current.Name.Name); foreach (TypeDefinition current2 in hashSet) { - textWriter.WriteLine("", current2.get_FullName()); + textWriter.WriteLine("", current2.FullName); } textWriter.WriteLine(""); } @@ -144,8 +140,8 @@ private static HashSet CollectAssembliesRecursive(IEnumerabl while (hashSet.Count > num) { num = hashSet.Count; - hashSet.UnionWith(hashSet.ToArray().SelectMany((AssemblyDefinition assembly) => from a in assembly.get_MainModule().get_AssemblyReferences() - select assembly.get_MainModule().get_AssemblyResolver().Resolve(a))); + hashSet.UnionWith(hashSet.ToArray().SelectMany((AssemblyDefinition assembly) => from a in assembly.MainModule.AssemblyReferences + select assembly.MainModule.AssemblyResolver.Resolve(a))); } return hashSet; } @@ -166,7 +162,7 @@ private static void CollectBlackListTypes(HashSet typesToPreserv break; } } - MonoAssemblyStripping.CollectBlackListTypes(typesToPreserve, current.get_NestedTypes(), baseTypes); + MonoAssemblyStripping.CollectBlackListTypes(typesToPreserve, current.NestedTypes, baseTypes); } } } @@ -178,7 +174,7 @@ private static void GenerateBlackListTypeXML(TextWriter w, IList MonoAssemblyStripping.CollectBlackListTypes(hashSet, types, baseTypes); foreach (TypeDefinition current in hashSet) { - w.WriteLine("", current.get_FullName()); + w.WriteLine("", current.FullName); } } @@ -187,7 +183,7 @@ private static bool DoesTypeEnheritFrom(TypeReference type, string typeName) bool result; while (type != null) { - if (type.get_FullName() == typeName) + if (type.FullName == typeName) { result = true; } @@ -196,7 +192,7 @@ private static bool DoesTypeEnheritFrom(TypeReference type, string typeName) TypeDefinition typeDefinition = type.Resolve(); if (typeDefinition != null) { - type = typeDefinition.get_BaseType(); + type = typeDefinition.BaseType; continue; } result = false; diff --git a/UnityEditor/UnityEditor/NoiseModuleUI.cs b/UnityEditor/UnityEditor/NoiseModuleUI.cs index 235fb08c..48197e92 100644 --- a/UnityEditor/UnityEditor/NoiseModuleUI.cs +++ b/UnityEditor/UnityEditor/NoiseModuleUI.cs @@ -35,7 +35,7 @@ private class Texts public GUIContent z = EditorGUIUtility.TextContent("Z"); - public GUIContent previewTexture = EditorGUIUtility.TextContent("Preview"); + public GUIContent previewTexture = EditorGUIUtility.TextContent("Preview|Preview the noise as a texture."); public string[] qualityDropdown = new string[] { diff --git a/UnityEditor/UnityEditor/PS4BuildSubtarget.cs b/UnityEditor/UnityEditor/PS4BuildSubtarget.cs index 1eb81e2d..dd8f519f 100644 --- a/UnityEditor/UnityEditor/PS4BuildSubtarget.cs +++ b/UnityEditor/UnityEditor/PS4BuildSubtarget.cs @@ -5,6 +5,7 @@ namespace UnityEditor public enum PS4BuildSubtarget { PCHosted, - Package + Package, + Iso } } diff --git a/UnityEditor/UnityEditor/PlayerSettings.cs b/UnityEditor/UnityEditor/PlayerSettings.cs index adcb0208..a8118bab 100644 --- a/UnityEditor/UnityEditor/PlayerSettings.cs +++ b/UnityEditor/UnityEditor/PlayerSettings.cs @@ -329,6 +329,30 @@ public static extern string appleDeveloperTeamID set; } + public static extern string iOSManualProvisioningProfileID + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + public static extern string tvOSManualProvisioningProfileID + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + public static extern bool appleEnableAutomaticSigning + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + public static extern string cameraUsageDescription { [MethodImpl(MethodImplOptions.InternalCall)] @@ -607,7 +631,8 @@ public sealed class PS4 public enum PS4AppCategory { Application, - Patch + Patch, + Remaster } public enum PS4RemotePlayKeyAssignment @@ -629,6 +654,13 @@ public enum PS4EnterButtonAssignment CrossButton } + public enum PlayStationVREyeToEyeDistanceSettings + { + PerUser, + ForceDefault, + DynamicModeAtRuntime + } + public static extern string npTrophyPackPath { [MethodImpl(MethodImplOptions.InternalCall)] @@ -829,6 +861,14 @@ public static extern int videoOutInitialWidth set; } + public static extern int videoOutBaseModeInitialWidth + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + public static extern int videoOutReprojectionRate { [MethodImpl(MethodImplOptions.InternalCall)] @@ -1022,6 +1062,14 @@ public static extern int garlicHeapSize set; } + public static extern int proGarlicHeapSize + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + public static extern bool reprojectionSupport { [MethodImpl(MethodImplOptions.InternalCall)] @@ -1118,6 +1166,30 @@ public static extern int attribCpuUsage set; } + public static extern bool videoRecordingFeaturesUsed + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + public static extern bool contentSearchFeaturesUsed + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + public static extern PlayerSettings.PS4.PlayStationVREyeToEyeDistanceSettings attribEyeToEyeDistanceSettingVR + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + public static extern string[] includedModules { [MethodImpl(MethodImplOptions.InternalCall)] @@ -3906,6 +3978,14 @@ public static extern bool graphicsJobs set; } + public static extern GraphicsJobMode graphicsJobMode + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + public static extern bool xboxPIXTextureCapture { [MethodImpl(MethodImplOptions.InternalCall)] diff --git a/UnityEditor/UnityEditor/PlayerSettingsEditor.cs b/UnityEditor/UnityEditor/PlayerSettingsEditor.cs index cc4798bf..db9216aa 100644 --- a/UnityEditor/UnityEditor/PlayerSettingsEditor.cs +++ b/UnityEditor/UnityEditor/PlayerSettingsEditor.cs @@ -21,8 +21,6 @@ private static class Styles { public static readonly GUIStyle categoryBox; - public static readonly GUIContent colorSpaceWindowsWarning; - public static readonly GUIContent colorSpaceAndroidWarning; public static readonly GUIContent colorSpaceWebGLWarning; @@ -39,6 +37,8 @@ private static class Styles public static readonly GUIContent vertexChannelCompressionMask; + public static readonly GUIContent graphicsJobsMode; + public static readonly GUIContent require31; public static readonly GUIContent requireAEP; @@ -48,7 +48,6 @@ private static class Styles static Styles() { PlayerSettingsEditor.Styles.categoryBox = new GUIStyle(EditorStyles.helpBox); - PlayerSettingsEditor.Styles.colorSpaceWindowsWarning = EditorGUIUtility.TextContent("On Windows, linear colorspace with OpenGL ES 2.0 and OpenGL ES 3.x is not supported, consider using OpenGL Core API instead by unchecking 'Automatic Graphics API'"); PlayerSettingsEditor.Styles.colorSpaceAndroidWarning = EditorGUIUtility.TextContent("On Android, linear colorspace requires OpenGL ES 3.0 only, uncheck 'Automatic Graphics API' to remove OpenGL ES 2 API and 'Minimum API Level' must be at least Android 4.3"); PlayerSettingsEditor.Styles.colorSpaceWebGLWarning = EditorGUIUtility.TextContent("On WebGL, linear colorspace is not supported"); PlayerSettingsEditor.Styles.colorSpaceIOSWarning = EditorGUIUtility.TextContent("Linear colorspace requires Metal API only. Uncheck 'Automatic Graphics API' and remove OpenGL ES 2 API. Additionally, 'minimum iOS version' set to 8.0 at least"); @@ -56,7 +55,8 @@ static Styles() PlayerSettingsEditor.Styles.cursorHotspot = EditorGUIUtility.TextContent("Cursor Hotspot"); PlayerSettingsEditor.Styles.defaultCursor = EditorGUIUtility.TextContent("Default Cursor"); PlayerSettingsEditor.Styles.defaultIcon = EditorGUIUtility.TextContent("Default Icon"); - PlayerSettingsEditor.Styles.vertexChannelCompressionMask = EditorGUIUtility.TextContent("Vertex Compression|Select which vertex channels should be compressed. Compression can save memory and bandwidth but precision will be lower."); + PlayerSettingsEditor.Styles.vertexChannelCompressionMask = EditorGUIUtility.TextContent("Vertex Compression*|Select which vertex channels should be compressed. Compression can save memory and bandwidth but precision will be lower."); + PlayerSettingsEditor.Styles.graphicsJobsMode = EditorGUIUtility.TextContent("Graphics Jobs Mode*"); PlayerSettingsEditor.Styles.require31 = EditorGUIUtility.TextContent("Require ES3.1"); PlayerSettingsEditor.Styles.requireAEP = EditorGUIUtility.TextContent("Require ES3.1+AEP"); PlayerSettingsEditor.Styles.kStereoRenderingMethodsAll = new GUIContent[] @@ -103,6 +103,18 @@ private enum FakeEnum public static readonly GUIContent defaultIsFullScreen = EditorGUIUtility.TextContent("Default Is Full Screen*"); + private static GraphicsJobMode[] m_GfxJobModeValues = new GraphicsJobMode[] + { + GraphicsJobMode.Native, + GraphicsJobMode.Legacy + }; + + private static GUIContent[] m_GfxJobModeNames = new GUIContent[] + { + new GUIContent("Native"), + new GUIContent("Legacy") + }; + private SavedInt m_SelectedSection = new SavedInt("PlayerSettings.ShownSection", -1); private BuildPlayerWindow.BuildPlatform[] validPlatforms; @@ -117,8 +129,6 @@ private enum FakeEnum private SerializedProperty m_IPhoneBuildNumber; - private SerializedProperty m_AppleDeveloperTeamID; - private SerializedProperty m_CameraUsageDescription; private SerializedProperty m_LocationUsageDescription; @@ -367,7 +377,6 @@ private void OnEnable() this.m_StripUnusedMeshComponents = this.FindPropertyAssert("StripUnusedMeshComponents"); this.m_VertexChannelCompressionMask = this.FindPropertyAssert("VertexChannelCompressionMask"); this.m_MetalForceHardShadows = this.FindPropertyAssert("iOSMetalForceHardShadows"); - this.m_AppleDeveloperTeamID = this.FindPropertyAssert("appleDeveloperTeamID"); this.m_ApplicationBundleIdentifier = base.serializedObject.FindProperty("bundleIdentifier"); if (this.m_ApplicationBundleIdentifier == null) { @@ -638,17 +647,30 @@ private void IconSectionGUI(BuildTargetGroup targetGroup, ISettingEditorExtensio { int num = Mathf.Min(96, iconWidthsForPlatform[i]); int num2 = (int)((float)iconHeightsForPlatform[i] * (float)num / (float)iconWidthsForPlatform[i]); - Rect rect = GUILayoutUtility.GetRect(64f, (float)(Mathf.Max(64, num2) + 6)); - float num3 = Mathf.Min(rect.width, EditorGUIUtility.labelWidth + 4f + 64f + 6f + 96f); + if (targetGroup == BuildTargetGroup.iPhone) + { + if (i + 1 < iconWidthsForPlatform.Length && iconWidthsForPlatform[i + 1] == 80) + { + Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20f); + GUI.Label(new Rect(rect.x, rect.y, EditorGUIUtility.labelWidth, 20f), "Spotlight icons", EditorStyles.boldLabel); + } + if (iconWidthsForPlatform[i] == 87) + { + Rect rect2 = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20f); + GUI.Label(new Rect(rect2.x, rect2.y, EditorGUIUtility.labelWidth, 20f), "Settings icons", EditorStyles.boldLabel); + } + } + Rect rect3 = GUILayoutUtility.GetRect(64f, (float)(Mathf.Max(64, num2) + 6)); + float num3 = Mathf.Min(rect3.width, EditorGUIUtility.labelWidth + 4f + 64f + 6f + 96f); string text2 = iconWidthsForPlatform[i] + "x" + iconHeightsForPlatform[i]; - GUI.Label(new Rect(rect.x, rect.y, num3 - 96f - 64f - 12f, 20f), text2); + GUI.Label(new Rect(rect3.x, rect3.y, num3 - 96f - 64f - 12f, 20f), text2); if (flag3) { int num4 = 64; int num5 = (int)((float)iconHeightsForPlatform[i] / (float)iconWidthsForPlatform[i] * 64f); - array[i] = (Texture2D)EditorGUI.ObjectField(new Rect(rect.x + num3 - 96f - 64f - 6f, rect.y, (float)num4, (float)num5), array[i], typeof(Texture2D), false); + array[i] = (Texture2D)EditorGUI.ObjectField(new Rect(rect3.x + num3 - 96f - 64f - 6f, rect3.y, (float)num4, (float)num5), array[i], typeof(Texture2D), false); } - Rect position = new Rect(rect.x + num3 - 96f, rect.y, (float)num, (float)num2); + Rect position = new Rect(rect3.x + num3 - 96f, rect3.y, (float)num, (float)num2); Texture2D iconForPlatformAtSize = PlayerSettings.GetIconForPlatformAtSize(text, iconWidthsForPlatform[i], iconHeightsForPlatform[i]); if (iconForPlatformAtSize != null) { @@ -1104,12 +1126,12 @@ public void DebugAndCrashReportingGUI(BuildPlayerWindow.BuildPlatform platform, if (this.BeginSettingsBox(3, EditorGUIUtility.TextContent("Debugging and crash reporting"))) { GUILayout.Label(EditorGUIUtility.TextContent("Debugging"), EditorStyles.boldLabel, new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_EnableInternalProfiler, EditorGUIUtility.TextContent("Enable Internal Profiler"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_EnableInternalProfiler, EditorGUIUtility.TextContent("Enable Internal Profiler*"), new GUILayoutOption[0]); EditorGUILayout.Space(); GUILayout.Label(EditorGUIUtility.TextContent("Crash Reporting"), EditorStyles.boldLabel, new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_ActionOnDotNetUnhandledException, EditorGUIUtility.TextContent("On .Net UnhandledException"), new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_LogObjCUncaughtExceptions, EditorGUIUtility.TextContent("Log Obj-C Uncaught Exceptions"), new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_EnableCrashReportAPI, EditorGUIUtility.TextContent("Enable CrashReport API"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_ActionOnDotNetUnhandledException, EditorGUIUtility.TextContent("On .Net UnhandledException*"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_LogObjCUncaughtExceptions, EditorGUIUtility.TextContent("Log Obj-C Uncaught Exceptions*"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_EnableCrashReportAPI, EditorGUIUtility.TextContent("Enable CrashReport API*"), new GUILayoutOption[0]); EditorGUILayout.Space(); } this.EndSettingsBox(); @@ -1214,14 +1236,6 @@ private void OtherSectionRenderingGUI(BuildPlayerWindow.BuildPlatform platform, EditorGUILayout.HelpBox(PlayerSettingsEditor.Styles.colorSpaceAndroidWarning.text, MessageType.Warning); } } - if (targetGroup == BuildTargetGroup.Standalone) - { - GraphicsDeviceType[] graphicsAPIs4 = PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows); - if (graphicsAPIs4.Contains(GraphicsDeviceType.OpenGLES3) || graphicsAPIs4.Contains(GraphicsDeviceType.OpenGLES2)) - { - EditorGUILayout.HelpBox(PlayerSettingsEditor.Styles.colorSpaceWindowsWarning.text, MessageType.Warning); - } - } if (targetGroup == BuildTargetGroup.WebGL) { EditorGUILayout.HelpBox(PlayerSettingsEditor.Styles.colorSpaceWebGLWarning.text, MessageType.Error); @@ -1310,39 +1324,54 @@ private void OtherSectionRenderingGUI(BuildPlayerWindow.BuildPlatform platform, ShaderUtil.RecreateSkinnedMeshResources(); } } - EditorGUILayout.PropertyField(this.m_GraphicsJobs, EditorGUIUtility.TextContent("Graphics Jobs (Experimental)"), new GUILayoutOption[0]); - if (this.m_VRSettings.TargetGroupSupportsVirtualReality(targetGroup)) + EditorGUILayout.PropertyField(this.m_GraphicsJobs, EditorGUIUtility.TextContent("Graphics Jobs (Experimental)*"), new GUILayoutOption[0]); + if (this.PlatformSupportsGfxJobModes(targetGroup)) { - this.m_VRSettings.DevicesGUI(targetGroup); - bool flag6 = PlayerSettingsEditor.TargetSupportsSinglePassStereoRendering(targetGroup); - bool flag7 = PlayerSettingsEditor.TargetSupportsStereoInstancingRendering(targetGroup); - if (PlayerSettings.virtualRealitySupported) - { - int num3 = 1 + ((!flag6) ? 0 : 1) + ((!flag7) ? 0 : 1); - GUIContent[] array = new GUIContent[num3]; - int[] array2 = new int[num3]; - int num4 = 0; - array[num4] = PlayerSettingsEditor.Styles.kStereoRenderingMethodsAll[0]; - array2[num4++] = PlayerSettingsEditor.kStereoRenderingMethodValues[0]; - if (flag6) - { - array[num4] = PlayerSettingsEditor.Styles.kStereoRenderingMethodsAll[1]; - array2[num4++] = PlayerSettingsEditor.kStereoRenderingMethodValues[1]; - } - if (flag7) - { - array[num4] = PlayerSettingsEditor.Styles.kStereoRenderingMethodsAll[2]; - array2[num4++] = PlayerSettingsEditor.kStereoRenderingMethodValues[2]; - } - if (!flag7 && this.m_StereoRenderingPath.intValue == 2) + using (new EditorGUI.DisabledScope(!this.m_GraphicsJobs.boolValue)) + { + int graphicsJobMode = (int)PlayerSettings.graphicsJobMode; + int num3 = PlayerSettingsEditor.BuildEnumPopup(PlayerSettingsEditor.Styles.graphicsJobsMode, graphicsJobMode, PlayerSettingsEditor.m_GfxJobModeValues, PlayerSettingsEditor.m_GfxJobModeNames); + if (num3 != graphicsJobMode) { - this.m_StereoRenderingPath.intValue = 1; + PlayerSettings.graphicsJobMode = (GraphicsJobMode)num3; } - if (!flag6 && this.m_StereoRenderingPath.intValue == 1) + } + } + if (this.m_VRSettings.TargetGroupSupportsVirtualReality(targetGroup)) + { + this.m_VRSettings.DevicesGUI(targetGroup); + using (new EditorGUI.DisabledScope(EditorApplication.isPlaying)) + { + bool flag6 = PlayerSettingsEditor.TargetSupportsSinglePassStereoRendering(targetGroup); + bool flag7 = PlayerSettingsEditor.TargetSupportsStereoInstancingRendering(targetGroup); + if (PlayerSettings.virtualRealitySupported) { - this.m_StereoRenderingPath.intValue = 0; + int num4 = 1 + ((!flag6) ? 0 : 1) + ((!flag7) ? 0 : 1); + GUIContent[] array = new GUIContent[num4]; + int[] array2 = new int[num4]; + int num5 = 0; + array[num5] = PlayerSettingsEditor.Styles.kStereoRenderingMethodsAll[0]; + array2[num5++] = PlayerSettingsEditor.kStereoRenderingMethodValues[0]; + if (flag6) + { + array[num5] = PlayerSettingsEditor.Styles.kStereoRenderingMethodsAll[1]; + array2[num5++] = PlayerSettingsEditor.kStereoRenderingMethodValues[1]; + } + if (flag7) + { + array[num5] = PlayerSettingsEditor.Styles.kStereoRenderingMethodsAll[2]; + array2[num5++] = PlayerSettingsEditor.kStereoRenderingMethodValues[2]; + } + if (!flag7 && this.m_StereoRenderingPath.intValue == 2) + { + this.m_StereoRenderingPath.intValue = 1; + } + if (!flag6 && this.m_StereoRenderingPath.intValue == 1) + { + this.m_StereoRenderingPath.intValue = 0; + } + EditorGUILayout.IntPopup(this.m_StereoRenderingPath, array, array2, EditorGUIUtility.TextContent("Stereo Rendering Method*"), new GUILayoutOption[0]); } - EditorGUILayout.IntPopup(this.m_StereoRenderingPath, array, array2, EditorGUIUtility.TextContent("Stereo Rendering Method*"), new GUILayoutOption[0]); } } if (PlayerSettingsEditor.TargetSupportsProtectedGraphicsMem(targetGroup)) @@ -1365,7 +1394,6 @@ private void OtherSectionIdentificationGUI(BuildTargetGroup targetGroup, ISettin if (targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS) { EditorGUILayout.PropertyField(this.m_IPhoneBuildNumber, EditorGUIUtility.TextContent("Build"), new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_AppleDeveloperTeamID, new GUIContent("iOS Developer Team ID", "Developers can retrieve their Team ID by visiting the Apple Developer site under Account > Membership."), new GUILayoutOption[0]); } if (settingsExtension != null) { @@ -1440,7 +1468,7 @@ private void OtherSectionConfigurationGUI(BuildTargetGroup targetGroup, ISetting } if (targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS) { - EditorGUILayout.PropertyField(this.m_useOnDemandResources, EditorGUIUtility.TextContent("Use on demand resources"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_useOnDemandResources, EditorGUIUtility.TextContent("Use on demand resources*"), new GUILayoutOption[0]); if (this.m_useOnDemandResources.boolValue && this.ParseIosVersion(this.m_IPhoneTargetOSVersion.stringValue).Major < 9) { this.m_IPhoneTargetOSVersion.stringValue = "9.0"; @@ -1449,13 +1477,13 @@ private void OtherSectionConfigurationGUI(BuildTargetGroup targetGroup, ISetting bool flag2 = targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS || targetGroup == BuildTargetGroup.WSA; if (flag2) { - EditorGUILayout.PropertyField(this.m_AccelerometerFrequency, EditorGUIUtility.TextContent("Accelerometer Frequency"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_AccelerometerFrequency, EditorGUIUtility.TextContent("Accelerometer Frequency*"), new GUILayoutOption[0]); } if (targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS) { - EditorGUILayout.PropertyField(this.m_CameraUsageDescription, EditorGUIUtility.TextContent("Camera Usage Description"), new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_LocationUsageDescription, EditorGUIUtility.TextContent("Location Usage Description"), new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_MicrophoneUsageDescription, EditorGUIUtility.TextContent("Microphone Usage Description"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_CameraUsageDescription, EditorGUIUtility.TextContent("Camera Usage Description*"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_LocationUsageDescription, EditorGUIUtility.TextContent("Location Usage Description*"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_MicrophoneUsageDescription, EditorGUIUtility.TextContent("Microphone Usage Description*"), new GUILayoutOption[0]); } if (targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS || targetGroup == BuildTargetGroup.Android) { @@ -1467,15 +1495,15 @@ private void OtherSectionConfigurationGUI(BuildTargetGroup targetGroup, ISetting { EditorGUILayout.PropertyField(this.m_PrepareIOSForRecording, EditorGUIUtility.TextContent("Prepare iOS for Recording"), new GUILayoutOption[0]); } - EditorGUILayout.PropertyField(this.m_UIRequiresPersistentWiFi, EditorGUIUtility.TextContent("Requires Persistent WiFi"), new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_IOSAllowHTTPDownload, EditorGUIUtility.TextContent("Allow downloads over HTTP (nonsecure)"), new GUILayoutOption[0]); - EditorGUILayout.PropertyField(this.m_IOSURLSchemes, EditorGUIUtility.TextContent("Supported URL schemes"), true, new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_UIRequiresPersistentWiFi, EditorGUIUtility.TextContent("Requires Persistent WiFi*"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_IOSAllowHTTPDownload, EditorGUIUtility.TextContent("Allow downloads over HTTP (nonsecure)*"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_IOSURLSchemes, EditorGUIUtility.TextContent("Supported URL schemes*"), true, new GUILayoutOption[0]); } } using (new EditorGUI.DisabledScope(!Application.HasProLicense())) { bool flag3 = !this.m_SubmitAnalytics.boolValue; - bool flag4 = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Disable HW Statistics|Disables HW Statistics (Pro Only)"), flag3, new GUILayoutOption[0]); + bool flag4 = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Disable HW Statistics*|Disables HW Statistics (Pro Only)"), flag3, new GUILayoutOption[0]); if (flag3 != flag4) { this.m_SubmitAnalytics.boolValue = !flag4; @@ -1489,7 +1517,7 @@ private void OtherSectionConfigurationGUI(BuildTargetGroup targetGroup, ISetting { settingsExtension.ConfigurationSectionGUI(); } - EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Scripting Define Symbols"), new GUILayoutOption[0]); + EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Scripting Define Symbols*"), new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); string defines = EditorGUILayout.DelayedTextField(PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup), EditorStyles.textField, new GUILayoutOption[0]); this.scriptingDefinesControlID = EditorGUIUtility.s_LastControlID; @@ -1514,19 +1542,19 @@ private void OtherSectionOptimizationGUI(BuildTargetGroup targetGroup) else { EditorGUI.BeginChangeCheck(); - EditorGUILayout.PropertyField(this.m_ApiCompatibilityLevel, new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_ApiCompatibilityLevel, EditorGUIUtility.TextContent("API Compatibility level*"), new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { PlayerSettings.SetApiCompatibilityInternal(this.m_ApiCompatibilityLevel.intValue); } } - EditorGUILayout.PropertyField(this.m_BakeCollisionMeshes, EditorGUIUtility.TextContent("Prebake Collision Meshes|Bake collision data into the meshes on build time"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_BakeCollisionMeshes, EditorGUIUtility.TextContent("Prebake Collision Meshes*|Bake collision data into the meshes on build time"), new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_PreloadShaders, EditorGUIUtility.TextContent("Preload Shaders"), new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_PreloadedAssets, EditorGUIUtility.TextContent("Preloaded Assets|Assets to load at start up in the player"), true, new GUILayoutOption[0]); bool flag = targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS || targetGroup == BuildTargetGroup.XboxOne || targetGroup == BuildTargetGroup.WiiU || targetGroup == BuildTargetGroup.PS4 || targetGroup == BuildTargetGroup.PSP2; if (flag) { - EditorGUILayout.PropertyField(this.m_AotOptions, EditorGUIUtility.TextContent("AOT Compilation Options"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_AotOptions, EditorGUIUtility.TextContent("AOT Compilation Options*"), new GUILayoutOption[0]); } bool flag2 = targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS || targetGroup == BuildTargetGroup.Android || targetGroup == BuildTargetGroup.Tizen || targetGroup == BuildTargetGroup.WebGL || targetGroup == BuildTargetGroup.WiiU || targetGroup == BuildTargetGroup.PSP2 || targetGroup == BuildTargetGroup.PS4 || targetGroup == BuildTargetGroup.XboxOne || targetGroup == BuildTargetGroup.WSA; if (flag2) @@ -1543,7 +1571,7 @@ private void OtherSectionOptimizationGUI(BuildTargetGroup targetGroup) } if (targetGroup == BuildTargetGroup.iPhone || targetGroup == BuildTargetGroup.tvOS) { - EditorGUILayout.PropertyField(this.m_IPhoneScriptCallOptimization, EditorGUIUtility.TextContent("Script Call Optimization"), new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_IPhoneScriptCallOptimization, EditorGUIUtility.TextContent("Script Call Optimization*"), new GUILayoutOption[0]); } if (targetGroup == BuildTargetGroup.Android) { @@ -1651,6 +1679,11 @@ private void OtherSectionLoggingGUI() GUILayout.EndVertical(); } + private bool PlatformSupportsGfxJobModes(BuildTargetGroup targetGroup) + { + return targetGroup == BuildTargetGroup.PS4; + } + private static GUIContent[] GetNiceScriptingBackendNames(ScriptingImplementation[] scriptingBackends) { if (PlayerSettingsEditor.m_NiceScriptingBackendNames == null) diff --git a/UnityEditor/UnityEditor/PlayerSettingsSplashScreenEditor.cs b/UnityEditor/UnityEditor/PlayerSettingsSplashScreenEditor.cs index fa41f4ab..cb6dcb25 100644 --- a/UnityEditor/UnityEditor/PlayerSettingsSplashScreenEditor.cs +++ b/UnityEditor/UnityEditor/PlayerSettingsSplashScreenEditor.cs @@ -37,7 +37,7 @@ private class Texts public GUIContent overlayOpacity = EditorGUIUtility.TextContent("Overlay Opacity|Overlay strength applied to improve logo visibility."); - public GUIContent previewSplash = EditorGUIUtility.TextContent("Preview"); + public GUIContent previewSplash = EditorGUIUtility.TextContent("Preview|Preview the splash screen in the game view."); public GUIContent showLogo = EditorGUIUtility.TextContent("Show Unity Logo"); diff --git a/UnityEditor/UnityEditor/PreviewWindow.cs b/UnityEditor/UnityEditor/PreviewWindow.cs index b75d08d5..03065b38 100644 --- a/UnityEditor/UnityEditor/PreviewWindow.cs +++ b/UnityEditor/UnityEditor/PreviewWindow.cs @@ -11,6 +11,7 @@ internal class PreviewWindow : InspectorWindow public void SetParentInspector(InspectorWindow inspector) { this.m_ParentInspectorWindow = inspector; + this.CreateTracker(); } protected override void OnEnable() @@ -28,7 +29,10 @@ protected override void OnDisable() protected override void CreateTracker() { - this.m_Tracker = this.m_ParentInspectorWindow.GetTracker(); + if (this.m_ParentInspectorWindow != null) + { + this.m_Tracker = this.m_ParentInspectorWindow.tracker; + } } public override Editor GetLastInteractedEditor() @@ -44,10 +48,9 @@ protected override void OnGUI() GUIUtility.ExitGUI(); } Editor.m_AllowMultiObjectAccess = true; - this.CreateTracker(); this.CreatePreviewables(); - base.AssignAssetEditor(this.m_Tracker.activeEditors); - IPreviewable[] editorsWithPreviews = base.GetEditorsWithPreviews(this.m_Tracker.activeEditors); + base.AssignAssetEditor(base.tracker.activeEditors); + IPreviewable[] editorsWithPreviews = base.GetEditorsWithPreviews(base.tracker.activeEditors); IPreviewable editorThatControlsPreview = base.GetEditorThatControlsPreview(editorsWithPreviews); bool flag = editorThatControlsPreview != null && editorThatControlsPreview.HasPreviewGUI(); Rect rect = EditorGUILayout.BeginHorizontal(GUIContent.none, InspectorWindow.styles.preToolbar, new GUILayoutOption[] diff --git a/UnityEditor/UnityEditor/Rigidbody2DEditor.cs b/UnityEditor/UnityEditor/Rigidbody2DEditor.cs index af78ad27..1eb4fc13 100644 --- a/UnityEditor/UnityEditor/Rigidbody2DEditor.cs +++ b/UnityEditor/UnityEditor/Rigidbody2DEditor.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using UnityEditor.AnimatedValues; using UnityEngine; using UnityEngine.Events; @@ -96,9 +97,21 @@ public override void OnInspectorGUI() if (EditorGUILayout.BeginFadeGroup(this.m_ShowIsKinematic.faded)) { EditorGUILayout.PropertyField(this.m_UseAutoMass, new GUILayoutOption[0]); - EditorGUI.BeginDisabledGroup(rigidbody2D.useAutoMass); - EditorGUILayout.PropertyField(this.m_Mass, new GUILayoutOption[0]); - EditorGUI.EndDisabledGroup(); + if (!this.m_UseAutoMass.hasMultipleDifferentValues) + { + if (this.m_UseAutoMass.boolValue) + { + if (base.targets.Any((UnityEngine.Object x) => PrefabUtility.GetPrefabType(x) == PrefabType.Prefab || !(x as Rigidbody2D).gameObject.activeInHierarchy)) + { + EditorGUILayout.HelpBox("The auto mass value cannot be displayed for a prefab or if the object is not active. The value will be calculated for a prefab instance and when the object is active.", MessageType.Info); + goto IL_161; + } + } + EditorGUI.BeginDisabledGroup(rigidbody2D.useAutoMass); + EditorGUILayout.PropertyField(this.m_Mass, new GUILayoutOption[0]); + EditorGUI.EndDisabledGroup(); + IL_161:; + } EditorGUILayout.PropertyField(this.m_LinearDrag, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_AngularDrag, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_GravityScale, new GUILayoutOption[0]); diff --git a/UnityEditor/UnityEditor/SceneViewRotation.cs b/UnityEditor/UnityEditor/SceneViewRotation.cs index f7fc80d0..0034232a 100644 --- a/UnityEditor/UnityEditor/SceneViewRotation.cs +++ b/UnityEditor/UnityEditor/SceneViewRotation.cs @@ -80,6 +80,13 @@ public Styles() "Perspective" }; + private static readonly GUIContent[] s_HandleAxisLabels = new GUIContent[] + { + new GUIContent("x"), + new GUIContent("y"), + new GUIContent("z") + }; + private int[] m_ViewDirectionControlIDs; private int m_CenterButtonControlID; @@ -193,12 +200,6 @@ private void AxisSelectors(SceneView view, Camera cam, float size, float sgn, GU for (int i = SceneViewRotation.kDirectionRotations.Length - 1; i >= 0; i--) { Quaternion quaternion = SceneViewRotation.kDirectionRotations[i]; - string[] array = new string[] - { - "x", - "y", - "z" - }; float faded = this.dirVisible[i % 3].faded; Vector3 vector = SceneViewRotation.kDirectionRotations[i] * Vector3.forward; float num = Vector3.Dot(view.camera.transform.forward, vector); @@ -234,15 +235,15 @@ private void AxisSelectors(SceneView view, Camera cam, float size, float sgn, GU } if (sgn > 0f) { - int arg_1C6_0 = this.m_ViewDirectionControlIDs[i]; - Vector3 arg_1C6_1 = quaternion * Vector3.forward * size * -1.2f; - Quaternion arg_1C6_2 = quaternion; - float arg_1C6_4 = size * 0.7f; + int arg_1A5_0 = this.m_ViewDirectionControlIDs[i]; + Vector3 arg_1A5_1 = quaternion * Vector3.forward * size * -1.2f; + Quaternion arg_1A5_2 = quaternion; + float arg_1A5_4 = size * 0.7f; if (SceneViewRotation.<>f__mg$cache0 == null) { SceneViewRotation.<>f__mg$cache0 = new Handles.CapFunction(Handles.ConeHandleCap); } - if (Handles.Button(arg_1C6_0, arg_1C6_1, arg_1C6_2, size, arg_1C6_4, SceneViewRotation.<>f__mg$cache0)) + if (Handles.Button(arg_1A5_0, arg_1A5_1, arg_1A5_2, size, arg_1A5_4, SceneViewRotation.<>f__mg$cache0)) { if (!view.in2DMode && !view.isRotationLocked) { @@ -256,19 +257,19 @@ private void AxisSelectors(SceneView view, Camera cam, float size, float sgn, GU Vector3 a = vector; a += num * view.camera.transform.forward * -0.5f; a = (a * 0.7f + a.normalized * 1.5f) * size; - Handles.Label(-a, new GUIContent(array[i]), SceneViewRotation.styles.viewAxisLabelStyle); + Handles.Label(-a, SceneViewRotation.s_HandleAxisLabels[i], SceneViewRotation.styles.viewAxisLabelStyle); } if (sgn < 0f) { - int arg_2F1_0 = this.m_ViewDirectionControlIDs[i]; - Vector3 arg_2F1_1 = quaternion * Vector3.forward * size * -1.2f; - Quaternion arg_2F1_2 = quaternion; - float arg_2F1_4 = size * 0.7f; + int arg_2CE_0 = this.m_ViewDirectionControlIDs[i]; + Vector3 arg_2CE_1 = quaternion * Vector3.forward * size * -1.2f; + Quaternion arg_2CE_2 = quaternion; + float arg_2CE_4 = size * 0.7f; if (SceneViewRotation.<>f__mg$cache1 == null) { SceneViewRotation.<>f__mg$cache1 = new Handles.CapFunction(Handles.ConeHandleCap); } - if (Handles.Button(arg_2F1_0, arg_2F1_1, arg_2F1_2, size, arg_2F1_4, SceneViewRotation.<>f__mg$cache1)) + if (Handles.Button(arg_2CE_0, arg_2CE_1, arg_2CE_2, size, arg_2CE_4, SceneViewRotation.<>f__mg$cache1)) { if (!view.in2DMode && !view.isRotationLocked) { diff --git a/UnityEditor/UnityEditor/ShapeModuleUI.cs b/UnityEditor/UnityEditor/ShapeModuleUI.cs index 9e13cf28..47346feb 100644 --- a/UnityEditor/UnityEditor/ShapeModuleUI.cs +++ b/UnityEditor/UnityEditor/ShapeModuleUI.cs @@ -414,14 +414,18 @@ public override void OnSceneGUI(ParticleSystem system, InitialModuleUI initial) EditorGUI.BeginChangeCheck(); int intValue = this.m_Type.intValue; Matrix4x4 matrix4x = default(Matrix4x4); - float d = (intValue != 6) ? 1f : this.m_MeshScale.floatValue; - if (system.main.scalingMode == ParticleSystemScalingMode.Hierarchy) + float num = (intValue != 6) ? 1f : this.m_MeshScale.floatValue; + if (system.main.scalingMode == ParticleSystemScalingMode.Local) { - matrix4x.SetTRS(system.transform.position, system.transform.rotation, system.transform.lossyScale * d); + matrix4x.SetTRS(system.transform.position, system.transform.rotation, system.transform.localScale * num); + } + else if (system.main.scalingMode == ParticleSystemScalingMode.Hierarchy) + { + matrix4x = system.transform.localToWorldMatrix * Matrix4x4.Scale(new Vector3(num, num, num)); } else { - matrix4x.SetTRS(system.transform.position, system.transform.rotation, system.transform.localScale * d); + matrix4x.SetTRS(system.transform.position, system.transform.rotation, system.transform.lossyScale * num); } Handles.matrix = matrix4x; if (intValue == 0 || intValue == 1) diff --git a/UnityEditor/UnityEditor/SubModuleUI.cs b/UnityEditor/UnityEditor/SubModuleUI.cs index 587facf4..2c757c8f 100644 --- a/UnityEditor/UnityEditor/SubModuleUI.cs +++ b/UnityEditor/UnityEditor/SubModuleUI.cs @@ -82,7 +82,10 @@ private void Update() string text = ParticleSystemEditorUtils.CheckCircularReferences(particleSystem); if (text.Length == 0) { - this.CheckIfChild(objectReferenceValue); + if (!this.CheckIfChild(objectReferenceValue)) + { + flag = false; + } } else { @@ -153,37 +156,45 @@ private bool ValidateSubemitter(ParticleSystem subEmitter) return result; } - private void CheckIfChild(UnityEngine.Object subEmitter) + private bool CheckIfChild(UnityEngine.Object subEmitter) { - if (subEmitter != null) + ParticleSystem root = this.m_ParticleSystemUI.m_ParticleEffectUI.GetRoot(); + bool result; + if (SubModuleUI.IsChild(subEmitter as ParticleSystem, root)) { - ParticleSystem root = this.m_ParticleSystemUI.m_ParticleEffectUI.GetRoot(); - if (!SubModuleUI.IsChild(subEmitter as ParticleSystem, root)) + result = true; + } + else + { + string message = string.Format("The assigned sub emitter is not a child of the current root particle system GameObject: '{0}' and is therefore NOT considered a part of the current effect. Do you want to reparent it?", root.gameObject.name); + if (EditorUtility.DisplayDialog("Reparent GameObjects", message, "Yes, Reparent", "No, Remove")) { - string message = string.Format("The assigned sub emitter is not a child of the current root particle system GameObject: '{0}' and is therefore NOT considered a part of the current effect. Do you want to reparent it?", root.gameObject.name); - if (EditorUtility.DisplayDialog("Reparent GameObjects", message, "Yes, Reparent", "No")) + if (EditorUtility.IsPersistent(subEmitter)) { - if (EditorUtility.IsPersistent(subEmitter)) + GameObject gameObject = UnityEngine.Object.Instantiate(subEmitter) as GameObject; + if (gameObject != null) { - GameObject gameObject = UnityEngine.Object.Instantiate(subEmitter) as GameObject; - if (gameObject != null) - { - gameObject.transform.parent = this.m_ParticleSystemUI.m_ParticleSystem.transform; - gameObject.transform.localPosition = Vector3.zero; - gameObject.transform.localRotation = Quaternion.identity; - } + gameObject.transform.parent = this.m_ParticleSystemUI.m_ParticleSystem.transform; + gameObject.transform.localPosition = Vector3.zero; + gameObject.transform.localRotation = Quaternion.identity; } - else + } + else + { + ParticleSystem particleSystem = subEmitter as ParticleSystem; + if (particleSystem) { - ParticleSystem particleSystem = subEmitter as ParticleSystem; - if (particleSystem) - { - Undo.SetTransformParent(particleSystem.gameObject.transform.transform, this.m_ParticleSystemUI.m_ParticleSystem.transform, "Reparent sub emitter"); - } + Undo.SetTransformParent(particleSystem.gameObject.transform.transform, this.m_ParticleSystemUI.m_ParticleSystem.transform, "Reparent sub emitter"); } } + result = true; + } + else + { + result = false; } } + return result; } private List GetSubEmitterProperties() diff --git a/UnityEditor/UnityEditor/SubstanceImporterInspector.cs b/UnityEditor/UnityEditor/SubstanceImporterInspector.cs index a6989d8a..d634bd0f 100644 --- a/UnityEditor/UnityEditor/SubstanceImporterInspector.cs +++ b/UnityEditor/UnityEditor/SubstanceImporterInspector.cs @@ -126,22 +126,16 @@ private ProceduralMaterial GetSelectedMaterial() else { ProceduralMaterial[] sortedMaterials = this.GetSortedMaterials(); - if (this.m_SelectedMaterialInstanceName == null) + ProceduralMaterial proceduralMaterial = Array.Find(sortedMaterials, (ProceduralMaterial element) => element.name == this.m_SelectedMaterialInstanceName); + if (this.m_SelectedMaterialInstanceName == null || proceduralMaterial == null) { if (sortedMaterials.Length > 0) { - this.m_SelectedMaterialInstanceName = sortedMaterials[0].name; - result = sortedMaterials[0]; + proceduralMaterial = sortedMaterials[0]; + this.m_SelectedMaterialInstanceName = proceduralMaterial.name; } - else - { - result = null; - } - } - else - { - result = Array.Find(sortedMaterials, (ProceduralMaterial element) => element.name == this.m_SelectedMaterialInstanceName); } + result = proceduralMaterial; } return result; } diff --git a/UnityEditor/UnityEditor/TextureImporterInspector.cs b/UnityEditor/UnityEditor/TextureImporterInspector.cs index eb4ea1c6..b0972a2f 100644 --- a/UnityEditor/UnityEditor/TextureImporterInspector.cs +++ b/UnityEditor/UnityEditor/TextureImporterInspector.cs @@ -1435,18 +1435,21 @@ private void ApplySettingsToTexture() for (int i = 0; i < targets.Length; i++) { AssetImporter assetImporter = (AssetImporter)targets[i]; - Texture tex = AssetDatabase.LoadMainAssetAtPath(assetImporter.assetPath) as Texture; - if (this.m_Aniso.intValue != -1) - { - TextureUtil.SetAnisoLevelNoDirty(tex, this.m_Aniso.intValue); - } - if (this.m_FilterMode.intValue != -1) - { - TextureUtil.SetFilterModeNoDirty(tex, (FilterMode)this.m_FilterMode.intValue); - } - if (this.m_WrapMode.intValue != -1) + Texture texture = AssetDatabase.LoadMainAssetAtPath(assetImporter.assetPath) as Texture; + if (texture != null) { - TextureUtil.SetWrapModeNoDirty(tex, (TextureWrapMode)this.m_WrapMode.intValue); + if (this.m_Aniso.intValue != -1) + { + TextureUtil.SetAnisoLevelNoDirty(texture, this.m_Aniso.intValue); + } + if (this.m_FilterMode.intValue != -1) + { + TextureUtil.SetFilterModeNoDirty(texture, (FilterMode)this.m_FilterMode.intValue); + } + if (this.m_WrapMode.intValue != -1) + { + TextureUtil.SetWrapModeNoDirty(texture, (TextureWrapMode)this.m_WrapMode.intValue); + } } } SceneView.RepaintAll(); @@ -1637,7 +1640,10 @@ public static void SelectMainAssets(UnityEngine.Object[] targets) arrayList.Add(texture); } } - Selection.objects = (arrayList.ToArray(typeof(UnityEngine.Object)) as UnityEngine.Object[]); + if (arrayList.Count > 0) + { + Selection.objects = (arrayList.ToArray(typeof(UnityEngine.Object)) as UnityEngine.Object[]); + } } internal override void ResetValues() diff --git a/UnityEditor/UnityEditor/TizenOSVersion.cs b/UnityEditor/UnityEditor/TizenOSVersion.cs index 3e32c7a4..96c0891a 100644 --- a/UnityEditor/UnityEditor/TizenOSVersion.cs +++ b/UnityEditor/UnityEditor/TizenOSVersion.cs @@ -4,7 +4,6 @@ namespace UnityEditor { public enum TizenOSVersion { - Version23, - Version24 + Version24 = 1 } } diff --git a/UnityEditor/UnityEditor/TrailRendererInspector.cs b/UnityEditor/UnityEditor/TrailRendererInspector.cs index 8b4786b1..7ad72306 100644 --- a/UnityEditor/UnityEditor/TrailRendererInspector.cs +++ b/UnityEditor/UnityEditor/TrailRendererInspector.cs @@ -17,19 +17,7 @@ private class Styles public static GUIContent alignment = EditorGUIUtility.TextContent("Alignment|Trails can rotate to face their transform component or the camera."); - public static GUIContent[] alignmentOptions = new GUIContent[] - { - EditorGUIUtility.TextContent("View"), - EditorGUIUtility.TextContent("Local") - }; - public static GUIContent textureMode = EditorGUIUtility.TextContent("Texture Mode|Should the U coordinate be stretched or tiled?"); - - public static GUIContent[] textureModeOptions = new GUIContent[] - { - EditorGUIUtility.TextContent("Stretch"), - EditorGUIUtility.TextContent("Tile") - }; } private string[] m_ExcludedProperties; @@ -80,8 +68,8 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(this.m_ColorGradient, TrailRendererInspector.Styles.colorGradient, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_NumCornerVertices, TrailRendererInspector.Styles.numCornerVertices, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_NumCapVertices, TrailRendererInspector.Styles.numCapVertices, new GUILayoutOption[0]); - this.m_Alignment.intValue = EditorGUILayout.Popup(TrailRendererInspector.Styles.alignment, this.m_Alignment.intValue, TrailRendererInspector.Styles.alignmentOptions, new GUILayoutOption[0]); - this.m_TextureMode.intValue = EditorGUILayout.Popup(TrailRendererInspector.Styles.textureMode, this.m_TextureMode.intValue, TrailRendererInspector.Styles.textureModeOptions, new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_Alignment, TrailRendererInspector.Styles.alignment, new GUILayoutOption[0]); + EditorGUILayout.PropertyField(this.m_TextureMode, TrailRendererInspector.Styles.textureMode, new GUILayoutOption[0]); this.m_Probes.OnGUI(base.targets, (Renderer)base.target, false); base.serializedObject.ApplyModifiedProperties(); } diff --git a/UnityEditor/UnityEditor/iOSAutomaticallySignValue.cs b/UnityEditor/UnityEditor/iOSAutomaticallySignValue.cs new file mode 100644 index 00000000..8c55596d --- /dev/null +++ b/UnityEditor/UnityEditor/iOSAutomaticallySignValue.cs @@ -0,0 +1,11 @@ +using System; + +namespace UnityEditor +{ + internal enum iOSAutomaticallySignValue + { + AutomaticallySignValueNotSet, + AutomaticallySignValueTrue, + AutomaticallySignValueFalse + } +} diff --git a/UnityEditor/UnityEditorInternal/AnimationWindowState.cs b/UnityEditor/UnityEditorInternal/AnimationWindowState.cs index 6a38f6db..d8899034 100644 --- a/UnityEditor/UnityEditorInternal/AnimationWindowState.cs +++ b/UnityEditor/UnityEditorInternal/AnimationWindowState.cs @@ -1214,16 +1214,16 @@ public void TransformSelectedKeys(Matrix4x4 matrix, bool flipX, bool flipY, bool current2.key.time = Mathf.Max((!snapToFrame) ? v.x : this.SnapToFrame(v.x, current.curve.clip.frameRate), 0f); if (flipX) { - current2.key.inTangent = -current2.keySnapshot.outTangent; - current2.key.outTangent = -current2.keySnapshot.inTangent; + current2.key.inTangent = ((current2.keySnapshot.outTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-current2.keySnapshot.outTangent)); + current2.key.outTangent = ((current2.keySnapshot.inTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-current2.keySnapshot.inTangent)); } if (!current2.key.isPPtrCurve) { current2.key.value = v.y; if (flipY) { - current2.key.inTangent = -current2.key.inTangent; - current2.key.outTangent = -current2.key.outTangent; + current2.key.inTangent = ((current2.key.inTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-current2.key.inTangent)); + current2.key.outTangent = ((current2.key.outTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-current2.key.outTangent)); } } } @@ -1255,8 +1255,8 @@ public void TransformRippleKeys(Matrix4x4 matrix, float t1, float t2, bool flipX current2.key.time = Mathf.Max((!snapToFrame) ? v.x : this.SnapToFrame(v.x, current.curve.clip.frameRate), 0f); if (flipX) { - current2.key.inTangent = -current2.keySnapshot.outTangent; - current2.key.outTangent = -current2.keySnapshot.inTangent; + current2.key.inTangent = ((current2.keySnapshot.outTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-current2.keySnapshot.outTangent)); + current2.key.outTangent = ((current2.keySnapshot.inTangent == float.PositiveInfinity) ? float.PositiveInfinity : (-current2.keySnapshot.inTangent)); } } this.SelectKey(current2.key); diff --git a/UnityEditor/UnityEditorInternal/AssemblyStripper.cs b/UnityEditor/UnityEditorInternal/AssemblyStripper.cs index 42e7fc99..517ff2b0 100644 --- a/UnityEditor/UnityEditorInternal/AssemblyStripper.cs +++ b/UnityEditor/UnityEditorInternal/AssemblyStripper.cs @@ -67,7 +67,7 @@ private static string GetModuleWhitelist(string module, string moduleStrippingIn }); } - private static bool StripAssembliesTo(string[] assemblies, string[] searchDirs, string outputFolder, string workingDirectory, out string output, out string error, string linkerPath, IIl2CppPlatformProvider platformProvider, IEnumerable additionalBlacklist, bool developmentBuild) + private static bool StripAssembliesTo(string[] assemblies, string[] searchDirs, string outputFolder, string workingDirectory, out string output, out string error, string linkerPath, IIl2CppPlatformProvider platformProvider, IEnumerable additionalBlacklist) { if (!Directory.Exists(outputFolder)) { @@ -92,7 +92,7 @@ private static bool StripAssembliesTo(string[] assemblies, string[] searchDirs, "-out \"" + outputFolder + "\"", "-l none", "-c link", - "-b " + developmentBuild, + "-b " + platformProvider.developmentMode, "-x \"" + AssemblyStripper.GetModuleWhitelist("Core", platformProvider.moduleStrippingInformationFolder) + "\"", "-f \"" + Path.Combine(platformProvider.il2CppFolder, "LinkerDescriptors") + "\"" }; @@ -122,7 +122,7 @@ where rcr.IsDLLUsed(s) select Path.Combine(managedDir, s)).ToList(); } - internal static void StripAssemblies(string stagingAreaData, IIl2CppPlatformProvider platformProvider, RuntimeClassRegistry rcr, bool developmentBuild) + internal static void StripAssemblies(string stagingAreaData, IIl2CppPlatformProvider platformProvider, RuntimeClassRegistry rcr) { string fullPath = Path.GetFullPath(Path.Combine(stagingAreaData, "Managed")); List userAssemblies = AssemblyStripper.GetUserAssemblies(rcr, fullPath); @@ -131,7 +131,7 @@ internal static void StripAssemblies(string stagingAreaData, IIl2CppPlatformProv { fullPath }; - AssemblyStripper.RunAssemblyStripper(stagingAreaData, userAssemblies, fullPath, assembliesToStrip, searchDirs, AssemblyStripper.MonoLinker2Path, platformProvider, rcr, developmentBuild); + AssemblyStripper.RunAssemblyStripper(stagingAreaData, userAssemblies, fullPath, assembliesToStrip, searchDirs, AssemblyStripper.MonoLinker2Path, platformProvider, rcr); } internal static void GenerateInternalCallSummaryFile(string icallSummaryPath, string managedAssemblyFolderPath, string strippedDLLPath) @@ -168,7 +168,7 @@ private static bool AddWhiteListsForModules(IEnumerable nativeModules, r return result; } - private static void RunAssemblyStripper(string stagingAreaData, IEnumerable assemblies, string managedAssemblyFolderPath, string[] assembliesToStrip, string[] searchDirs, string monoLinkerPath, IIl2CppPlatformProvider platformProvider, RuntimeClassRegistry rcr, bool developmentBuild) + private static void RunAssemblyStripper(string stagingAreaData, IEnumerable assemblies, string managedAssemblyFolderPath, string[] assembliesToStrip, string[] searchDirs, string monoLinkerPath, IIl2CppPlatformProvider platformProvider, RuntimeClassRegistry rcr) { bool flag = rcr != null && PlayerSettings.stripEngineCode && platformProvider.supportsEngineStripping; IEnumerable enumerable = AssemblyStripper.Il2CppBlacklistPaths; @@ -202,7 +202,7 @@ private static void RunAssemblyStripper(string stagingAreaData, IEnumerable asse break; } string text2; - if (!AssemblyStripper.StripAssembliesTo(assembliesToStrip, searchDirs, fullPath, managedAssemblyFolderPath, out text2, out text3, monoLinkerPath, platformProvider, enumerable, developmentBuild)) + if (!AssemblyStripper.StripAssembliesTo(assembliesToStrip, searchDirs, fullPath, managedAssemblyFolderPath, out text2, out text3, monoLinkerPath, platformProvider, enumerable)) { goto Block_6; } diff --git a/UnityEditor/UnityEditorInternal/BaseIl2CppPlatformProvider.cs b/UnityEditor/UnityEditorInternal/BaseIl2CppPlatformProvider.cs index abe7f084..259a6105 100644 --- a/UnityEditor/UnityEditorInternal/BaseIl2CppPlatformProvider.cs +++ b/UnityEditor/UnityEditorInternal/BaseIl2CppPlatformProvider.cs @@ -130,7 +130,7 @@ public virtual string il2CppFolder { get { - PackageInfo packageInfo = BaseIl2CppPlatformProvider.FindIl2CppPackage(); + Unity.DataContract.PackageInfo packageInfo = BaseIl2CppPlatformProvider.FindIl2CppPackage(); string result; if (packageInfo == null) { @@ -170,7 +170,7 @@ public virtual Il2CppNativeCodeBuilder CreateIl2CppNativeCodeBuilder() protected string GetFolderInPackageOrDefault(string path) { - PackageInfo packageInfo = BaseIl2CppPlatformProvider.FindIl2CppPackage(); + Unity.DataContract.PackageInfo packageInfo = BaseIl2CppPlatformProvider.FindIl2CppPackage(); string result; if (packageInfo == null) { @@ -186,7 +186,7 @@ protected string GetFolderInPackageOrDefault(string path) protected string GetFileInPackageOrDefault(string path) { - PackageInfo packageInfo = BaseIl2CppPlatformProvider.FindIl2CppPackage(); + Unity.DataContract.PackageInfo packageInfo = BaseIl2CppPlatformProvider.FindIl2CppPackage(); string result; if (packageInfo == null) { @@ -200,9 +200,9 @@ protected string GetFileInPackageOrDefault(string path) return result; } - private static PackageInfo FindIl2CppPackage() + private static Unity.DataContract.PackageInfo FindIl2CppPackage() { - return ModuleManager.packageManager.get_unityExtensions().FirstOrDefault((PackageInfo e) => e.name == "IL2CPP"); + return ModuleManager.packageManager.unityExtensions.FirstOrDefault((Unity.DataContract.PackageInfo e) => e.name == "IL2CPP"); } } } diff --git a/UnityEditor/UnityEditorInternal/IL2CPPBuilder.cs b/UnityEditor/UnityEditorInternal/IL2CPPBuilder.cs index 4a0e078f..1abacd12 100644 --- a/UnityEditor/UnityEditorInternal/IL2CPPBuilder.cs +++ b/UnityEditor/UnityEditorInternal/IL2CPPBuilder.cs @@ -5,6 +5,7 @@ using System.Linq; using UnityEditor; using UnityEditor.Scripting.Compilers; +using UnityEngine; namespace UnityEditorInternal { @@ -20,18 +21,18 @@ internal class IL2CPPBuilder private readonly RuntimeClassRegistry m_RuntimeClassRegistry; - private readonly bool m_DevelopmentBuild; + private readonly bool m_DebugBuild; private readonly LinkXmlReader m_linkXmlReader = new LinkXmlReader(); - public IL2CPPBuilder(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool developmentBuild) + public IL2CPPBuilder(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool debugBuild) { this.m_TempFolder = tempFolder; this.m_StagingAreaData = stagingAreaData; this.m_PlatformProvider = platformProvider; this.m_ModifyOutputBeforeCompile = modifyOutputBeforeCompile; this.m_RuntimeClassRegistry = runtimeClassRegistry; - this.m_DevelopmentBuild = developmentBuild; + this.m_DebugBuild = debugBuild; } public void Run() @@ -45,7 +46,7 @@ public void Run() FileInfo fileInfo = new FileInfo(fileName); fileInfo.IsReadOnly = false; } - AssemblyStripper.StripAssemblies(this.m_StagingAreaData, this.m_PlatformProvider, this.m_RuntimeClassRegistry, this.m_DevelopmentBuild); + AssemblyStripper.StripAssemblies(this.m_StagingAreaData, this.m_PlatformProvider, this.m_RuntimeClassRegistry); FileUtil.CreateOrCleanDirectory(cppOutputDirectoryInStagingArea); if (this.m_ModifyOutputBeforeCompile != null) { @@ -68,7 +69,8 @@ public void RunCompileAndLink() if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); - List list = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths).ToList(); + List list = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths, this.m_DebugBuild).ToList(); + list.Add(string.Format("--map-file-parser=\"{0}\"", IL2CPPBuilder.GetMapFileParserPath())); list.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(this.GetCppOutputDirectoryInStagingArea()))); Action setupStartInfo = new Action(il2CppNativeCodeBuilder.SetupStartInfo); string fullPath = Path.GetFullPath(Path.Combine(this.m_StagingAreaData, "Managed")); @@ -117,6 +119,11 @@ public static string GetCppOutputPath(string tempFolder) return Path.Combine(tempFolder, "il2cppOutput"); } + private static string GetMapFileParserPath() + { + return Path.GetFullPath(Path.Combine(EditorApplication.applicationContentsPath, (Application.platform != RuntimePlatform.WindowsEditor) ? "Tools/MapFileParser/MapFileParser" : "Tools\\MapFileParser\\MapFileParser.exe")); + } + private void ConvertPlayerDlltoCpp(ICollection userAssemblies, string outputDirectory, string workingDirectory) { if (userAssemblies.Count != 0) @@ -153,8 +160,9 @@ private void ConvertPlayerDlltoCpp(ICollection userAssemblies, string ou if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); - list.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths)); + list.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths, this.m_DebugBuild)); } + list.Add(string.Format("--map-file-parser=\"{0}\"", IL2CPPBuilder.GetMapFileParserPath())); if (array.Length > 0) { string[] array2 = array; diff --git a/UnityEditor/UnityEditorInternal/IL2CPPUtils.cs b/UnityEditor/UnityEditorInternal/IL2CPPUtils.cs index 13e5b0c1..66ee9b3e 100644 --- a/UnityEditor/UnityEditorInternal/IL2CPPUtils.cs +++ b/UnityEditor/UnityEditorInternal/IL2CPPUtils.cs @@ -22,16 +22,16 @@ internal static IIl2CppPlatformProvider PlatformProviderForNotModularPlatform(Bu throw new Exception("Platform unsupported, or already modular."); } - internal static IL2CPPBuilder RunIl2Cpp(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool developmentBuild) + internal static IL2CPPBuilder RunIl2Cpp(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool debugBuild) { - IL2CPPBuilder iL2CPPBuilder = new IL2CPPBuilder(tempFolder, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, developmentBuild); + IL2CPPBuilder iL2CPPBuilder = new IL2CPPBuilder(tempFolder, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, debugBuild); iL2CPPBuilder.Run(); return iL2CPPBuilder; } - internal static IL2CPPBuilder RunIl2Cpp(string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool developmentBuild) + internal static IL2CPPBuilder RunIl2Cpp(string stagingAreaData, IIl2CppPlatformProvider platformProvider, Action modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool debugBuild) { - IL2CPPBuilder iL2CPPBuilder = new IL2CPPBuilder(stagingAreaData, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, developmentBuild); + IL2CPPBuilder iL2CPPBuilder = new IL2CPPBuilder(stagingAreaData, stagingAreaData, platformProvider, modifyOutputBeforeCompile, runtimeClassRegistry, debugBuild); iL2CPPBuilder.Run(); return iL2CPPBuilder; } @@ -63,11 +63,16 @@ where f.EndsWith("-resources.dat") } internal static void CopySymmapFile(string tempFolder, string destinationFolder) + { + IL2CPPUtils.CopySymmapFile(tempFolder, destinationFolder, string.Empty); + } + + internal static void CopySymmapFile(string tempFolder, string destinationFolder, string destinationFileNameSuffix) { string text = Path.Combine(tempFolder, "SymbolMap"); if (File.Exists(text)) { - File.Copy(text, Path.Combine(destinationFolder, "SymbolMap"), true); + File.Copy(text, Path.Combine(destinationFolder, "SymbolMap" + destinationFileNameSuffix), true); } } diff --git a/UnityEditor/UnityEditorInternal/Il2CppNativeCodeBuilderUtils.cs b/UnityEditor/UnityEditorInternal/Il2CppNativeCodeBuilderUtils.cs index 04d4556e..ccdaeca2 100644 --- a/UnityEditor/UnityEditorInternal/Il2CppNativeCodeBuilderUtils.cs +++ b/UnityEditor/UnityEditorInternal/Il2CppNativeCodeBuilderUtils.cs @@ -6,14 +6,21 @@ namespace UnityEditorInternal { public static class Il2CppNativeCodeBuilderUtils { - public static IEnumerable AddBuilderArguments(Il2CppNativeCodeBuilder builder, string outputRelativePath, IEnumerable includeRelativePaths) + public static IEnumerable AddBuilderArguments(Il2CppNativeCodeBuilder builder, string outputRelativePath, IEnumerable includeRelativePaths, bool debugBuild) { List list = new List(); list.Add("--compile-cpp"); list.Add("--libil2cpp-static"); list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("platform", builder.CompilerPlatform)); list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("architecture", builder.CompilerArchitecture)); - list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("configuration", "Release")); + if (debugBuild) + { + list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("configuration", "Debug")); + } + else + { + list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("configuration", "Release")); + } list.Add(Il2CppNativeCodeBuilderUtils.FormatArgument("outputpath", builder.ConvertOutputFileToFullPath(outputRelativePath))); if (!string.IsNullOrEmpty(builder.CacheDirectory)) { diff --git a/UnityEditor/UnityEditorInternal/ProvisioningProfile.cs b/UnityEditor/UnityEditorInternal/ProvisioningProfile.cs new file mode 100644 index 00000000..257ad14d --- /dev/null +++ b/UnityEditor/UnityEditorInternal/ProvisioningProfile.cs @@ -0,0 +1,70 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; + +namespace UnityEditorInternal +{ + internal class ProvisioningProfile + { + private string m_UUID = string.Empty; + + private static readonly string s_FirstLinePattern = "UUID<\\/key>"; + + private static readonly string s_SecondLinePattern = "((\\w*\\-?){5})"; + + public string UUID + { + get + { + return this.m_UUID; + } + set + { + this.m_UUID = value; + } + } + + internal ProvisioningProfile() + { + } + + internal ProvisioningProfile(string UUID) + { + this.m_UUID = UUID; + } + + internal static ProvisioningProfile ParseProvisioningProfileAtPath(string pathToFile) + { + ProvisioningProfile provisioningProfile = new ProvisioningProfile(); + ProvisioningProfile.parseFile(pathToFile, provisioningProfile); + return provisioningProfile; + } + + private static void parseFile(string filePath, ProvisioningProfile profile) + { + StreamReader streamReader = new StreamReader(filePath); + string input; + while ((input = streamReader.ReadLine()) != null) + { + Match match = Regex.Match(input, ProvisioningProfile.s_FirstLinePattern); + if (match.Success) + { + if ((input = streamReader.ReadLine()) != null) + { + Match match2 = Regex.Match(input, ProvisioningProfile.s_SecondLinePattern); + if (match2.Success) + { + profile.UUID = match2.Groups[1].Value; + break; + } + } + } + if (!string.IsNullOrEmpty(profile.UUID)) + { + break; + } + } + streamReader.Close(); + } + } +} diff --git a/UnityEditor/UnityEditorInternal/ProvisioningProfileGUI.cs b/UnityEditor/UnityEditorInternal/ProvisioningProfileGUI.cs new file mode 100644 index 00000000..0ebbc321 --- /dev/null +++ b/UnityEditor/UnityEditorInternal/ProvisioningProfileGUI.cs @@ -0,0 +1,180 @@ +using System; +using UnityEditor; +using UnityEngine; + +namespace UnityEditorInternal +{ + internal class ProvisioningProfileGUI + { + internal delegate void ProvisioningProfileChangedDelegate(ProvisioningProfile profile); + + internal static void ShowProvisioningProfileUIWithProperty(GUIContent titleWithToolTip, ProvisioningProfile profile, SerializedProperty prop) + { + GUILayout.BeginHorizontal(new GUILayoutOption[0]); + GUILayout.Label(titleWithToolTip, EditorStyles.label, new GUILayoutOption[0]); + Rect controlRect = EditorGUILayout.GetControlRect(false, 0f, new GUILayoutOption[0]); + GUIContent label = EditorGUIUtility.TextContent("Profile ID:"); + EditorGUI.BeginProperty(controlRect, label, prop); + if (GUILayout.Button("Browse", EditorStyles.miniButton, new GUILayoutOption[0])) + { + ProvisioningProfile provisioningProfile = ProvisioningProfileGUI.Browse(""); + if (provisioningProfile != null && !string.IsNullOrEmpty(provisioningProfile.UUID)) + { + profile = provisioningProfile; + prop.stringValue = profile.UUID; + GUI.FocusControl(""); + } + } + GUILayout.EndHorizontal(); + EditorGUI.EndProperty(); + EditorGUI.BeginChangeCheck(); + EditorGUI.indentLevel++; + controlRect = EditorGUILayout.GetControlRect(true, 0f, new GUILayoutOption[0]); + label = EditorGUIUtility.TextContent("Profile ID:"); + EditorGUI.BeginProperty(controlRect, label, prop); + profile.UUID = EditorGUILayout.TextField(label, profile.UUID, new GUILayoutOption[0]); + if (EditorGUI.EndChangeCheck()) + { + prop.stringValue = profile.UUID; + } + EditorGUI.EndProperty(); + EditorGUI.indentLevel--; + } + + internal static void ShowProvisioningProfileUIWithCallback(GUIContent titleWithToolTip, ProvisioningProfile profile, ProvisioningProfileGUI.ProvisioningProfileChangedDelegate callback) + { + GUILayout.BeginHorizontal(new GUILayoutOption[0]); + GUILayout.Label(titleWithToolTip, EditorStyles.label, new GUILayoutOption[0]); + if (GUILayout.Button("Browse", EditorStyles.miniButton, new GUILayoutOption[0])) + { + ProvisioningProfile provisioningProfile = ProvisioningProfileGUI.Browse(""); + if (provisioningProfile != null && !string.IsNullOrEmpty(provisioningProfile.UUID)) + { + profile = provisioningProfile; + callback(profile); + GUI.FocusControl(""); + } + } + GUILayout.EndHorizontal(); + EditorGUI.BeginChangeCheck(); + EditorGUI.indentLevel++; + GUIContent label = EditorGUIUtility.TextContent("Profile ID:"); + profile.UUID = EditorGUILayout.TextField(label, profile.UUID, new GUILayoutOption[0]); + EditorGUI.indentLevel--; + if (EditorGUI.EndChangeCheck()) + { + callback(profile); + } + } + + internal static ProvisioningProfile Browse(string path) + { + string title = "Select the Provising Profile used for Manual Signing"; + string directory = path; + ProvisioningProfile result; + if (InternalEditorUtility.inBatchMode) + { + result = null; + } + else + { + ProvisioningProfile provisioningProfile = null; + while (true) + { + path = EditorUtility.OpenFilePanel(title, directory, "mobileprovision"); + if (path.Length == 0) + { + break; + } + if (ProvisioningProfileGUI.GetProvisioningProfileId(path, out provisioningProfile)) + { + goto Block_3; + } + } + result = null; + return result; + Block_3: + result = provisioningProfile; + } + return result; + } + + internal static bool GetProvisioningProfileId(string filePath, out ProvisioningProfile provisioningProfile) + { + ProvisioningProfile provisioningProfile2 = ProvisioningProfile.ParseProvisioningProfileAtPath(filePath); + provisioningProfile = provisioningProfile2; + return provisioningProfile2.UUID != null; + } + + internal static void ShowUIWithDefaults(string provisioningPrefKey, SerializedProperty enableAutomaticSigningProp, GUIContent automaticSigningGUI, SerializedProperty manualSigningIDProp, GUIContent manualSigningProfileGUI, SerializedProperty appleDevIDProp, GUIContent teamIDGUIContent) + { + int defaultAutomaticSigningValue = ProvisioningProfileGUI.GetDefaultAutomaticSigningValue(enableAutomaticSigningProp, iOSEditorPrefKeys.kDefaultiOSAutomaticallySignBuild); + bool boolForAutomaticSigningValue = ProvisioningProfileGUI.GetBoolForAutomaticSigningValue(defaultAutomaticSigningValue); + Rect controlRect = EditorGUILayout.GetControlRect(true, 0f, new GUILayoutOption[0]); + EditorGUI.BeginProperty(controlRect, automaticSigningGUI, enableAutomaticSigningProp); + bool flag = EditorGUILayout.Toggle(automaticSigningGUI, boolForAutomaticSigningValue, new GUILayoutOption[0]); + if (flag != boolForAutomaticSigningValue) + { + enableAutomaticSigningProp.intValue = ProvisioningProfileGUI.GetIntValueForAutomaticSigningBool(flag); + } + EditorGUI.EndProperty(); + if (!flag) + { + ProvisioningProfileGUI.ShowProvisioningProfileUIWithDefaults(provisioningPrefKey, manualSigningIDProp, manualSigningProfileGUI); + } + else + { + string defaultStringValue = ProvisioningProfileGUI.GetDefaultStringValue(appleDevIDProp, iOSEditorPrefKeys.kDefaultiOSAutomaticSignTeamId); + Rect controlRect2 = EditorGUILayout.GetControlRect(true, 0f, new GUILayoutOption[0]); + EditorGUI.BeginProperty(controlRect2, teamIDGUIContent, appleDevIDProp); + EditorGUI.BeginChangeCheck(); + string stringValue = EditorGUILayout.TextField(teamIDGUIContent, defaultStringValue, new GUILayoutOption[0]); + if (EditorGUI.EndChangeCheck()) + { + appleDevIDProp.stringValue = stringValue; + } + EditorGUI.EndProperty(); + } + } + + private static void ShowProvisioningProfileUIWithDefaults(string defaultPreferenceKey, SerializedProperty uuidProp, GUIContent title) + { + string text = uuidProp.stringValue; + if (string.IsNullOrEmpty(text)) + { + text = EditorPrefs.GetString(defaultPreferenceKey); + } + ProvisioningProfileGUI.ShowProvisioningProfileUIWithProperty(title, new ProvisioningProfile(text), uuidProp); + } + + private static bool GetBoolForAutomaticSigningValue(int signingValue) + { + return signingValue == 1; + } + + private static int GetIntValueForAutomaticSigningBool(bool automaticallySign) + { + return (!automaticallySign) ? 2 : 1; + } + + private static int GetDefaultAutomaticSigningValue(SerializedProperty prop, string editorPropKey) + { + int num = prop.intValue; + if (num == 0) + { + num = ((!EditorPrefs.GetBool(editorPropKey, true)) ? 2 : 1); + } + return num; + } + + private static string GetDefaultStringValue(SerializedProperty prop, string editorPrefKey) + { + string text = prop.stringValue; + if (string.IsNullOrEmpty(text)) + { + text = EditorPrefs.GetString(editorPrefKey, ""); + } + return text; + } + } +} diff --git a/UnityEditor/UnityEditorInternal/VisualStudioUtil.cs b/UnityEditor/UnityEditorInternal/VisualStudioUtil.cs new file mode 100644 index 00000000..fa5950ec --- /dev/null +++ b/UnityEditor/UnityEditorInternal/VisualStudioUtil.cs @@ -0,0 +1,11 @@ +using System; +using System.Runtime.CompilerServices; + +namespace UnityEditorInternal +{ + internal static class VisualStudioUtil + { + [MethodImpl(MethodImplOptions.InternalCall)] + public static extern bool CanVS2017BuildCppCode(); + } +} diff --git a/UnityEditor/UnityEditorInternal/iOSEditorPrefKeys.cs b/UnityEditor/UnityEditorInternal/iOSEditorPrefKeys.cs new file mode 100644 index 00000000..450fcad5 --- /dev/null +++ b/UnityEditor/UnityEditorInternal/iOSEditorPrefKeys.cs @@ -0,0 +1,15 @@ +using System; + +namespace UnityEditorInternal +{ + internal class iOSEditorPrefKeys + { + public static readonly string kDefaultiOSAutomaticallySignBuild = "DefaultiOSAutomaticallySignBuild"; + + public static readonly string kDefaultiOSAutomaticSignTeamId = "DefaultiOSAutomaticSignTeamId"; + + public static readonly string kDefaultiOSProvisioningProfileUUID = "DefaultiOSProvisioningProfileUUID"; + + public static readonly string kDefaulttvOSProvisioningProfileUUID = "DefaulttvOSProvisioningProfileUUID"; + } +} diff --git a/UnityEngine.UI/UnityEngine.EventSystems/EventSystem.cs b/UnityEngine.UI/UnityEngine.EventSystems/EventSystem.cs index 35d4487a..2a51968e 100644 --- a/UnityEngine.UI/UnityEngine.EventSystems/EventSystem.cs +++ b/UnityEngine.UI/UnityEngine.EventSystems/EventSystem.cs @@ -257,6 +257,10 @@ protected override void OnEnable() { EventSystem.current = this; } + else + { + Debug.LogWarning("Multiple EventSystems in scene... this is not supported"); + } } protected override void OnDisable() diff --git a/UnityEngine.UI/UnityEngine.EventSystems/StandaloneInputModule.cs b/UnityEngine.UI/UnityEngine.EventSystems/StandaloneInputModule.cs index 47f56128..eeaa4b5a 100644 --- a/UnityEngine.UI/UnityEngine.EventSystems/StandaloneInputModule.cs +++ b/UnityEngine.UI/UnityEngine.EventSystems/StandaloneInputModule.cs @@ -23,6 +23,8 @@ public enum InputMode private Vector2 m_MousePosition; + private GameObject m_CurrentFocusedGameObject; + [SerializeField] private string m_HorizontalAxis = "Horizontal"; @@ -445,6 +447,7 @@ protected void ProcessMouseEvent() this.ProcessMouseEvent(0); } + [Obsolete("This method is no longer checked, overriding it with return true does nothing!")] protected virtual bool ForceAutoSelect() { return false; @@ -454,10 +457,7 @@ protected void ProcessMouseEvent(int id) { PointerInputModule.MouseState mousePointerEventData = this.GetMousePointerEventData(id); PointerInputModule.MouseButtonEventData eventData = mousePointerEventData.GetButtonState(PointerEventData.InputButton.Left).eventData; - if (this.ForceAutoSelect()) - { - base.eventSystem.SetSelectedGameObject(eventData.buttonData.pointerCurrentRaycast.gameObject, eventData.buttonData); - } + this.m_CurrentFocusedGameObject = eventData.buttonData.pointerCurrentRaycast.gameObject; this.ProcessMousePress(eventData); this.ProcessMove(eventData.buttonData); this.ProcessDrag(eventData.buttonData); @@ -561,5 +561,10 @@ protected void ProcessMousePress(PointerInputModule.MouseButtonEventData data) } } } + + protected GameObject GetCurrentFocusedGameObject() + { + return this.m_CurrentFocusedGameObject; + } } } diff --git a/UnityEngine.UI/UnityEngine.EventSystems/UIBehaviour.cs b/UnityEngine.UI/UnityEngine.EventSystems/UIBehaviour.cs index 1a43a136..13bf877e 100644 --- a/UnityEngine.UI/UnityEngine.EventSystems/UIBehaviour.cs +++ b/UnityEngine.UI/UnityEngine.EventSystems/UIBehaviour.cs @@ -29,6 +29,14 @@ public virtual bool IsActive() return base.isActiveAndEnabled; } + protected virtual void OnValidate() + { + } + + protected virtual void Reset() + { + } + protected virtual void OnRectTransformDimensionsChange() { } diff --git a/UnityEngine.UI/UnityEngine.UI.csproj b/UnityEngine.UI/UnityEngine.UI.csproj index 3f10ab8e..31cc77b0 100644 --- a/UnityEngine.UI/UnityEngine.UI.csproj +++ b/UnityEngine.UI/UnityEngine.UI.csproj @@ -1,7 +1,7 @@ - + - {F7CDA827-F65F-486A-80A6-948FDDD88300} + {A2D84E72-888B-43DE-B8E8-42CE1813FC15} Debug AnyCPU Library @@ -28,6 +28,7 @@ + @@ -93,6 +94,7 @@ + diff --git a/UnityEngine.UI/UnityEngine.UI/AspectRatioFitter.cs b/UnityEngine.UI/UnityEngine.UI/AspectRatioFitter.cs index d4607e2c..58a78979 100644 --- a/UnityEngine.UI/UnityEngine.UI/AspectRatioFitter.cs +++ b/UnityEngine.UI/UnityEngine.UI/AspectRatioFitter.cs @@ -97,6 +97,12 @@ private void UpdateRect() this.m_Tracker.Clear(); switch (this.m_AspectMode) { + case AspectRatioFitter.AspectMode.None: + if (!Application.isPlaying) + { + this.m_AspectRatio = Mathf.Clamp(this.rectTransform.rect.width / this.rectTransform.rect.height, 0.001f, 1000f); + } + break; case AspectRatioFitter.AspectMode.WidthControlsHeight: this.m_Tracker.Add(this, this.rectTransform, DrivenTransformProperties.SizeDeltaY); this.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, this.rectTransform.rect.width / this.m_AspectRatio); @@ -161,5 +167,11 @@ protected void SetDirty() { this.UpdateRect(); } + + protected override void OnValidate() + { + this.m_AspectRatio = Mathf.Clamp(this.m_AspectRatio, 0.001f, 1000f); + this.SetDirty(); + } } } diff --git a/UnityEngine.UI/UnityEngine.UI/BaseMeshEffect.cs b/UnityEngine.UI/UnityEngine.UI/BaseMeshEffect.cs index c1796425..6c43315d 100644 --- a/UnityEngine.UI/UnityEngine.UI/BaseMeshEffect.cs +++ b/UnityEngine.UI/UnityEngine.UI/BaseMeshEffect.cs @@ -48,6 +48,15 @@ protected override void OnDidApplyAnimationProperties() base.OnDidApplyAnimationProperties(); } + protected override void OnValidate() + { + base.OnValidate(); + if (this.graphic != null) + { + this.graphic.SetVerticesDirty(); + } + } + public virtual void ModifyMesh(Mesh mesh) { using (VertexHelper vertexHelper = new VertexHelper(mesh)) diff --git a/UnityEngine.UI/UnityEngine.UI/CanvasScaler.cs b/UnityEngine.UI/UnityEngine.UI/CanvasScaler.cs index 01244599..1f18cea1 100644 --- a/UnityEngine.UI/UnityEngine.UI/CanvasScaler.cs +++ b/UnityEngine.UI/UnityEngine.UI/CanvasScaler.cs @@ -345,5 +345,11 @@ protected void SetReferencePixelsPerUnit(float referencePixelsPerUnit) this.m_PrevReferencePixelsPerUnit = referencePixelsPerUnit; } } + + protected override void OnValidate() + { + this.m_ScaleFactor = Mathf.Max(0.01f, this.m_ScaleFactor); + this.m_DefaultSpriteDPI = Mathf.Max(1f, this.m_DefaultSpriteDPI); + } } } diff --git a/UnityEngine.UI/UnityEngine.UI/ContentSizeFitter.cs b/UnityEngine.UI/UnityEngine.UI/ContentSizeFitter.cs index 75d74ff8..8ffcdbe3 100644 --- a/UnityEngine.UI/UnityEngine.UI/ContentSizeFitter.cs +++ b/UnityEngine.UI/UnityEngine.UI/ContentSizeFitter.cs @@ -127,5 +127,10 @@ protected void SetDirty() LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform); } } + + protected override void OnValidate() + { + this.SetDirty(); + } } } diff --git a/UnityEngine.UI/UnityEngine.UI/Dropdown.cs b/UnityEngine.UI/UnityEngine.UI/Dropdown.cs index 0c3871da..30c77902 100644 --- a/UnityEngine.UI/UnityEngine.UI/Dropdown.cs +++ b/UnityEngine.UI/UnityEngine.UI/Dropdown.cs @@ -320,15 +320,27 @@ protected Dropdown() protected override void Awake() { - this.m_AlphaTweenRunner = new TweenRunner(); - this.m_AlphaTweenRunner.Init(this); - if (this.m_CaptionImage) + if (Application.isPlaying) { - this.m_CaptionImage.enabled = (this.m_CaptionImage.sprite != null); + this.m_AlphaTweenRunner = new TweenRunner(); + this.m_AlphaTweenRunner.Init(this); + if (this.m_CaptionImage) + { + this.m_CaptionImage.enabled = (this.m_CaptionImage.sprite != null); + } + if (this.m_Template) + { + this.m_Template.gameObject.SetActive(false); + } } - if (this.m_Template) + } + + protected override void OnValidate() + { + base.OnValidate(); + if (this.IsActive()) { - this.m_Template.gameObject.SetActive(false); + this.RefreshShownValue(); } } diff --git a/UnityEngine.UI/UnityEngine.UI/Graphic.cs b/UnityEngine.UI/UnityEngine.UI/Graphic.cs index ee073e07..b6b949c0 100644 --- a/UnityEngine.UI/UnityEngine.UI/Graphic.cs +++ b/UnityEngine.UI/UnityEngine.UI/Graphic.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Reflection; using UnityEngine.Events; using UnityEngine.EventSystems; using UnityEngine.Serialization; @@ -324,6 +325,7 @@ protected override void OnEnable() base.OnEnable(); this.CacheCanvas(); GraphicRegistry.RegisterGraphicForCanvas(this.canvas, this); + GraphicRebuildTracker.TrackGraphic(this); if (Graphic.s_WhiteTexture == null) { Graphic.s_WhiteTexture = Texture2D.whiteTexture; @@ -333,6 +335,7 @@ protected override void OnEnable() protected override void OnDisable() { + GraphicRebuildTracker.UnTrackGraphic(this); GraphicRegistry.UnregisterGraphicForCanvas(this.canvas, this); CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (this.canvasRenderer != null) @@ -478,6 +481,29 @@ protected virtual void OnPopulateMesh(VertexHelper vh) vh.AddTriangle(2, 3, 0); } + public virtual void OnRebuildRequested() + { + MonoBehaviour[] components = base.gameObject.GetComponents(); + MonoBehaviour[] array = components; + for (int i = 0; i < array.Length; i++) + { + MonoBehaviour monoBehaviour = array[i]; + if (!(monoBehaviour == null)) + { + MethodInfo method = monoBehaviour.GetType().GetMethod("OnValidate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + if (method != null) + { + method.Invoke(monoBehaviour, null); + } + } + } + } + + protected override void Reset() + { + this.SetAllDirty(); + } + protected override void OnDidApplyAnimationProperties() { this.SetAllDirty(); @@ -547,6 +573,12 @@ public virtual bool Raycast(Vector2 sp, Camera eventCamera) return result; } + protected override void OnValidate() + { + base.OnValidate(); + this.SetAllDirty(); + } + public Vector2 PixelAdjustPoint(Vector2 point) { Vector2 result; diff --git a/UnityEngine.UI/UnityEngine.UI/GraphicRebuildTracker.cs b/UnityEngine.UI/UnityEngine.UI/GraphicRebuildTracker.cs new file mode 100644 index 00000000..b0707519 --- /dev/null +++ b/UnityEngine.UI/UnityEngine.UI/GraphicRebuildTracker.cs @@ -0,0 +1,44 @@ +using System; +using System.Runtime.CompilerServices; +using UnityEngine.UI.Collections; + +namespace UnityEngine.UI +{ + public static class GraphicRebuildTracker + { + private static IndexedSet m_Tracked = new IndexedSet(); + + private static bool s_Initialized; + + [CompilerGenerated] + private static CanvasRenderer.OnRequestRebuild <>f__mg$cache0; + + public static void TrackGraphic(Graphic g) + { + if (!GraphicRebuildTracker.s_Initialized) + { + if (GraphicRebuildTracker.<>f__mg$cache0 == null) + { + GraphicRebuildTracker.<>f__mg$cache0 = new CanvasRenderer.OnRequestRebuild(GraphicRebuildTracker.OnRebuildRequested); + } + CanvasRenderer.onRequestRebuild += GraphicRebuildTracker.<>f__mg$cache0; + GraphicRebuildTracker.s_Initialized = true; + } + GraphicRebuildTracker.m_Tracked.AddUnique(g); + } + + public static void UnTrackGraphic(Graphic g) + { + GraphicRebuildTracker.m_Tracked.Remove(g); + } + + private static void OnRebuildRequested() + { + StencilMaterial.ClearAll(); + for (int i = 0; i < GraphicRebuildTracker.m_Tracked.Count; i++) + { + GraphicRebuildTracker.m_Tracked[i].OnRebuildRequested(); + } + } + } +} diff --git a/UnityEngine.UI/UnityEngine.UI/GraphicRegistry.cs b/UnityEngine.UI/UnityEngine.UI/GraphicRegistry.cs index b284eece..6495cabd 100644 --- a/UnityEngine.UI/UnityEngine.UI/GraphicRegistry.cs +++ b/UnityEngine.UI/UnityEngine.UI/GraphicRegistry.cs @@ -55,6 +55,10 @@ public static void UnregisterGraphicForCanvas(Canvas c, Graphic graphic) if (GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet)) { indexedSet.Remove(graphic); + if (indexedSet.Count == 0) + { + GraphicRegistry.instance.m_Graphics.Remove(c); + } } } } diff --git a/UnityEngine.UI/UnityEngine.UI/GridLayoutGroup.cs b/UnityEngine.UI/UnityEngine.UI/GridLayoutGroup.cs index 11f3ce16..84c8d009 100644 --- a/UnityEngine.UI/UnityEngine.UI/GridLayoutGroup.cs +++ b/UnityEngine.UI/UnityEngine.UI/GridLayoutGroup.cs @@ -120,6 +120,12 @@ protected GridLayoutGroup() { } + protected override void OnValidate() + { + base.OnValidate(); + this.constraintCount = this.constraintCount; + } + public override void CalculateLayoutInputHorizontal() { base.CalculateLayoutInputHorizontal(); diff --git a/UnityEngine.UI/UnityEngine.UI/HorizontalOrVerticalLayoutGroup.cs b/UnityEngine.UI/UnityEngine.UI/HorizontalOrVerticalLayoutGroup.cs index 74766a44..3e0216b6 100644 --- a/UnityEngine.UI/UnityEngine.UI/HorizontalOrVerticalLayoutGroup.cs +++ b/UnityEngine.UI/UnityEngine.UI/HorizontalOrVerticalLayoutGroup.cs @@ -209,5 +209,12 @@ private void GetChildSizes(RectTransform child, int axis, bool controlSize, bool flexible = Mathf.Max(flexible, 1f); } } + + protected override void Reset() + { + base.Reset(); + this.m_ChildControlWidth = false; + this.m_ChildControlHeight = false; + } } } diff --git a/UnityEngine.UI/UnityEngine.UI/InputField.cs b/UnityEngine.UI/UnityEngine.UI/InputField.cs index 1904ed06..174f9186 100644 --- a/UnityEngine.UI/UnityEngine.UI/InputField.cs +++ b/UnityEngine.UI/UnityEngine.UI/InputField.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using UnityEditor; using UnityEngine.Events; using UnityEngine.EventSystems; using UnityEngine.Serialization; @@ -316,19 +317,26 @@ public string text { this.m_Text = ((this.characterLimit <= 0 || value.Length <= this.characterLimit) ? value : value.Substring(0, this.characterLimit)); } - if (this.m_Keyboard != null) - { - this.m_Keyboard.text = this.m_Text; - } - if (this.m_CaretPosition > this.m_Text.Length) + if (!Application.isPlaying) { - this.m_CaretPosition = (this.m_CaretSelectPosition = this.m_Text.Length); + this.SendOnValueChangedAndUpdateLabel(); } - else if (this.m_CaretSelectPosition > this.m_Text.Length) + else { - this.m_CaretSelectPosition = this.m_Text.Length; + if (this.m_Keyboard != null) + { + this.m_Keyboard.text = this.m_Text; + } + if (this.m_CaretPosition > this.m_Text.Length) + { + this.m_CaretPosition = (this.m_CaretSelectPosition = this.m_Text.Length); + } + else if (this.m_CaretSelectPosition > this.m_Text.Length) + { + this.m_CaretSelectPosition = this.m_Text.Length; + } + this.SendOnValueChangedAndUpdateLabel(); } - this.SendOnValueChangedAndUpdateLabel(); } } } @@ -664,6 +672,19 @@ private bool hasSelection } } + [Obsolete("caretSelectPosition has been deprecated. Use selectionFocusPosition instead (UnityUpgradable) -> selectionFocusPosition", true)] + public int caretSelectPosition + { + get + { + return this.selectionFocusPosition; + } + protected set + { + this.selectionFocusPosition = value; + } + } + public int caretPosition { get @@ -813,6 +834,21 @@ protected void ClampPos(ref int pos) } } + protected override void OnValidate() + { + base.OnValidate(); + this.EnforceContentType(); + this.m_CharacterLimit = Math.Max(0, this.m_CharacterLimit); + if (this.IsActive()) + { + this.UpdateLabel(); + if (this.m_AllowInput) + { + this.SetCaretActive(); + } + } + } + protected override void OnEnable() { base.OnEnable(); @@ -938,6 +974,29 @@ private bool InPlaceEditing() return !TouchScreenKeyboard.isSupported; } + private void UpdateCaretFromKeyboard() + { + RangeInt selection = this.m_Keyboard.selection; + int start = selection.start; + int end = selection.end; + bool flag = false; + if (this.caretPositionInternal != start) + { + flag = true; + this.caretPositionInternal = start; + } + if (this.caretSelectPositionInternal != end) + { + this.caretSelectPositionInternal = end; + flag = true; + } + if (flag) + { + this.m_BlinkStartTime = Time.unscaledTime; + this.UpdateLabel(); + } + } + protected virtual void LateUpdate() { if (this.m_ShouldActivateNextUpdate) @@ -1010,9 +1069,16 @@ protected virtual void LateUpdate() { this.m_Text = this.m_Text.Substring(0, this.characterLimit); } - int length = this.m_Text.Length; - this.caretSelectPositionInternal = length; - this.caretPositionInternal = length; + if (this.m_Keyboard.canGetSelection) + { + this.UpdateCaretFromKeyboard(); + } + else + { + int length = this.m_Text.Length; + this.caretSelectPositionInternal = length; + this.caretPositionInternal = length; + } if (this.m_Text != text) { this.m_Keyboard.text = this.m_Text; @@ -1020,6 +1086,10 @@ protected virtual void LateUpdate() this.SendOnValueChangedAndUpdateLabel(); } } + else if (this.m_Keyboard.canGetSelection) + { + this.UpdateCaretFromKeyboard(); + } if (this.m_Keyboard.done) { if (this.m_Keyboard.wasCanceled) @@ -2014,7 +2084,10 @@ public void ForceLabelUpdate() private void MarkGeometryAsDirty() { - CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); + if (Application.isPlaying && !(PrefabUtility.GetPrefabObject(base.gameObject) != null)) + { + CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); + } } public virtual void Rebuild(CanvasUpdate update) @@ -2035,25 +2108,28 @@ public virtual void GraphicUpdateComplete() private void UpdateGeometry() { - if (this.shouldHideMobileInput) + if (Application.isPlaying) { - if (this.m_CachedInputRenderer == null && this.m_TextComponent != null) - { - GameObject gameObject = new GameObject(base.transform.name + " Input Caret"); - gameObject.hideFlags = HideFlags.DontSave; - gameObject.transform.SetParent(this.m_TextComponent.transform.parent); - gameObject.transform.SetAsFirstSibling(); - gameObject.layer = base.gameObject.layer; - this.caretRectTrans = gameObject.AddComponent(); - this.m_CachedInputRenderer = gameObject.AddComponent(); - this.m_CachedInputRenderer.SetMaterial(Graphic.defaultGraphicMaterial, Texture2D.whiteTexture); - gameObject.AddComponent().ignoreLayout = true; - this.AssignPositioningIfNeeded(); - } - if (!(this.m_CachedInputRenderer == null)) + if (this.shouldHideMobileInput) { - this.OnFillVBO(this.mesh); - this.m_CachedInputRenderer.SetMesh(this.mesh); + if (this.m_CachedInputRenderer == null && this.m_TextComponent != null) + { + GameObject gameObject = new GameObject(base.transform.name + " Input Caret"); + gameObject.hideFlags = HideFlags.DontSave; + gameObject.transform.SetParent(this.m_TextComponent.transform.parent); + gameObject.transform.SetAsFirstSibling(); + gameObject.layer = base.gameObject.layer; + this.caretRectTrans = gameObject.AddComponent(); + this.m_CachedInputRenderer = gameObject.AddComponent(); + this.m_CachedInputRenderer.SetMaterial(Graphic.defaultGraphicMaterial, Texture2D.whiteTexture); + gameObject.AddComponent().ignoreLayout = true; + this.AssignPositioningIfNeeded(); + } + if (!(this.m_CachedInputRenderer == null)) + { + this.OnFillVBO(this.mesh); + this.m_CachedInputRenderer.SetMesh(this.mesh); + } } } } diff --git a/UnityEngine.UI/UnityEngine.UI/LayoutElement.cs b/UnityEngine.UI/UnityEngine.UI/LayoutElement.cs index b22806e9..229a7f92 100644 --- a/UnityEngine.UI/UnityEngine.UI/LayoutElement.cs +++ b/UnityEngine.UI/UnityEngine.UI/LayoutElement.cs @@ -186,5 +186,10 @@ protected void SetDirty() LayoutRebuilder.MarkLayoutForRebuild(base.transform as RectTransform); } } + + protected override void OnValidate() + { + this.SetDirty(); + } } } diff --git a/UnityEngine.UI/UnityEngine.UI/LayoutGroup.cs b/UnityEngine.UI/UnityEngine.UI/LayoutGroup.cs index 72b1dbd3..b20e5bc6 100644 --- a/UnityEngine.UI/UnityEngine.UI/LayoutGroup.cs +++ b/UnityEngine.UI/UnityEngine.UI/LayoutGroup.cs @@ -311,5 +311,10 @@ private IEnumerator DelayedSetDirty(RectTransform rectTransform) c__Iterator.rectTransform = rectTransform; return c__Iterator; } + + protected override void OnValidate() + { + this.SetDirty(); + } } } diff --git a/UnityEngine.UI/UnityEngine.UI/Mask.cs b/UnityEngine.UI/UnityEngine.UI/Mask.cs index 514fec73..681ff37c 100644 --- a/UnityEngine.UI/UnityEngine.UI/Mask.cs +++ b/UnityEngine.UI/UnityEngine.UI/Mask.cs @@ -109,6 +109,19 @@ protected override void OnDisable() MaskUtilities.NotifyStencilStateChanged(this); } + protected override void OnValidate() + { + base.OnValidate(); + if (this.IsActive()) + { + if (this.graphic != null) + { + this.graphic.SetMaterialDirty(); + } + MaskUtilities.NotifyStencilStateChanged(this); + } + } + public virtual bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) { return !base.isActiveAndEnabled || RectTransformUtility.RectangleContainsScreenPoint(this.rectTransform, sp, eventCamera); diff --git a/UnityEngine.UI/UnityEngine.UI/MaskableGraphic.cs b/UnityEngine.UI/UnityEngine.UI/MaskableGraphic.cs index 7066be10..c6495979 100644 --- a/UnityEngine.UI/UnityEngine.UI/MaskableGraphic.cs +++ b/UnityEngine.UI/UnityEngine.UI/MaskableGraphic.cs @@ -163,6 +163,14 @@ protected override void OnDisable() } } + protected override void OnValidate() + { + base.OnValidate(); + this.m_ShouldRecalculateStencil = true; + this.UpdateClipParent(); + this.SetMaterialDirty(); + } + protected override void OnTransformParentChanged() { base.OnTransformParentChanged(); diff --git a/UnityEngine.UI/UnityEngine.UI/RectMask2D.cs b/UnityEngine.UI/UnityEngine.UI/RectMask2D.cs index 1950012a..c293899f 100644 --- a/UnityEngine.UI/UnityEngine.UI/RectMask2D.cs +++ b/UnityEngine.UI/UnityEngine.UI/RectMask2D.cs @@ -81,6 +81,16 @@ protected override void OnDisable() MaskUtilities.Notify2DMaskStateChanged(this); } + protected override void OnValidate() + { + base.OnValidate(); + this.m_ShouldRecalculateClipRects = true; + if (this.IsActive()) + { + MaskUtilities.Notify2DMaskStateChanged(this); + } + } + public virtual bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) { return !base.isActiveAndEnabled || RectTransformUtility.RectangleContainsScreenPoint(this.rectTransform, sp, eventCamera); diff --git a/UnityEngine.UI/UnityEngine.UI/ScrollRect.cs b/UnityEngine.UI/UnityEngine.UI/ScrollRect.cs index c7c091b1..4a547b47 100644 --- a/UnityEngine.UI/UnityEngine.UI/ScrollRect.cs +++ b/UnityEngine.UI/UnityEngine.UI/ScrollRect.cs @@ -830,7 +830,7 @@ private void SetNormalizedPosition(float value, int axis) float num2 = this.m_ViewBounds.min[axis] - value * num; float num3 = this.m_Content.localPosition[axis] + num2 - this.m_ContentBounds.min[axis]; Vector3 localPosition = this.m_Content.localPosition; - if (Mathf.Abs(localPosition[axis] - num3) > 0.0001f) + if (Mathf.Abs(localPosition[axis] - num3) > 0.01f) { localPosition[axis] = num3; this.m_Content.localPosition = localPosition; @@ -1081,6 +1081,11 @@ protected void SetDirtyCaching() } } + protected override void OnValidate() + { + this.SetDirtyCaching(); + } + Transform ICanvasElement.get_transform() { return base.transform; diff --git a/UnityEngine.UI/UnityEngine.UI/Scrollbar.cs b/UnityEngine.UI/UnityEngine.UI/Scrollbar.cs index 5569ac53..c2c1cbd4 100644 --- a/UnityEngine.UI/UnityEngine.UI/Scrollbar.cs +++ b/UnityEngine.UI/UnityEngine.UI/Scrollbar.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Diagnostics; +using UnityEditor; using UnityEngine.Events; using UnityEngine.EventSystems; @@ -175,8 +176,29 @@ protected Scrollbar() { } + protected override void OnValidate() + { + base.OnValidate(); + this.m_Size = Mathf.Clamp01(this.m_Size); + if (this.IsActive()) + { + this.UpdateCachedReferences(); + this.Set(this.m_Value, false); + this.UpdateVisuals(); + } + PrefabType prefabType = PrefabUtility.GetPrefabType(this); + if (prefabType != PrefabType.Prefab && !Application.isPlaying) + { + CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); + } + } + public virtual void Rebuild(CanvasUpdate executing) { + if (executing == CanvasUpdate.Prelayout) + { + this.onValueChanged.Invoke(this.value); + } } public virtual void LayoutComplete() @@ -243,6 +265,10 @@ protected override void OnRectTransformDimensionsChange() private void UpdateVisuals() { + if (!Application.isPlaying) + { + this.UpdateCachedReferences(); + } this.m_Tracker.Clear(); if (this.m_ContainerRect != null) { diff --git a/UnityEngine.UI/UnityEngine.UI/Selectable.cs b/UnityEngine.UI/UnityEngine.UI/Selectable.cs index 01777a57..d92b0c9f 100644 --- a/UnityEngine.UI/UnityEngine.UI/Selectable.cs +++ b/UnityEngine.UI/UnityEngine.UI/Selectable.cs @@ -286,7 +286,14 @@ protected override void OnEnable() private void OnSetProperty() { - this.InternalEvaluateAndTransitionToSelectionState(false); + if (!Application.isPlaying) + { + this.InternalEvaluateAndTransitionToSelectionState(true); + } + else + { + this.InternalEvaluateAndTransitionToSelectionState(false); + } } protected override void OnDisable() @@ -296,6 +303,28 @@ protected override void OnDisable() base.OnDisable(); } + protected override void OnValidate() + { + base.OnValidate(); + this.m_Colors.fadeDuration = Mathf.Max(this.m_Colors.fadeDuration, 0f); + if (base.isActiveAndEnabled) + { + if (!this.interactable && EventSystem.current != null && EventSystem.current.currentSelectedGameObject == base.gameObject) + { + EventSystem.current.SetSelectedGameObject(null); + } + this.DoSpriteSwap(null); + this.StartColorTween(Color.white, true); + this.TriggerAnimation(this.m_AnimationTriggers.normalTrigger); + this.InternalEvaluateAndTransitionToSelectionState(true); + } + } + + protected override void Reset() + { + this.m_TargetGraphic = base.GetComponent(); + } + protected virtual void InstantClearState() { string normalTrigger = this.m_AnimationTriggers.normalTrigger; diff --git a/UnityEngine.UI/UnityEngine.UI/Shadow.cs b/UnityEngine.UI/UnityEngine.UI/Shadow.cs index 18addc20..1bdfa949 100644 --- a/UnityEngine.UI/UnityEngine.UI/Shadow.cs +++ b/UnityEngine.UI/UnityEngine.UI/Shadow.cs @@ -88,6 +88,12 @@ protected Shadow() { } + protected override void OnValidate() + { + this.effectDistance = this.m_EffectDistance; + base.OnValidate(); + } + protected void ApplyShadowZeroAlloc(List verts, Color32 color, int start, int end, float x, float y) { int num = verts.Count + end - start; diff --git a/UnityEngine.UI/UnityEngine.UI/Slider.cs b/UnityEngine.UI/UnityEngine.UI/Slider.cs index d94b494c..4d7923f2 100644 --- a/UnityEngine.UI/UnityEngine.UI/Slider.cs +++ b/UnityEngine.UI/UnityEngine.UI/Slider.cs @@ -1,4 +1,5 @@ using System; +using UnityEditor; using UnityEngine.Events; using UnityEngine.EventSystems; @@ -241,8 +242,33 @@ protected Slider() { } + protected override void OnValidate() + { + base.OnValidate(); + if (this.wholeNumbers) + { + this.m_MinValue = Mathf.Round(this.m_MinValue); + this.m_MaxValue = Mathf.Round(this.m_MaxValue); + } + if (this.IsActive()) + { + this.UpdateCachedReferences(); + this.Set(this.m_Value, false); + this.UpdateVisuals(); + } + PrefabType prefabType = PrefabUtility.GetPrefabType(this); + if (prefabType != PrefabType.Prefab && !Application.isPlaying) + { + CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); + } + } + public virtual void Rebuild(CanvasUpdate executing) { + if (executing == CanvasUpdate.Prelayout) + { + this.onValueChanged.Invoke(this.value); + } } public virtual void LayoutComplete() @@ -363,6 +389,10 @@ protected override void OnRectTransformDimensionsChange() private void UpdateVisuals() { + if (!Application.isPlaying) + { + this.UpdateCachedReferences(); + } this.m_Tracker.Clear(); if (this.m_FillContainerRect != null) { @@ -389,10 +419,10 @@ private void UpdateVisuals() this.m_Tracker.Add(this, this.m_HandleRect, DrivenTransformProperties.Anchors); Vector2 zero2 = Vector2.zero; Vector2 one2 = Vector2.one; - int arg_144_1 = (int)this.axis; + int arg_154_1 = (int)this.axis; float value = (!this.reverseValue) ? this.normalizedValue : (1f - this.normalizedValue); one2[(int)this.axis] = value; - zero2[arg_144_1] = value; + zero2[arg_154_1] = value; this.m_HandleRect.anchorMin = zero2; this.m_HandleRect.anchorMax = one2; } diff --git a/UnityEngine.UI/UnityEngine.UI/Text.cs b/UnityEngine.UI/UnityEngine.UI/Text.cs index b9a161d7..24c2e37e 100644 --- a/UnityEngine.UI/UnityEngine.UI/Text.cs +++ b/UnityEngine.UI/UnityEngine.UI/Text.cs @@ -9,6 +9,8 @@ public class Text : MaskableGraphic, ILayoutElement [SerializeField] private FontData m_FontData = FontData.defaultFontData; + private Font m_LastTrackedFont; + [SerializeField, TextArea(3, 10)] protected string m_Text = string.Empty; @@ -83,6 +85,7 @@ public Font font FontUpdateTracker.UntrackText(this); this.m_FontData.font = value; FontUpdateTracker.TrackText(this); + this.m_LastTrackedFont = value; this.SetAllDirty(); } } @@ -431,6 +434,11 @@ protected override void UpdateGeometry() } } + protected override void Reset() + { + this.AssignDefaultFont(); + } + internal void AssignDefaultFont() { this.font = Resources.GetBuiltinResource("Arial.ttf"); @@ -562,5 +570,34 @@ public virtual void CalculateLayoutInputHorizontal() public virtual void CalculateLayoutInputVertical() { } + + public override void OnRebuildRequested() + { + FontUpdateTracker.UntrackText(this); + FontUpdateTracker.TrackText(this); + this.cachedTextGenerator.Invalidate(); + base.OnRebuildRequested(); + } + + protected override void OnValidate() + { + if (!this.IsActive()) + { + base.OnValidate(); + } + else + { + if (this.m_FontData.font != this.m_LastTrackedFont) + { + Font font = this.m_FontData.font; + this.m_FontData.font = this.m_LastTrackedFont; + FontUpdateTracker.UntrackText(this); + this.m_FontData.font = font; + FontUpdateTracker.TrackText(this); + this.m_LastTrackedFont = font; + } + base.OnValidate(); + } + } } } diff --git a/UnityEngine.UI/UnityEngine.UI/Toggle.cs b/UnityEngine.UI/UnityEngine.UI/Toggle.cs index 8a306709..5c581416 100644 --- a/UnityEngine.UI/UnityEngine.UI/Toggle.cs +++ b/UnityEngine.UI/UnityEngine.UI/Toggle.cs @@ -1,4 +1,5 @@ using System; +using UnityEditor; using UnityEngine.Events; using UnityEngine.EventSystems; using UnityEngine.Serialization; @@ -40,8 +41,11 @@ public ToggleGroup group set { this.m_Group = value; - this.SetToggleGroup(this.m_Group, true); - this.PlayEffect(true); + if (Application.isPlaying) + { + this.SetToggleGroup(this.m_Group, true); + this.PlayEffect(true); + } } } @@ -61,8 +65,22 @@ protected Toggle() { } + protected override void OnValidate() + { + base.OnValidate(); + PrefabType prefabType = PrefabUtility.GetPrefabType(this); + if (prefabType != PrefabType.Prefab && !Application.isPlaying) + { + CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); + } + } + public virtual void Rebuild(CanvasUpdate executing) { + if (executing == CanvasUpdate.Prelayout) + { + this.onValueChanged.Invoke(this.m_IsOn); + } } public virtual void LayoutComplete() @@ -151,7 +169,14 @@ private void PlayEffect(bool instant) { if (!(this.graphic == null)) { - this.graphic.CrossFadeAlpha((!this.m_IsOn) ? 0f : 1f, (!instant) ? 0.1f : 0f, true); + if (!Application.isPlaying) + { + this.graphic.canvasRenderer.SetAlpha((!this.m_IsOn) ? 0f : 1f); + } + else + { + this.graphic.CrossFadeAlpha((!this.m_IsOn) ? 0f : 1f, (!instant) ? 0.1f : 0f, true); + } } } diff --git a/UnityEngine/UnityEngine.Networking.Match/NetworkMatch.cs b/UnityEngine/UnityEngine.Networking.Match/NetworkMatch.cs index 25543c98..475166a3 100644 --- a/UnityEngine/UnityEngine.Networking.Match/NetworkMatch.cs +++ b/UnityEngine/UnityEngine.Networking.Match/NetworkMatch.cs @@ -35,17 +35,27 @@ public void SetProgramAppID(AppID programAppID) public Coroutine CreateMatch(string matchName, uint matchSize, bool matchAdvertise, string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForMatch, int requestDomain, NetworkMatch.DataResponseDelegate callback) { - return this.CreateMatch(new CreateMatchRequest + Coroutine result; + if (Application.platform == RuntimePlatform.WebGLPlayer) { - name = matchName, - size = matchSize, - advertise = matchAdvertise, - password = matchPassword, - publicAddress = publicClientAddress, - privateAddress = privateClientAddress, - eloScore = eloScoreForMatch, - domain = requestDomain - }, callback); + UnityEngine.Debug.LogError("Matchmaking is not supported on WebGL player."); + result = null; + } + else + { + result = this.CreateMatch(new CreateMatchRequest + { + name = matchName, + size = matchSize, + advertise = matchAdvertise, + password = matchPassword, + publicAddress = publicClientAddress, + privateAddress = privateClientAddress, + eloScore = eloScoreForMatch, + domain = requestDomain + }, callback); + } + return result; } internal Coroutine CreateMatch(CreateMatchRequest req, NetworkMatch.DataResponseDelegate callback) @@ -225,15 +235,25 @@ internal void OnDropConnection(DropConnectionResponse response, NetworkMatch.Bas public Coroutine ListMatches(int startPageNumber, int resultPageSize, string matchNameFilter, bool filterOutPrivateMatchesFromResults, int eloScoreTarget, int requestDomain, NetworkMatch.DataResponseDelegate> callback) { - return this.ListMatches(new ListMatchRequest + Coroutine result; + if (Application.platform == RuntimePlatform.WebGLPlayer) { - pageNum = startPageNumber, - pageSize = resultPageSize, - nameFilter = matchNameFilter, - filterOutPrivateMatches = filterOutPrivateMatchesFromResults, - eloScore = eloScoreTarget, - domain = requestDomain - }, callback); + UnityEngine.Debug.LogError("Matchmaking is not supported on WebGL player."); + result = null; + } + else + { + result = this.ListMatches(new ListMatchRequest + { + pageNum = startPageNumber, + pageSize = resultPageSize, + nameFilter = matchNameFilter, + filterOutPrivateMatches = filterOutPrivateMatchesFromResults, + eloScore = eloScoreTarget, + domain = requestDomain + }, callback); + } + return result; } internal Coroutine ListMatches(ListMatchRequest req, NetworkMatch.DataResponseDelegate> callback) diff --git a/UnityEngine/UnityEngine.Networking/NetworkTransport.cs b/UnityEngine/UnityEngine.Networking/NetworkTransport.cs index bc87b4df..5f034698 100644 --- a/UnityEngine/UnityEngine.Networking/NetworkTransport.cs +++ b/UnityEngine/UnityEngine.Networking/NetworkTransport.cs @@ -257,6 +257,7 @@ public static int AddWebsocketHost(HostTopology topology, int port, [DefaultValu { throw new NullReferenceException("topology is not defined"); } + NetworkTransport.CheckTopology(topology); int result; if (ip == null) { @@ -296,6 +297,7 @@ public static int AddHost(HostTopology topology, [DefaultValue("0")] int port, [ { throw new NullReferenceException("topology is not defined"); } + NetworkTransport.CheckTopology(topology); int result; if (ip == null) { @@ -329,6 +331,7 @@ public static int AddHostWithSimulator(HostTopology topology, int minTimeout, in { throw new NullReferenceException("topology is not defined"); } + NetworkTransport.CheckTopology(topology); int result; if (ip == null) { diff --git a/UnityEngine/UnityEngine.Networking/UnityWebRequest.cs b/UnityEngine/UnityEngine.Networking/UnityWebRequest.cs index da963ef3..beaf0126 100644 --- a/UnityEngine/UnityEngine.Networking/UnityWebRequest.cs +++ b/UnityEngine/UnityEngine.Networking/UnityWebRequest.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; -using System.Text.RegularExpressions; +using UnityEngineInternal; namespace UnityEngine.Networking { @@ -66,8 +66,6 @@ internal enum UnityWebRequestError public const string kHttpVerbDELETE = "DELETE"; - private static Regex domainRegex = new Regex("^\\s*\\w+(?:\\.\\w+)+\\s*$"); - private static readonly string[] forbiddenHeaderKeys = new string[] { "accept-charset", @@ -184,38 +182,8 @@ public string url } set { - string text = value; - string uriString = "http://localhost/"; - Uri uri = new Uri(uriString); - if (text.StartsWith("//")) - { - text = uri.Scheme + ":" + text; - } - if (text.StartsWith("/")) - { - text = uri.Scheme + "://" + uri.Host + text; - } - if (UnityWebRequest.domainRegex.IsMatch(text)) - { - text = uri.Scheme + "://" + text; - } - Uri uri2 = null; - try - { - uri2 = new Uri(text); - } - catch (FormatException ex) - { - try - { - uri2 = new Uri(uri, text); - } - catch (FormatException) - { - throw ex; - } - } - this.InternalSetUrl(uri2.AbsoluteUri); + string localUrl = "http://localhost/"; + this.InternalSetUrl(WebRequestUtils.MakeInitialUrl(value, localUrl)); } } @@ -393,8 +361,13 @@ public static UnityWebRequest Put(string uri, string bodyData) public static UnityWebRequest Post(string uri, string postData) { UnityWebRequest unityWebRequest = new UnityWebRequest(uri, "POST"); - string s = WWWTranscoder.URLEncode(postData, Encoding.UTF8); - unityWebRequest.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(s)); + byte[] data = null; + if (!string.IsNullOrEmpty(postData)) + { + string s = WWWTranscoder.URLEncode(postData, Encoding.UTF8); + data = Encoding.UTF8.GetBytes(s); + } + unityWebRequest.uploadHandler = new UploadHandlerRaw(data); unityWebRequest.uploadHandler.contentType = "application/x-www-form-urlencoded"; unityWebRequest.downloadHandler = new DownloadHandlerBuffer(); return unityWebRequest; @@ -403,12 +376,24 @@ public static UnityWebRequest Post(string uri, string postData) public static UnityWebRequest Post(string uri, WWWForm formData) { UnityWebRequest unityWebRequest = new UnityWebRequest(uri, "POST"); - unityWebRequest.uploadHandler = new UploadHandlerRaw(formData.data); + byte[] array = null; + if (formData != null) + { + array = formData.data; + if (array.Length == 0) + { + array = null; + } + } + unityWebRequest.uploadHandler = new UploadHandlerRaw(array); unityWebRequest.downloadHandler = new DownloadHandlerBuffer(); - Dictionary headers = formData.headers; - foreach (KeyValuePair current in headers) + if (formData != null) { - unityWebRequest.SetRequestHeader(current.Key, current.Value); + Dictionary headers = formData.headers; + foreach (KeyValuePair current in headers) + { + unityWebRequest.SetRequestHeader(current.Key, current.Value); + } } return unityWebRequest; } @@ -422,7 +407,11 @@ public static UnityWebRequest Post(string uri, List multi public static UnityWebRequest Post(string uri, List multipartFormSections, byte[] boundary) { UnityWebRequest unityWebRequest = new UnityWebRequest(uri, "POST"); - byte[] data = UnityWebRequest.SerializeFormSections(multipartFormSections, boundary); + byte[] data = null; + if (multipartFormSections != null && multipartFormSections.Count != 0) + { + data = UnityWebRequest.SerializeFormSections(multipartFormSections, boundary); + } unityWebRequest.uploadHandler = new UploadHandlerRaw(data) { contentType = "multipart/form-data; boundary=" + Encoding.UTF8.GetString(boundary, 0, boundary.Length) @@ -434,7 +423,11 @@ public static UnityWebRequest Post(string uri, List multi public static UnityWebRequest Post(string uri, Dictionary formFields) { UnityWebRequest unityWebRequest = new UnityWebRequest(uri, "POST"); - byte[] data = UnityWebRequest.SerializeSimpleForm(formFields); + byte[] data = null; + if (formFields != null && formFields.Count != 0) + { + data = UnityWebRequest.SerializeSimpleForm(formFields); + } unityWebRequest.uploadHandler = new UploadHandlerRaw(data) { contentType = "application/x-www-form-urlencoded" diff --git a/UnityEngine/UnityEngine.Rendering/BuiltinShaderType.cs b/UnityEngine/UnityEngine.Rendering/BuiltinShaderType.cs index 10984579..9f925bec 100644 --- a/UnityEngine/UnityEngine.Rendering/BuiltinShaderType.cs +++ b/UnityEngine/UnityEngine.Rendering/BuiltinShaderType.cs @@ -9,9 +9,8 @@ public enum BuiltinShaderType LegacyDeferredLighting, ScreenSpaceShadows, DepthNormals, + MotionVectors, LightHalo, - LensFlare, - Sprite, - MotionVectors + LensFlare } } diff --git a/UnityEngine/UnityEngine.SceneManagement/SceneManager.cs b/UnityEngine/UnityEngine.SceneManagement/SceneManager.cs index da3faaf8..78a5fbc5 100644 --- a/UnityEngine/UnityEngine.SceneManagement/SceneManager.cs +++ b/UnityEngine/UnityEngine.SceneManagement/SceneManager.cs @@ -233,11 +233,17 @@ public static Scene CreateScene(string sceneName) [Obsolete("Use SceneManager.UnloadSceneAsync. This function is not safe to use during triggers and under other circumstances. See Scripting reference for more details.")] public static bool UnloadScene(Scene scene) { - bool result; - SceneManager.UnloadSceneNameIndexInternal("", scene.buildIndex, true, out result); - return result; + return SceneManager.UnloadSceneInternal(scene); } + private static bool UnloadSceneInternal(Scene scene) + { + return SceneManager.INTERNAL_CALL_UnloadSceneInternal(ref scene); + } + + [MethodImpl(MethodImplOptions.InternalCall)] + private static extern bool INTERNAL_CALL_UnloadSceneInternal(ref Scene scene); + [Obsolete("Use SceneManager.UnloadSceneAsync. This function is not safe to use during triggers and under other circumstances. See Scripting reference for more details.")] public static bool UnloadScene(int sceneBuildIndex) { @@ -268,10 +274,17 @@ public static AsyncOperation UnloadSceneAsync(string sceneName) public static AsyncOperation UnloadSceneAsync(Scene scene) { - bool flag; - return SceneManager.UnloadSceneNameIndexInternal("", scene.buildIndex, false, out flag); + return SceneManager.UnloadSceneAsyncInternal(scene); + } + + private static AsyncOperation UnloadSceneAsyncInternal(Scene scene) + { + return SceneManager.INTERNAL_CALL_UnloadSceneAsyncInternal(ref scene); } + [MethodImpl(MethodImplOptions.InternalCall)] + private static extern AsyncOperation INTERNAL_CALL_UnloadSceneAsyncInternal(ref Scene scene); + [MethodImpl(MethodImplOptions.InternalCall)] private static extern AsyncOperation UnloadSceneNameIndexInternal(string sceneName, int sceneBuildIndex, bool immediately, out bool outSuccess); diff --git a/UnityEngine/UnityEngine.csproj b/UnityEngine/UnityEngine.csproj index 70bb0b59..c0723d10 100644 --- a/UnityEngine/UnityEngine.csproj +++ b/UnityEngine/UnityEngine.csproj @@ -1,7 +1,7 @@ - + - {45BFEA31-16C1-4F6A-AC9B-EFA7A5449446} + {87EA7A76-1542-4CAA-B07E-3DABE44E610B} Debug AnyCPU Library @@ -807,6 +807,7 @@ + diff --git a/UnityEngine/UnityEngine.iOS/Device.cs b/UnityEngine/UnityEngine.iOS/Device.cs index 02ff2894..4bde1bca 100644 --- a/UnityEngine/UnityEngine.iOS/Device.cs +++ b/UnityEngine/UnityEngine.iOS/Device.cs @@ -39,9 +39,11 @@ public static extern bool advertisingTrackingEnabled get; } + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] public static extern void SetNoBackupFlag(string path); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] public static extern void ResetNoBackupFlag(string path); diff --git a/UnityEngine/UnityEngine.iOS/DeviceGeneration.cs b/UnityEngine/UnityEngine.iOS/DeviceGeneration.cs index 6e9ed76e..c5678fb8 100644 --- a/UnityEngine/UnityEngine.iOS/DeviceGeneration.cs +++ b/UnityEngine/UnityEngine.iOS/DeviceGeneration.cs @@ -39,6 +39,7 @@ public enum DeviceGeneration iPadPro10Inch1Gen, iPhone7, iPhone7Plus, + iPodTouch6Gen, iPhoneUnknown = 10001, iPadUnknown, iPodTouchUnknown diff --git a/UnityEngine/UnityEngine/Application.cs b/UnityEngine/UnityEngine/Application.cs index a4eaa92b..8c30c0f0 100644 --- a/UnityEngine/UnityEngine/Application.cs +++ b/UnityEngine/UnityEngine/Application.cs @@ -5,6 +5,7 @@ using System.Security; using System.Text; using UnityEngine.Internal; +using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.Scripting; @@ -324,10 +325,13 @@ internal static extern bool submitAnalytics get; } - public static extern bool isShowingSplashScreen + [Obsolete("This property is deprecated, please use SplashScreen.isFinished instead")] + public static bool isShowingSplashScreen { - [MethodImpl(MethodImplOptions.InternalCall)] - get; + get + { + return !SplashScreen.isFinished; + } } [Obsolete("Use SceneManager.sceneCountInBuildSettings")] diff --git a/UnityEngine/UnityEngine/ComputeBuffer.cs b/UnityEngine/UnityEngine/ComputeBuffer.cs index 5a5c7200..9a428baa 100644 --- a/UnityEngine/UnityEngine/ComputeBuffer.cs +++ b/UnityEngine/UnityEngine/ComputeBuffer.cs @@ -52,7 +52,14 @@ public void Dispose() private void Dispose(bool disposing) { - ComputeBuffer.DestroyBuffer(this); + if (disposing) + { + ComputeBuffer.DestroyBuffer(this); + } + else if (this.m_Ptr != IntPtr.Zero) + { + Debug.LogWarning("GarbageCollector disposing of ComputeBuffer. Please use ComputeBuffer.Release() or .Dispose() to manually release the buffer."); + } this.m_Ptr = IntPtr.Zero; } diff --git a/UnityEngine/UnityEngine/Material.cs b/UnityEngine/UnityEngine/Material.cs index cbf6a156..f30dcc4a 100644 --- a/UnityEngine/UnityEngine/Material.cs +++ b/UnityEngine/UnityEngine/Material.cs @@ -560,8 +560,18 @@ public int GetInt(int nameID) return (int)this.GetFloat(nameID); } + public void SetBuffer(string name, ComputeBuffer value) + { + this.SetBuffer(Shader.PropertyToID(name), value); + } + + public void SetBuffer(int nameID, ComputeBuffer value) + { + this.SetBufferImpl(nameID, value); + } + [MethodImpl(MethodImplOptions.InternalCall)] - public extern void SetBuffer(string propertyName, ComputeBuffer buffer); + private extern void SetBufferImpl(int nameID, ComputeBuffer value); public bool HasProperty(string propertyName) { diff --git a/UnityEngine/UnityEngine/Mesh.cs b/UnityEngine/UnityEngine/Mesh.cs index 2113cb91..000bb052 100644 --- a/UnityEngine/UnityEngine/Mesh.cs +++ b/UnityEngine/UnityEngine/Mesh.cs @@ -294,9 +294,15 @@ public void Clear() [MethodImpl(MethodImplOptions.InternalCall)] private extern int[] GetTrianglesImpl(int submesh); + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void GetTrianglesNonAllocImpl(object values, int submesh); + [MethodImpl(MethodImplOptions.InternalCall)] private extern int[] GetIndicesImpl(int submesh); + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void GetIndicesNonAllocImpl(object values, int submesh); + [MethodImpl(MethodImplOptions.InternalCall)] private extern void SetTrianglesImpl(int submesh, Array triangles, int arraySize, [UnityEngine.Internal.DefaultValue("true")] bool calculateBounds); @@ -419,6 +425,12 @@ public IntPtr GetNativeIndexBufferPtr() [MethodImpl(MethodImplOptions.InternalCall)] public extern MeshTopology GetTopology(int submesh); + [MethodImpl(MethodImplOptions.InternalCall)] + public extern uint GetIndexStart(int submesh); + + [MethodImpl(MethodImplOptions.InternalCall)] + public extern uint GetIndexCount(int submesh); + [MethodImpl(MethodImplOptions.InternalCall)] public extern void CombineMeshes(CombineInstance[] combine, [UnityEngine.Internal.DefaultValue("true")] bool mergeSubMeshes, [UnityEngine.Internal.DefaultValue("true")] bool useMatrices); @@ -437,6 +449,15 @@ public void CombineMeshes(CombineInstance[] combine) this.CombineMeshes(combine, mergeSubMeshes, useMatrices); } + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void GetBoneWeightsNonAllocImpl(object values); + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern int GetBindposeCount(); + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void GetBindposesNonAllocImpl(object values); + [MethodImpl(MethodImplOptions.InternalCall)] public extern void MarkDynamic(); @@ -543,26 +564,100 @@ private void SetListForChannel(Mesh.InternalShaderChannel channel, List va this.SetSizedArrayForChannel(channel, Mesh.InternalVertexChannelType.Float, Mesh.DefaultDimensionForChannel(channel), Mesh.ExtractArrayFromList(values), this.SafeLength(values)); } + private void GetListForChannel(List buffer, int capacity, Mesh.InternalShaderChannel channel, int dim) + { + this.GetListForChannel(buffer, capacity, channel, dim, Mesh.InternalVertexChannelType.Float); + } + + private void GetListForChannel(List buffer, int capacity, Mesh.InternalShaderChannel channel, int dim, Mesh.InternalVertexChannelType channelType) + { + buffer.Clear(); + if (!this.canAccess) + { + this.PrintErrorCantAccessMesh(channel); + } + else if (this.HasChannel(channel)) + { + this.PrepareUserBuffer(buffer, capacity); + this.GetArrayFromChannelImpl(channel, channelType, dim, Mesh.ExtractArrayFromList(buffer)); + } + } + + private void PrepareUserBuffer(List buffer, int capacity) + { + buffer.Clear(); + if (buffer.Capacity < capacity) + { + buffer.Capacity = capacity; + } + Mesh.ResizeList(buffer, capacity); + } + + public void GetVertices(List vertices) + { + if (vertices == null) + { + throw new ArgumentNullException("The result vertices list cannot be null.", "vertices"); + } + this.GetListForChannel(vertices, this.vertexCount, Mesh.InternalShaderChannel.Vertex, Mesh.DefaultDimensionForChannel(Mesh.InternalShaderChannel.Vertex)); + } + public void SetVertices(List inVertices) { this.SetListForChannel(Mesh.InternalShaderChannel.Vertex, inVertices); } + public void GetNormals(List normals) + { + if (normals == null) + { + throw new ArgumentNullException("The result normals list cannot be null.", "normals"); + } + this.GetListForChannel(normals, this.vertexCount, Mesh.InternalShaderChannel.Normal, Mesh.DefaultDimensionForChannel(Mesh.InternalShaderChannel.Normal)); + } + public void SetNormals(List inNormals) { this.SetListForChannel(Mesh.InternalShaderChannel.Normal, inNormals); } + public void GetTangents(List tangents) + { + if (tangents == null) + { + throw new ArgumentNullException("The result tangents list cannot be null.", "tangents"); + } + this.GetListForChannel(tangents, this.vertexCount, Mesh.InternalShaderChannel.Tangent, Mesh.DefaultDimensionForChannel(Mesh.InternalShaderChannel.Tangent)); + } + public void SetTangents(List inTangents) { this.SetListForChannel(Mesh.InternalShaderChannel.Tangent, inTangents); } + public void GetColors(List colors) + { + if (colors == null) + { + throw new ArgumentNullException("The result colors list cannot be null.", "colors"); + } + this.GetListForChannel(colors, this.vertexCount, Mesh.InternalShaderChannel.Color, Mesh.DefaultDimensionForChannel(Mesh.InternalShaderChannel.Color)); + } + public void SetColors(List inColors) { this.SetListForChannel(Mesh.InternalShaderChannel.Color, inColors); } + public void GetColors(List colors) + { + if (colors == null) + { + throw new ArgumentNullException("The result colors list cannot be null.", "colors"); + } + this.GetListForChannel(colors, this.vertexCount, Mesh.InternalShaderChannel.Color, 1, Mesh.InternalVertexChannelType.Color); + } + public void SetColors(List inColors) { this.SetListForChannel(Mesh.InternalShaderChannel.Color, Mesh.InternalVertexChannelType.Color, 1, inColors); @@ -595,37 +690,17 @@ public void SetUVs(int channel, List uvs) this.SetUvsImpl(channel, 4, uvs); } - private void GetUVsInternal(List uvs, int uvIndex, int dim) - { - Mesh.InternalShaderChannel uVChannel = this.GetUVChannel(uvIndex); - Mesh.ResizeList(uvs, this.vertexCount); - this.GetArrayFromChannelImpl(uVChannel, Mesh.InternalVertexChannelType.Float, dim, Mesh.ExtractArrayFromList(uvs)); - } - private void GetUVsImpl(int uvIndex, List uvs, int dim) { if (uvs == null) { - throw new ArgumentException("The result uvs list cannot be null", "uvs"); + throw new ArgumentNullException("The result uvs list cannot be null.", "uvs"); } if (uvIndex < 0 || uvIndex > 3) { - throw new ArgumentException("The uv index is invalid (must be in [0..3]", "uvIndex"); - } - uvs.Clear(); - Mesh.InternalShaderChannel uVChannel = this.GetUVChannel(uvIndex); - if (!this.canAccess) - { - this.PrintErrorCantAccessMesh(uVChannel); - } - else if (this.HasChannel(uVChannel)) - { - if (this.vertexCount > uvs.Capacity) - { - uvs.Capacity = this.vertexCount; - } - this.GetUVsInternal(uvs, uvIndex, dim); + throw new IndexOutOfRangeException("Specified uv index is out of range. Must be in the range [0, 3]."); } + this.GetListForChannel(uvs, this.vertexCount, this.GetUVChannel(uvIndex), dim); } public void GetUVs(int channel, List uvs) @@ -685,9 +760,58 @@ public int[] GetTriangles(int submesh) return (!this.CheckCanAccessSubmeshTriangles(submesh)) ? new int[0] : this.GetTrianglesImpl(submesh); } + public void GetTriangles(List triangles, int submesh) + { + if (triangles == null) + { + throw new ArgumentNullException("The result triangles list cannot be null.", "triangles"); + } + if (submesh < 0 || submesh >= this.subMeshCount) + { + throw new IndexOutOfRangeException("Specified sub mesh is out of range. Must be greater or equal to 0 and less than subMeshCount."); + } + this.PrepareUserBuffer(triangles, (int)this.GetIndexCount(submesh)); + this.GetTrianglesNonAllocImpl(triangles, submesh); + } + public int[] GetIndices(int submesh) { return (!this.CheckCanAccessSubmeshIndices(submesh)) ? new int[0] : this.GetIndicesImpl(submesh); } + + public void GetIndices(List indices, int submesh) + { + if (indices == null) + { + throw new ArgumentNullException("The result indices list cannot be null.", "indices"); + } + if (submesh < 0 || submesh >= this.subMeshCount) + { + throw new IndexOutOfRangeException("Specified sub mesh is out of range. Must be greater or equal to 0 and less than subMeshCount."); + } + this.PrepareUserBuffer(indices, (int)this.GetIndexCount(submesh)); + indices.Clear(); + this.GetIndicesNonAllocImpl(indices, submesh); + } + + public void GetBindposes(List bindposes) + { + if (bindposes == null) + { + throw new ArgumentNullException("The result bindposes list cannot be null.", "bindposes"); + } + this.PrepareUserBuffer(bindposes, this.GetBindposeCount()); + this.GetBindposesNonAllocImpl(bindposes); + } + + public void GetBoneWeights(List boneWeights) + { + if (boneWeights == null) + { + throw new ArgumentNullException("The result boneWeights list cannot be null.", "boneWeights"); + } + this.PrepareUserBuffer(boneWeights, this.vertexCount); + this.GetBoneWeightsNonAllocImpl(boneWeights); + } } } diff --git a/UnityEngine/UnityEngine/RangeInt.cs b/UnityEngine/UnityEngine/RangeInt.cs new file mode 100644 index 00000000..364165c2 --- /dev/null +++ b/UnityEngine/UnityEngine/RangeInt.cs @@ -0,0 +1,25 @@ +using System; + +namespace UnityEngine +{ + public struct RangeInt + { + public int start; + + public int length; + + public int end + { + get + { + return this.start + this.length; + } + } + + public RangeInt(int start, int length) + { + this.start = start; + this.length = length; + } + } +} diff --git a/UnityEngine/UnityEngine/TerrainData.cs b/UnityEngine/UnityEngine/TerrainData.cs index 5f28bbca..080a8d90 100644 --- a/UnityEngine/UnityEngine/TerrainData.cs +++ b/UnityEngine/UnityEngine/TerrainData.cs @@ -313,27 +313,35 @@ public TerrainData() this.Internal_Create(this); } + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMaximumResolution(); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMinimumDetailResolutionPerPatch(); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMaximumDetailResolutionPerPatch(); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMaximumDetailPatchCount(); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMinimumAlphamapResolution(); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMaximumAlphamapResolution(); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMinimumBaseMapResolution(); + [ThreadAndSerializationSafe] [MethodImpl(MethodImplOptions.InternalCall)] private static extern int Internal_GetMaximumBaseMapResolution(); diff --git a/UnityEngine/UnityEngine/TextGenerator.cs b/UnityEngine/UnityEngine/TextGenerator.cs index 218ba230..bd57dff3 100644 --- a/UnityEngine/UnityEngine/TextGenerator.cs +++ b/UnityEngine/UnityEngine/TextGenerator.cs @@ -318,8 +318,18 @@ private TextGenerationError PopulateAlways(string str, TextGenerationSettings se internal bool Populate_Internal(string str, Font font, Color color, int fontSize, float scaleFactor, float lineSpacing, FontStyle style, bool richText, bool resizeTextForBestFit, int resizeTextMinSize, int resizeTextMaxSize, VerticalWrapMode verticalOverFlow, HorizontalWrapMode horizontalOverflow, bool updateBounds, TextAnchor anchor, Vector2 extents, Vector2 pivot, bool generateOutOfBounds, bool alignByGeometry, out TextGenerationError error) { uint num = 0u; - bool result = this.Populate_Internal_cpp(str, font, color, fontSize, scaleFactor, lineSpacing, style, richText, resizeTextForBestFit, resizeTextMinSize, resizeTextMaxSize, (int)verticalOverFlow, (int)horizontalOverflow, updateBounds, anchor, extents.x, extents.y, pivot.x, pivot.y, generateOutOfBounds, alignByGeometry, out num); - error = (TextGenerationError)num; + bool result; + if (font == null) + { + error = TextGenerationError.NoFont; + result = false; + } + else + { + bool flag = this.Populate_Internal_cpp(str, font, color, fontSize, scaleFactor, lineSpacing, style, richText, resizeTextForBestFit, resizeTextMinSize, resizeTextMaxSize, (int)verticalOverFlow, (int)horizontalOverflow, updateBounds, anchor, extents.x, extents.y, pivot.x, pivot.y, generateOutOfBounds, alignByGeometry, out num); + error = (TextGenerationError)num; + result = flag; + } return result; } diff --git a/UnityEngine/UnityEngine/TouchScreenKeyboard.cs b/UnityEngine/UnityEngine/TouchScreenKeyboard.cs index 1fab5bc5..ebe46093 100644 --- a/UnityEngine/UnityEngine/TouchScreenKeyboard.cs +++ b/UnityEngine/UnityEngine/TouchScreenKeyboard.cs @@ -90,6 +90,22 @@ public extern bool wasCanceled get; } + public extern bool canGetSelection + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + } + + public RangeInt selection + { + get + { + RangeInt result; + this.GetSelectionInternal(out result.start, out result.length); + return result; + } + } + public extern int targetDisplay { [MethodImpl(MethodImplOptions.InternalCall)] @@ -199,6 +215,9 @@ public static TouchScreenKeyboard Open(string text, [DefaultValue("TouchScreenKe return new TouchScreenKeyboard(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder); } + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void GetSelectionInternal(out int start, out int length); + [MethodImpl(MethodImplOptions.InternalCall)] private static extern void INTERNAL_get_area(out Rect value); } diff --git a/UnityEngine/UnityEngineInternal/WebRequestUtils.cs b/UnityEngine/UnityEngineInternal/WebRequestUtils.cs index 4296450f..25e2cf06 100644 --- a/UnityEngine/UnityEngineInternal/WebRequestUtils.cs +++ b/UnityEngine/UnityEngineInternal/WebRequestUtils.cs @@ -1,10 +1,13 @@ using System; +using System.Text.RegularExpressions; using UnityEngine.Scripting; namespace UnityEngineInternal { internal static class WebRequestUtils { + private static Regex domainRegex = new Regex("^\\s*\\w+(?:\\.\\w+)+\\s*$"); + [RequiredByNativeCode] internal static string RedirectTo(string baseUri, string redirectUri) { @@ -30,5 +33,39 @@ internal static string RedirectTo(string baseUri, string redirectUri) } return result; } + + internal static string MakeInitialUrl(string targetUrl, string localUrl) + { + Uri uri = new Uri(localUrl); + if (targetUrl.StartsWith("//")) + { + targetUrl = uri.Scheme + ":" + targetUrl; + } + if (targetUrl.StartsWith("/")) + { + targetUrl = uri.Scheme + "://" + uri.Host + targetUrl; + } + if (WebRequestUtils.domainRegex.IsMatch(targetUrl)) + { + targetUrl = uri.Scheme + "://" + targetUrl; + } + Uri uri2 = null; + try + { + uri2 = new Uri(targetUrl); + } + catch (FormatException ex) + { + try + { + uri2 = new Uri(uri, targetUrl); + } + catch (FormatException) + { + throw ex; + } + } + return uri2.OriginalString; + } } }