Esempio n. 1
0
        private void DrawIcon()
        {
            var       totalIcons = PlayerSettings.GetIconsForTargetGroup(BuildTargetGroup.Unknown);
            Texture2D icon       = totalIcons.FirstOrDefault();

            EditorGUI.BeginChangeCheck();

            var newIcon = EditorGUIExtensions.TextureField("Default Icon", icon);

            if (EditorGUI.EndChangeCheck())
            {
                if (totalIcons.Length <= 0)
                {
                    totalIcons = new Texture2D[] { newIcon };
                }
                else
                {
                    totalIcons[0] = newIcon;
                }

                PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown, totalIcons);
            }

            if (_settings.SelectedPreferences.icon.Required && newIcon == null)
            {
                EditorGUILayout.HelpBox("App has no icon.", MessageType.Warning);
            }
        }
Esempio n. 2
0
        private void DrawScriptingBackend(BuildTargetGroup buildTargetGroup)
        {
            EditorGUI.BeginChangeCheck();

            var value = (ScriptingImplementation)EditorGUILayout.EnumPopup("Scripting Backend", PlayerSettings.GetScriptingBackend(buildTargetGroup));

            if (EditorGUI.EndChangeCheck())
            {
                PlayerSettings.SetScriptingBackend(buildTargetGroup, value);
            }

            ScriptingImplementation prefSI;

            switch (buildTargetGroup)
            {
            case BuildTargetGroup.Android:
                prefSI = _settings.SelectedPreferences.android.scriptingImplementation;
                break;

            case BuildTargetGroup.iOS:
                prefSI = _settings.SelectedPreferences.iOS.scriptingImplementation;
                break;

            default:
                return;
            }

            if (value != prefSI && EditorGUIExtensions.DrawFixHelpBox($"Incorrect scripting backend on {buildTargetGroup.ToString()}"))
            {
                PlayerSettings.SetScriptingBackend(buildTargetGroup, prefSI);
            }
        }
Esempio n. 3
0
        private void DrawIOSPreferences()
        {
            EditorGUIExtensions.DrawHeader("iOS");

            DrawScriptingImplementationIOS();
            DrawAppleTeamId();
            DrawAutomaticallySign();
        }
Esempio n. 4
0
        private void DrawPlatformButtons()
        {
            EditorGUIExtensions.DrawHeader("Platform settings");

            GUILayout.BeginHorizontal();

            DrawPlatformButton(BuildTarget.Android);
            DrawPlatformButton(BuildTarget.iOS);

            GUILayout.EndHorizontal();
        }
Esempio n. 5
0
        private void DrawAndroidPreferences()
        {
            EditorGUIExtensions.DrawHeader("Android");

            DrawMinAPIVersion();
            DrawTargetAPIVersion();
            DrawArchitecturesAndroid();
            DrawScriptingImplementationAndroid();
            DrawSplitAPKs();
            DrawManifestIsDebuggable();
        }
Esempio n. 6
0
        private void DrawManifestInfo()
        {
            EditorGUIExtensions.DrawHeader("Android Manifest Settings");

            if (ManifestUtility.HasManifest())
            {
                DrawIsDebuggable();
            }
            else
            {
                EditorGUILayout.HelpBox("AndroidManifest.xml doesn't exist.", MessageType.Warning);
            }
        }
Esempio n. 7
0
 private void DrawSharedSettings()
 {
     EditorGUIExtensions.DrawHeader("Application");
     DrawProWarning();
     DrawAppName();
     DrawCompany();
     DrawVersion();
     DrawIcon();
     EditorGUIExtensions.DrawHeader("Splash screen");
     DrawSplashLogos();
     DrawSplashBackgroundColor();
     EditorGUIExtensions.DrawHeader("Orientation");
     DrawOrientationMode();
 }
Esempio n. 8
0
        private void DrawSDKs()
        {
            for (int i = 0; i < _target.SDKs.Count; i++)
            {
                var sdk = _target.SDKs[i];

                EditorGUI.BeginChangeCheck();

                bool removed;

                EditorGUILayout.BeginHorizontal();

                var newSDK = (SDKBuildPreferences)EditorGUILayout.ObjectField(sdk, typeof(SDKBuildPreferences), false);

                removed = GUILayout.Button("Remove");

                EditorGUILayout.EndHorizontal();

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(_target, "Edited Build Preferences");

                    _target.SDKs[i] = newSDK;
                }

                if (removed)
                {
                    Undo.RecordObject(_target, "Edited Build Preferences");

                    _target.SDKs.RemoveAt(i);
                    i--;
                    continue;
                }

                if (newSDK)
                {
                    EditorGUIExtensions.DrawHeader(newSDK.ItemName);
                    newSDK.DrawPreferences();
                }
            }

            if (GUILayout.Button("Add SDK"))
            {
                Undo.RecordObject(_target, "Edited Build Preferences");

                _target.SDKs.Add(null);
            }
        }
Esempio n. 9
0
        private void DrawSplashLogos()
        {
            var logos = _target.splash.logos;

            for (int i = 0; i < logos.Count; i++)
            {
                var logo = logos[i];

                EditorGUILayout.BeginHorizontal();

                EditorGUI.BeginChangeCheck();

                var newLogo = EditorGUIExtensions.SpriteField($"Logo {i}", logo);

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(_target, "Edited Build Preferences");

                    logos[i] = newLogo;
                }

                if (!newLogo)
                {
                    EditorGUILayout.HelpBox("Logo is null", MessageType.Warning);
                }

                if (GUILayout.Button("Remove"))
                {
                    Undo.RecordObject(_target, "Edited Build Preferences");

                    logos.RemoveAt(i--);
                }

                EditorGUILayout.EndHorizontal();
            }

            if (GUILayout.Button("Add logo"))
            {
                Undo.RecordObject(_target, "Edited Build Preferences");

                logos.Add(null);
            }

            if ((logos == null || logos.Count <= 0))
            {
                EditorGUILayout.HelpBox("No logos defined.", MessageType.Warning);
            }
        }
Esempio n. 10
0
        private void DrawTargetSDK()
        {
            EditorGUI.BeginChangeCheck();

            var code = EditorGUILayout.IntSlider("Target SDK Version", (int)PlayerSettings.Android.targetSdkVersion, 16, 30);

            if (EditorGUI.EndChangeCheck())
            {
                PlayerSettings.Android.targetSdkVersion = (AndroidSdkVersions)code;
            }

            if (code != _settings.SelectedPreferences.android.targetApiVersionInt && EditorGUIExtensions.DrawFixHelpBox("Mismatching target API version"))
            {
                PlayerSettings.Android.targetSdkVersion = (AndroidSdkVersions)_settings.SelectedPreferences.android.targetApiVersionInt;
            }
        }
Esempio n. 11
0
        private void DrawIsDebuggable()
        {
            EditorGUI.BeginChangeCheck();

            var debuggable = EditorGUILayout.Toggle("Is debuggable", ManifestUtility.IsDebuggable());

            if (EditorGUI.EndChangeCheck())
            {
                ManifestUtility.SetDebuggableValue(debuggable);
            }

            if (_settings.SelectedPreferences.android.manifestPreferences.debuggable != debuggable &&
                EditorGUIExtensions.DrawFixHelpBox("Is debuggable is incorrect"))
            {
                ManifestUtility.SetDebuggableValue(_settings.SelectedPreferences.android.manifestPreferences.debuggable);
            }
        }
Esempio n. 12
0
        private void DrawSDKsSettings()
        {
            foreach (var sdk in _settings.SelectedPreferences.SDKs)
            {
                if (sdk != null)
                {
                    EditorGUIExtensions.DrawHeader(sdk.ItemName);

                    sdk.DrawComparsion();

                    if (sdk.HasInternalSettings && GUILayout.Button("Open SDK settings"))
                    {
                        sdk.OpenInternalSettings();
                    }
                }
            }
        }
Esempio n. 13
0
        private void DrawSigningTeamId()
        {
            EditorGUI.BeginChangeCheck();

            var id = EditorGUILayout.TextField("Developer Team Id", PlayerSettings.iOS.appleDeveloperTeamID);

            if (EditorGUI.EndChangeCheck())
            {
                PlayerSettings.iOS.appleDeveloperTeamID = id;
            }

            if (_settings.SelectedPreferences.iOS.signingTeamId != id &&
                EditorGUIExtensions.DrawFixHelpBox("Incorrect team ID"))
            {
                PlayerSettings.iOS.appleDeveloperTeamID = _settings.SelectedPreferences.iOS.signingTeamId;
            }
        }
Esempio n. 14
0
        private void DrawAutomaticallySign()
        {
            EditorGUI.BeginChangeCheck();

            var value = EditorGUILayout.Toggle("Automatically Sign", PlayerSettings.iOS.appleEnableAutomaticSigning);

            if (EditorGUI.EndChangeCheck())
            {
                PlayerSettings.iOS.appleEnableAutomaticSigning = value;
            }

            if (_settings.SelectedPreferences.iOS.automaticallySign != value &&
                EditorGUIExtensions.DrawFixHelpBox("Automatically sign value is incorrect"))
            {
                PlayerSettings.iOS.appleEnableAutomaticSigning = _settings.SelectedPreferences.iOS.automaticallySign;
            }
        }
Esempio n. 15
0
        private void DrawSplashBackgroundColor()
        {
            EditorGUI.BeginChangeCheck();

            var newColor = EditorGUILayout.ColorField("Splash Screen Background Color", PlayerSettings.SplashScreen.backgroundColor);

            if (EditorGUI.EndChangeCheck())
            {
                PlayerSettings.SplashScreen.backgroundColor = newColor;
            }

            if (_settings.SelectedPreferences.splash.Required &&
                _settings.SelectedPreferences.splash.backgroundColor != PlayerSettings.SplashScreen.backgroundColor &&
                EditorGUIExtensions.DrawFixHelpBox("Incorrect Splash Background Color."))
            {
                PlayerSettings.SplashScreen.backgroundColor = _settings.SelectedPreferences.splash.backgroundColor;
            }
        }
Esempio n. 16
0
        private void DrawCompany()
        {
            EditorGUI.BeginChangeCheck();

            var value = EditorGUILayout.TextField("Company", PlayerSettings.companyName);

            if (EditorGUI.EndChangeCheck())
            {
                PlayerSettings.companyName = value;
            }

            if (_settings.SelectedPreferences.company.Required &&
                _settings.SelectedPreferences.company.name != value &&
                EditorGUIExtensions.DrawFixHelpBox("Company name doesn't match with preferences."))
            {
                PlayerSettings.companyName = _settings.SelectedPreferences.company.name;
            }
        }
Esempio n. 17
0
        private bool DrawRequirable(Requirable requirable)
        {
            EditorGUI.BeginChangeCheck();

            EditorGUIExtensions.DrawHeader(requirable.ItemName);

            var value = EditorGUILayout.Toggle("Required", requirable.Required);

            EditorGUILayout.Space();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(_target, "Edited Build Preferences");

                requirable.Required = value;
            }

            return(value);
        }
Esempio n. 18
0
        private void DrawBuildType()
        {
            EditorGUI.BeginChangeCheck();

            var prefType = (BuildPreferencesType)EditorGUILayout.EnumPopup("Build Type", _settings.selectedPrefType);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(_settings, "Edited Build Preferences");

                _settings.selectedPrefType = prefType;
            }

            if (prefType != BuildPreferencesType.Release && EditorGUIExtensions.DrawFixHelpBox("Selected non-release build type.", "Switch to release"))
            {
                Undo.RecordObject(_settings, "Edited Build Preferences");
                _settings.selectedPrefType = BuildPreferencesType.Release;
            }
        }
Esempio n. 19
0
        private void DrawSplashLogos()
        {
            var logos = PlayerSettings.SplashScreen.logos.ToList();

            for (int i = 0; i < logos.Count; i++)
            {
                var logo = logos[i];

                EditorGUILayout.BeginHorizontal();

                EditorGUI.BeginChangeCheck();

                var newLogo = EditorGUIExtensions.SpriteField($"Logo {i}", logo.logo);

                if (_settings.SelectedPreferences.splash.Required && !_settings.SelectedPreferences.splash.logos.Contains(logo.logo))
                {
                    EditorGUILayout.HelpBox("This logo wasn't expected by preferences.", MessageType.Warning);
                }

                if (EditorGUI.EndChangeCheck())
                {
                    logo.logo = newLogo;

                    logos[i] = logo;

                    PlayerSettings.SplashScreen.logos = logos.ToArray();
                }

                if (GUILayout.Button("Remove"))
                {
                    logos.RemoveAt(i--);

                    PlayerSettings.SplashScreen.logos = logos.ToArray();
                }


                EditorGUILayout.EndHorizontal();
            }

            if (GUILayout.Button("Add logo"))
            {
                logos.Add(new PlayerSettings.SplashScreenLogo());

                PlayerSettings.SplashScreen.logos = logos.ToArray();
            }

            foreach (var prefLogo in _settings.SelectedPreferences.splash.logos)
            {
                if (prefLogo == null)
                {
                    continue;
                }

                bool found = false;

                foreach (var existingLogo in logos)
                {
                    if (existingLogo.logo == prefLogo)
                    {
                        found = true;
                    }
                }

                if (!found)
                {
                    if (_settings.SelectedPreferences.splash.Required && EditorGUIExtensions.DrawFixHelpBox($"Logo {prefLogo.name} wasn't added."))
                    {
                        var newLogo = new PlayerSettings.SplashScreenLogo();

                        newLogo.logo = prefLogo;

                        logos.Add(newLogo);

                        PlayerSettings.SplashScreen.logos = logos.ToArray();
                    }
                }
            }

            if (_settings.SelectedPreferences.splash.Required && (logos == null || logos.Count <= 0))
            {
                EditorGUILayout.HelpBox("App has logos.", MessageType.Warning);
            }
        }
Esempio n. 20
0
 private void DrawOwnSettings()
 {
     EditorGUIExtensions.DrawHeader("Internal");
     DrawBuildType();
     DrawLinkToPreferences();
 }
Esempio n. 21
0
        private void DrawOrientationMode()
        {
            EditorGUI.BeginChangeCheck();

            var orientation = (UIOrientation)EditorGUILayout.EnumPopup("Default orientation", PlayerSettings.defaultInterfaceOrientation);

            if (EditorGUI.EndChangeCheck())
            {
                PlayerSettings.defaultInterfaceOrientation = orientation;
            }

            if (orientation != _settings.SelectedPreferences.deviceOrientation.Orientation &&
                EditorGUIExtensions.DrawFixHelpBox($"Incorrect device orientation. It should be {_settings.SelectedPreferences.deviceOrientation.Orientation}"))
            {
                PlayerSettings.defaultInterfaceOrientation = _settings.SelectedPreferences.deviceOrientation.Orientation;
            }

            if (orientation == UIOrientation.AutoRotation)
            {
                EditorGUI.BeginChangeCheck();
                var leftRot = EditorGUILayout.Toggle("Landscape Left", PlayerSettings.allowedAutorotateToLandscapeLeft);
                if (EditorGUI.EndChangeCheck())
                {
                    PlayerSettings.allowedAutorotateToLandscapeLeft = leftRot;
                }

                if (_settings.SelectedPreferences.deviceOrientation.AutoRotation)
                {
                    if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.LandscapeLeft))
                    {
                        if (PlayerSettings.allowedAutorotateToLandscapeLeft && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable"))
                        {
                            PlayerSettings.allowedAutorotateToLandscapeLeft = false;
                        }
                    }
                    else
                    {
                        if (!PlayerSettings.allowedAutorotateToLandscapeLeft && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable"))
                        {
                            PlayerSettings.allowedAutorotateToLandscapeLeft = true;
                        }
                    }
                }

                EditorGUI.BeginChangeCheck();
                var rightRot = EditorGUILayout.Toggle("Landscape Right", PlayerSettings.allowedAutorotateToLandscapeRight);
                if (EditorGUI.EndChangeCheck())
                {
                    PlayerSettings.allowedAutorotateToLandscapeRight = rightRot;
                }

                if (_settings.SelectedPreferences.deviceOrientation.AutoRotation)
                {
                    if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.LandscapeRight))
                    {
                        if (PlayerSettings.allowedAutorotateToLandscapeRight && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable"))
                        {
                            PlayerSettings.allowedAutorotateToLandscapeRight = false;
                        }
                    }
                    else
                    {
                        if (!PlayerSettings.allowedAutorotateToLandscapeRight && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable"))
                        {
                            PlayerSettings.allowedAutorotateToLandscapeRight = true;
                        }
                    }
                }

                EditorGUI.BeginChangeCheck();
                var portrait = EditorGUILayout.Toggle("Portrait", PlayerSettings.allowedAutorotateToPortrait);
                if (EditorGUI.EndChangeCheck())
                {
                    PlayerSettings.allowedAutorotateToPortrait = portrait;
                }

                if (_settings.SelectedPreferences.deviceOrientation.AutoRotation)
                {
                    if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.Portrait))
                    {
                        if (PlayerSettings.allowedAutorotateToPortrait && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable"))
                        {
                            PlayerSettings.allowedAutorotateToPortrait = false;
                        }
                    }
                    else
                    {
                        if (!PlayerSettings.allowedAutorotateToPortrait && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable"))
                        {
                            PlayerSettings.allowedAutorotateToPortrait = true;
                        }
                    }
                }

                EditorGUI.BeginChangeCheck();
                var portraitUpsideDown = EditorGUILayout.Toggle("Portrait Upside Down", PlayerSettings.allowedAutorotateToPortraitUpsideDown);
                if (EditorGUI.EndChangeCheck())
                {
                    PlayerSettings.allowedAutorotateToPortraitUpsideDown = portraitUpsideDown;
                }

                if (_settings.SelectedPreferences.deviceOrientation.AutoRotation)
                {
                    if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.PortraitUpsideDown))
                    {
                        if (PlayerSettings.allowedAutorotateToPortraitUpsideDown && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable"))
                        {
                            PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
                        }
                    }
                    else
                    {
                        if (!PlayerSettings.allowedAutorotateToPortraitUpsideDown && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable"))
                        {
                            PlayerSettings.allowedAutorotateToPortraitUpsideDown = true;
                        }
                    }
                }
            }
        }