Esempio n. 1
0
    private void LoginAccountGUI()
    {
        GUILayout.Space(5);
        GUILayout.Box("Login Account");
        GUILayout.BeginHorizontal();
        GUILayout.Space(5);
        // GUILayout.FlexibleSpace();

        GUILayout.BeginVertical();
        GUILayout.Label("Key");
        config.loginKey = GUILayout.TextField(config.loginKey);
        GUILayout.Space(2);
        modifyPassword = EditorGUILayout.Toggle("Modify Password", modifyPassword);
        if (modifyPassword)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("password", GUILayout.Width(90));
            pw = EditorGUILayout.PasswordField(pw, GUILayout.Width(160));
            GUILayout.Label(">5 length");

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("password again", GUILayout.Width(90));
            if (!string.IsNullOrEmpty(pwVerify) && !string.IsNullOrEmpty(pw) && pw != pwVerify)
            {
                GUI.color = Color.red;
            }
            pwVerify  = EditorGUILayout.PasswordField(pwVerify, GUILayout.Width(160));
            GUI.color = Color.white;

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();



            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (!string.IsNullOrEmpty(pwVerify) &&
                !string.IsNullOrEmpty(pw) &&
                pw == pwVerify &&
                GUILayout.Button("Ok", GUILayout.Width(90)))
            {
                if (string.IsNullOrEmpty(pw))
                {
                    ShowNotification(new GUIContent("The password cannot be empty!"));
                    return;
                }
                if (pw.Length < 6)
                {
                    ShowNotification(new GUIContent("The password must be longer than 5!"));
                    return;
                }
                config.loginPassword = MD5Tool.GetObjectMD5(pw);
                Debug.Log(config.loginPassword);
                modifyPassword = false;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();

        GUILayout.EndHorizontal();
    }