SchoolFightingSimple/Assets/Scripts/JsonManager.cs

25 lines
705 B
C#

using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class JsonManager : MonoBehaviour
{
public static string JsonDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ZData", "SmallSchoolPlatformer");
public static int SelectedSave = 0;
public int Save { get; set; }
public static Charecter LoadChar()
{
string json = File.ReadAllText(Path.Combine(JsonDir, $"Save_{SelectedSave}.json"));
Charecter charecter = JsonConvert.DeserializeObject<Charecter>(json);
return charecter;
}
}
public class Charecter
{
public int x, y, z;
}