Пример #1
0
 public PlayerInf(PlayerInf_Profile profile)
 {
     this.lv        = profile.lv;
     this.moneyLeft = profile.moneyLeft;
     this.army      = new List <RoleRecord>();
     foreach (RoleRecord_profile rp in profile.roleRecords)
     {
         this.army.Add(new RoleRecord(rp));
         army[army.Count - 1].index = (army.Count - 1);
     }
     this.itemInBag = profile.itemInBag;
 }
Пример #2
0
    public static PlayerInf loadInf()
    {
        var    filePath      = Application.persistentDataPath + "/" + fileName;
        string serizliedData = (null);

        try
        {
            var bytes = File.ReadAllBytes(filePath);
            serizliedData = System.Text.Encoding.UTF8.GetString(bytes);
        }
        catch (System.IO.FileNotFoundException)
        {
            return(null);
        }
        Debug.Log("serizlied Data:" + serizliedData);
        PlayerInf_Profile profile = JsonMapper.ToObject <PlayerInf_Profile>(serizliedData);

        return(new PlayerInf(profile));
    }