91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.8MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-24
  • 語言: 其他
  • 標簽:

資源簡介

直接調用:ScreenshotHelper.iCaptureScreen(CaptureScreenCallBack);即可實現截屏。 函數void CaptureScreenCallBack(Texture2D texture2D) { new FilePathName().SaveTextureAs(texture2D,FilePathName.SaveFormat.JPG); } 是截屏成功后的回調函數,負責保存圖片。 簡單易用!經測試,無問題!

資源截圖

代碼片段和文件信息

using?System.Collections;
using?System.Collections.Generic;
using?UnityEngine;
using?System;
using?System.IO;

public?class?FilePathName
{
public?enum?SaveFormat
{
GIF?=?0
JPG
PNG
}

public?string?GetSaveDirectory()
{
//GIF?store?in?Virtual?Memory
//Available?path:?Application.persistentDataPath?Application.temporaryCachePath?Application.dataPath
//Do?not?allow?sub-Folder?under?the?path.?If?you?need?to?view?gif?you?can?filter?the?file?names?to?include?.gif?only.
#if?UNITY_EDITOR
return?Application.dataPath;?
#else
// return?Application.persistentDataPath;
return?“/storage/emulated/0/DCIM/“;
#endif
}

public?string?GeFileNameWithoutExt()
{
return?DateTime.Now.ToString(“yyyy-MM-dd-HH-mm-ss“);
}

public?string?GetGifFileName()
{
string?timestamp?=?GeFileNameWithoutExt();
return?“GIF_“?+?timestamp;
}
public?string?GetGifFullPath()
{
return?GetSaveDirectory()?+?“/“?+?GetGifFileName()?+?“.gif“;
}
public?string?GetDownloadedGifSaveFullPath()
{
return?GetSaveDirectory()?+?“/“?+?GetGifFileName()?+?“.gif“;
}

public?string?GetJpgFileName()
{
string?timestamp?=?GeFileNameWithoutExt();
return?“JPG_“?+?timestamp;
}
public?string?GetJpgFullPath()
{
return?GetSaveDirectory()?+?“/“?+?GetJpgFileName()?+?“.jpg“;
}

public?string?GetPngFileName()
{
string?timestamp?=?GeFileNameWithoutExt();
return?“PNG_“?+?timestamp;
}
public?string?GetPngFullPath()
{
return?GetSaveDirectory()?+?“/“?+?GetPngFileName()?+?“.png“;
}

public?byte[]?ReadFileToBytes(string?fullPath)
{
return?File.ReadAllBytes(fullPath);
}

public?void?WriteBytesToFile(string?toFullpath?byte[]?byteArray)
{
File.WriteAllBytes(toFullpath?byteArray);
}

public?void?FileStreamTo(string?fullpath?byte[]?byteArray)
{
using(?FileStream?fs?=?new?FileStream(fullpath?FileMode.Create?FileAccess.Write)?)
{
fs.Write(byteArray?0?byteArray.Length);
}
}

public?string?SaveTextureAs(Texture2D?texture2D?SaveFormat?format?=?SaveFormat.JPG)
{
string?savePath?=?string.Empty;
switch(format)
{
case?SaveFormat.JPG:
savePath?=?GetJpgFullPath?();
Debug.Log?(“savePath?is:?“+savePath);
WriteBytesToFile(savePath?texture2D.EncodeToJPG(90));
break;
case?SaveFormat.PNG:
savePath?=?GetPngFullPath();
WriteBytesToFile(savePath?texture2D.EncodeToPNG());
break;
case?SaveFormat.GIF:
//savePath?=?ProGifTexture2DsToGIF.Instance.Save(new?List{texture2D}?texture2D.width?texture2D.height?1?0?10);
break;
}
return?savePath;
}

// public?string?SaveTexturesAsGIF(List?textureList?int?width?int?height?int?fps?int?loop?int?quality
// Action?onFileSaved?=?null?Action?onFileSaveProgress?=?null?
// ProGifTexture2DsToGIF.ResolutionHandle?resolutionHandle?=?ProGifTexture2DsToGIF.ResolutionHandle.ResizeKeepRatio)
// {
// return?ProGifTexture2DsToGIF.Instance.Save(textureList?width?height?fps?loop?quality?onFileSaved?onFileSaveProgress

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????117072??2017-10-28?22:37??SWAN?Dev\3rd?Party\Fonts\DroidSansMono.ttf

????..A..H.???????344??2017-10-28?22:37??SWAN?Dev\3rd?Party\Fonts\DroidSansMono.ttf.meta

????..A..H.???????193??2017-10-28?22:37??SWAN?Dev\3rd?Party\Fonts.meta

????..A..H.???????193??2017-10-28?22:37??SWAN?Dev\3rd?Party.meta

?????文件???????3031??2018-02-09?17:16??SWAN?Dev\Common\FilePathName.cs

????..A..H.???????264??2017-10-28?22:37??SWAN?Dev\Common\FilePathName.cs.meta

?????文件???????3392??2017-10-28?22:37??SWAN?Dev\Common\SDemoAnimation.cs

????..A..H.???????264??2017-10-28?22:37??SWAN?Dev\Common\SDemoAnimation.cs.meta

?????文件???????1025??2017-10-28?22:37??SWAN?Dev\Common\SelfAnimation.cs

????..A..H.???????264??2017-10-28?22:37??SWAN?Dev\Common\SelfAnimation.cs.meta

????..A..H.???????193??2017-10-28?22:37??SWAN?Dev\Common.meta

?????文件?????240484??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\001.jpg

????..A..H.??????2294??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\001.jpg.meta

?????文件?????453943??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\002.jpg

????..A..H.??????2294??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\002.jpg.meta

?????文件?????159981??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\003.jpg

????..A..H.??????2294??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\003.jpg.meta

?????文件?????358097??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\004.jpg

????..A..H.??????2294??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\004.jpg.meta

?????文件?????540128??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\005.jpg

????..A..H.??????2294??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo\005.jpg.meta

????..A..H.???????193??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images\Photo.meta

????..A..H.???????193??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Images.meta

?????文件???????2454??2018-02-09?16:51??SWAN?Dev\ScreenshotHelper\Materials\SpriteDefault.mat

????..A..H.???????181??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Materials\SpriteDefault.mat.meta

?????文件???????2454??2018-02-09?16:51??SWAN?Dev\ScreenshotHelper\Materials\SpriteDiffuse.mat

????..A..H.???????181??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Materials\SpriteDiffuse.mat.meta

????..A..H.???????193??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Materials.meta

?????文件??????25437??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Readme?-?Screenshot?Helper?1.02.pdf

????..A..H.???????176??2017-10-28?22:37??SWAN?Dev\ScreenshotHelper\Readme?-?Screenshot?Helper?1.02.pdf.meta

............此處省略26個文件信息

評論

共有 條評論

相關資源