Прокинул управление настройками через In
This commit is contained in:
parent
0235aa45ff
commit
b3e9c1952c
@ -584,8 +584,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: -20, y: -80}
|
||||
m_SizeDelta: {x: -839.99994, y: 562.7}
|
||||
m_AnchoredPosition: {x: -17.234985, y: -80}
|
||||
m_SizeDelta: {x: -845.52997, y: 562.7}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1514098326
|
||||
MonoBehaviour:
|
||||
@ -840,6 +840,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: c0343bffc1f51dc4ea7c7d3dc9fc25bf, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::SettingsScreen
|
||||
NextSetting: 2
|
||||
PreviousSetting: 0
|
||||
ChangeSettingPositive: 1
|
||||
ChangeSettingNegative: 3
|
||||
GroupViewPrefab: {fileID: 5195463367869704542, guid: d0e462ba641f9114da23886885450b5f, type: 3}
|
||||
pointer: {fileID: 1647539554}
|
||||
scrollRect: {fileID: 1514098326}
|
||||
|
||||
@ -4,9 +4,15 @@ using UnityEngine.UI;
|
||||
|
||||
public class SettingsScreen : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private SettingGroupView GroupViewPrefab;
|
||||
[SerializeField] RectTransform pointer;
|
||||
[Header("Управление")]
|
||||
[SerializeField] private InSignal NextSetting;
|
||||
[SerializeField] private InSignal PreviousSetting;
|
||||
[SerializeField] private InSignal ChangeSettingPositive;
|
||||
[SerializeField] private InSignal ChangeSettingNegative;
|
||||
|
||||
[Header("Ссылки")]
|
||||
[SerializeField] private SettingGroupView GroupViewPrefab;
|
||||
[SerializeField] private RectTransform pointer;
|
||||
[SerializeField] private ScrollRect scrollRect;
|
||||
[SerializeField] private RectTransform Content;
|
||||
|
||||
@ -28,13 +34,18 @@ public class SettingsScreen : MonoBehaviour
|
||||
private void Update()
|
||||
{
|
||||
if (!Generated) return;
|
||||
int dir;
|
||||
|
||||
// Навигация по элементам
|
||||
if (Input.GetKeyDown(KeyCode.Space)) SwitchItem();
|
||||
// Навигация по настройкам
|
||||
dir = 0;
|
||||
if (In.GetButtonDown(PreviousSetting)) dir -= 1;
|
||||
if (In.GetButtonDown(NextSetting)) dir += 1;
|
||||
SwitchItem(dir);
|
||||
|
||||
int dir = 0;
|
||||
if (Input.GetKey(KeyCode.LeftArrow)) dir -= 1;
|
||||
if (Input.GetKey(KeyCode.RightArrow)) dir += 1;
|
||||
//Взаимодействие с настройками
|
||||
dir = 0;
|
||||
if (In.GetButton(ChangeSettingNegative)) dir -= 1;
|
||||
if (In.GetButton(ChangeSettingPositive)) dir += 1;
|
||||
SelectedSetting.InteractView(dir);
|
||||
|
||||
// Плавный скролл к выбранному элементу
|
||||
@ -45,22 +56,29 @@ public class SettingsScreen : MonoBehaviour
|
||||
DisplayPointer();
|
||||
}
|
||||
|
||||
void SwitchItem()
|
||||
void SwitchItem(int direction)
|
||||
{
|
||||
activeSetting++;
|
||||
if (direction == 0) return;
|
||||
|
||||
activeSetting += direction;
|
||||
SettingGroupView currentGroup = settingsGroups[activeGroup];
|
||||
|
||||
|
||||
|
||||
//Выход за пределы группы (верхний предел)
|
||||
if (activeSetting > currentGroup.GeneratedSettingViews.Count - 1)
|
||||
{
|
||||
activeGroup = (activeGroup + 1 + settingsGroups.Count) % settingsGroups.Count;
|
||||
activeSetting = 0;
|
||||
}
|
||||
//Выход за пределы группы (нижний предел)
|
||||
else if (activeSetting < 0)
|
||||
{
|
||||
activeGroup = (activeGroup - 1 + settingsGroups.Count) % settingsGroups.Count;
|
||||
activeSetting = settingsGroups[activeGroup].GeneratedSettingViews.Count - 1;
|
||||
}
|
||||
|
||||
UpdateScrollTarget();
|
||||
|
||||
// Отладка
|
||||
Debug.Log($"Switched to Group: {activeGroup}, Setting: {activeSetting}");
|
||||
}
|
||||
|
||||
void DisplayPointer()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user