// Image Handler public void AddImage() // Open Gallery and add image { if (NativeGallery.CanSelectMultipleFilesFromGallery()) { NativeGallery.MediaPickMultipleCallback multi_callback = new NativeGallery.MediaPickMultipleCallback(LoadImages); NativeGallery.GetImagesFromGallery(multi_callback); return; } NativeGallery.MediaPickCallback callback = new NativeGallery.MediaPickCallback(LoadImage); NativeGallery.GetImageFromGallery(callback); }
public void AddPicturesFromGalleryOnClick() { if (NativeGallery.IsMediaPickerBusy()) { return; } if (NativeGallery.CanSelectMultipleFilesFromGallery()) { NativeGallery.GetImagesFromGallery((paths) => HandlePictureAddition(paths), "Select pictures", "image/*"); } else { NativeGallery.GetImageFromGallery((path) => HandlePictureAddition(new[] { path }), "Select picture", "image/*"); } }
private void LoadImagesFromGallery() { NativeGallery.Permission permission; if (NativeGallery.CanSelectMultipleFilesFromGallery()) { permission = NativeGallery.GetImagesFromGallery((paths) => { if (paths != null) { foreach (string path in paths) { Texture2D loadedTexture = LoadTextureFromGallery(path); LoadedTextures.Add(loadedTexture); } } if (LoadedTextures[0]) { gameController.LoadingOfImagesDone(); } }, title: "Select multiple images", mime: "image/*"); } else { permission = NativeGallery.GetImageFromGallery((path) => { if (path != null) { Texture2D loadedTexture = LoadTextureFromGallery(path); LoadedTextures.Add(loadedTexture); } if (LoadedTextures[0]) { gameController.LoadingOfImagesDone(); } }, title: "Select single image", mime: "image/*"); } }