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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user