Commit c00ca85d authored by JiangWanZhi's avatar JiangWanZhi

去掉加载工程文件的测试代码

parent 1621a71a
...@@ -84,7 +84,7 @@ public class Native : MonoBehaviour ...@@ -84,7 +84,7 @@ public class Native : MonoBehaviour
Debug.Log("JSON:" + json); Debug.Log("JSON:" + json);
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 = "{\"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}";
string name = "ccgCTqoiwmXnQ1RGBb"; string name = "cc0pwJCtz_oyKIWTCq";
json = json.Replace("cc--EDgRpc_nHQru7H", name); json = json.Replace("cc--EDgRpc_nHQru7H", name);
//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/ccnKNH1bTLS-_Mg7A2.zip\",\"highImg\":\"https://d21z6ifg4bbv2v.cloudfront.net/tspng/ccnKNH1bTLS-_Mg7A2.png\",\"hybridType\":64,\"id\":\"ccnKNH1bTLS-_Mg7A2\",\"originalJson\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsjson/ccnKNH1bTLS-_Mg7A2.json\",\"picAssets\":\"{\\\"pictureBin\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/zsD2ySwS4pJ25frj.p\\\", \\\"pictureThn4\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/V8ZvUuDlOEB7mifd.png\\\", \\\"pictureColorThn4\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc400\\\", \\\"pictureWallThn8\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/oWqHjCo5mQvXIVP_.png\\\", \\\"pictureWallColorThn8\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc800\\\"}\",\"pictureBin\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureBin.p\",\"pictureColorThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureColorThn4.jpg\",\"pictureThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureThn4.png\",\"schedule\":0,\"seriesName\":\"\",\"sid\":2967,\"sort\":80,\"type\":6}"; //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/ccnKNH1bTLS-_Mg7A2.zip\",\"highImg\":\"https://d21z6ifg4bbv2v.cloudfront.net/tspng/ccnKNH1bTLS-_Mg7A2.png\",\"hybridType\":64,\"id\":\"ccnKNH1bTLS-_Mg7A2\",\"originalJson\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsjson/ccnKNH1bTLS-_Mg7A2.json\",\"picAssets\":\"{\\\"pictureBin\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/zsD2ySwS4pJ25frj.p\\\", \\\"pictureThn4\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/V8ZvUuDlOEB7mifd.png\\\", \\\"pictureColorThn4\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc400\\\", \\\"pictureWallThn8\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/oWqHjCo5mQvXIVP_.png\\\", \\\"pictureWallColorThn8\\\": \\\"ccv1/production-pic/20221027/ccnKNH1bTLS-_Mg7A2/IDdMO8yT0fPPhUtU.jpg?x-oss-process\\u003dstyle/cc800\\\"}\",\"pictureBin\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureBin.p\",\"pictureColorThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureColorThn4.jpg\",\"pictureThn4\":\"https://d21z6ifg4bbv2v.cloudfront.net/tsgame/ccnKNH1bTLS-_Mg7A2_pictureThn4.png\",\"schedule\":0,\"seriesName\":\"\",\"sid\":2967,\"sort\":80,\"type\":6}";
//#endif //#endif
......
...@@ -1784,164 +1784,55 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法 ...@@ -1784,164 +1784,55 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
string mappath = dirpath + $"{key}_map.png"; string mappath = dirpath + $"{key}_map.png";
string loadpath = ""; string loadpath = "";
bool localflag = false; loadpath = pngpath;
if (File.Exists(pngpath)) //有保存过图片
{
localflag = true;
UnityWebRequest request_png = UnityWebRequestTexture.GetTexture(pngpath);
loadpath = pngpath;
#if UNITY_ANDROID #if UNITY_ANDROID
loadpath = "file://" + pngpath; loadpath = "file://" + pngpath;
#endif #endif
var file_png = new WWW(loadpath); var file_png = new WWW(loadpath);
yield return file_png; yield return file_png;
if (file_png.isDone) if (file_png.isDone)
{
png = file_png.texture;
}
}
else
{ {
string path = Application.streamingAssetsPath + $"/{key}/{key}_png.png"; png = file_png.texture;
WWW www = new WWW(path);
yield return www;
png = www.texture;
} }
loadpath = jpgpath;
if (File.Exists(jpgpath))
{
loadpath = jpgpath;
#if UNITY_ANDROID #if UNITY_ANDROID
loadpath = "file://" + jpgpath; loadpath = "file://" + jpgpath;
#endif #endif
var file_jpg = new WWW(loadpath); var file_jpg = new WWW(loadpath);
yield return file_jpg; yield return file_jpg;
if (file_jpg.isDone) if (file_jpg.isDone)
{ {
jpg_texture = file_jpg.texture; jpg_texture = file_jpg.texture;
jpg = Sprite.Create(jpg_texture, new Rect(0, 0, jpg_texture.width, jpg_texture.height), new Vector2(0.5f, 0.5f)); jpg = Sprite.Create(jpg_texture, new Rect(0, 0, jpg_texture.width, jpg_texture.height), new Vector2(0.5f, 0.5f));
}
}
else
{
string path = Application.streamingAssetsPath + $"/{key}/{key}_jpg.jpg";
WWW www = new WWW(path);
yield return www;
jpg_texture = www.texture;
} }
if (File.Exists(mappath))
{
UnityWebRequest request_map = UnityWebRequestTexture.GetTexture(mappath);
loadpath = mappath; loadpath = mappath;
#if UNITY_ANDROID #if UNITY_ANDROID
loadpath = "file://" + mappath; loadpath = "file://" + mappath;
#endif #endif
var file_map = new WWW(loadpath); var file_map = new WWW(loadpath);
yield return file_map; yield return file_map;
if (file_map.isDone) if (file_map.isDone)
{
map = file_map.texture;
}
}
else
{ {
string path = Application.streamingAssetsPath + $"/{key}/{key}_map.png"; map = file_map.texture;
WWW www = new WWW(path);
yield return www;
map = www.texture;
} }
string binlocalpath = Application.persistentDataPath + $"/MyPic/{key}/{key}_json.bin"; string binlocalpath = Application.persistentDataPath + $"/MyPic/{key}/{key}_json.bin";
ResJsonData jsondata = null; ResJsonData jsondata = getdata(key);
if (!File.Exists(binlocalpath))
{
string path = Application.streamingAssetsPath + $"/{key}/{key}_json.bin";
WWW www = new WWW(path);
while (!www.isDone)
{
}
MemoryStream stream = new MemoryStream(www.bytes);
//二进制反序列化
BinaryFormatter bf = new BinaryFormatter();
jsondata = (ResJsonData)bf.Deserialize(stream);
}
else
{
jsondata = getdata(key);
}
string bindynamiclocalpath = Application.persistentDataPath + $"/MyPic/{key}/{key}_dynamic.bin"; string bindynamiclocalpath = Application.persistentDataPath + $"/MyPic/{key}/{key}_dynamic.bin";
DynamicData dynamic = null; DynamicData dynamic = getdynamicdata(key);
if (!File.Exists(bindynamiclocalpath))
{
string path = Application.streamingAssetsPath + $"/{key}/{key}_dynamic.bin";
WWW www = new WWW(path);
while (!www.isDone)
{
}
MemoryStream stream = new MemoryStream(www.bytes);
//二进制反序列化
BinaryFormatter bf = new BinaryFormatter();
dynamic = (DynamicData)bf.Deserialize(stream);
}
else
{
dynamic = getdynamicdata(key);
}
if (localflag) //加载本地的到这里就回去了,下面是加载工程;里面的后续跑的 System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
{ sw.Start();
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
item.Init(key, png, jpg, jsondata, dynamic, map);
sw.Start();
GroupListManager.Instance.Init_Text.text = $"初始化消耗时间:{sw.ElapsedMilliseconds}";
yield break;
}
SaveManager.Instance.SaveRes(key, dynamic, png);
SaveManager.Instance.SaveJPG(key, jpg_texture);
SaveManager.Instance.SaveMap(key, map);
SaveManager.Instance.SaveJson(key, jsondata);
while (!SaveManager.Instance.IsSaveOver)
{
yield return null;
}
item.Init(key, png, jpg, jsondata, dynamic, map); item.Init(key, png, jpg, jsondata, dynamic, map);
sw.Start();
GroupListManager.Instance.Init_Text.text = $"初始化消耗时间:{sw.ElapsedMilliseconds}";
//加载本地的
// loadpath = pngpath;
//#if UNITY_ANDROID
// loadpath = "file://" + pngpath;
//#endif
// var www_png = new WWW(pngpath);
// yield return www_png;
// if (www_png.isDone)
// {
// png = www_png.texture;
// }
// loadpath = jpgpath;
//#if UNITY_ANDROID
// loadpath = "file://" + jpgpath;
//#endif
// var www_jpg = new WWW(jpgpath);
// yield return www_jpg;
// if (www_jpg.isDone)
// {
// jpg_texture = www_jpg.texture;
// jpg = Sprite.Create(jpg_texture, new Rect(0, 0, jpg_texture.width, jpg_texture.height), new Vector2(0.5f, 0.5f));
// }
// jsondata = getdata(key);
// item.Init(name, png, jpg, jsondata, dynamic);
} }
......
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