コード例 #1
0
ファイル: IGShare.cs プロジェクト: Tardis-x/Bigger-Inside
        ///  <summary>
        ///      Share the specified text with optional image.
        ///  </summary>
        ///  <param name="onFinished">Callback invoked when sharing finished.</param>
        ///  <param name="onError">Callback invoked when error happened while shairng.</param>
        ///  <param name="text">Text to share.</param>
        ///  <param name="image">Image to share.</param>
        ///  <param name="iPadScreenPosition">Position of the arrow on iPad screen. Positioning zero is at top left screen point. </param>
        public static void Share(Action <string> onFinished, Action <string> onError,
                                 string text, Texture2D image = null, Vector2 iPadScreenPosition = default(Vector2))
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            Check.Argument.IsNotNull(onFinished, "onFinished");
            Check.Argument.IsNotNull(onError, "onError");

            var posX = IGUtils.ClampXScreenPos(iPadScreenPosition);
            var posY = IGUtils.ClampYScreenPos(iPadScreenPosition);

            if (image != null)
            {
                var imageBuffer = image.EncodeToPNG();
                var handle      = GCHandle.Alloc(imageBuffer, GCHandleType.Pinned);
                _showShareMessageWithImage(text, handle.AddrOfPinnedObject(), imageBuffer.Length,
                                           posX, posY,
                                           IGUtils.ActionStringCallaback, onFinished.GetPointer(), onError.GetPointer());
                handle.Free();
                return;
            }
            // Just text
            _showShareMessageWithImage(text, EmptyByteArray.GetPointer(), EmptyByteArray.Length,
                                       posX, posY,
                                       IGUtils.ActionStringCallaback, onFinished.GetPointer(), onError.GetPointer());
        }
コード例 #2
0
        /// <summary>
        ///     Displays action sheet with cancel and destructive button and provided options.
        /// </summary>
        /// <param name="title">Action sheet title</param>
        /// <param name="cancelBtnTitle">Action sheet cancel button title</param>
        /// <param name="onCancelClicked">Action sheet cancel button callback</param>
        /// <param name="destructiveButtonTitle">Action sheet destructive button title</param>
        /// <param name="onDestructiveButtonClicked">Action sheet destructive button callback</param>
        /// <param name="otherButtonTitles">Titles of other buttons</param>
        /// <param name="onOtherButtonClicked">
        ///     Action sheet other button callback, index is the same as index array passed to
        ///     method
        /// </param>
        /// <param name="message"> Optional message to be displayed on the action sheet. </param>
        ///  <param name="iPadScreenPosition">Position of the arrow on iPad screen. Positioning zero is at top left screen point. </param>
        public static void ShowActionSheet(string title,
                                           string cancelBtnTitle, Action onCancelClicked,
                                           string destructiveButtonTitle, Action onDestructiveButtonClicked,
                                           [CanBeNull] string[] otherButtonTitles, Action <int> onOtherButtonClicked, string message = null, Vector2 iPadScreenPosition = default(Vector2))
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            if (message == null)
            {
                message = string.Empty;
            }

            if (otherButtonTitles == null)
            {
                otherButtonTitles = new string[] { };
            }

            var posX = IGUtils.ClampXScreenPos(iPadScreenPosition);
            var posY = IGUtils.ClampYScreenPos(iPadScreenPosition);

            _showActionSheet(title, message, cancelBtnTitle, destructiveButtonTitle, string.Join("|", otherButtonTitles), posX, posY,
                             IGUtils.ActionIntCallback, onOtherButtonClicked.GetPointer(),
                             IGUtils.ActionVoidCallback, onCancelClicked.GetPointer(), onDestructiveButtonClicked.GetPointer());
        }
コード例 #3
0
        public static void PickVideoFromPhotoLibrary(Action <string> callback, Action onCancel,
                                                     bool allowEditing          = true,
                                                     Vector2 iPadScreenPosition = default(Vector2))
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            Check.Argument.IsNotNull(callback, "callback");

            var posX = IGUtils.ClampXScreenPos(iPadScreenPosition);
            var posY = IGUtils.ClampYScreenPos(iPadScreenPosition);

            _pickVideoFromGallery(IGUtils.ActionStringCallback, callback.GetPointer(),
                                  IGUtils.ActionVoidCallback, onCancel.GetPointer(),
                                  (int)GallerySourceType.PhotosAlbum, allowEditing,
                                  posX, posY);
        }
コード例 #4
0
ファイル: IGShare.cs プロジェクト: Tardis-x/Bigger-Inside
        /// <summary>
        ///	 Share the specified text with link.
        /// </summary>
        /// <param name="onFinished">Callback invoked when sharing finished.</param>
        /// <param name="onError">Callback invoked when error happened while shairng.</param>
        /// <param name="text">Text to share.</param>
        /// <param name="url">Link to share.</param>
        ///  <param name="iPadScreenPosition">Position of the arrow on iPad screen. Positioning zero is at top left screen point. </param>
        public static void ShareTextWithLink(Action <string> onFinished, Action <string> onError,
                                             string text, string url, Vector2 iPadScreenPosition = default(Vector2))
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            Check.Argument.IsNotNull(onFinished, "onFinished");
            Check.Argument.IsNotNull(onError, "onError");
            Check.Argument.IsStrNotNullOrEmpty(text, "message");
            Check.Argument.IsStrNotNullOrEmpty(url, "url");

            var posX = IGUtils.ClampXScreenPos(iPadScreenPosition);
            var posY = IGUtils.ClampYScreenPos(iPadScreenPosition);

            _showShareMessageWithLink(text, url,
                                      posX, posY,
                                      IGUtils.ActionStringCallaback, onFinished.GetPointer(), onError.GetPointer());
        }
コード例 #5
0
        public static void PickImageFromPhotosAlbum(Action <Texture2D> callback, Action onCancel,
                                                    float compressionQuality   = 1f,
                                                    bool allowEditing          = true,
                                                    Vector2 iPadScreenPosition = default(Vector2))
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            Check.Argument.IsNotNull(callback, "callback");
            compressionQuality = Mathf.Clamp01(compressionQuality);

            var posX = IGUtils.ClampXScreenPos(iPadScreenPosition);
            var posY = IGUtils.ClampYScreenPos(iPadScreenPosition);

            _pickImageFromGallery(
                ImageResultCallback, callback.GetPointer(),
                IGUtils.ActionVoidCallback, onCancel.GetPointer(),
                (int)GallerySourceType.PhotosAlbum, compressionQuality, allowEditing,
                posX, posY);
        }
コード例 #6
0
        /// <summary>
        ///     Displays action sheet with cancel button and provided options.
        /// </summary>
        /// <param name="title">Action sheet title</param>
        /// <param name="cancelBtnTitle">Action sheet cancel button title</param>
        /// <param name="onCancelClicked">Action sheet cancel button callback</param>
        /// <param name="otherButtonTitles">Titles of other buttons. You should provide at least one button title.</param>
        /// <param name="onOtherButtonClicked">
        ///     Action sheet other button callback, index is the same as index array passed to
        ///     method.
        /// </param>
        /// <param name="message"> Optional message to be displayed on the action sheet. </param>
        ///  <param name="iPadScreenPosition">Position of the arrow on iPad screen. Positioning zero is at top left screen point. </param>
        public static void ShowActionSheet(string title,
                                           string cancelBtnTitle, Action onCancelClicked,
                                           string[] otherButtonTitles, Action <int> onOtherButtonClicked, string message = null, Vector2 iPadScreenPosition = default(Vector2))
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            if (message == null)
            {
                message = string.Empty;
            }

            Check.Argument.IsNotNull(otherButtonTitles, "OtherButtonTitles");

            var posX = IGUtils.ClampXScreenPos(iPadScreenPosition);
            var posY = IGUtils.ClampYScreenPos(iPadScreenPosition);

            _showActionSheet(title, message, cancelBtnTitle, string.Empty, string.Join("|", otherButtonTitles),
                             posX, posY,
                             IGUtils.ActionIntCallback, onOtherButtonClicked.GetPointer(),
                             IGUtils.ActionVoidCallback, onCancelClicked.GetPointer(), IntPtr.Zero);
        }