|
@@ -1,3 +1,4 @@
|
|
|
|
+using System.Collections;
|
|
using System.IO;
|
|
using System.IO;
|
|
using FairyGUI;
|
|
using FairyGUI;
|
|
using UI.DressUp;
|
|
using UI.DressUp;
|
|
@@ -31,13 +32,12 @@ namespace GFGGame
|
|
}
|
|
}
|
|
private void OnClickBtnSave()
|
|
private void OnClickBtnSave()
|
|
{
|
|
{
|
|
- Texture2D tex = this.viewData as Texture2D;
|
|
|
|
- byte[] bytes = tex.EncodeToPNG();//将纹理数据,转化成一个png图片
|
|
|
|
|
|
|
|
- string path = Application.persistentDataPath + "/wanshijing";
|
|
|
|
|
|
+
|
|
|
|
+ string path = Application.persistentDataPath;
|
|
|
|
|
|
#if UNITY_ANDROID
|
|
#if UNITY_ANDROID
|
|
- path = "/sdcard/DCIM/wanshijing";
|
|
|
|
|
|
+ path = path + "/万世镜";
|
|
#endif
|
|
#endif
|
|
//判断目录是否存在,不存在则会创建目录
|
|
//判断目录是否存在,不存在则会创建目录
|
|
if (!Directory.Exists(path))
|
|
if (!Directory.Exists(path))
|
|
@@ -47,10 +47,19 @@ namespace GFGGame
|
|
string fileName = DateUtils.Instance.GetCurTime() + ".png";
|
|
string fileName = DateUtils.Instance.GetCurTime() + ".png";
|
|
path = path + "/" + fileName;
|
|
path = path + "/" + fileName;
|
|
|
|
|
|
- Debug.Log("文件路径:" + fileName);
|
|
|
|
- //存图片
|
|
|
|
- System.IO.File.WriteAllBytes(fileName, bytes);//写入数据
|
|
|
|
- PromptController.Instance.ShowFloatTextPrompt("保持成功");
|
|
|
|
|
|
+ Debug.Log("文件路径:" + path);
|
|
|
|
+ Texture2D tex = this.viewData as Texture2D;
|
|
|
|
+ byte[] bytes = tex.EncodeToPNG();//将纹理数据,转化成一个png图片
|
|
|
|
+ File.WriteAllBytes(path, bytes);
|
|
|
|
+ Timers.inst.StartCoroutine(GetSaveState(path));// ();
|
|
|
|
+ }
|
|
|
|
+ private IEnumerator GetSaveState(string path)
|
|
|
|
+ {
|
|
|
|
+ yield return new WaitForEndOfFrame();
|
|
|
|
+ if (File.Exists(path))
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("保存成功");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
{
|
|
{
|