Commit cd01177b authored by JiangWanZhi's avatar JiangWanZhi

加载文件的时候不再是读取固定的值了

parent bf849fc1
......@@ -1773,13 +1773,13 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
StartCoroutine(LoadPic(path, $"{CurPicName}", item));
}
IEnumerator LoadPic(string dirpath,string name, GameMgr item)
IEnumerator LoadPic(string dirpath,string key, GameMgr item)
{
Texture2D png = null;
Sprite jpg = null;
Texture2D jpg_texture = null;
string pngpath = dirpath+$"{name}_png.png";
string jpgpath = dirpath + $"{name}_jpg.jpg";
string pngpath = dirpath+$"{key}_png.png";
string jpgpath = dirpath + $"{key}_jpg.jpg";
string loadpath = "";
bool localflag = false;
......@@ -1832,7 +1832,7 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
jpg_texture = www.texture;
}
string binlocalpath = Application.persistentDataPath + $"/MyPic/{name}/{name}_json.bin";
string binlocalpath = Application.persistentDataPath + $"/MyPic/{key}/{key}_json.bin";
ResJsonData jsondata = null;
if (!File.Exists(binlocalpath))
{
......@@ -1848,10 +1848,10 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
}
else
{
jsondata = getdata("cc2D9Z2w9k0evqUiCQ");
jsondata = getdata(key);
}
string bindynamiclocalpath = Application.persistentDataPath + $"/MyPic/{name}/{name}_dynamic.bin";
string bindynamiclocalpath = Application.persistentDataPath + $"/MyPic/{key}/{key}_dynamic.bin";
DynamicData dynamic = null;
if (!File.Exists(bindynamiclocalpath))
{
......@@ -1867,19 +1867,19 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
}
else
{
dynamic = getdynamicdata("cc2D9Z2w9k0evqUiCQ");
dynamic = getdynamicdata(key);
}
if (localflag) //加载本地的到这里就回去了,下面是加载工程;里面的后续跑的
{
item.Init("cc2D9Z2w9k0evqUiCQ", png, jpg, jsondata, dynamic);
item.Init(key, png, jpg, jsondata, dynamic);
yield break;
}
SaveManager.Instance.SaveRes("cc2D9Z2w9k0evqUiCQ", dynamic, png);
SaveManager.Instance.SaveJPG("cc2D9Z2w9k0evqUiCQ", jpg_texture);
SaveManager.Instance.SaveJson("cc2D9Z2w9k0evqUiCQ", jsondata);
SaveManager.Instance.SaveRes(key, dynamic, png);
SaveManager.Instance.SaveJPG(key, jpg_texture);
SaveManager.Instance.SaveJson(key, jsondata);
while (!SaveManager.Instance.IsSaveOver)
{
......@@ -1910,8 +1910,8 @@ public class mainGameView : MonoBehaviour //大图的处理、具体的玩法
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("cc2D9Z2w9k0evqUiCQ");
item.Init("cc2D9Z2w9k0evqUiCQ", png, jpg, jsondata, dynamic);
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