示例#1
0
        private void DrawLaunchScreenGUI(LaunchScreenProperties properties, UnityEditor.iOS.DeviceType device)
        {
            PlayerSettingsEditor.BuildEnumPopup <iOSLaunchScreenType>(properties.type, EditorGUIUtility.TextContent("Launch screen type"), kLaunchScreenTypeOrder, kLaunchScreenUIDescriptions);
            iOSLaunchScreenType intValue = (iOSLaunchScreenType)properties.type.intValue;

            switch (intValue)
            {
            case iOSLaunchScreenType.ImageAndBackgroundRelative:
            case iOSLaunchScreenType.ImageAndBackgroundConstant:
                if (device == UnityEditor.iOS.DeviceType.iPhone)
                {
                    SettingsUI.Texture2DField(properties.portraitImage, EditorGUIUtility.TextContent("Portrait Image | Use only advanced type textures"));
                    SettingsUI.Texture2DField(properties.landscapeImage, EditorGUIUtility.TextContent("Landscape Image | Use only advanced type textures"));
                }
                if (device == UnityEditor.iOS.DeviceType.iPad)
                {
                    SettingsUI.Texture2DField(properties.portraitAndLandscapeImage, EditorGUIUtility.TextContent("Image | Use only advanced type textures"));
                }
                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(properties.backgroundColor, EditorGUIUtility.TextContent("Background Color"), new GUILayoutOption[0]);
                if (intValue == iOSLaunchScreenType.ImageAndBackgroundConstant)
                {
                    GUIContent label = null;
                    if (device == UnityEditor.iOS.DeviceType.iPad)
                    {
                        label = EditorGUIUtility.TextContent("Size in points | Vertical in both portrait and landscape");
                    }
                    else
                    {
                        label = EditorGUIUtility.TextContent("Size in points | Horizontal in portrait, vertical in landscape");
                    }
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(properties.size, label, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck() && (properties.size.floatValue < 0f))
                    {
                        properties.size.floatValue = 0f;
                    }
                }
                else
                {
                    GUIContent content2 = null;
                    if (device == UnityEditor.iOS.DeviceType.iPad)
                    {
                        content2 = EditorGUIUtility.TextContent("Fill percentage | Vertical in both portrait and landscape");
                    }
                    else
                    {
                        content2 = EditorGUIUtility.TextContent("Fill percentage | Horizontal in portrait, vertical in landscape");
                    }
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(properties.fillPercentage, content2, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (properties.fillPercentage.floatValue < 1f)
                        {
                            properties.fillPercentage.floatValue = 1f;
                        }
                        else if (properties.fillPercentage.floatValue > 100f)
                        {
                            properties.fillPercentage.floatValue = 100f;
                        }
                    }
                }
                break;

            default:
                if (intValue == iOSLaunchScreenType.CustomXib)
                {
                    PlayerSettingsEditor.BuildFileBoxButton(properties.customXibPath, LocalizationDatabase.GetLocalizedString("Custom Xib"), Application.dataPath, "xib", null);
                }
                break;
            }
        }
示例#2
0
        internal static string UpdateStringForBackgroundConstant(string contents, XibWithBackgroundData data, UnityEditor.iOS.DeviceType device)
        {
            bool      flag = true;
            XDocument doc  = PlistDocument.ParseXmlNoDtd(contents);

            flag &= UpdateLaunchScreenAllImageSizes(doc.Root, data, device);
            XElement parentEl = doc.Root.XPathSelectElement("./objects/view[@id='iN0-l3-epB']");

            if (parentEl == null)
            {
                flag = false;
            }
            else
            {
                flag &= SetBackgroundColorElement(parentEl, data.background);
                if (device == UnityEditor.iOS.DeviceType.iPhone)
                {
                    XElement el = parentEl.XPathSelectElement("./subviews/view[@id='eQG-9T-8bq']/constraints/constraint[@id='rU5-7V-ukh']");
                    flag &= SetConstantForConstraint(el, data.iPhonePortraitHorizontalSize);
                    el    = parentEl.XPathSelectElement("./subviews/view[@id='gVh-4A-1je']/constraints/constraint[@id='NjH-A4-Wg3']");
                    flag &= SetConstantForConstraint(el, data.iPhoneLandscapeVerticalSize);
                }
                if (device == UnityEditor.iOS.DeviceType.iPad)
                {
                    XElement element3 = parentEl.XPathSelectElement("./subviews/view[@id='7bp-Iv-3mp']/constraints/constraint[@id='0Cy-oZ-PWZ']");
                    flag &= SetConstantForConstraint(element3, data.iPadVerticalSize);
                }
            }
            if (!flag)
            {
                Debug.Log("Launch screen XIB file is malformed");
            }
            return(PlistDocument.CleanDtdToString(doc));
        }
示例#3
0
        internal static string UpdateStringForBackgroundRelative(string contents, XibWithBackgroundData data, UnityEditor.iOS.DeviceType device)
        {
            bool      flag = true;
            XDocument doc  = PlistDocument.ParseXmlNoDtd(contents);

            flag &= UpdateLaunchScreenAllImageSizes(doc.Root, data, device);
            XElement parentEl = doc.Root.XPathSelectElement("./objects/view[@id='iN0-l3-epB']");

            if (parentEl == null)
            {
                flag = false;
            }
            else
            {
                flag &= SetBackgroundColorElement(parentEl, data.background);
                if (device == UnityEditor.iOS.DeviceType.iPhone)
                {
                    XElement first    = parentEl.XPathSelectElement("./constraints/constraint[@id='VWh-bq-Pfv']");
                    XElement second   = parentEl.XPathSelectElement("./constraints/constraint[@id='S6m-R2-QBg']");
                    XElement element4 = parentEl.XPathSelectElement("./constraints/constraint[@id='e2k-A9-5oM']");
                    XElement element5 = parentEl.XPathSelectElement("./constraints/constraint[@id='omh-z1-Che']");
                    flag &= SetRelativeSizeConstraints(data.iPhoneLandscapeRelativeVerticalSize, first, second, true);
                    flag &= SetRelativeSizeConstraints(data.iPhonePortraitRelativeHorizontalSize, element4, element5, false);
                }
                if (device == UnityEditor.iOS.DeviceType.iPad)
                {
                    XElement element6 = parentEl.XPathSelectElement("./constraints/constraint[@id='wWy-Vq-I9X']");
                    XElement element7 = parentEl.XPathSelectElement("./constraints/constraint[@id='FGm-8j-iPJ']");
                    flag &= SetRelativeSizeConstraints(data.iPadRelativeVerticalSize, element6, element7, true);
                }
            }
            if (!flag)
            {
                Debug.Log("Launch screen XIB file is malformed");
            }
            return(PlistDocument.CleanDtdToString(doc));
        }
示例#4
0
        private static bool UpdateLaunchScreenAllImageSizes(XElement rootEl, XibWithBackgroundData data, UnityEditor.iOS.DeviceType device)
        {
            bool flag = true;

            if (device == UnityEditor.iOS.DeviceType.iPhone)
            {
                XElement el = rootEl.XPathSelectElement("./resources/image[@name='LaunchScreen-iPhonePortrait.png']");
                flag &= SetImageSize(el, data.iPhonePortraitWidth, data.iPhonePortraitHeight);
                el    = rootEl.XPathSelectElement("./resources/image[@name='LaunchScreen-iPhoneLandscape.png']");
                flag &= SetImageSize(el, data.iPhoneLandscapeWidth, data.iPhoneLandscapeHeight);
            }
            if (device == UnityEditor.iOS.DeviceType.iPad)
            {
                XElement element2 = rootEl.XPathSelectElement("./resources/image[@name='LaunchScreen-iPad.png']");
                flag &= SetImageSize(element2, data.iPadWidth, data.iPadHeight);
            }
            return(flag);
        }