up
This commit is contained in:
61
Assets/3rd/Scripts/MyCamera.cs
Normal file
61
Assets/3rd/Scripts/MyCamera.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Coolape;
|
||||
|
||||
public static class MyCamera
|
||||
{
|
||||
|
||||
public static NativeCamera.Permission getImage(object callback, int maxSize = -1)
|
||||
{
|
||||
NativeCamera.Permission pm;
|
||||
pm = NativeCamera.CheckPermission();
|
||||
if (pm == NativeCamera.Permission.Granted)
|
||||
{
|
||||
NativeCamera.TakePicture((path) =>
|
||||
{
|
||||
Utl.doCallback(callback, path);
|
||||
}, maxSize, true, NativeCamera.PreferredCamera.Default);
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
public static NativeCamera.Permission getImageFacing(object callback, int maxSize = -1)
|
||||
{
|
||||
NativeCamera.Permission pm;
|
||||
pm = NativeCamera.CheckPermission();
|
||||
if (pm == NativeCamera.Permission.Granted)
|
||||
{
|
||||
NativeCamera.TakePicture((path) =>
|
||||
{
|
||||
Utl.doCallback(callback, path);
|
||||
}, maxSize, true, NativeCamera.PreferredCamera.Front);
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
public static NativeCamera.Permission getVideo(object callback)
|
||||
{
|
||||
NativeCamera.Permission pm;
|
||||
pm = NativeCamera.CheckPermission();
|
||||
if (pm == NativeCamera.Permission.Granted)
|
||||
{
|
||||
NativeCamera.RecordVideo((path) =>
|
||||
{
|
||||
Utl.doCallback(callback, path);
|
||||
});
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
public static bool openSetting()
|
||||
{
|
||||
if (NativeCamera.CanOpenSettings())
|
||||
{
|
||||
NativeCamera.OpenSettings();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/3rd/Scripts/MyCamera.cs.meta
Normal file
11
Assets/3rd/Scripts/MyCamera.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27474c449f2934a59b021704591ab111
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Assets/3rd/Scripts/MyGallery.cs
Normal file
47
Assets/3rd/Scripts/MyGallery.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Coolape;
|
||||
|
||||
public static class MyGallery
|
||||
{
|
||||
|
||||
public static NativeGallery.Permission getImage(object callback)
|
||||
{
|
||||
NativeGallery.Permission pm;
|
||||
pm = NativeGallery.CheckPermission();
|
||||
if (pm == NativeGallery.Permission.Granted)
|
||||
{
|
||||
NativeGallery.GetImageFromGallery((path) =>
|
||||
{
|
||||
Utl.doCallback(callback, path);
|
||||
});
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
public static NativeGallery.Permission getMultImages(object callback)
|
||||
{
|
||||
NativeGallery.Permission pm;
|
||||
pm = NativeGallery.CheckPermission();
|
||||
if (pm == NativeGallery.Permission.Granted)
|
||||
{
|
||||
NativeGallery.GetImagesFromGallery((pathList) =>
|
||||
{
|
||||
Utl.doCallback(callback, pathList);
|
||||
});
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
public static bool openSetting()
|
||||
{
|
||||
if (NativeGallery.CanOpenSettings())
|
||||
{
|
||||
NativeGallery.OpenSettings();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/3rd/Scripts/MyGallery.cs.meta
Normal file
11
Assets/3rd/Scripts/MyGallery.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64663a08f69c441d19f0d7a50eae5465
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user