12 private static readonly GUILayoutOption LabelWidth = GUILayout.Width(110f);
14 private static readonly GUILayoutOption ButtonWidth = GUILayout.Width(110f);
18 private string password;
20 private GUIContent message;
22 private GUIStyle messageStyle;
26 public static void Show(
string path)
29 CertificatePasswordWindow certificatePasswordWindow = (array.Length <= 0) ? CreateInstance<CertificatePasswordWindow>() : array[0];
30 path = path.Replace(
"\\",
"/");
31 certificatePasswordWindow.path = path.Substring(path.LastIndexOf(
"Assets/", StringComparison.Ordinal));
32 certificatePasswordWindow.password =
string.Empty;
33 certificatePasswordWindow.message = GUIContent.none;
34 certificatePasswordWindow.messageStyle =
new GUIStyle(GUI.skin.label);
35 certificatePasswordWindow.messageStyle.fontStyle = FontStyle.Italic;
36 certificatePasswordWindow.focus =
"password";
39 certificatePasswordWindow.Focus();
43 certificatePasswordWindow.titleContent =
new GUIContent(
"Enter Windows Store Certificate Password");
44 certificatePasswordWindow.position =
new Rect(100f, 100f, 350f, 90f);
45 certificatePasswordWindow.minSize =
new Vector2(certificatePasswordWindow.position.width, certificatePasswordWindow.position.height);
46 certificatePasswordWindow.maxSize = certificatePasswordWindow.minSize;
47 certificatePasswordWindow.ShowUtility();
53 Event current = Event.current;
57 if (current.type == EventType.KeyDown)
59 flag = (current.keyCode == KeyCode.Escape);
60 flag2 = (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter);
63 using (
new EditorGUILayout.HorizontalScope())
66 using (
new EditorGUILayout.VerticalScope())
68 GUILayout.FlexibleSpace();
69 using (
new EditorGUILayout.HorizontalScope())
71 GUILayout.Label(
new GUIContent(
"Password|Certificate password."), LabelWidth);
72 GUI.SetNextControlName(
"password");
73 password = GUILayout.PasswordField(password,
'●');
76 using (
new EditorGUILayout.HorizontalScope())
78 GUILayout.Label(message, messageStyle);
79 GUILayout.FlexibleSpace();
80 if (GUILayout.Button(
new GUIContent(
"Ok"), ButtonWidth) || flag2)
82 message = GUIContent.none;
85 if (PlayerSettings.WSA.SetCertificate(path, password))
91 message =
new GUIContent(
"Invalid password.");
94 catch (UnityException ex)
96 Debug.LogError(ex.Message);
100 GUILayout.FlexibleSpace();
102 GUILayout.Space(10f);
109 else if (focus != null)
111 EditorGUI.FocusTextInControl(focus);