コード例 #1
0
        public void DrawUsage()
        {
            // Title
            m_Config.m_ShowUsage = EditorGUILayout.Foldout(m_Config.m_ShowUsage, "Permissions".ToUpper());
            if (m_Config.m_ShowUsage == false)
            {
                return;
            }

            PhotoUsageDescription usage = AssetUtils.GetOrCreate <PhotoUsageDescription> ("iOSPhotoUsageDescription.asset");

            if (usage == null)
            {
                return;
            }


            // Exclude from build
            EditorGUILayout.Separator();
            if (usage.m_NeedsPermission)
            {
                if (!permissionChecked)
                {
                    permissionChecked = true;
                    FrameworkDependency.SetiOSFrameworkDependency();
                }

                EditorGUILayout.HelpBox("Currently, your iOS and Android builds REQUIER the access to the device and photo gallery. " +
                                        "If you only want to use the asset in editor or do not requier to access to the device gallery, use the button below. ", MessageType.Info);

                if (GUILayout.Button("Remove permission needs for iOS and Android"))
                {
                    RemovePermissionNeeds.Remove(true);
                    usage.m_NeedsPermission = false;
                }

                EditorGUILayout.LabelField("iOS Photo library usage description:");
                string newUsage = EditorGUILayout.TextArea(usage.m_UsageDescription, EditorStyles.textArea);
                if (newUsage != usage.m_UsageDescription)
                {
                    usage.m_UsageDescription = newUsage;
                    EditorUtility.SetDirty(usage);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Currently, your iOS and Android builds DO NOT REQUIER the access to the device and photo gallery. " +
                                        "However, it is now impossible to access the device gallery from build.", MessageType.Info);

                if (GUILayout.Button("Restore permission needs for iOS and Android"))
                {
                    RemovePermissionNeeds.Remove(false);
                    usage.m_NeedsPermission = true;
                }
            }
        }
コード例 #2
0
        public void DrawUsage()
        {
            // Title
            m_Config.m_ShowUsage = EditorGUILayout.Foldout(m_Config.m_ShowUsage, "Permissions".ToUpper());
            if (m_Config.m_ShowUsage == false)
            {
                return;
            }

            if (usage == null)
            {
                usage = AssetUtils.GetFirstOrCreate <PhotoUsageDescription>("iOSPhotoUsageDescription", "Assets/");
            }
            if (usage == null)
            {
                return;
            }

            /*
             *          // Exlude from build
             *          EditorGUILayout.Separator ();
             *          EditorGUILayout.LabelField ("Editor Only");
             *          if (!usage.m_EditorOnly) {
             *                  EditorGUILayout.HelpBox ("If you want to use the asset in editor only, use the button below to exclude it from build. " +
             *                  "Be careful not to use any scripts in builds to prevent errors.", MessageType.Info);
             *                  if (GUILayout.Button ("Switch to editor only")) {
             *                          ExcludeFromBuild.Exclude (true);
             *                          usage.m_EditorOnly = true;
             *                  }
             *          } else {
             *                  EditorGUILayout.HelpBox ("The asset is currently in Editor Only mode. Use the button below to restore the asset in build mode.", MessageType.Info);
             *                  if (GUILayout.Button ("Switch to build mode")) {
             *                          ExcludeFromBuild.Exclude (false);
             *                          usage.m_EditorOnly = false;
             *                  }
             *          }
             */

            // Add framework dependency to iOS
            if (!permissionChecked)
            {
                permissionChecked = true;
                FrameworkDependency.SetiOSFrameworkDependency();
            }

            // Exclude from iOS and Android
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("iOS and Android Gallery permissions");
            if (usage.m_NeedsPermission)
            {
                EditorGUILayout.HelpBox("Currently, your iOS and Android builds REQUIER the access to the device and photo gallery. " +
                                        "If you only want to use the asset in editor or do not requier to access to the device gallery, use the button below. ", MessageType.Info);


                if (GUILayout.Button("Remove permission needs for iOS and Android"))
                {
                    RemovePermissionNeeds.Remove(true);
                    usage.m_NeedsPermission = false;
                }

                EditorGUILayout.LabelField("iOS Photo library usage description:");
                string newUsage = EditorGUILayout.TextArea(usage.m_UsageDescription, EditorStyles.textArea);
                if (newUsage != usage.m_UsageDescription)
                {
                    usage.m_UsageDescription = newUsage;
                    EditorUtility.SetDirty(usage);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Currently, your iOS and Android builds DO NOT REQUIER the access to the device and photo gallery. " +
                                        "However, it is now impossible to access the device gallery from build.", MessageType.Info);

                if (GUILayout.Button("Restore permission needs for iOS and Android"))
                {
                    RemovePermissionNeeds.Remove(false);
                    usage.m_NeedsPermission = true;
                }
            }
        }