private void DoUserAuthorizationDialog(int windowID) { UserAuthorization userAuthorizationRequestMode = Application.GetUserAuthorizationRequestMode(); GUILayout.FlexibleSpace(); GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f, 0.7f); GUILayout.BeginHorizontal("box", new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label(this.warningIcon, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (userAuthorizationRequestMode == (UserAuthorization)3) { GUILayout.Label("The content on this site would like to use your\ncomputer's web camera and microphone.\nThese images and sounds may be recorded.", new GUILayoutOption[0]); } else { if (userAuthorizationRequestMode == UserAuthorization.WebCam) { GUILayout.Label("The content on this site would like to use\nyour computer's web camera. The images\nfrom your web camera may be recorded.", new GUILayoutOption[0]); } else { if (userAuthorizationRequestMode != UserAuthorization.Microphone) { return; } GUILayout.Label("The content on this site would like to use\nyour computer's microphone. The sounds\nfrom your microphone may be recorded.", new GUILayoutOption[0]); } } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUI.backgroundColor = Color.white; GUILayout.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button("Deny", new GUILayoutOption[0])) { Application.ReplyToUserAuthorizationRequest(false); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Always Allow for this Site", new GUILayoutOption[0])) { Application.ReplyToUserAuthorizationRequest(true, true); } GUILayout.Space(5f); if (GUILayout.Button("Allow", new GUILayoutOption[0])) { Application.ReplyToUserAuthorizationRequest(true); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); }
private void Start() { this.warningIcon = (Resources.GetBuiltinResource(typeof(Texture2D), "WarningSign.psd") as Texture2D); if (Screen.width < 385 || Screen.height < 155) { Debug.LogError("Screen is to small to display authorization dialog. Authorization denied."); Application.ReplyToUserAuthorizationRequest(false); } this.windowRect = new Rect((float)(Screen.width / 2 - 192), (float)(Screen.height / 2 - 77), 385f, 155f); }
internal static void ReplyToUserAuthorizationRequest(bool reply) { bool remember = false; Application.ReplyToUserAuthorizationRequest(reply, remember); }