Commit 70230318 authored by JiangWanZhi's avatar JiangWanZhi

保存文件修改

parent 48da5d96
......@@ -29,7 +29,7 @@ public class gameUserInfos : MonoBehaviour, IEventHandler
if (utilsTools.ContainsKeyGDataByKey(EventName.DataName.Data_NativeGameData) == false)
{
string json = "{\"append\":\"\",\"classId\":\"1,8,10,14\",\"displayDate\":\"20221102\",\"enterType\":\"0\",\"extraJson\":\"{\\\"cut_height\\\": 0, \\\"refer_drawer\\\": \\\"DoMyzu\\\"}\",\"extraType\":0,\"file\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H.zip\",\"highImg\":\"https://d21z6ifg4bbv2v.cloudfront.net/tspng/cc--EDgRpc_nHQru7H.png\",\"hybridType\":64,\"id\":\"cc--EDgRpc_nHQru7H\",\"originalJson\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsjson/cc--EDgRpc_nHQru7H.json\",\"picAssets\":\"{\\\"pictureBin\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/zsD2ySwS4pJ25frj.p\\\", \\\"pictureThn4\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/V8ZvUuDlOEB7mifd.png\\\", \\\"pictureColorThn4\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc400\\\", \\\"pictureWallThn8\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/oWqHjCo5mQvXIVP_.png\\\", \\\"pictureWallColorThn8\\\": \\\"ccv1/production-pic/20221027/cc--EDgRpc_nHQru7H/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc800\\\"}\",\"pictureBin\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureBin.p\",\"pictureColorThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureColorThn4.jpg\",\"pictureThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/cc--EDgRpc_nHQru7H_pictureThn4.png\",\"schedule\":0,\"seriesName\":\"\",\"sid\":2967,\"sort\":80,\"type\":6}";
json = json.Replace( "cc--EDgRpc_nHQru7H", "cc3W3C7u7UGXjwYQdn");
json = json.Replace( "cc--EDgRpc_nHQru7H", "cc2D9Z2w9k0evqUiCQ");
utilsTools.setGDataByKey(EventName.DataName.Data_NativeGameData, JsonUtility.FromJson<netLableImageItem>(json));
}
......
......@@ -4,31 +4,40 @@ using UnityEngine;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
public class FileUtility : MonoBehaviour
public class SaveManager : MonoBehaviour
{
private static FileUtility instance;
private static SaveManager instance;
public static FileUtility Instance => instance;
public static SaveManager Instance => instance;
private string savepath;
private string SavePath
public string SavePath
{
get
{
return Application.dataPath+$"/Resources/cc2D9Z2w9k0evqUiCQ/"; //暂时先用这里的
}
set { savepath = value; }
}
private void Awake()
{
instance = this;
}
public void SaveBin(string pngname,ResJsonData data)
{
string json= JsonUtility.ToJson(data);
SaveBin(pngname,json);
}
/// <summary>
/// 保存bin文件
/// </summary>
/// <param name="path"></param>
/// <param name="json"></param>
public void SaveBin(string name,string json)
public void SaveBin(string pngname, string json)
{
FileStream fs = new FileStream(SavePath+$"{name}.bin", FileMode.Create, FileAccess.Write);
......@@ -61,4 +70,24 @@ public class FileUtility : MonoBehaviour
fs.Flush();
fs.Close();
}
public void SaveJPG(Texture2D png)
{
//var colors = png.GetPixels();
//for (int i = 0; i < png.width; i+=2)
//{
// for (int j = 0; j < png.height; j+=2)
// {
// png.SetPixel(i, j, new Color(1, 1, 1, 1));
// }
//}
//png.Apply();
byte[] dataBytes = png.EncodeToPNG();
FileStream fs = File.Open(SavePath + $"{png.name}.jpg", FileMode.OpenOrCreate);
fs.Write(dataBytes, 0, dataBytes.Length);
fs.Flush();
fs.Close();
}
}
......@@ -27,6 +27,9 @@ EditorUserSettings:
value: 0752045f560d5a025a0b5f7b12250e44424f407b757b7e612b7d4e61b3e13061
flags: 0
RecentlyUsedSceneGuid-7:
value: 02540c5f520c59595d5b097411710c4417154c297c7f24312c7b4462e6e16c61
flags: 0
RecentlyUsedSceneGuid-8:
value: 5350045f5c07085d085b5a2013205a4444154f7a7e7e7f342e281866e1b7676e
flags: 0
UnityEditor.ShaderGraph.Blackboard:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment