Danro/Assets/Scripts/Settings/_sega/SettingsManager.cs
Danil Iarosh 98d5285b46 feat(logging): add advanced logging example with file output
- Created AdvancedLoggingExample class demonstrating composite and file loggers
- Implemented multi-file logging setup with separate error and full logs
- Added game event and performance logging methods
- Included key input handling for log operations (flush, clear)
- Setup proper resource disposal on application quit
2025-11-07 14:12:50 +03:00

137 lines
4.9 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.

// using System.Text;
// using System.Collections.Generic;
// using UnityEngine;
// using UnityEngine.Events;
//
// using RR.Common.Behaviour.ScriptableObjects;
//
// public class SettingsManager : MonoBehaviour
// {
// public static SettingsManager instance;
// public GameSettings gameSettings;
// const string SETTINGS_PREFS_KEY = "SETTINGS";
// int ActualHash => settingsHash(getDefaultSettings());
//
// public UnityEvent OnSettingsChanged;
//
// private void Awake()
// {
// instance ??= this;
// OnSettingsChanged = new UnityEvent();
//
// LoadOrCreateSettings();
// }
// private void LoadOrCreateSettings()
// {
// bool shouldLoadDefault = !PlayerPrefs.HasKey(SETTINGS_PREFS_KEY) || !IsSavedSettingsValid();
//
// if (shouldLoadDefault)
// {
// LoadDefaultSettings();
// }
// else
// {
// LoadSettings();
// }
//
// bool IsSavedSettingsValid()
// {
// LoadSettings();
// return gameSettings.hash == ActualHash;
// }
// }
//
// public void ChangeSetting(string settingName, int newIndex)
// {
// var setting = gameSettings.GetSetting(settingName);
// if (setting != null && newIndex >= 0 && newIndex < setting.options.Count)
// {
// setting.chosenIndex = newIndex;
// SaveSettings();
// }
// }
// public void SaveSettings()
// {
// string json = JsonUtility.ToJson(gameSettings);
//
// PlayerPrefs.SetString(SETTINGS_PREFS_KEY, json);
// PlayerPrefs.Save();
// OnSettingsChanged?.Invoke();
// }
//
// public string GetSettingValue(string settingName)
// => gameSettings.GetSetting(settingName).ChosenOption;
//
//
// int settingsHash(List<SettingOption> settings)
// {
// StringBuilder sb = new StringBuilder();
// foreach (SettingOption settingOption in settings)
// {
// sb.Append(settingOption.settingName);
// foreach (string option in settingOption.options)
// {
// sb.Append(option);
// }
// }
//
// int hash = sb.ToString().GetHashCode();
// return hash;
// }
//
// void LoadDefaultSettings()
// {
// //print("Загрузка стандартных настроек");
//
// gameSettings.settings = getDefaultSettings();
// gameSettings.hash = settingsHash(gameSettings.settings);
//
// SaveSettings();
// }
//
// List<SettingOption> getDefaultSettings()
// {
// List<SettingOption> settings = new List<SettingOption>();
//
// settings.Add(new SettingOption(settingName: "Громкость музыки",
// options: new List<string>() { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" },
// defaultIndex: 1));
//
// settings.Add(new SettingOption(settingName: "Громкость эффектов",
// options: new List<string>() { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" },
// defaultIndex: 8));
//
// settings.Add(new SettingOption(settingName: "Выдача призов при игре с ботом",
// options: new List<string>() { "Выдавать", "Не выдавать" },
// defaultIndex: 0));
//
// settings.Add(new SettingOption(settingName: "Озвучка персонажей",
// options: new List<string>() { "Вкл", "Выкл" },
// defaultIndex: 0));
//
// settings.Add(new SettingOption(settingName: "Сложность ботов",
// options: new List<string>() { "Легкая", "Средняя", "Сложная" },
// defaultIndex: 1));
//
// settings.Add(new SettingOption(settingName: "Бесплатная игра",
// options: new List<string>() { "Вкл", "Выкл" },
// defaultIndex: 1));
//
// settings.Add(new SettingOption(settingName: "Показывать контакты администрации",
// options: new List<string>() { "Вкл", "Выкл" },
// defaultIndex: 0));
// return settings;
// }
//
//
// void LoadSettings()
// {
// string json = PlayerPrefs.GetString(SETTINGS_PREFS_KEY);
// gameSettings = JsonUtility.FromJson<GameSettings>(json);
//
// SaveSettings();
// }
//
//
//
// }