67 lines
No EOL
1.5 KiB
C#
67 lines
No EOL
1.5 KiB
C#
// Assets/ShiroginSDK/Runtime/Data/SettingsData.cs
|
|
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace ShiroginSDK.Runtime.Modules.Data.Scripts
|
|
{
|
|
[Serializable]
|
|
public class SettingsData : BaseData
|
|
{
|
|
[Range(0f, 1f)]
|
|
public float MusicVolume = 0.7f;
|
|
|
|
[Range(0f, 1f)]
|
|
public float SfxVolume = 0.7f;
|
|
|
|
public bool Vibration = true;
|
|
public bool NotificationsEnabled = true;
|
|
public string LanguageCode = "en"; // "tr", "en", vb.
|
|
public int GraphicsQualityIndex = 2; // kendi QualitySettings haritanla eşle
|
|
|
|
public int TargetFps = 60;
|
|
protected override string PrefsKey => "SETTINGS_DATA";
|
|
|
|
public void SetMusicVolume(float v)
|
|
{
|
|
MusicVolume = Mathf.Clamp01(v);
|
|
Save();
|
|
}
|
|
|
|
public void SetSfxVolume(float v)
|
|
{
|
|
SfxVolume = Mathf.Clamp01(v);
|
|
Save();
|
|
}
|
|
|
|
public void SetVibration(bool on)
|
|
{
|
|
Vibration = on;
|
|
Save();
|
|
}
|
|
|
|
public void SetNotifications(bool on)
|
|
{
|
|
NotificationsEnabled = on;
|
|
Save();
|
|
}
|
|
|
|
public void SetLanguage(string code)
|
|
{
|
|
LanguageCode = code;
|
|
Save();
|
|
}
|
|
|
|
public void SetGraphicsQuality(int index)
|
|
{
|
|
GraphicsQualityIndex = Mathf.Max(0, index);
|
|
Save();
|
|
}
|
|
|
|
public void SetTargetFps(int fps)
|
|
{
|
|
TargetFps = Mathf.Max(30, fps);
|
|
Save();
|
|
}
|
|
}
|
|
} |