资源简介
unity for ios 上传IOS机本地的头像 相机的获取 相册的获取 截图拍照
代码片段和文件信息
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class IOSAlbumCamera : MonoBehaviour
{
[DllImport (“__Internal“)]
private static extern void _iosOpenPhotoLibrary();
[DllImport (“__Internal“)]
private static extern void _iosOpenPhotoAlbums();
[DllImport (“__Internal“)]
private static extern void _iosOpenCamera();
[DllImport (“__Internal“)]
private static extern void _iosOpenPhotoLibrary_allowsEditing();
[DllImport (“__Internal“)]
private static extern void _iosOpenPhotoAlbums_allowsEditing();
[DllImport (“__Internal“)]
private static extern void _iosOpenCamera_allowsEditing();
[DllImport (“__Internal“)]
private static extern void _iosSaveImageToPhotosAlbum(string readAddr);
///
/// 打开照片
///
///
public static void iosOpenPhotoLibrary(bool allowsEditing=false)
{
if (allowsEditing)
_iosOpenPhotoLibrary_allowsEditing ();
else
_iosOpenPhotoLibrary ();
}
///
/// 打开相册
///
///
public static void iosOpenPhotoAlbums(bool allowsEditing=false)
{
if (allowsEditing)
_iosOpenPhotoAlbums_allowsEditing ();
else
_iosOpenPhotoAlbums ();
}
///
/// 打开相机
///
///
public static void iosOpenCamera(bool allowsEditing=false)
{
if (allowsEditing)
_iosOpenCamera_allowsEditing ();
else
_iosOpenCamera ();
}
///
/// 保存图片到相册
///
///
public static void iosSaveImageToPhotosAlbum(string readAddr)
{
_iosSaveImageToPhotosAlbum (readAddr);
}
///
/// 将ios传过的string转成u3d中的texture
///
/// se64“>
///
public static Texture2D base64StringToTexture2D(string base64)
{
Texture2D tex = new Texture2D (4 4 TextureFormat.ARGB32 false);
try
{
byte[] bytes = System.Convert.Frombase64String(base64);
tex.LoadImage(bytes);
}
catch(System.Exception ex)
{
Debug.LogError(ex.Message);
}
return tex;
}
private static IOSAlbumCamera _instance;
public static IOSAlbumCamera Instance{get{ return _instance; }}
public System.Action CallBack_PickImage_With_base64;
public System.Action CallBack_ImageSavedToAlbum;
void Awake()
{
if (_instance != null)
{
DestroyImmediate(this);
return;
}
_instance = this;
// Gameobject go = new Gameobject (“IOSAlbumCamera“);
// _instance = go.AddComponent ();
}
///
/// 打开相册相机后的从ios回调到unity的方法
///
/// se64“>base64.
void PickImageCallBack_base64(string base64)
{
if(CallBack_PickImage_With_base64!=null)
{
CallBack_PickImage_With_base64(base64);
}
}
///
/// 保存图片到相册后,从ios回调到unity的方法
///
///
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-02-26 13:14 IOSXiangce\
目录 0 2016-02-26 13:00 IOSXiangce\.vs\
目录 0 2016-02-26 13:00 IOSXiangce\.vs\IOSAlubmCamera\
目录 0 2016-02-26 13:14 IOSXiangce\.vs\IOSAlubmCamera\v14\
文件 98304 2016-02-26 13:14 IOSXiangce\.vs\IOSAlubmCamera\v14\.suo
文件 4349 2016-02-26 10:35 IOSXiangce\Assembly-CSharp.csproj
目录 0 2016-02-26 13:14 IOSXiangce\Assets\
目录 0 2016-02-26 13:14 IOSXiangce\Assets\IOSAlubmCamera\
文件 191 2016-02-25 18:26 IOSXiangce\Assets\IOSAlubmCamera.me
目录 0 2016-02-26 12:02 IOSXiangce\Assets\IOSAlubmCamera\demo\
文件 191 2016-02-25 18:29 IOSXiangce\Assets\IOSAlubmCamera\demo.me
文件 25338 2016-02-24 20:45 IOSXiangce\Assets\IOSAlubmCamera\demo\49DB73250F3DA51A67A5FCF14D6239CF.png
文件 1308 2016-02-26 12:00 IOSXiangce\Assets\IOSAlubmCamera\demo\49DB73250F3DA51A67A5FCF14D6239CF.png.me
文件 1752 2016-02-26 12:01 IOSXiangce\Assets\IOSAlubmCamera\demo\iosalubmcamer_demo.cs
文件 262 2016-02-25 18:29 IOSXiangce\Assets\IOSAlubmCamera\demo\iosalubmcamer_demo.cs.me
文件 44628 2016-02-26 12:02 IOSXiangce\Assets\IOSAlubmCamera\demo\isoalubmcamer_demo.unity
文件 174 2016-02-25 18:27 IOSXiangce\Assets\IOSAlubmCamera\demo\isoalubmcamer_demo.unity.me
文件 3319 2016-02-26 13:14 IOSXiangce\Assets\IOSAlubmCamera\IOSAlbumCamera.cs
文件 262 2016-02-25 18:30 IOSXiangce\Assets\IOSAlubmCamera\IOSAlbumCamera.cs.me
目录 0 2016-02-26 13:14 IOSXiangce\Assets\Plugins\
文件 191 2016-02-25 18:27 IOSXiangce\Assets\Plugins.me
目录 0 2016-02-26 11:44 IOSXiangce\Assets\Plugins\IOS\
文件 191 2016-02-25 18:27 IOSXiangce\Assets\Plugins\IOS.me
文件 210 2016-02-26 10:37 IOSXiangce\Assets\Plugins\IOS\IOSAlbumCameraController.h
文件 309 2016-02-25 18:28 IOSXiangce\Assets\Plugins\IOS\IOSAlbumCameraController.h.me
文件 10369 2016-02-26 11:44 IOSXiangce\Assets\Plugins\IOS\IOSAlbumCameraController.mm
文件 309 2016-02-25 18:28 IOSXiangce\Assets\Plugins\IOS\IOSAlbumCameraController.mm.me
文件 6494 2016-02-26 13:00 IOSXiangce\IOSAlubmCamera.CSharp.csproj
文件 931 2016-02-26 12:54 IOSXiangce\IOSAlubmCamera.sln
文件 639 2016-02-26 12:51 IOSXiangce\IOSAlubmCamera.userprefs
目录 0 2016-02-26 13:14 IOSXiangce\Library\
............此处省略803个文件信息
- 上一篇:opencv 神经网络分类
- 下一篇:最全的HFSS 仿真模型60个
相关资源
- Unity3D期末
- AVPro Movie Capture3.6.8
- SilverLining Skies 3D Clouds v1.9.unitypackage
- Unity最新绳子插件《Ultimate Rope Editor
- Unity 自定义扇形无限循环列表
- Unityshader——HLSL初级教程
- Unity动态水体涟漪效果
- unity拉取安卓苹果相册的插件
- unity场景调用自己拼接键盘输出汉字拼
- UnityWWW压缩包并且解压到桌面
- Unity3D 角色控制器CharacterController
- Pocket Portal VR 2.2传送门
- Unity安卓Dll热更新框架原工程
- unity人物模型资源包
- Unity石头资源
- NavMesh 2D.unitypackage
- Unity 新手引导
- unity3d串口数据显示.docx
- 2D动态云彩
- Dynamic Bone V1.2.2
- Unity3d常用中文字体
- Optimized ScrollView Adapter v3.0.2
- shader水效果.rar
- 鱼游动逻辑算法
- Unity 3D小游戏
- 2d游戏之五子棋
- Unity高清水素材,水材质
- 噩梦射手 Unity 实训报告
- 2D UFO Tutorialunity官方资源
- Unity数据处理
评论
共有 条评论