Beispiel #1
0
 private void ShowGeneralOptions()
 {
     EditorGUI.BeginChangeCheck();
     this.m_CompatibleWithAnyPlatform = this.ToggleWithMixedValue(this.m_CompatibleWithAnyPlatform, "Any Platform");
     using (new EditorGUI.DisabledScope(this.m_CompatibleWithAnyPlatform == 1))
     {
         this.m_CompatibleWithEditor = this.ToggleWithMixedValue(this.m_CompatibleWithEditor, "Editor");
         EditorGUI.BeginChangeCheck();
         int compatibleWithStandalone = this.ToggleWithMixedValue(this.compatibleWithStandalone, "Standalone");
         if (EditorGUI.EndChangeCheck())
         {
             this.compatibleWithStandalone = compatibleWithStandalone;
             this.m_DesktopExtension.ValidateSingleCPUTargets(this);
         }
         foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets())
         {
             if (!PluginImporterInspector.IsStandaloneTarget(current))
             {
                 this.m_CompatibleWithPlatform[(int)current] = this.ToggleWithMixedValue(this.m_CompatibleWithPlatform[(int)current], current.ToString());
             }
         }
     }
     if (EditorGUI.EndChangeCheck())
     {
         this.m_HasModified = true;
     }
 }
Beispiel #2
0
        internal override bool HasModified()
        {
            bool flag = this.m_HasModified || base.HasModified();
            bool result;

            if (!this.IsEditingPlatformSettingsSupported())
            {
                result = flag;
            }
            else
            {
                IPluginImporterExtension[] additionalExtensions = this.additionalExtensions;
                for (int i = 0; i < additionalExtensions.Length; i++)
                {
                    IPluginImporterExtension pluginImporterExtension = additionalExtensions[i];
                    flag |= pluginImporterExtension.HasModified(this);
                }
                foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets())
                {
                    IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current);
                    if (pluginImporterExtension2 != null)
                    {
                        flag |= pluginImporterExtension2.HasModified(this);
                    }
                }
                result = flag;
            }
            return(result);
        }
Beispiel #3
0
 private void OnEnable()
 {
     if (!this.IsEditingPlatformSettingsSupported())
     {
         return;
     }
     foreach (IPluginImporterExtension additionalExtension in this.additionalExtensions)
     {
         additionalExtension.OnEnable(this);
     }
     using (List <BuildTarget> .Enumerator enumerator = PluginImporterInspector.GetValidBuildTargets().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             IPluginImporterExtension importerExtension = ModuleManager.GetPluginImporterExtension(enumerator.Current);
             if (importerExtension != null)
             {
                 importerExtension.OnEnable(this);
                 importerExtension.ResetValues(this);
             }
         }
     }
     this.m_PluginInformation         = new Dictionary <string, string>();
     this.m_PluginInformation["Path"] = this.importer.assetPath;
     this.m_PluginInformation["Type"] = !this.importer.isNativePlugin ? "Managed" : "Native";
 }
Beispiel #4
0
 internal override void ResetValues()
 {
     base.ResetValues();
     this.m_HasModified = false;
     this.ResetCompatability(ref this.m_CompatibleWithAnyPlatform, (PluginImporter imp) => imp.GetCompatibleWithAnyPlatform());
     this.ResetCompatability(ref this.m_CompatibleWithEditor, (PluginImporter imp) => imp.GetCompatibleWithEditor());
     foreach (BuildTarget platform in PluginImporterInspector.GetValidBuildTargets())
     {
         this.ResetCompatability(ref this.m_CompatibleWithPlatform[(int)platform], (PluginImporter imp) => imp.GetCompatibleWithPlatform(platform));
     }
     if (!this.IsEditingPlatformSettingsSupported())
     {
         return;
     }
     IPluginImporterExtension[] additionalExtensions = this.additionalExtensions;
     for (int i = 0; i < additionalExtensions.Length; i++)
     {
         IPluginImporterExtension pluginImporterExtension = additionalExtensions[i];
         pluginImporterExtension.ResetValues(this);
     }
     foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets())
     {
         IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current);
         if (pluginImporterExtension2 != null)
         {
             pluginImporterExtension2.ResetValues(this);
         }
     }
 }
Beispiel #5
0
        public override void OnPlatformSettingsGUI(PluginImporterInspector inspector)
        {
            PluginImporter imp = inspector.importer;

            EditorGUI.BeginChangeCheck();
            if (IsUsableOnWindows(imp))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Windows"), EditorStyles.boldLabel);
                m_WindowsX86.OnGUI(inspector);
                m_WindowsX86_X64.OnGUI(inspector);
                EditorGUILayout.Space();
            }

            if (IsUsableOnLinux(imp))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("Linux"), EditorStyles.boldLabel);
                m_Linux.OnGUI(inspector);
                EditorGUILayout.Space();
            }

            if (IsUsableOnOSX(imp))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TrTextContent("macOS"), EditorStyles.boldLabel);
                m_MacOS.OnGUI(inspector);
                EditorGUILayout.Space();
            }

            if (EditorGUI.EndChangeCheck())
            {
                hasModified = true;
            }
        }
Beispiel #6
0
        internal override bool HasModified()
        {
            bool flag = this.m_HasModified || base.HasModified();

            if (!this.IsEditingPlatformSettingsSupported())
            {
                return(flag);
            }
            foreach (IPluginImporterExtension additionalExtension in this.additionalExtensions)
            {
                flag |= additionalExtension.HasModified(this);
            }
            using (List <BuildTarget> .Enumerator enumerator = PluginImporterInspector.GetValidBuildTargets().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IPluginImporterExtension importerExtension = ModuleManager.GetPluginImporterExtension(enumerator.Current);
                    if (importerExtension != null)
                    {
                        flag |= importerExtension.HasModified(this);
                    }
                }
            }
            return(flag);
        }
 public override void OnPlatformSettingsGUI(PluginImporterInspector inspector)
 {
   PluginImporter importer = inspector.importer;
   EditorGUI.BeginChangeCheck();
   if (this.IsUsableOnWindows(importer))
   {
     EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Windows"), EditorStyles.boldLabel, new GUILayoutOption[0]);
     this.m_WindowsX86.OnGUI(inspector);
     this.m_WindowsX86_X64.OnGUI(inspector);
     EditorGUILayout.Space();
   }
   if (this.IsUsableOnLinux(importer))
   {
     EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Linux"), EditorStyles.boldLabel, new GUILayoutOption[0]);
     this.m_LinuxX86.OnGUI(inspector);
     this.m_LinuxX86_X64.OnGUI(inspector);
     EditorGUILayout.Space();
   }
   if (this.IsUsableOnOSX(importer))
   {
     EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Mac OS X"), EditorStyles.boldLabel, new GUILayoutOption[0]);
     this.m_OSXX86.OnGUI(inspector);
     this.m_OSXX86_X64.OnGUI(inspector);
   }
   if (!EditorGUI.EndChangeCheck())
     return;
   this.ValidateUniversalTargets(inspector);
   this.hasModified = true;
 }
Beispiel #8
0
 private void OnEnable()
 {
     if (!this.IsEditingPlatformSettingsSupported())
     {
         return;
     }
     IPluginImporterExtension[] additionalExtensions = this.additionalExtensions;
     for (int i = 0; i < additionalExtensions.Length; i++)
     {
         IPluginImporterExtension pluginImporterExtension = additionalExtensions[i];
         pluginImporterExtension.OnEnable(this);
     }
     foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets())
     {
         IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current);
         if (pluginImporterExtension2 != null)
         {
             pluginImporterExtension2.OnEnable(this);
             pluginImporterExtension2.ResetValues(this);
         }
     }
     this.m_PluginInformation         = new Dictionary <string, string>();
     this.m_PluginInformation["Path"] = this.importer.assetPath;
     this.m_PluginInformation["Type"] = ((!this.importer.isNativePlugin) ? "Managed" : "Native");
 }
 internal override void OnGUI(PluginImporterInspector inspector)
 {
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(10f);
     this.isCpuTargetEnabled = EditorGUILayout.Toggle(base.name, this.isCpuTargetEnabled, new GUILayoutOption[0]);
     EditorGUILayout.EndHorizontal();
 }
        public override void OnPlatformSettingsGUI(PluginImporterInspector inspector)
        {
            PluginImporter importer = inspector.importer;

            EditorGUI.BeginChangeCheck();
            if (this.IsUsableOnWindows(importer))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TextContent("BuildSettings.StandaloneWindows"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                this.m_WindowsX86.OnGUI(inspector);
                this.m_WindowsX86_X64.OnGUI(inspector);
                EditorGUILayout.Space();
            }
            if (this.IsUsableOnLinux(importer))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TextContent("BuildSettings.StandaloneLinux"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                this.m_LinuxX86.OnGUI(inspector);
                this.m_LinuxX86_X64.OnGUI(inspector);
                EditorGUILayout.Space();
            }
            if (this.IsUsableOnOSX(importer))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TextContent("BuildSettings.StandaloneOSXIntel"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                this.m_OSXX86.OnGUI(inspector);
                this.m_OSXX86_X64.OnGUI(inspector);
            }
            if (EditorGUI.EndChangeCheck())
            {
                inspector.importer.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", this.CalculateMultiCPUArchitecture(this.m_LinuxX86.isCpuTargetEnabled, this.m_LinuxX86_X64.isCpuTargetEnabled).ToString());
                inspector.importer.SetPlatformData(BuildTarget.StandaloneOSXUniversal, "CPU", this.CalculateMultiCPUArchitecture(this.m_OSXX86.isCpuTargetEnabled, this.m_OSXX86_X64.isCpuTargetEnabled).ToString());
                this.hasModified = true;
            }
        }
Beispiel #11
0
        private void ShowGeneralOptions()
        {
            EditorGUI.BeginChangeCheck();
            this.m_CompatibleWithAnyPlatform = this.ToggleWithMixedValue(this.m_CompatibleWithAnyPlatform, "Any Platform");
            EditorGUI.BeginDisabledGroup(this.m_CompatibleWithAnyPlatform == 1);
            this.m_CompatibleWithEditor = this.ToggleWithMixedValue(this.m_CompatibleWithEditor, "Editor");
            EditorGUI.BeginChangeCheck();
            int num = this.ToggleWithMixedValue(this.compatibleWithStandalone, "Standalone");

            if (EditorGUI.EndChangeCheck())
            {
                this.compatibleWithStandalone = num;
                this.m_DesktopExtension.ValidateSingleCPUTargets(this);
            }
            using (List <BuildTarget> .Enumerator enumerator = PluginImporterInspector.GetValidBuildTargets().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BuildTarget current = enumerator.Current;
                    if (!PluginImporterInspector.IsStandaloneTarget(current))
                    {
                        this.m_CompatibleWithPlatform[(int)current] = this.ToggleWithMixedValue(this.m_CompatibleWithPlatform[(int)current], current.ToString());
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
            if (!EditorGUI.EndChangeCheck())
            {
                return;
            }
            this.m_HasModified = true;
        }
			internal override void OnGUI(PluginImporterInspector inspector)
			{
				EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
				GUILayout.Space(10f);
				this.isCpuTargetEnabled = EditorGUILayout.Toggle(base.name, this.isCpuTargetEnabled, new GUILayoutOption[0]);
				EditorGUILayout.EndHorizontal();
			}
Beispiel #13
0
        public override void OnPlatformSettingsGUI(PluginImporterInspector inspector)
        {
            PluginImporter importer = inspector.importer;

            EditorGUI.BeginChangeCheck();
            if (this.IsUsableOnWindows(importer))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Windows"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                this.m_WindowsX86.OnGUI(inspector);
                this.m_WindowsX86_X64.OnGUI(inspector);
                EditorGUILayout.Space();
            }
            if (this.IsUsableOnLinux(importer))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Linux"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                this.m_LinuxX86.OnGUI(inspector);
                this.m_LinuxX86_X64.OnGUI(inspector);
                EditorGUILayout.Space();
            }
            if (this.IsUsableOnOSX(importer))
            {
                EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Mac OS X"), EditorStyles.boldLabel, new GUILayoutOption[0]);
                this.m_OSXX86.OnGUI(inspector);
                this.m_OSXX86_X64.OnGUI(inspector);
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.ValidateUniversalTargets(inspector);
                this.hasModified = true;
            }
        }
Beispiel #14
0
        private static List <BuildTarget> GetValidBuildTargets()
        {
            List <BuildTarget> list       = new List <BuildTarget>();
            IEnumerator        enumerator = Enum.GetValues(typeof(BuildTarget)).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    BuildTarget buildTarget = (BuildTarget)((int)enumerator.Current);
                    if (!PluginImporterInspector.IgnorePlatform(buildTarget) && !list.Contains(buildTarget))
                    {
                        if (!ModuleManager.IsPlatformSupported(buildTarget) || ModuleManager.IsPlatformSupportLoaded(ModuleManager.GetTargetStringFromBuildTarget(buildTarget)))
                        {
                            list.Add(buildTarget);
                        }
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            return(list);
        }
Beispiel #15
0
 public void ValidateSingleCPUTargets(PluginImporterInspector inspector)
 {
     DesktopPluginImporterExtension.DesktopSingleCPUProperty[] array = new DesktopPluginImporterExtension.DesktopSingleCPUProperty[]
     {
         this.m_WindowsX86,
         this.m_WindowsX86_X64,
         this.m_LinuxX86,
         this.m_LinuxX86_X64,
         this.m_OSXX86,
         this.m_OSXX86_X64
     };
     DesktopPluginImporterExtension.DesktopSingleCPUProperty[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         DesktopPluginImporterExtension.DesktopSingleCPUProperty desktopSingleCPUProperty = array2[i];
         string           value     = (!desktopSingleCPUProperty.IsTargetEnabled(inspector)) ? DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None.ToString() : desktopSingleCPUProperty.defaultValue.ToString();
         PluginImporter[] importers = inspector.importers;
         for (int j = 0; j < importers.Length; j++)
         {
             PluginImporter pluginImporter = importers[j];
             pluginImporter.SetPlatformData(desktopSingleCPUProperty.platformName, "CPU", value);
         }
     }
     this.ValidateUniversalTargets(inspector);
 }
Beispiel #16
0
        private void ValidateUniversalTargets(PluginImporterInspector inspector)
        {
            bool flag  = this.m_LinuxX86.IsTargetEnabled(inspector);
            bool flag2 = this.m_LinuxX86_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture = this.CalculateMultiCPUArchitecture(flag, flag2);
            PluginImporter[] importers = inspector.importers;
            for (int i = 0; i < importers.Length; i++)
            {
                PluginImporter pluginImporter = importers[i];
                pluginImporter.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", desktopPluginCPUArchitecture.ToString());
            }
            inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneLinuxUniversal), flag || flag2);
            bool flag3 = this.m_OSXX86.IsTargetEnabled(inspector);
            bool flag4 = this.m_OSXX86_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture2 = this.CalculateMultiCPUArchitecture(flag3, flag4);
            PluginImporter[] importers2 = inspector.importers;
            for (int j = 0; j < importers2.Length; j++)
            {
                PluginImporter pluginImporter2 = importers2[j];
                pluginImporter2.SetPlatformData(BuildTarget.StandaloneOSXUniversal, "CPU", desktopPluginCPUArchitecture2.ToString());
            }
            inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneOSXUniversal), flag3 || flag4);
        }
Beispiel #17
0
 internal bool IsTargetEnabled(PluginImporterInspector inspector)
 {
     PluginImporterInspector.Compatibility platformCompatibility = inspector.GetPlatformCompatibility(base.platformName);
     if (platformCompatibility == PluginImporterInspector.Compatibility.Mixed)
     {
         throw new Exception("Unexpected mixed value for '" + inspector.importer.assetPath + "', platform: " + base.platformName);
     }
     return(platformCompatibility == PluginImporterInspector.Compatibility.Compatible);
 }
 public void ValidateSingleCPUTargets(PluginImporterInspector inspector)
 {
     DesktopSingleCPUProperty[] propertyArray = new DesktopSingleCPUProperty[] { this.m_WindowsX86, this.m_WindowsX86_X64, this.m_LinuxX86, this.m_LinuxX86_X64, this.m_OSXX86, this.m_OSXX86_X64 };
     foreach (DesktopSingleCPUProperty property in propertyArray)
     {
         string str = !property.IsTargetEnabled(inspector) ? DesktopPluginCPUArchitecture.None.ToString() : property.defaultValue.ToString();
         inspector.importer.SetPlatformData(property.platformName, "CPU", str);
     }
     this.ValidateUniversalTargets(inspector);
 }
Beispiel #19
0
        public override void OnEnable()
        {
            if (this.IsEditingPlatformSettingsSupported())
            {
                IPluginImporterExtension[] additionalExtensions = this.additionalExtensions;
                for (int i = 0; i < additionalExtensions.Length; i++)
                {
                    IPluginImporterExtension pluginImporterExtension = additionalExtensions[i];
                    pluginImporterExtension.OnEnable(this);
                }
                foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets())
                {
                    IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current);
                    if (pluginImporterExtension2 != null)
                    {
                        pluginImporterExtension2.OnEnable(this);
                        pluginImporterExtension2.ResetValues(this);
                    }
                }
                this.m_PluginInformation         = new Dictionary <string, string>();
                this.m_PluginInformation["Path"] = this.importer.assetPath;
                this.m_PluginInformation["Type"] = ((!this.importer.isNativePlugin) ? "Managed" : "Native");
                if (!this.importer.isNativePlugin)
                {
                    string value;
                    switch (this.importer.dllType)
                    {
                    case DllType.UnknownManaged:
                        value = "Targets Unknown .NET";
                        break;

                    case DllType.ManagedNET35:
                        value = "Targets .NET 3.5";
                        break;

                    case DllType.ManagedNET40:
                        value = "Targets .NET 4.x";
                        break;

                    case DllType.WinMDNative:
                        value = "Native WinMD";
                        break;

                    case DllType.WinMDNET40:
                        value = "Managed WinMD";
                        break;

                    default:
                        throw new Exception("Unknown managed dll type: " + this.importer.dllType.ToString());
                    }
                    this.m_PluginInformation["Assembly Info"] = value;
                }
                this.m_ReferencesUnityEngineModule = this.importer.HasDiscouragedReferences();
            }
        }
Beispiel #20
0
 internal override void Apply()
 {
     base.Apply();
     PluginImporter[] importers = this.importers;
     for (int i = 0; i < importers.Length; i++)
     {
         PluginImporter pluginImporter = importers[i];
         if (this.m_CompatibleWithAnyPlatform > PluginImporterInspector.Compatibility.Mixed)
         {
             pluginImporter.SetCompatibleWithAnyPlatform(this.m_CompatibleWithAnyPlatform == PluginImporterInspector.Compatibility.Compatible);
         }
         if (this.m_CompatibleWithEditor > PluginImporterInspector.Compatibility.Mixed)
         {
             pluginImporter.SetCompatibleWithEditor(this.m_CompatibleWithEditor == PluginImporterInspector.Compatibility.Compatible);
         }
         foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets())
         {
             if (this.m_CompatibleWithPlatform[(int)current] > PluginImporterInspector.Compatibility.Mixed)
             {
                 pluginImporter.SetCompatibleWithPlatform(current, this.m_CompatibleWithPlatform[(int)current] == PluginImporterInspector.Compatibility.Compatible);
             }
         }
         if (this.m_CompatibleWithEditor > PluginImporterInspector.Compatibility.Mixed)
         {
             pluginImporter.SetExcludeEditorFromAnyPlatform(this.m_CompatibleWithEditor == PluginImporterInspector.Compatibility.NotCompatible);
         }
         foreach (BuildTarget current2 in PluginImporterInspector.GetValidBuildTargets())
         {
             if (this.m_CompatibleWithPlatform[(int)current2] > PluginImporterInspector.Compatibility.Mixed)
             {
                 pluginImporter.SetExcludeFromAnyPlatform(current2, this.m_CompatibleWithPlatform[(int)current2] == PluginImporterInspector.Compatibility.NotCompatible);
             }
         }
     }
     if (this.IsEditingPlatformSettingsSupported())
     {
         IPluginImporterExtension[] additionalExtensions = this.additionalExtensions;
         for (int j = 0; j < additionalExtensions.Length; j++)
         {
             IPluginImporterExtension pluginImporterExtension = additionalExtensions[j];
             pluginImporterExtension.Apply(this);
         }
         foreach (BuildTarget current3 in PluginImporterInspector.GetValidBuildTargets())
         {
             IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current3);
             if (pluginImporterExtension2 != null)
             {
                 pluginImporterExtension2.Apply(this);
             }
         }
     }
 }
            internal override void OnGUI(PluginImporterInspector inspector)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(10f);
                EditorGUI.BeginChangeCheck();
                bool enabled = EditorGUILayout.Toggle(this.name, this.IsTargetEnabled(inspector), new GUILayoutOption[0]);

                if (EditorGUI.EndChangeCheck())
                {
                    this.value = !enabled ? (object)DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None : this.defaultValue;
                    inspector.SetCompatibleWithPlatform(this.platformName, enabled);
                }
                EditorGUILayout.EndHorizontal();
            }
Beispiel #22
0
        internal void SetPlatformCompatibility(string platformName, PluginImporterInspector.Compatibility compatibility)
        {
            if (compatibility == PluginImporterInspector.Compatibility.Mixed)
            {
                throw new ArgumentException("compatibility value cannot be Mixed");
            }
            BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName);

            if (PluginImporterInspector.IsValidBuildTarget(buildTargetByName) && this.m_CompatibleWithPlatform[(int)buildTargetByName] != compatibility)
            {
                this.m_CompatibleWithPlatform[(int)buildTargetByName] = compatibility;
                this.m_HasModified = true;
            }
        }
Beispiel #23
0
        public void ValidateSingleCPUTargets(PluginImporterInspector inspector)
        {
            var singleCPUTargets = properties.OfType <DesktopSingleCPUProperty>();

            foreach (var target in singleCPUTargets)
            {
                target.value = target.IsTargetEnabled(inspector) ? target.defaultValue : DesktopPluginCPUArchitecture.None;

                foreach (var importer in inspector.importers)
                {
                    importer.SetPlatformData(target.platformName, "CPU", target.value.ToString());
                }
            }
        }
Beispiel #24
0
            internal override void OnGUI(PluginImporterInspector inspector)
            {
                EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(10f);
                EditorGUI.BeginChangeCheck();
                bool flag = EditorGUILayout.Toggle(base.name, this.IsTargetEnabled(inspector), new GUILayoutOption[0]);

                if (EditorGUI.EndChangeCheck())
                {
                    base.value = ((!flag) ? DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None : base.defaultValue);
                    inspector.SetPlatformCompatibility(base.platformName, flag);
                }
                EditorGUILayout.EndHorizontal();
            }
        private void ValidateUniversalTargets(PluginImporterInspector inspector)
        {
            bool flag  = this.m_LinuxX86.IsTargetEnabled(inspector);
            bool flag2 = this.m_LinuxX86_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture = this.CalculateMultiCPUArchitecture(flag, flag2);
            inspector.importer.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", desktopPluginCPUArchitecture.ToString());
            inspector.SetCompatibleWithPlatform(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneLinuxUniversal), flag || flag2);
            bool flag3 = this.m_OSXX86.IsTargetEnabled(inspector);
            bool flag4 = this.m_OSXX86_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture2 = this.CalculateMultiCPUArchitecture(flag3, flag4);
            inspector.importer.SetPlatformData(BuildTarget.StandaloneOSXUniversal, "CPU", desktopPluginCPUArchitecture2.ToString());
            inspector.SetCompatibleWithPlatform(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneOSXUniversal), flag3 || flag4);
        }
        private void ValidateUniversalTargets(PluginImporterInspector inspector)
        {
            bool x86_1 = this.m_LinuxX86.IsTargetEnabled(inspector);
            bool x64_1 = this.m_LinuxX86_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture multiCpuArchitecture1 = this.CalculateMultiCPUArchitecture(x86_1, x64_1);
            inspector.importer.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", multiCpuArchitecture1.ToString());
            inspector.SetCompatibleWithPlatform(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneLinuxUniversal), x86_1 || x64_1);
            bool x86_2 = this.m_OSXX86.IsTargetEnabled(inspector);
            bool x64_2 = this.m_OSXX86_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture multiCpuArchitecture2 = this.CalculateMultiCPUArchitecture(x86_2, x64_2);
            inspector.importer.SetPlatformData(BuildTarget.StandaloneOSXUniversal, "CPU", multiCpuArchitecture2.ToString());
            inspector.SetCompatibleWithPlatform(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneOSXUniversal), x86_2 || x64_2);
        }
Beispiel #27
0
        internal PluginImporterInspector.Compatibility GetPlatformCompatibility(string platformName)
        {
            BuildTarget buildTargetByName = BuildPipeline.GetBuildTargetByName(platformName);

            PluginImporterInspector.Compatibility result;
            if (!PluginImporterInspector.IsValidBuildTarget(buildTargetByName))
            {
                result = PluginImporterInspector.Compatibility.NotCompatible;
            }
            else
            {
                result = this.m_CompatibleWithPlatform[(int)buildTargetByName];
            }
            return(result);
        }
Beispiel #28
0
 internal override void ResetValues()
 {
     base.ResetValues();
     this.m_HasModified = false;
     this.ResetCompatability(ref this.m_CompatibleWithAnyPlatform, (PluginImporter imp) => imp.GetCompatibleWithAnyPlatform());
     this.ResetCompatability(ref this.m_CompatibleWithEditor, (PluginImporter imp) => imp.GetCompatibleWithEditor());
     if (this.m_CompatibleWithAnyPlatform < PluginImporterInspector.Compatibility.Compatible)
     {
         this.ResetCompatability(ref this.m_CompatibleWithEditor, (PluginImporter imp) => imp.GetCompatibleWithEditor("", ""));
         using (List <BuildTarget> .Enumerator enumerator = PluginImporterInspector.GetValidBuildTargets().GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 BuildTarget platform = enumerator.Current;
                 this.ResetCompatability(ref this.m_CompatibleWithPlatform[(int)platform], (PluginImporter imp) => imp.GetCompatibleWithPlatform(platform));
             }
         }
     }
     else
     {
         this.ResetCompatability(ref this.m_CompatibleWithEditor, (PluginImporter imp) => !imp.GetExcludeEditorFromAnyPlatform());
         using (List <BuildTarget> .Enumerator enumerator2 = PluginImporterInspector.GetValidBuildTargets().GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 BuildTarget platform = enumerator2.Current;
                 this.ResetCompatability(ref this.m_CompatibleWithPlatform[(int)platform], (PluginImporter imp) => !imp.GetExcludeFromAnyPlatform(platform));
             }
         }
     }
     if (this.IsEditingPlatformSettingsSupported())
     {
         IPluginImporterExtension[] additionalExtensions = this.additionalExtensions;
         for (int i = 0; i < additionalExtensions.Length; i++)
         {
             IPluginImporterExtension pluginImporterExtension = additionalExtensions[i];
             pluginImporterExtension.ResetValues(this);
         }
         foreach (BuildTarget current in PluginImporterInspector.GetValidBuildTargets())
         {
             IPluginImporterExtension pluginImporterExtension2 = ModuleManager.GetPluginImporterExtension(current);
             if (pluginImporterExtension2 != null)
             {
                 pluginImporterExtension2.ResetValues(this);
             }
         }
     }
 }
            internal bool IsTargetEnabled(PluginImporterInspector inspector)
            {
                PluginImporterInspector.Compatibility compatibililty = inspector.GetPlatformCompatibility(platformName);
                if (compatibililty == PluginImporterInspector.Compatibility.Mixed)
                {
                    throw new Exception("Unexpected mixed value for '" + inspector.importer.assetPath + "', platform: " + platformName);
                }
                if (compatibililty != PluginImporterInspector.Compatibility.Compatible)
                {
                    return(false);
                }

                var pluginCPU = value as DesktopPluginCPUArchitecture ? ?? DesktopPluginCPUArchitecture.None;

                return(pluginCPU == (DesktopPluginCPUArchitecture)defaultValue || pluginCPU == DesktopPluginCPUArchitecture.AnyCPU);
            }
Beispiel #30
0
        public override void OnPlatformSettingsGUI(PluginImporterInspector inspector)
        {
            EditorGUI.BeginChangeCheck();

            editorOSProperty.OnGUI(inspector);
            editorCPUProperty.OnGUI(inspector);

            if (EditorGUI.EndChangeCheck())
            {
                if (!CanSelectArch(editorCPUProperty.value as Enum))
                {
                    editorCPUProperty.value = EditorPluginCPUArchitecture.AnyCPU;
                }

                hasModified = true;
            }
        }
Beispiel #31
0
        private static List <BuildTarget> GetValidBuildTargets()
        {
            List <BuildTarget> buildTargetList = new List <BuildTarget>();

            using (List <Enum> .Enumerator enumerator = typeof(BuildTarget).EnumGetNonObsoleteValues().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    BuildTarget current = (BuildTarget)enumerator.Current;
                    if (!PluginImporterInspector.IgnorePlatform(current) && (!ModuleManager.IsPlatformSupported(current) || ModuleManager.IsPlatformSupportLoaded(ModuleManager.GetTargetStringFromBuildTarget(current)) || PluginImporterInspector.IsStandaloneTarget(current)))
                    {
                        buildTargetList.Add(current);
                    }
                }
            }
            return(buildTargetList);
        }
Beispiel #32
0
            internal override void OnGUI(PluginImporterInspector inspector)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(10);
                EditorGUI.BeginChangeCheck();

                int selectedIndex = GetArchitectureIndex(GetCurrentArchitecture(inspector));

                selectedIndex = EditorGUILayout.Popup(name, selectedIndex, m_SupportedArchitectureNames);

                if (EditorGUI.EndChangeCheck())
                {
                    value = m_SupportedArchitectures[selectedIndex];
                    inspector.SetPlatformCompatibility(platformName, m_SupportedArchitectures[selectedIndex] != DesktopPluginCPUArchitecture.None);
                }
                EditorGUILayout.EndHorizontal();
            }
 internal override void OnGUI(PluginImporterInspector inspector)
 {
     bool flag = false;
     EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins, new GUILayoutOption[0]);
     GUILayout.Label("Framework dependencies", EditorStyles.boldLabel, new GUILayoutOption[0]);
     EditorGUI.BeginChangeCheck();
     foreach (KeyValuePair<string, bool> pair in this.m_isFrequentEnabled)
     {
         this.m_isFrequentEnabled[pair.Key] = GUILayout.Toggle(pair.Value, pair.Key, new GUILayoutOption[0]);
     }
     if (EditorGUI.EndChangeCheck())
     {
         flag = true;
     }
     this.m_isDefaultVisible = EditorGUILayout.Foldout(this.m_isDefaultVisible, this.GetDefaultFrameworksLabel(), true);
     if (this.m_isDefaultVisible)
     {
         EditorGUI.indentLevel++;
         using (new EditorGUI.DisabledScope(true))
         {
             foreach (string str in this.m_defaultFrameworks)
             {
                 GUILayout.Toggle(true, str, new GUILayoutOption[0]);
             }
         }
         EditorGUI.indentLevel--;
     }
     this.m_isRareVisible = EditorGUILayout.Foldout(this.m_isRareVisible, this.GetRareFrameworksLabel(), true);
     if (this.m_isRareVisible)
     {
         EditorGUI.indentLevel++;
         EditorGUI.BeginChangeCheck();
         foreach (KeyValuePair<string, bool> pair2 in this.m_isRareEnabled)
         {
             this.m_isRareEnabled[pair2.Key] = GUILayout.Toggle(pair2.Value, pair2.Key, new GUILayoutOption[0]);
         }
         if (EditorGUI.EndChangeCheck())
         {
             flag = true;
         }
         EditorGUI.indentLevel--;
     }
     GUILayout.EndVertical();
     this.UpdateValue();
     GUI.changed = flag;
 }
 public override void OnPlatformSettingsGUI(PluginImporterInspector inspector)
 {
     if (!base.propertiesRefreshed)
     {
         this.RefreshProperties(inspector);
     }
     EditorGUI.BeginChangeCheck();
     foreach (DefaultPluginImporterExtension.Property property in base.properties)
     {
         if ((property.key != cpuTag) || (Path.GetExtension(inspector.importer.assetPath) == ".so"))
         {
             property.OnGUI(inspector);
         }
     }
     if (EditorGUI.EndChangeCheck())
     {
         base.hasModified = true;
     }
 }
 internal override void OnGUI(PluginImporterInspector inspector)
 {
     if (!((PluginImporter) inspector.target).isNativePlugin)
     {
         this.selectedIndex = EditorGUILayout.Popup(base.name, this.selectedIndex, this.placeHolders, new GUILayoutOption[0]);
         if ((this.selectedIndex >= 0) && (this.selectedIndex < this.placeHolders.Length))
         {
             string text = this.placeHolders[this.selectedIndex].text;
             if (text == "(none)")
             {
                 this.selectedIndex = -1;
                 text = "";
             }
             base.value = text;
         }
         else
         {
             base.value = "";
         }
     }
 }
 internal override void Reset(PluginImporterInspector inspector)
 {
     base.Reset(inspector);
     string platformData = inspector.importer.GetPlatformData(base.platformName, base.key);
     this.ResetValues();
     char[] separator = new char[] { ';' };
     string[] strArray = platformData.Split(separator);
     foreach (string str2 in strArray)
     {
         if (this.m_isFrequentEnabled.ContainsKey(str2))
         {
             this.m_isFrequentEnabled[str2] = true;
         }
         else if (this.m_isRareEnabled.ContainsKey(str2))
         {
             this.m_isRareEnabled[str2] = true;
         }
         else if (str2 != "")
         {
             this.m_userFrameworks.Add(str2);
         }
     }
 }
 public void ValidateSingleCPUTargets(PluginImporterInspector inspector)
 {
   DesktopPluginImporterExtension.DesktopSingleCPUProperty[] singleCpuPropertyArray = new DesktopPluginImporterExtension.DesktopSingleCPUProperty[6]{ this.m_WindowsX86, this.m_WindowsX86_X64, this.m_LinuxX86, this.m_LinuxX86_X64, this.m_OSXX86, this.m_OSXX86_X64 };
   foreach (DesktopPluginImporterExtension.DesktopSingleCPUProperty singleCpuProperty in singleCpuPropertyArray)
   {
     string str = !singleCpuProperty.IsTargetEnabled(inspector) ? DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None.ToString() : singleCpuProperty.defaultValue.ToString();
     inspector.importer.SetPlatformData(singleCpuProperty.platformName, "CPU", str);
   }
   this.ValidateUniversalTargets(inspector);
 }
 private void ValidateUniversalTargets(PluginImporterInspector inspector)
 {
   bool x86_1 = this.m_LinuxX86.IsTargetEnabled(inspector);
   bool x64_1 = this.m_LinuxX86_X64.IsTargetEnabled(inspector);
   DesktopPluginImporterExtension.DesktopPluginCPUArchitecture multiCpuArchitecture1 = this.CalculateMultiCPUArchitecture(x86_1, x64_1);
   inspector.importer.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", multiCpuArchitecture1.ToString());
   inspector.SetCompatibleWithPlatform(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneLinuxUniversal), x86_1 || x64_1);
   bool x86_2 = this.m_OSXX86.IsTargetEnabled(inspector);
   bool x64_2 = this.m_OSXX86_X64.IsTargetEnabled(inspector);
   DesktopPluginImporterExtension.DesktopPluginCPUArchitecture multiCpuArchitecture2 = this.CalculateMultiCPUArchitecture(x86_2, x64_2);
   inspector.importer.SetPlatformData(BuildTarget.StandaloneOSXUniversal, "CPU", multiCpuArchitecture2.ToString());
   inspector.SetCompatibleWithPlatform(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneOSXUniversal), x86_2 || x64_2);
 }
 internal bool IsTargetEnabled(PluginImporterInspector inspector)
 {
   return inspector.GetCompatibleWithPlatform(this.platformName);
 }
 internal override void OnGUI(PluginImporterInspector inspector)
 {
   EditorGUILayout.BeginHorizontal();
   GUILayout.Space(10f);
   EditorGUI.BeginChangeCheck();
   bool enabled = EditorGUILayout.Toggle(this.name, this.IsTargetEnabled(inspector), new GUILayoutOption[0]);
   if (EditorGUI.EndChangeCheck())
   {
     this.value = !enabled ? (object) DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None : this.defaultValue;
     inspector.SetCompatibleWithPlatform(this.platformName, enabled);
   }
   EditorGUILayout.EndHorizontal();
 }
 private void ResetCompatability(ref int value, PluginImporterInspector.GetComptability getComptability)
 {
   value = !getComptability(this.importer) ? 0 : 1;
   foreach (PluginImporter importer in this.importers)
   {
     if (value != (!getComptability(importer) ? 0 : 1))
     {
       value = -1;
       break;
     }
   }
 }
 internal override void OnGUI(PluginImporterInspector inspector)
 {
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(10f);
     EditorGUI.BeginChangeCheck();
     bool compatible = EditorGUILayout.Toggle(base.name, this.IsTargetEnabled(inspector), new GUILayoutOption[0]);
     if (EditorGUI.EndChangeCheck())
     {
         base.value = !compatible ? DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None : base.defaultValue;
         inspector.SetPlatformCompatibility(base.platformName, compatible);
     }
     EditorGUILayout.EndHorizontal();
 }
 internal bool IsTargetEnabled(PluginImporterInspector inspector)
 {
     PluginImporterInspector.Compatibility platformCompatibility = inspector.GetPlatformCompatibility(base.platformName);
     if (platformCompatibility == PluginImporterInspector.Compatibility.Mixed)
     {
         throw new Exception("Unexpected mixed value for '" + inspector.importer.assetPath + "', platform: " + base.platformName);
     }
     return (platformCompatibility == PluginImporterInspector.Compatibility.Compatible);
 }
 private void ValidateUniversalTargets(PluginImporterInspector inspector)
 {
     bool flag = this.m_LinuxX86.IsTargetEnabled(inspector);
     bool flag2 = this.m_LinuxX86_X64.IsTargetEnabled(inspector);
     DesktopPluginCPUArchitecture architecture = this.CalculateMultiCPUArchitecture(flag, flag2);
     foreach (PluginImporter importer in inspector.importers)
     {
         importer.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", architecture.ToString());
     }
     inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneLinuxUniversal), flag || flag2);
     bool flag3 = this.m_OSXX86.IsTargetEnabled(inspector);
     bool flag4 = this.m_OSXX86_X64.IsTargetEnabled(inspector);
     DesktopPluginCPUArchitecture architecture2 = this.CalculateMultiCPUArchitecture(flag3, flag4);
     foreach (PluginImporter importer2 in inspector.importers)
     {
         importer2.SetPlatformData(BuildTarget.StandaloneOSXUniversal, "CPU", architecture2.ToString());
     }
     inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneOSXUniversal), flag3 || flag4);
 }
 internal override void Reset(PluginImporterInspector inspector)
 {
     base.Reset(inspector);
     this._placeHolders = null;
     this.ResolveIndex();
 }
 public void ValidateSingleCPUTargets(PluginImporterInspector inspector)
 {
     DesktopSingleCPUProperty[] propertyArray = new DesktopSingleCPUProperty[] { this.m_WindowsX86, this.m_WindowsX86_X64, this.m_LinuxX86, this.m_LinuxX86_X64, this.m_OSXX86, this.m_OSXX86_X64 };
     foreach (DesktopSingleCPUProperty property in propertyArray)
     {
         string str = !property.IsTargetEnabled(inspector) ? 0.ToString() : property.defaultValue.ToString();
         foreach (PluginImporter importer in inspector.importers)
         {
             importer.SetPlatformData(property.platformName, "CPU", str);
         }
     }
     this.ValidateUniversalTargets(inspector);
 }
		public override void OnPlatformSettingsGUI(PluginImporterInspector inspector)
		{
			PluginImporter importer = inspector.importer;
			EditorGUI.BeginChangeCheck();
			if (this.IsUsableOnWindows(importer))
			{
				EditorGUILayout.LabelField(EditorGUIUtility.TextContent("BuildSettings.StandaloneWindows"), EditorStyles.boldLabel, new GUILayoutOption[0]);
				this.m_WindowsX86.OnGUI(inspector);
				this.m_WindowsX86_X64.OnGUI(inspector);
				EditorGUILayout.Space();
			}
			if (this.IsUsableOnLinux(importer))
			{
				EditorGUILayout.LabelField(EditorGUIUtility.TextContent("BuildSettings.StandaloneLinux"), EditorStyles.boldLabel, new GUILayoutOption[0]);
				this.m_LinuxX86.OnGUI(inspector);
				this.m_LinuxX86_X64.OnGUI(inspector);
				EditorGUILayout.Space();
			}
			if (this.IsUsableOnOSX(importer))
			{
				EditorGUILayout.LabelField(EditorGUIUtility.TextContent("BuildSettings.StandaloneOSXIntel"), EditorStyles.boldLabel, new GUILayoutOption[0]);
				this.m_OSXX86.OnGUI(inspector);
				this.m_OSXX86_X64.OnGUI(inspector);
			}
			if (EditorGUI.EndChangeCheck())
			{
				inspector.importer.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", this.CalculateMultiCPUArchitecture(this.m_LinuxX86.isCpuTargetEnabled, this.m_LinuxX86_X64.isCpuTargetEnabled).ToString());
				inspector.importer.SetPlatformData(BuildTarget.StandaloneOSXUniversal, "CPU", this.CalculateMultiCPUArchitecture(this.m_OSXX86.isCpuTargetEnabled, this.m_OSXX86_X64.isCpuTargetEnabled).ToString());
				this.hasModified = true;
			}
		}