Автосборка настроек типа вкл/выкл
Реализована генерация разметки для настроек типа вкл/выкл
This commit is contained in:
parent
3c04f0d590
commit
701bc8c6eb
@ -12,7 +12,16 @@ public class SettingsToHtml : MonoBehaviour
|
||||
sb.AppendLine("Настройки фишки:");
|
||||
foreach (Setting setting in settings)
|
||||
{
|
||||
sb.AppendLine($"<p>{setting.Alias}: {GetStringSettingValue(setting)}</p>");
|
||||
|
||||
if(setting.Type== SettingType.Bool)
|
||||
{
|
||||
string boolView = GetBoolView(setting);
|
||||
sb.AppendLine(boolView);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine($"<p>{setting.Alias}: {GetStringSettingValue(setting)}</p>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,4 +53,25 @@ public class SettingsToHtml : MonoBehaviour
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static string GetBoolView(Setting setting)
|
||||
{
|
||||
string res = string.Empty;
|
||||
res += "<div class=\"form-group\" style=\"border: 2px solid black;border-radius: 5px;\">";
|
||||
|
||||
|
||||
|
||||
res += $"<label for=\"{setting.Id}\">{setting.Alias}</label>";
|
||||
|
||||
string ischecked = setting.BoolValue ? "checked" : "";
|
||||
res += $"<input type=\"checkbox\" name=\"Голосовые реплики\" id=\"{setting.Id}\" {ischecked}>";
|
||||
|
||||
|
||||
res += "</div>";
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user