コード例 #1
0
 public ClubRoomUpgradeData(ClubRoomUpgrade upgrade)
 {
     mUnlockLevel        = upgrade.UnlockLevel;
     mIsEnabled          = upgrade.IsEnabled;
     mIsOwned            = upgrade.IsOwned;
     mPurchaseCost       = upgrade.PurchaseCost;
     mTicketPurchaseCost = upgrade.TicketPurchaseCost;
     mPosition           = upgrade.Position;
 }
コード例 #2
0
        public static void SaveUpgrade(ClubRoomUpgrade upgrade)
        {
            string path = Application.persistentDataPath + "/" + upgrade.Position + "Upgrade.sav";

            using (FileStream stream = File.Open(path, FileMode.OpenOrCreate, FileAccess.Write))
            {
                stream.Position = 0;

                ClubRoomUpgradeData upgradeData = new ClubRoomUpgradeData(upgrade);

                string dataAsJson = JsonUtility.ToJson(upgradeData);

                using (StreamWriter streamWriter = new StreamWriter(stream))
                {
                    streamWriter.WriteLine(dataAsJson);

                    stream.SetLength(stream.Position);
                    streamWriter.Close();
                    stream.Close();
                }
            }
        }