Пример #1
0
    public string SaveData()
    {
        PlayerSave      playerSave = new PlayerSave(Player);
        List <DormSave> dormSaves  = dorm.Save();
        PosSave         playerPos  = new PosSave(Pos.position, MapEvents.ActiveMap, MapEvents.CurrentMap.transform.name);
        HomeSave        homeSave   = StartHomeStats.Save();
        VoreSaves       voreSaves  = voreChar.Save;
        FullSave        fullSave   = new FullSave(playerSave, playerPos, dormSaves, homeSave, voreSaves, MapEvents.GetMapEvents.GetTeleportSaves());

        Debug.Log(JsonUtility.ToJson(fullSave));

        return(JsonUtility.ToJson(fullSave));
    }
Пример #2
0
    public void LoadData(string json)
    {
        FullSave fullSave = JsonUtility.FromJson <FullSave>(json);

        // Singleton static
        // Reference
        JsonUtility.FromJsonOverwrite(fullSave.PlayerPart.Who, Player);
        StartHomeStats.Load(fullSave.HomePart);
        dorm.Load(fullSave.DormPart);
        voreChar.Load(fullSave.VoreSaves, Player);
        // Pure static
        DateSystem.Load(fullSave.DatePart);
        QuestsSystem.Load(fullSave.QuestSave);
        PlayerFlags.Load(fullSave.PlayerFlagsSave);
        MapEvents.GetMapEvents.Load(fullSave.PosPart, fullSave.TeleportSaves);
        GameManager.Load(fullSave.GameManagerSave);
        EventLog.ClearLog();
        LoadEvent?.Invoke();
    }