Ejemplo n.º 1
0
 public void Init(SaveInfo save)
 {
     this.CurrentHasEquipments = save.PlayerInfoModel.CurrentHasEquipments;
     this.Info            = save.PlayerInfoModel.Info;
     this.FinishTaskIds   = save.PlayerInfoModel.FinishTaskIds;
     this.CurrentTaskIds  = save.PlayerInfoModel.CurrentTaskIds;
     this.CurrentHasItems = save.PlayerInfoModel.CurrentHasItems;
     this.Gold            = save.PlayerInfoModel.Gold;
     this.Silver          = save.PlayerInfoModel.Silver;
     this.Copper          = save.PlayerInfoModel.Copper;
     this.Experience      = save.PlayerInfoModel.Experience;
 }
        public override void Execute()
        {
            SaveInfo save = new SaveInfo(Transform.position, Transform.rotation.eulerAngles);

            save.PlayerInfoModel = PlayerInfoModel;
            if (!Directory.Exists(Application.dataPath + "/../Save"))
            {
                Directory.CreateDirectory(Application.dataPath + "/../Save");
            }
            using (var fs = File.Create(Application.dataPath + "/../Save/SaveInfo.bin"))//序列化存档
            {
                Serializer.Serialize <SaveInfo>(fs, save);
            }
        }