DoLayout() публичный статический Метод

public static DoLayout ( ) : IDisposable
Результат IDisposable
        public void OnGUI()
        {
            var e     = Event.current;
            var close = false;
            var enter = false;

            if (e.type == EventType.KeyDown)
            {
                close = (e.keyCode == KeyCode.Escape);
                enter = ((e.keyCode == KeyCode.Return) || (e.keyCode == KeyCode.KeypadEnter));
            }

            using (HorizontalLayout.DoLayout())
            {
                GUILayout.Space(kSpace * 2);

                using (VerticalLayout.DoLayout())
                {
                    GUILayout.FlexibleSpace();

                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TrTextContent("Password", "Certificate password."), kLabelWidth);
                        GUI.SetNextControlName(kPasswordId);
                        password = GUILayout.PasswordField(password, kPasswordChar);
                    }

                    GUILayout.Space(kSpace * 2);

                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(message, messageStyle);

                        GUILayout.FlexibleSpace();

                        if (GUILayout.Button(EditorGUIUtility.TrTextContent("Ok"), kButtonWidth) || enter)
                        {
                            message = GUIContent.none;

                            try
                            {
                                if (PlayerSettings.WSA.SetCertificate(path, password))
                                {
                                    close = true;
                                }
                                else
                                {
                                    message = EditorGUIUtility.TrTextContent("Invalid password.");
                                }
                            }
                            catch (UnityException ex)
                            {
                                Debug.LogError(ex.Message);
                            }
                        }
                    }

                    GUILayout.FlexibleSpace();
                }

                GUILayout.Space(kSpace * 2);
            }

            if (close)
            {
                Close();
            }
            else if (focus != null)
            {
                EditorGUI.FocusTextInControl(focus);
                focus = null;
            }
        }
Пример #2
0
        public void OnGUI()
        {
            Event current = Event.current;
            bool  flag    = false;
            bool  flag2   = false;

            if (current.type == EventType.KeyDown)
            {
                flag  = (current.keyCode == KeyCode.Escape);
                flag2 = (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter);
            }
            using (HorizontalLayout.DoLayout())
            {
                GUILayout.Space(10f);
                using (VerticalLayout.DoLayout())
                {
                    GUILayout.FlexibleSpace();
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TextContent("Publisher|Publisher of the package."), new GUILayoutOption[]
                        {
                            MetroCreateTestCertificateWindow.kLabelWidth
                        });
                        GUI.SetNextControlName("publisher");
                        this.publisher = GUILayout.TextField(this.publisher, new GUILayoutOption[0]);
                    }
                    GUILayout.Space(5f);
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TextContent("Password|Certificate password."), new GUILayoutOption[]
                        {
                            MetroCreateTestCertificateWindow.kLabelWidth
                        });
                        GUI.SetNextControlName("password");
                        this.password = GUILayout.PasswordField(this.password, '●', new GUILayoutOption[0]);
                    }
                    GUILayout.Space(5f);
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TextContent("Confirm password|Re-enter certificate password."), new GUILayoutOption[]
                        {
                            MetroCreateTestCertificateWindow.kLabelWidth
                        });
                        GUI.SetNextControlName("confirm");
                        this.confirm = GUILayout.PasswordField(this.confirm, '●', new GUILayoutOption[0]);
                    }
                    GUILayout.Space(10f);
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(this.message, this.messageStyle, new GUILayoutOption[0]);
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button(EditorGUIUtility.TextContent("Create"), new GUILayoutOption[]
                        {
                            MetroCreateTestCertificateWindow.kButtonWidth
                        }) || flag2)
                        {
                            this.message = GUIContent.none;
                            if (string.IsNullOrEmpty(this.publisher))
                            {
                                this.message = EditorGUIUtility.TextContent("Publisher must be specified.");
                                this.focus   = "publisher";
                            }
                            else if (this.password != this.confirm)
                            {
                                if (string.IsNullOrEmpty(this.confirm))
                                {
                                    this.message = EditorGUIUtility.TextContent("Confirm the password.");
                                    this.focus   = "confirm";
                                }
                                else
                                {
                                    this.message  = EditorGUIUtility.TextContent("Passwords do not match.");
                                    this.password = string.Empty;
                                    this.confirm  = this.password;
                                    this.focus    = "password";
                                }
                            }
                            else
                            {
                                try
                                {
                                    EditorUtility.WSACreateTestCertificate(this.path, this.publisher, this.password, true);
                                    AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
                                    if (!PlayerSettings.WSA.SetCertificate(FileUtil.GetProjectRelativePath(this.path), this.password))
                                    {
                                        this.message = EditorGUIUtility.TextContent("Invalid password.");
                                    }
                                    flag = true;
                                }
                                catch (UnityException ex)
                                {
                                    Debug.LogError(ex.Message);
                                }
                            }
                        }
                    }
                    GUILayout.FlexibleSpace();
                }
                GUILayout.Space(10f);
            }
            if (flag)
            {
                base.Close();
            }
            else if (this.focus != null)
            {
                EditorGUI.FocusTextInControl(this.focus);
                this.focus = null;
            }
        }
        public void OnGUI()
        {
            Event current = Event.current;
            bool  flag    = false;
            bool  flag2   = false;

            if (current.type == EventType.KeyDown)
            {
                flag  = (current.keyCode == KeyCode.Escape);
                flag2 = (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter);
            }
            using (HorizontalLayout.DoLayout())
            {
                GUILayout.Space(10f);
                using (VerticalLayout.DoLayout())
                {
                    GUILayout.FlexibleSpace();
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TrTextContent("Password", "Certificate password.", null), new GUILayoutOption[]
                        {
                            MetroCertificatePasswordWindow.kLabelWidth
                        });
                        GUI.SetNextControlName("password");
                        this.password = GUILayout.PasswordField(this.password, '●', new GUILayoutOption[0]);
                    }
                    GUILayout.Space(10f);
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(this.message, this.messageStyle, new GUILayoutOption[0]);
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button(EditorGUIUtility.TrTextContent("Ok", null, null), new GUILayoutOption[]
                        {
                            MetroCertificatePasswordWindow.kButtonWidth
                        }) || flag2)
                        {
                            this.message = GUIContent.none;
                            try
                            {
                                if (PlayerSettings.WSA.SetCertificate(this.path, this.password))
                                {
                                    flag = true;
                                }
                                else
                                {
                                    this.message = EditorGUIUtility.TrTextContent("Invalid password.", null, null);
                                }
                            }
                            catch (UnityException ex)
                            {
                                Debug.LogError(ex.Message);
                            }
                        }
                    }
                    GUILayout.FlexibleSpace();
                }
                GUILayout.Space(10f);
            }
            if (flag)
            {
                base.Close();
            }
            else if (this.focus != null)
            {
                EditorGUI.FocusTextInControl(this.focus);
                this.focus = null;
            }
        }
        public void OnGUI()
        {
            var e     = Event.current;
            var close = false;
            var enter = false;

            if (e.type == EventType.KeyDown)
            {
                close = (e.keyCode == KeyCode.Escape);
                enter = ((e.keyCode == KeyCode.Return) || (e.keyCode == KeyCode.KeypadEnter));
            }

            using (HorizontalLayout.DoLayout())
            {
                GUILayout.Space(kSpace * 2);

                using (VerticalLayout.DoLayout())
                {
                    GUILayout.FlexibleSpace();

                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TrTextContent("Publisher", "Publisher of the package."), kLabelWidth);
                        GUI.SetNextControlName(kPublisherId);
                        publisher = GUILayout.TextField(publisher);
                    }

                    GUILayout.Space(kSpace);

                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TrTextContent("Password", "Certificate password."), kLabelWidth);
                        GUI.SetNextControlName(kPasswordId);
                        password = GUILayout.PasswordField(password, kPasswordChar);
                    }

                    GUILayout.Space(kSpace);

                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TrTextContent("Confirm password", "Re-enter certificate password."), kLabelWidth);
                        GUI.SetNextControlName(kConfirmId);
                        confirm = GUILayout.PasswordField(confirm, kPasswordChar);
                    }

                    GUILayout.Space(kSpace * 2);

                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(message, messageStyle);

                        GUILayout.FlexibleSpace();

                        if (GUILayout.Button(EditorGUIUtility.TrTextContent("Create"), kButtonWidth) || enter)
                        {
                            message = GUIContent.none;

                            if (string.IsNullOrEmpty(publisher))
                            {
                                message = EditorGUIUtility.TrTextContent("Publisher must be specified.");
                                focus   = kPublisherId;
                            }

                            /*else if (!IsValidPublisher(publisher))
                             * {
                             *  message = EditorGUIUtility.TrTextContent("Invalid publisher.");
                             *  focus = kPublisherId;
                             * }*/
                            else if (password != confirm)
                            {
                                if (string.IsNullOrEmpty(confirm))
                                {
                                    message = EditorGUIUtility.TrTextContent("Confirm the password.");
                                    focus   = kConfirmId;
                                }
                                else
                                {
                                    message  = EditorGUIUtility.TrTextContent("Passwords do not match.");
                                    password = string.Empty;
                                    confirm  = password;
                                    focus    = kPasswordId;
                                }
                            }
                            else
                            {
                                try
                                {
                                    EditorUtility.WSACreateTestCertificate(path, publisher, password, true);

                                    AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

                                    if (!PlayerSettings.WSA.SetCertificate(FileUtil.GetProjectRelativePath(path), password))
                                    {
                                        message = EditorGUIUtility.TrTextContent("Invalid password.");
                                    }

                                    close = true;
                                }
                                catch (UnityException ex)
                                {
                                    Debug.LogError(ex.Message);
                                }
                            }
                        }
                    }

                    GUILayout.FlexibleSpace();
                }

                GUILayout.Space(kSpace * 2);
            }

            if (close)
            {
                Close();
            }
            else if (focus != null)
            {
                EditorGUI.FocusTextInControl(focus);
                focus = null;
            }
        }
Пример #5
0
        public void OnGUI()
        {
            Event current = Event.current;
            bool  flag1   = false;
            bool  flag2   = false;

            if (current.type == EventType.KeyDown)
            {
                flag1 = current.keyCode == KeyCode.Escape;
                flag2 = current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter;
            }
            using (HorizontalLayout.DoLayout())
            {
                GUILayout.Space(10f);
                using (VerticalLayout.DoLayout())
                {
                    GUILayout.FlexibleSpace();
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(EditorGUIUtility.TextContent("Password|Certificate password."), new GUILayoutOption[1]
                        {
                            MetroCertificatePasswordWindow.kLabelWidth
                        });
                        GUI.SetNextControlName("password");
                        this.password = GUILayout.PasswordField(this.password, '●');
                    }
                    GUILayout.Space(10f);
                    using (HorizontalLayout.DoLayout())
                    {
                        GUILayout.Label(this.message, this.messageStyle, new GUILayoutOption[0]);
                        GUILayout.FlexibleSpace();
                        if (!GUILayout.Button(EditorGUIUtility.TextContent("Ok"), new GUILayoutOption[1] {
                            MetroCertificatePasswordWindow.kButtonWidth
                        }))
                        {
                            if (!flag2)
                            {
                                goto label_21;
                            }
                        }
                        this.message = GUIContent.none;
                        try
                        {
                            if (PlayerSettings.WSA.SetCertificate(this.path, this.password))
                            {
                                flag1 = true;
                            }
                            else
                            {
                                this.message = EditorGUIUtility.TextContent("Invalid password.");
                            }
                        }
                        catch (UnityException ex)
                        {
                            Debug.LogError((object)ex.Message);
                        }
                    }
label_21:
                    GUILayout.FlexibleSpace();
                }
                GUILayout.Space(10f);
            }
            if (flag1)
            {
                this.Close();
            }
            else
            {
                if (this.focus == null)
                {
                    return;
                }
                EditorGUI.FocusTextInControl(this.focus);
                this.focus = (string)null;
            }
        }