private void _AboutWindow() { if (m_backgroundTexture != null) { GUI.DrawTexture(m_aboutScreenRect, m_backgroundTexture, ScaleMode.StretchToFill); } GUILayout.BeginArea(m_aboutScreenRect); Color oldBackgroundColor = GUI.backgroundColor; Color oldColor = GUI.color; GUI.backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); GUI.color = Color.gray; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("<size=20>" + m_applicationName + "</size>"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("<size=20>Version = " + m_applicationVersion + "</size>"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("<size=20>Libarary = " + Tango.TangoApplication.GetTangoServiceVersion() + "</size>"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (m_showLinkToChangeList) { GUILayout.Space(40); GUI.color = Color.blue; if (GUILayout.Button("<size=20>Release Notes</size>")) { //m_isActive = false; #if !UNITY_EDITOR && UNITY_ANDROID string packageName = AndroidHelper.GetCurrentPackageName(); Application.OpenURL("market://details?q=pname:" + packageName + "/"); #else Application.OpenURL("http://play.google.com"); #endif } } GUI.color = oldColor; GUI.backgroundColor = oldBackgroundColor; GUILayout.EndArea(); }
/// <summary> /// Request permissions for Unity functionality. /// </summary> /// <returns><c>true</c>, if request permissions was _ed, <c>false</c> otherwise.</returns> /// <param name="permissionType">Permission type.</param> private IEnumerator _RequestPermissions(string permissionType) { //#if !UNITY_EDITOR && UNITY_ANDROID // verify string syncFile = "data/data/" + AndroidHelper.GetCurrentPackageName() + "/files/activity_result"; string result = string.Empty; yield return(StartCoroutine(_Delete(syncFile))); Debug.Log("Launching permission requester for : " + permissionType); // request AndroidHelper.StartTangoPermissionsActivity(permissionType); while (!File.Exists(syncFile)) { // sit and spin while waiting for the permissions intent to // steal focus from Unity. Once the intent returns this text // file will exist. yield return(null); } try { StreamReader streamReader = new StreamReader(syncFile); result = streamReader.ReadLine(); streamReader.Close(); } catch (System.IO.FileNotFoundException e) { Debug.Log(CLASS_NAME + "._RequestPermissions : File Not Found: " + e.Message); } if (string.IsNullOrEmpty(result) == false) { if (result != "RESULT_OK") { m_anyPermissionDenied = true; } } yield return(StartCoroutine(_Delete(syncFile))); //#endif yield return(null); }
// Use this for initialization void Start() { m_isActive = false; m_buttonRect = new Rect((Screen.width * BUTTON_X_POSITION_RIGHT_ALIGNED) - BUTTON_WIDTH, Screen.height * BUTTON_Y_POSITION_RIGHT_ALIGNED, BUTTON_WIDTH, BUTTON_HEIGHT); m_aboutScreenRect = new Rect((Screen.width * 0.5f) - (ABOUT_SCREEN_WIDTH * 0.5f), (Screen.height * 0.5f) - (ABOUT_SCREEN_HEIGHT * 0.5f), ABOUT_SCREEN_WIDTH, m_showLinkToChangeList ? ABOUT_SCREEN_HEIGHT * 3.0f : ABOUT_SCREEN_HEIGHT); m_applicationName = AndroidHelper.GetCurrentApplicationLabel(); m_applicationVersion = AndroidHelper.GetVersionName(AndroidHelper.GetCurrentPackageName()); }
/// <summary> /// Request permissions for Unity functionality. /// </summary> /// <returns><c>true</c>, if request permissions was _ed, <c>false</c> otherwise.</returns> /// <param name="permissionType">Permission type.</param> private bool _RequestPermissions(string permissionType) { #if !UNITY_EDITOR && UNITY_ANDROID // verify string syncFile = "data/data/" + AndroidHelper.GetCurrentPackageName() + "/files/activity_result"; string result = string.Empty; _BlockingDelete(syncFile); // request AndroidHelper.StartTangoPermissionsActivity(permissionType); while (!File.Exists(syncFile)) { // sit and spin while waiting for the permissions intent to // steal focus from Unity. Once the intent returns this text // file will exist. } try { StreamReader streamReader = new StreamReader(syncFile); result = streamReader.ReadLine(); streamReader.Close(); } catch (System.IO.FileNotFoundException e) { Debug.Log(CLASS_NAME + "._RequestPermissions : File Not Found: " + e.Message); } if (string.IsNullOrEmpty(result) == false) { return(result == "RESULT_OK"); } _BlockingDelete(syncFile); #endif return(false); }