50 lines
No EOL
1.4 KiB
C#
50 lines
No EOL
1.4 KiB
C#
// 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);
|
||
}
|
||
}
|
||
} |