using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Text; using UnityEngine; public class SettingsToHtml : MonoBehaviour { public static string GetSettingsString(List settings) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Настройки фишки:"); sb.AppendLine("
"); foreach (Setting setting in settings) { if(setting.Type== SettingType.Bool) { string boolView = GetBoolView(setting); sb.AppendLine(boolView); } else if(setting.Type == SettingType.Float) { string view = GetFloatView(setting); sb.AppendLine(view); } else { sb.AppendLine($"

{setting.Alias}: {GetStringSettingValue(setting)}

"); } } sb.AppendLine(""); sb.AppendLine("
"); return sb.ToString(); } private static string GetStringSettingValue(Setting setting) { if (setting.Type == SettingType.Bool) { return setting.BoolValue ? "true" : "false"; } else if (setting.Type == SettingType.String) { return setting.StringValue; } else if (setting.Type == SettingType.Int) { return setting.IntValue.ToString(); } else if (setting.Type == SettingType.Float) { return setting.FloatValue.ToString(); } else { return "Непонятый гений..."; } } private static string GetBoolView(Setting setting) { string res = string.Empty; res += "
"; res += $""; string ischecked = setting.BoolValue ? "checked" : ""; res += $""; res += "
"; return res; } private static string GetFloatView(Setting setting) { string res = string.Empty; res += "
"; res += $""; //res += $""; res += $""; res += "
"; return res; } }