SchoolFightingSimple/Assets/Scripts/JsonManager.cs

25 lines
705 B
C#
Raw Permalink Normal View History

using Newtonsoft.Json;
2023-08-21 03:58:07 +02:00
using System;
2023-08-18 01:03:41 +02:00
using System.Collections;
using System.Collections.Generic;
2023-08-21 03:58:07 +02:00
using System.IO;
2023-08-18 01:03:41 +02:00
using UnityEngine;
2023-08-20 03:31:31 +02:00
public class JsonManager : MonoBehaviour
2023-08-18 01:03:41 +02:00
{
2023-08-21 03:58:07 +02:00
public static string JsonDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ZData", "SmallSchoolPlatformer");
public static int SelectedSave = 0;
2023-08-18 01:03:41 +02:00
2023-08-21 03:58:07 +02:00
public int Save { get; set; }
public static Charecter LoadChar()
2023-08-18 01:03:41 +02:00
{
string json = File.ReadAllText(Path.Combine(JsonDir, $"Save_{SelectedSave}.json"));
Charecter charecter = JsonConvert.DeserializeObject<Charecter>(json);
return charecter;
2023-08-18 01:03:41 +02:00
}
}
public class Charecter
{
public int x, y, z;
2023-08-18 01:03:41 +02:00
}