|
@@ -70,12 +70,18 @@ public class CharacterManager : MonoBehaviour
|
|
|
/// <param name="cr"></param>
|
|
|
public async void GoodsReadFromFile(CharacterRender cr)
|
|
|
{
|
|
|
- string jsonStr = File.ReadAllText(Application.persistentDataPath + "/PlayerGoods.json");
|
|
|
- List<Good> goods = JsonMapper.ToObject<List<Good>>(jsonStr);
|
|
|
- foreach(var item in goods)
|
|
|
+ string path = Application.persistentDataPath + "/PlayerGoods.json";
|
|
|
+
|
|
|
+ if (File.Exists(path))
|
|
|
{
|
|
|
- await ChangePlayerTex(cr, item);
|
|
|
+ string jsonStr = File.ReadAllText(path);
|
|
|
+ List<Good> goods = JsonMapper.ToObject<List<Good>>(jsonStr);
|
|
|
+ foreach (var item in goods)
|
|
|
+ {
|
|
|
+ await ChangePlayerTex(cr, item);
|
|
|
+ }
|
|
|
}
|
|
|
+ else Debug.Log("ûÓÐÕÒµ½PlayerGoods.jsonÎļþ!");
|
|
|
}
|
|
|
public async UniTask ChangePlayerTex (CharacterRender cr, Good config)
|
|
|
{
|