Playvoi/Assets/ShiroginSDK/Runtime/Modules/Data/Scripts/GameData.cs
2025-10-30 22:48:16 +03:00

50 lines
No EOL
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Assets/ShiroginSDK/Runtime/Data/GameData.cs
using System;
using UnityEngine;
namespace ShiroginSDK.Runtime.Modules.Data.Scripts
{
/// <summary>
/// Tüm oyun verilerini tek JSON dosyada tutan ana sınıf.
/// </summary>
[Serializable]
public class GameData : BaseData
{
// 🔹 Alt veriler
public PlayerData Player = new();
public EconomyData Economy = new();
public StoreData Store = new();
public SettingsData Settings = new();
public RewardData Rewards = new();
public DeviceData Device = new();
public ProgressionData Progression = new();
public InventoryData Inventory = new();
// 🔹 Opsiyonel meta bilgiler
public string LastSaveDate;
public string GameVersion;
public int TotalPlaytimeMinutes;
public ThemeData Theme = new();
protected override string PrefsKey => "GAME_DATA";
public void UpdateMeta()
{
LastSaveDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss");
GameVersion = Application.version;
}
// 🔹 Override Save — alt dataları da dâhil kaydet
public override void Save(bool saveToFile = false)
{
UpdateMeta();
base.Save(saveToFile);
}
// 🔹 Debug JSON output
public override string ToString()
{
return JsonUtility.ToJson(this, true);
}
}
}