资源简介
实现AR的相机功能 录屏功能 拍照功能 选择物体在屏幕中对其进行操作的功能 UI页面滑动的功能
代码片段和文件信息
#pragma warning disable 0168 // variable declared but not used.
#pragma warning disable 0219 // variable assigned but not used.
using UnityEngine;
using System;
using System.IO;
using System.Collections;
using System.Runtime.InteropServices;
public class ScreenshotManager : MonoBehaviour
{
public static event Action ScreenshotFinishedSaving;
public static event Action ImageFinishedSaving;
#if UNITY_IPHONE
[DllImport(“__Internal“)]
private static extern bool saveToGallery( string path );
#endif
///
/// 截屏并保存图片
///
/// 项目中的图片名
/// 项目中保存图片的文件夹名
/// 是否回调方法
///
public static IEnumerator Save(string fileName string albumName = “MyScreenshots“ bool callback = false)
{
bool photoSaved = false;
string date = System.DateTime.Now.ToString(“dd-MM-yy“);
ScreenshotManager.ScreenShotNumber++;
string screenshotFilename = fileName + “_“ + ScreenshotManager.ScreenShotNumber + “_“ + date + “.png“;
Debug.Log(“Save screenshot “ + screenshotFilename);
#if UNITY_IPHONE
if(Application.platform == RuntimePlatform.IPhonePlayer)
{
Debug.Log(“iOS platform detected“);
string iosPath = Application.persistentDataPath + “/“ + screenshotFilename;
Application.CaptureScreenshot(screenshotFilename);
while(!photoSaved)
{
photoSaved = saveToGallery( iosPath );
yield return new WaitForSeconds(.5f);
}
iPhone.SetNoBackupFlag( iosPath );
} else {
Application.CaptureScreenshot(screenshotFilename);
}
#elif UNITY_ANDROID
if (Application.platform == RuntimePlatform.Android)
{
Debug.Log(“Android platform detected“);
string androidPath = “/../../../../DCIM/“ + albumName + “/“ + screenshotFilename;
string path = Application.persistentDataPath + androidPath;
string pathonly = Path.GetDirectoryName(path);
Directory.CreateDirectory(pathonly);
//ScreenCapture.CaptureScreenshot(androidPath);
Application.CaptureScreenshot(androidPath);
AndroidJavaClass obj = new AndroidJavaClass(“com.ryanwebb.androidscreenshot.MainActivity“);
while (!photoSaved)
{
photoSaved = obj.CallStatic(“scanMedia“ path);
yield return new WaitForSeconds(.5f);
}
}
else
{
Application.CaptureScreenshot(screenshotFilename);
//ScreenCapture.CaptureScreenshot(screenshotFilename);
}
#else
while(!photoSaved)
{
yield return new WaitForSeconds(.5f);
Debug.Log(“Screenshots only available in iOS/Android mode!“);
photoSaved = true;
}
#endif
if (callback)
Sc
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-13 13:57 TongChengProject\
目录 0 2018-02-28 10:39 TongChengProject\.vs\
目录 0 2018-02-28 10:39 TongChengProject\.vs\TongChengProject\
目录 0 2018-03-06 16:41 TongChengProject\.vs\TongChengProject\v15\
文件 136704 2018-03-12 18:15 TongChengProject\.vs\TongChengProject\v15\.suo
目录 0 2018-03-12 16:07 TongChengProject\.vs\TongChengProject\v15\sqlite3\
文件 1277952 2018-03-12 16:07 TongChengProject\.vs\TongChengProject\v15\sqlite3\storage.ide
目录 0 2018-03-12 15:47 TongChengProject\Assets\
目录 0 2018-03-08 13:37 TongChengProject\Assets\Materials\
文件 2028 2018-03-08 13:37 TongChengProject\Assets\Materials\chuiuv.mat
文件 207 2018-03-08 13:20 TongChengProject\Assets\Materials\chuiuv.mat.me
文件 2022 2018-02-28 18:43 TongChengProject\Assets\Materials\color 1.mat
文件 229 2018-02-28 16:55 TongChengProject\Assets\Materials\color 1.mat.me
文件 2022 2018-02-28 18:43 TongChengProject\Assets\Materials\color 2.mat
文件 229 2018-02-28 16:55 TongChengProject\Assets\Materials\color 2.mat.me
文件 2021 2018-03-05 16:18 TongChengProject\Assets\Materials\color 3.mat
文件 229 2018-02-28 16:55 TongChengProject\Assets\Materials\color 3.mat.me
文件 2019 2018-02-28 16:55 TongChengProject\Assets\Materials\color.mat
文件 229 2018-02-28 16:34 TongChengProject\Assets\Materials\color.mat.me
文件 213 2018-02-28 16:33 TongChengProject\Assets\Materials.me
目录 0 2018-03-12 16:00 TongChengProject\Assets\Models\
目录 0 2018-03-08 13:37 TongChengProject\Assets\Models\Materials\
文件 2028 2018-03-08 13:37 TongChengProject\Assets\Models\Materials\gougou.mat
文件 207 2018-03-08 13:33 TongChengProject\Assets\Models\Materials\gougou.mat.me
文件 191 2018-03-08 13:33 TongChengProject\Assets\Models\Materials.me
文件 556834 2017-09-21 16:03 TongChengProject\Assets\Models\chuiuv.jpg
文件 1474 2018-03-08 13:21 TongChengProject\Assets\Models\chuiuv.jpg.me
文件 38048 2017-09-21 16:03 TongChengProject\Assets\Models\chuizi.fbx
文件 2001 2018-03-08 13:31 TongChengProject\Assets\Models\chuizi.fbx.me
文件 3061 2018-03-12 16:00 TongChengProject\Assets\Models\dog.controller
文件 207 2018-03-08 14:19 TongChengProject\Assets\Models\dog.controller.me
............此处省略8749个文件信息
相关资源
- 中英教材——泛函分析第2版[美] 鲁丁
- Toony Colors Pro 2 v2.3.55
- G Strang的经典著作 Introduction to Linear
- G Strang的经典著作 Introduction to Linear
- AnIntroductiontoStatisticalLearning.zip
- Godec 稀疏表示与低秩表示的结合
- word转PDF然后实现在线预览的功能.ra
- 启示录-打造用户喜爱的产品 MARTY CA
- Car_License_Plate.rar
- 野火STM32F10X例程源码_ZigBee.rar
- zw_OpenCV-2.3.1-win-superpack.part3.zip
- 计算机图形学习题答案源代码.rar
- TI smartRf flash programmer 1.12.7
- 静夜思Authorware课件
- otrs-6.0.16-01.noarch.rpm
- 光盘刻录.rar
- Angular权威教程 中文版
- 贝尔MSA1K-3113NA固件 AR9344固件 OPENWRT+不
- authorware课件作品含源文件素材
- 嵌入式实时操作系统μC\\OS-Ⅱ(第2版
- 机器学习完整版 Machine Learning-A Proba
- 软件工程-实践者的研究方法英文版第
- openCV1.0.rar
- ArcGis10图标全套
- fonts-chinese-3.02-12.el5.noarch.rpm
- arcsde全套教程
- ARM7嵌入式系统设计与仿真
- 车牌测试图片.rar
- Search Engines Information Retrieval in Practi
- 深信服面试题目.rar
评论
共有 条评论