소스 검색

拍照路径

zhaoyang 3 년 전
부모
커밋
f44c93ee69
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographSaveView.cs

+ 3 - 1
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographSaveView.cs

@@ -37,7 +37,7 @@ namespace GFGGame
             string path = Application.persistentDataPath;
 
 #if UNITY_ANDROID
-            path = path + "/万世镜";
+            path = Application.persistentDataPath.IndexOf("Android") > 0 ? path.Substring(0, Application.persistentDataPath.IndexOf("Android")) : path + "/Pictures/万世镜";
 #endif
             //判断目录是否存在,不存在则会创建目录
             if (!Directory.Exists(path))
@@ -50,6 +50,8 @@ namespace GFGGame
             Debug.Log("文件路径:" + path);
             Texture2D tex = this.viewData as Texture2D;
             byte[] bytes = tex.EncodeToPNG();//将纹理数据,转化成一个png图片
+
+            // string path = Application.persistentDataPath.Substring(0, Application.persistentDataPath.IndexOf("Android"));
             File.WriteAllBytes(path, bytes);
             Timers.inst.StartCoroutine(GetSaveState(path));// ();
         }