58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SettingsScreen : MonoBehaviour
|
|
{
|
|
[Header("Ссылки")]
|
|
[SerializeField] private SettingGroup GroupPrefab;
|
|
|
|
private bool Generated = false;
|
|
private int activeGroup;
|
|
private int activeSetting;
|
|
private List<SettingGroup> settingsGroups;
|
|
|
|
|
|
//====================
|
|
[Header("Управление")]
|
|
[SerializeField] private Axis switchAxis = Axis.Vertical;
|
|
[SerializeField] private Axis interactAxis = Axis.Horizontal;
|
|
[SerializeField] private PlayerAction intractButton = PlayerAction.action;
|
|
|
|
[SerializeField] private RectTransform Content;
|
|
|
|
private void Start()
|
|
{
|
|
Generate();
|
|
}
|
|
|
|
public void Generate()
|
|
{
|
|
ClearContent();
|
|
settingsGroups = new List<SettingGroup>();
|
|
|
|
foreach (var group in SettingsManager.currentSchemeDTO.groups)
|
|
{
|
|
var generatedGroup = GenerateGroup(group);
|
|
settingsGroups.Add(generatedGroup);
|
|
}
|
|
|
|
activeGroup = 0;
|
|
activeSetting = 0;
|
|
|
|
Generated = true;
|
|
}
|
|
|
|
private SettingGroup GenerateGroup(SettingsGroupDTO groupData)
|
|
{
|
|
var group = Instantiate(GroupPrefab, Content);
|
|
group.Configure(groupData);
|
|
return group;
|
|
}
|
|
|
|
private void ClearContent()
|
|
{
|
|
for (int i = Content.childCount - 1; i >= 0; i--)
|
|
Destroy(Content.GetChild(i).gameObject);
|
|
}
|
|
} |