From 12132ee3ac577808e9052f5328a11a73b72ea533 Mon Sep 17 00:00:00 2001 From: sega Date: Thu, 20 Aug 2026 16:45:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/BaseSettingView.cs | 1 + .../ВыручкаДоСброса сложности.asset | 3 +- Assets/MNumberStepper.cs | 96 ++++- Assets/NewSettingViews/BoolSetting.prefab | 37 ++ Assets/NewSettingViews/FloatSetting.prefab | 39 +- Assets/NewSettingViews/IntSetting.prefab | 57 +++ Assets/NewSettingViews/SignalSetting.prefab | 49 ++- Assets/NewSettingViews/StringSetting.prefab | 49 +++ Assets/NumberStepper.prefab | 29 +- Assets/Scenes/GameScene3D.unity | 351 +++++++++++------- Assets/Scripts/Common/Inputs/In.cs | 38 +- Assets/Scripts/Settings/SettingsScreen.cs | 74 +++- Assets/Scripts/Settings/Views/FloatView.cs | 1 + Assets/Scripts/Settings/Views/SettingView.cs | 2 - Assets/SettingGroup.cs | 23 +- Assets/SettingsGroup.prefab | 211 ++--------- Assets/SignalButton.prefab | 8 +- Assets/Slider.prefab | 10 +- Assets/Sprites/settings_asset.png.meta | 2 +- Assets/Toggle.prefab | 8 +- 20 files changed, 707 insertions(+), 381 deletions(-) diff --git a/Assets/BaseSettingView.cs b/Assets/BaseSettingView.cs index 742d855..0a5022b 100644 --- a/Assets/BaseSettingView.cs +++ b/Assets/BaseSettingView.cs @@ -3,6 +3,7 @@ using UnityEngine; public abstract class BaseSettingView : MonoBehaviour { + public RectTransform pivotPoint; [SerializeField] private TextMeshProUGUI _settingNameLabel; public virtual void Initialize(SettingDTO setting) diff --git a/Assets/Data/Settings/Игровой процесс/ВыручкаДоСброса сложности.asset b/Assets/Data/Settings/Игровой процесс/ВыручкаДоСброса сложности.asset index d867844..084ec9d 100644 --- a/Assets/Data/Settings/Игровой процесс/ВыручкаДоСброса сложности.asset +++ b/Assets/Data/Settings/Игровой процесс/ВыручкаДоСброса сложности.asset @@ -15,7 +15,8 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::Setting Type: 0 Id: CashToResetDifficulty - Alias: + Alias: "\u0412\u044B\u0440\u0443\u0447\u043A\u0430 \u0434\u043E \u0441\u0431\u0440\u043E\u0441\u0430 + \u0441\u043B\u043E\u0436\u043D\u043E\u0441\u0442\u0438" Description: BoolValue: 0 IntValue: 1 diff --git a/Assets/MNumberStepper.cs b/Assets/MNumberStepper.cs index d4b2573..d3c09ca 100644 --- a/Assets/MNumberStepper.cs +++ b/Assets/MNumberStepper.cs @@ -9,10 +9,18 @@ public class MNumberStepper : MonoBehaviour [SerializeField] private TextMeshProUGUI _valueLabel; [SerializeField] private CanvasGroup _leftArrow; [SerializeField] private CanvasGroup _rightArrow; - [SerializeField] float _acceleration; - private float _speed; - private float _lastDirection; + [Header("Настройки ускорения")] + [SerializeField] private float _accelerationTime = 0.8f; // Время до максимальной скорости + [SerializeField] private int _maxStep = 10; // Максимальный шаг + [SerializeField] private float _minInterval = 0.5f; // Начальный интервал (сек) + [SerializeField] private float _maxInterval = 0.03f; // Минимальный интервал (сек) + [SerializeField] private AnimationCurve _accelerationCurve = AnimationCurve.EaseInOut(0, 0, 1, 1); + + private float _holdTime; + private int _lastDirection; + private bool _isHolding; + private float _lastChangeTime; private int _value; private int _min; @@ -23,39 +31,97 @@ public class MNumberStepper : MonoBehaviour _value = value; _min = min; _max = max; - + ResetState(); UpdateView(); } public void SetDirection(int direction) { + if (direction == 0) + { + // Отпустили кнопку + _isHolding = false; + _lastDirection = 0; + _holdTime = 0f; + return; + } + + if (!_isHolding) + { + // Первое нажатие - мгновенно меняем значение + _isHolding = true; + _lastDirection = direction; + _holdTime = 0f; + _lastChangeTime = Time.unscaledTime; + + // Мгновенное изменение при первом клике + ChangeValue(direction, 1); + return; + } + + // Если направление изменилось - сбрасываем ускорение if (_lastDirection != direction) - ResetSpeed(); - _lastDirection = direction; + { + _lastDirection = direction; + _holdTime = 0f; + _lastChangeTime = Time.unscaledTime; + return; + } - _speed += direction * _acceleration * Time.deltaTime; - int step = (int)_speed; + // Увеличиваем время удержания + _holdTime += Time.unscaledDeltaTime; - int newValue = _value + step; + // Вычисляем прогресс ускорения (0 -> 1) + float progress = Mathf.Clamp01(_holdTime / _accelerationTime); + float curveValue = _accelerationCurve.Evaluate(progress); + + // 1. РАССЧИТЫВАЕМ ШАГ (увеличивается от 1 до _maxStep) + int step = 1 + Mathf.RoundToInt(curveValue * (_maxStep - 1)); + step = Mathf.Max(1, step); // Шаг не может быть меньше 1 + + // 2. РАССЧИТЫВАЕМ ИНТЕРВАЛ (уменьшается от _minInterval до _maxInterval) + float currentInterval = Mathf.Lerp(_minInterval, _maxInterval, curveValue); + + // Проверяем, пора ли менять значение + float timeSinceLastChange = Time.unscaledTime - _lastChangeTime; + + if (timeSinceLastChange >= currentInterval) + { + _lastChangeTime = Time.unscaledTime; + ChangeValue(_lastDirection, step); + } + } + + private void ChangeValue(int direction, int step) + { + int newValue = _value + direction * step; newValue = Mathf.Clamp(newValue, _min, _max); - bool valueChanged = newValue != _value; - if (valueChanged) + if (newValue != _value) { _value = newValue; OnValueChanged?.Invoke(_value); UpdateView(); } + else + { + // Если уперлись в границу - сбрасываем ускорение + ResetState(); + } } private void UpdateView() { _valueLabel.text = _value.ToString(); - _leftArrow.alpha = _value == _min ? 0 : 1; _rightArrow.alpha = _value == _max ? 0 : 1; } - private void ResetSpeed() - => _speed = 0; -} + public void ResetState() + { + _isHolding = false; + _lastDirection = 0; + _holdTime = 0f; + _lastChangeTime = 0f; + } +} \ No newline at end of file diff --git a/Assets/NewSettingViews/BoolSetting.prefab b/Assets/NewSettingViews/BoolSetting.prefab index c2bbf2c..84ba2fc 100644 --- a/Assets/NewSettingViews/BoolSetting.prefab +++ b/Assets/NewSettingViews/BoolSetting.prefab @@ -32,6 +32,7 @@ RectTransform: m_Children: - {fileID: 1407253749716458978} - {fileID: 6420127606789139323} + - {fileID: 4955592855872722000} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -59,6 +60,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ac519a1382a296149bf79e89e34c84d5, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::BoolView + pivotPoint: {fileID: 4955592855872722000} _settingNameLabel: {fileID: 6619818367823288239} _toggle: {fileID: 5906765608918040139} --- !u!1 &1843995630019402221 @@ -198,6 +200,41 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &6454509365925083309 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4955592855872722000} + m_Layer: 5 + m_Name: pivot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4955592855872722000 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6454509365925083309} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1494698429595343414} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 2, y: 47.9} + m_Pivot: {x: 0, y: 0.5} --- !u!1001 &794187670196976159 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/NewSettingViews/FloatSetting.prefab b/Assets/NewSettingViews/FloatSetting.prefab index 21c87cf..104cf39 100644 --- a/Assets/NewSettingViews/FloatSetting.prefab +++ b/Assets/NewSettingViews/FloatSetting.prefab @@ -30,6 +30,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 7551836649061619531} - {fileID: 1407253749716458978} - {fileID: 6420127606789139323} m_Father: {fileID: 0} @@ -59,9 +60,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a8d664be26d7260418a0637442d1694d, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::FloatView + pivotPoint: {fileID: 7551836649061619531} _settingNameLabel: {fileID: 6619818367823288239} _slider: {fileID: 5064590625449069381} - _speed: 10 + _speed: 70 --- !u!1 &1843995630019402221 GameObject: m_ObjectHideFlags: 0 @@ -199,6 +201,41 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &5054709760542722219 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7551836649061619531} + m_Layer: 5 + m_Name: pivot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7551836649061619531 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5054709760542722219} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1494698429595343414} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 2, y: 47.9} + m_Pivot: {x: 0, y: 0.5} --- !u!1001 &4905954001419954942 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/NewSettingViews/IntSetting.prefab b/Assets/NewSettingViews/IntSetting.prefab index 6875d6a..e62f391 100644 --- a/Assets/NewSettingViews/IntSetting.prefab +++ b/Assets/NewSettingViews/IntSetting.prefab @@ -31,6 +31,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 2319248186337631230} - {fileID: 1407253749716458978} - {fileID: 6846462344833863378} m_Father: {fileID: 0} @@ -60,6 +61,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 98e213c3e8dc53c4fa3852d32b28590e, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::IntView + pivotPoint: {fileID: 2319248186337631230} _settingNameLabel: {fileID: 6619818367823288239} _stepper: {fileID: 2068114791710324587} SwitchClip: {fileID: 8300000, guid: 1c48900c9ab0aa8418920a8193050870, type: 3} @@ -298,6 +300,41 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4667262318756712280 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2319248186337631230} + m_Layer: 5 + m_Name: pivot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2319248186337631230 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4667262318756712280} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1494698429595343414} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 2, y: 47.9} + m_Pivot: {x: 0, y: 0.5} --- !u!1001 &4936945405805347389 PrefabInstance: m_ObjectHideFlags: 0 @@ -406,6 +443,18 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 2683425166055752915, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} + propertyPath: m_text + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2683425166055752915, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5640940333419372446, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} - target: {fileID: 6405499040113261454, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -426,6 +475,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 7281945167825958426, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} + propertyPath: m_Spacing + value: 10 + objectReference: {fileID: 0} - target: {fileID: 8055866410577572243, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -446,6 +499,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 8152043523952237552, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8556998190284949453, guid: ced775cf87d3b2c4b9c58d53e5af7f72, type: 3} propertyPath: m_Name value: NumberStepper diff --git a/Assets/NewSettingViews/SignalSetting.prefab b/Assets/NewSettingViews/SignalSetting.prefab index 1b42968..e14ba54 100644 --- a/Assets/NewSettingViews/SignalSetting.prefab +++ b/Assets/NewSettingViews/SignalSetting.prefab @@ -30,13 +30,14 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 5177281694138168307} - {fileID: 9159338027149713966} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 891.44995, y: 38.25} + m_SizeDelta: {x: 891.44995, y: 54.02} m_Pivot: {x: 0, y: 1} --- !u!222 &7426346546271364008 CanvasRenderer: @@ -58,8 +59,44 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0ac5ce41d41becf4db103a3b68f7ccf0, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::SignalView + pivotPoint: {fileID: 5177281694138168307} _settingNameLabel: {fileID: 1890240610685982407} _signalButton: {fileID: 6034858491677103217} +--- !u!1 &3164273789815050325 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5177281694138168307} + m_Layer: 5 + m_Name: pivot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5177281694138168307 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3164273789815050325} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1494698429595343414} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 2, y: 63.02} + m_Pivot: {x: 0, y: 0.5} --- !u!1001 &520807226183219737 PrefabInstance: m_ObjectHideFlags: 0 @@ -72,9 +109,13 @@ PrefabInstance: propertyPath: m_Name value: SignalButton objectReference: {fileID: 0} + - target: {fileID: 3946266212054413381, guid: c244207dd10914141af206f200c91b0a, type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8657825045506627639, guid: c244207dd10914141af206f200c91b0a, type: 3} propertyPath: m_Pivot.x - value: 0.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8657825045506627639, guid: c244207dd10914141af206f200c91b0a, type: 3} propertyPath: m_Pivot.y @@ -82,7 +123,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8657825045506627639, guid: c244207dd10914141af206f200c91b0a, type: 3} propertyPath: m_AnchorMax.x - value: 0.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8657825045506627639, guid: c244207dd10914141af206f200c91b0a, type: 3} propertyPath: m_AnchorMax.y @@ -90,7 +131,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8657825045506627639, guid: c244207dd10914141af206f200c91b0a, type: 3} propertyPath: m_AnchorMin.x - value: 0.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8657825045506627639, guid: c244207dd10914141af206f200c91b0a, type: 3} propertyPath: m_AnchorMin.y diff --git a/Assets/NewSettingViews/StringSetting.prefab b/Assets/NewSettingViews/StringSetting.prefab index 9fa2f16..beec3cd 100644 --- a/Assets/NewSettingViews/StringSetting.prefab +++ b/Assets/NewSettingViews/StringSetting.prefab @@ -31,6 +31,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 2924469890355612162} - {fileID: 1407253749716458978} - {fileID: 6846462344833863378} m_Father: {fileID: 0} @@ -157,6 +158,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 92b7e97bf63d9224484d902c7acae3d4, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::StringView + pivotPoint: {fileID: 2924469890355612162} _settingNameLabel: {fileID: 6619818367823288239} _stepper: {fileID: 7027308042307283320} SwitchClip: {fileID: 8300000, guid: 1c48900c9ab0aa8418920a8193050870, type: 3} @@ -297,6 +299,41 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &3717741854442311066 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2924469890355612162} + m_Layer: 5 + m_Name: pivot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2924469890355612162 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3717741854442311066} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1494698429595343414} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 2, y: 47.9} + m_Pivot: {x: 0, y: 0.5} --- !u!1001 &7738861659687268133 PrefabInstance: m_ObjectHideFlags: 0 @@ -305,6 +342,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 1494698429595343414} m_Modifications: + - target: {fileID: 782228741111818699, guid: 0a9ecdc5a3c3c3441ad9a45276a1e1e3, type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3775829131982643703, guid: 0a9ecdc5a3c3c3441ad9a45276a1e1e3, type: 3} propertyPath: m_Pivot.x value: 0 @@ -429,6 +470,14 @@ PrefabInstance: propertyPath: m_Name value: StringStepper objectReference: {fileID: 0} + - target: {fileID: 6829595005887756008, guid: 0a9ecdc5a3c3c3441ad9a45276a1e1e3, type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7038806558190891654, guid: 0a9ecdc5a3c3c3441ad9a45276a1e1e3, type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8575591933987296918, guid: 0a9ecdc5a3c3c3441ad9a45276a1e1e3, type: 3} propertyPath: m_AnchorMax.y value: 0 diff --git a/Assets/NumberStepper.prefab b/Assets/NumberStepper.prefab index 0907aaf..e74b408 100644 --- a/Assets/NumberStepper.prefab +++ b/Assets/NumberStepper.prefab @@ -411,7 +411,34 @@ MonoBehaviour: _valueLabel: {fileID: 2683425166055752915} _leftArrow: {fileID: 2619186664971085571} _rightArrow: {fileID: 5323371681113456563} - _acceleration: 5 + _accelerationTime: 5 + _maxStep: 10 + _minInterval: 0.5 + _maxInterval: 0.03 + _accelerationCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!114 &7281945167825958426 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/GameScene3D.unity b/Assets/Scenes/GameScene3D.unity index e7f1e5d..289b0bc 100644 --- a/Assets/Scenes/GameScene3D.unity +++ b/Assets/Scenes/GameScene3D.unity @@ -6708,6 +6708,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 428795312} m_CullTransparentMesh: 1 +--- !u!1 &435572912 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 435572913} + - component: {fileID: 435572915} + - component: {fileID: 435572914} + m_Layer: 5 + m_Name: highlight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &435572913 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435572912} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1642698354} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: -30.214935, y: -1.6399975} + m_SizeDelta: {x: 1003.4, y: 47.9} + m_Pivot: {x: 0, y: 0.5} +--- !u!114 &435572914 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435572912} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 6197983427131835774, guid: d4abb67fd4a2bbe468b70301a2bd2596, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 4 +--- !u!222 &435572915 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 435572912} + m_CullTransparentMesh: 1 --- !u!1 &436763672 GameObject: m_ObjectHideFlags: 0 @@ -8978,6 +9053,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: GroupPrefab: {fileID: 0} + testPointer: {fileID: 0} + scrollRect: {fileID: 0} switchAxis: 1 interactAxis: 1 intractButton: 4 @@ -14983,11 +15060,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 989230129} m_CullTransparentMesh: 1 ---- !u!224 &1000936489 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - m_PrefabInstance: {fileID: 6432247727839861939} - m_PrefabAsset: {fileID: 0} --- !u!1 &1008654643 GameObject: m_ObjectHideFlags: 0 @@ -23463,6 +23535,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1549643811} m_CullTransparentMesh: 1 +--- !u!1 &1558714547 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1558714548} + - component: {fileID: 1558714550} + - component: {fileID: 1558714549} + m_Layer: 5 + m_Name: Arrow pointer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1558714548 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1558714547} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0002826, y: 1.0002826, z: 1.0002826} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1642698354} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 10.445006, y: 0.0000003874302} + m_SizeDelta: {x: 20.89, y: 24.69} + m_Pivot: {x: 1, y: 0.5} +--- !u!114 &1558714549 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1558714547} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 0.972549, g: 0.91764706, b: 0.23529412, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: -3390835886679162015, guid: cf234dbb1551ec647959db3ae7c0a6b5, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1558714550 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1558714547} + m_CullTransparentMesh: 1 --- !u!1 &1565043281 GameObject: m_ObjectHideFlags: 0 @@ -25041,6 +25188,52 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1637412869} m_CullTransparentMesh: 1 +--- !u!1 &1642698353 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1642698354} + - component: {fileID: 1642698356} + m_Layer: 5 + m_Name: Arrow pointer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1642698354 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1642698353} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 435572913} + - {fileID: 1558714548} + m_Father: {fileID: 1922048923} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -788.5001, y: 1.639997} + m_SizeDelta: {x: 20.89, y: 24.69} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &1642698356 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1642698353} + m_CullTransparentMesh: 1 --- !u!1 &1645472011 GameObject: m_ObjectHideFlags: 0 @@ -28299,6 +28492,7 @@ GameObject: m_Component: - component: {fileID: 1843853773} - component: {fileID: 1843853774} + - component: {fileID: 1843853775} m_Layer: 5 m_Name: Content m_TagString: Untagged @@ -28317,14 +28511,13 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1000936489} + m_Children: [] m_Father: {fileID: 1996701889} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 300} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &1843853774 MonoBehaviour: @@ -28344,7 +28537,7 @@ MonoBehaviour: m_Top: 0 m_Bottom: 0 m_ChildAlignment: 0 - m_Spacing: 40 + m_Spacing: 23 m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 0 @@ -28352,6 +28545,20 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &1843853775 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843853772} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter + m_HorizontalFit: 0 + m_VerticalFit: 2 --- !u!1 &1844986817 GameObject: m_ObjectHideFlags: 0 @@ -29387,6 +29594,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1642698354} - {fileID: 730497169} - {fileID: 266292069} - {fileID: 1980776983} @@ -30106,6 +30314,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Assembly-CSharp::SettingsScreen GroupPrefab: {fileID: 1011650303975809369, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} + testPointer: {fileID: 1642698354} + scrollRect: {fileID: 1980776984} switchAxis: 1 interactAxis: 0 intractButton: 4 @@ -30672,7 +30882,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image m_Material: {fileID: 0} - m_Color: {r: 1, g: 0.6094339, b: 0.6094339, a: 0.11372549} + m_Color: {r: 1, g: 0.6094339, b: 0.6094339, a: 0} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -35466,127 +35676,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 17729df6bbea32c4c9dcea80389992b7, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::MenuPanelsScroll ---- !u!1001 &6432247727839861939 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1843853773} - m_Modifications: - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_SizeDelta.x - value: 891.45 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_SizeDelta.y - value: 170 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1498054060512460501, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1741445776219476952, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1741445776219476952, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1934016956738394627, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1934016956738394627, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1934016956738394627, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4340255196234907629, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6601928016005572456, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} - propertyPath: m_Name - value: SettingsGroup - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 9368f9b18ede1664e94d2d1304998bc5, type: 3} --- !u!1001 &6662214523308698937 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Common/Inputs/In.cs b/Assets/Scripts/Common/Inputs/In.cs index 1402486..6244990 100644 --- a/Assets/Scripts/Common/Inputs/In.cs +++ b/Assets/Scripts/Common/Inputs/In.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using UnityEngine; public class In : MonoBehaviour @@ -19,21 +20,23 @@ public class In : MonoBehaviour if (!success) Debug.LogWarning("Не удалось проинициалзировать источник управления."); } - public static int GetAxis(Axis axis, JoystickSide side) + public static int GetAxis(Axis axis, JoystickSide side, InteractMode interactMode = InteractMode.Discrete) { - if (axis == Axis.Horizontal) return GetHorizontalAxis(side); - else if (axis == Axis.Vertical) return GetVerticalAxis(side); + if (axis == Axis.Horizontal) return GetHorizontalAxis(side, interactMode); + else if (axis == Axis.Vertical) return GetVerticalAxis(side, interactMode); else return 0; } - private static int GetHorizontalAxis(JoystickSide side) + private static int GetHorizontalAxis(JoystickSide side, InteractMode interactMode) { + Func func = interactMode == InteractMode.Discrete ? GetButtonDown : GetButton; + int dir = 0; if (side == JoystickSide.Both) { - if (GetButtonDown(InSignal.left1) || GetButtonDown(InSignal.left2)) dir -= 1; - if (GetButtonDown(InSignal.right1) || GetButtonDown(InSignal.right2)) dir += 1; + if (func(InSignal.left1) || func(InSignal.left2)) dir -= 1; + if (func(InSignal.right1) || func(InSignal.right2)) dir += 1; return dir; } else @@ -50,21 +53,22 @@ public class In : MonoBehaviour JoystickSide.Right => InSignal.right2, }; - if (GetButtonDown(left)) dir -= 1; - if (GetButtonDown(right)) dir += 1; + if (func(left)) dir -= 1; + if (func(right)) dir += 1; return dir; } } - private static int GetVerticalAxis(JoystickSide side) + private static int GetVerticalAxis(JoystickSide side, InteractMode interactMode) { + Func func = interactMode == InteractMode.Discrete ? GetButtonDown : GetButton; int dir = 0; if (side == JoystickSide.Both) { - if (GetButtonDown(InSignal.down1) || GetButtonDown(InSignal.down2)) dir -= 1; - if (GetButtonDown(InSignal.up1) || GetButtonDown(InSignal.up2)) dir += 1; + if (func(InSignal.down1) || func(InSignal.down2)) dir -= 1; + if (func(InSignal.up1) || func(InSignal.up2)) dir += 1; return dir; } else @@ -81,8 +85,8 @@ public class In : MonoBehaviour JoystickSide.Right => InSignal.up2, }; - if (GetButtonDown(downSignal)) dir -= 1; - if (GetButtonDown(upSignal)) dir += 1; + if (func(downSignal)) dir -= 1; + if (func(upSignal)) dir += 1; return dir; } @@ -137,4 +141,10 @@ public enum JoystickSide Left, Right, Both +} + +public enum InteractMode +{ + Discrete, + Continious } \ No newline at end of file diff --git a/Assets/Scripts/Settings/SettingsScreen.cs b/Assets/Scripts/Settings/SettingsScreen.cs index 69c90b4..7591fd4 100644 --- a/Assets/Scripts/Settings/SettingsScreen.cs +++ b/Assets/Scripts/Settings/SettingsScreen.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System.Buffers.Text; +using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; @@ -8,9 +9,12 @@ public class SettingsScreen : MonoBehaviour [SerializeField] private SettingGroup GroupPrefab; private bool Generated = false; - private int activeGroup; private int activeSetting; - private List settingsGroups; + + private List settings; + + [SerializeField] RectTransform testPointer; + [SerializeField] ScrollRect scrollRect; //==================== @@ -26,15 +30,28 @@ public class SettingsScreen : MonoBehaviour Generate(); } + private void Update() + { + int switchDirection = -In.GetAxis(switchAxis, JoystickSide.Both); + + activeSetting = (activeSetting + switchDirection + settings.Count) % settings.Count; + + var activePivot = settings[activeSetting].pivotPoint; + ScrollToElementVertical(activePivot); + testPointer.position = activePivot.position; + + int interactDirection = In.GetAxis(interactAxis, JoystickSide.Both, InteractMode.Continious); + settings[activeSetting].TakeInput(interactDirection, false); + } + public void Generate() { ClearContent(); - settingsGroups = new List(); + settings = new List(); foreach (var group in SettingsManager.currentSchemeDTO.groups) - settingsGroups.Add(GenerateGroup(group)); + settings.AddRange(GenerateGroup(group).settings); - activeGroup = 0; activeSetting = 0; Generated = true; } @@ -51,4 +68,49 @@ public class SettingsScreen : MonoBehaviour for (int i = Content.childCount - 1; i >= 0; i--) Destroy(Content.GetChild(i).gameObject); } + + public void ScrollToElementVertical(RectTransform targetRect) + { + if (scrollRect == null || targetRect == null) + { + Debug.LogWarning("ScrollRect или Target не назначены"); + return; + } + + LayoutRebuilder.ForceRebuildLayoutImmediate(scrollRect.content); + + RectTransform viewport = scrollRect.viewport; + RectTransform content = scrollRect.content; + + if (viewport == null || content == null) + { + Debug.LogWarning("Viewport или Content не назначены"); + return; + } + + Vector2 targetLocalPos = content.InverseTransformPoint(targetRect.position); + Vector2 viewportLocalPos = content.InverseTransformPoint(viewport.position); + + float targetHeight = targetRect.rect.height; + float viewportHeight = viewport.rect.height; + float contentHeight = content.rect.height; + + if (contentHeight <= viewportHeight) + { + scrollRect.verticalNormalizedPosition = 1f; + return; + } + + float offsetY = (targetLocalPos.y - viewportLocalPos.y) * -1f; + + float targetCenterY = offsetY + targetHeight * 0.5f; + float viewportCenterY = viewportHeight * 0.5f; + + float deltaY = (targetCenterY - viewportCenterY) / (contentHeight - viewportHeight); + + float newPosition = Mathf.Clamp01(scrollRect.verticalNormalizedPosition - deltaY); + + scrollRect.verticalNormalizedPosition = newPosition; + } + } \ No newline at end of file diff --git a/Assets/Scripts/Settings/Views/FloatView.cs b/Assets/Scripts/Settings/Views/FloatView.cs index a020510..a1faf9c 100644 --- a/Assets/Scripts/Settings/Views/FloatView.cs +++ b/Assets/Scripts/Settings/Views/FloatView.cs @@ -21,6 +21,7 @@ public class FloatView : BaseSettingView CachedSetting = setting; CacheSettingValues(setting); + Display(); } diff --git a/Assets/Scripts/Settings/Views/SettingView.cs b/Assets/Scripts/Settings/Views/SettingView.cs index f4ef483..9b71036 100644 --- a/Assets/Scripts/Settings/Views/SettingView.cs +++ b/Assets/Scripts/Settings/Views/SettingView.cs @@ -6,8 +6,6 @@ public class SettingView : MonoBehaviour [Header("Layout ссылки")] [SerializeField] private TextMeshProUGUI SettingNameLabel; - - BaseSettingView view; public void Generate(SettingDTO setting) diff --git a/Assets/SettingGroup.cs b/Assets/SettingGroup.cs index 136d82a..3b45859 100644 --- a/Assets/SettingGroup.cs +++ b/Assets/SettingGroup.cs @@ -1,23 +1,36 @@ -using TMPro; +using System.Collections.Generic; +using TMPro; using UnityEngine; +using UnityEngine.UI; public class SettingGroup : MonoBehaviour { + public List settings; + [SerializeField] private TextMeshProUGUI _titleLabel; [SerializeField] private RectTransform _contentVLG; + [SerializeField] private float _titleHeight; + public void Configure(SettingsGroupDTO data) { _titleLabel.text = data.Name; + settings = new(); foreach (var setting in data.Settings) - GenerateSetting(setting); + settings.Add( GenerateSetting(setting)); + + LayoutRebuilder.ForceRebuildLayoutImmediate(_contentVLG); + float _groupHeight = _contentVLG.sizeDelta.y - _contentVLG.anchoredPosition.y; + var rect = GetComponent(); + rect.sizeDelta = new Vector2(rect.sizeDelta.x, _groupHeight); } - public void GenerateSetting(SettingDTO setting) + public BaseSettingView GenerateSetting(SettingDTO setting) { var settingPrefab = SettingViewsProvider.GetViewBySetting(setting); - Instantiate(settingPrefab, _contentVLG); - print($"генерация настройки {setting.Id}"); + var view = Instantiate(settingPrefab, _contentVLG); + view.Initialize(setting); + return view; } } diff --git a/Assets/SettingsGroup.prefab b/Assets/SettingsGroup.prefab index 78c4ddc..75b434f 100644 --- a/Assets/SettingsGroup.prefab +++ b/Assets/SettingsGroup.prefab @@ -1,80 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &1751459345578911339 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1934016956738394627} - - component: {fileID: 3795380670033344988} - - component: {fileID: 8276516079088460447} - m_Layer: 5 - m_Name: Setting1.1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1934016956738394627 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1751459345578911339} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 2347931048431031818} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 891.44995, y: 38.25} - m_Pivot: {x: 0, y: 1} ---- !u!222 &3795380670033344988 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1751459345578911339} - m_CullTransparentMesh: 1 ---- !u!114 &8276516079088460447 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1751459345578911339} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 0} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &2930320801749786472 GameObject: m_ObjectHideFlags: 0 @@ -109,7 +34,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0.000030517578, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 434.4, y: 44.009995} m_Pivot: {x: 0, y: 1} --- !u!222 &752265477011332046 @@ -222,6 +147,7 @@ GameObject: m_Component: - component: {fileID: 2347931048431031818} - component: {fileID: 75821213775944797} + - component: {fileID: 5626840860947347716} m_Layer: 5 m_Name: Settings VLG m_TagString: Untagged @@ -240,16 +166,14 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1741445776219476952} - - {fileID: 1934016956738394627} + m_Children: [] m_Father: {fileID: 1498054060512460501} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -0.00003051758, y: -35.09006} - m_SizeDelta: {x: 891.45, y: 100} - m_Pivot: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: -70.09004} + m_SizeDelta: {x: 891.45, y: 0} + m_Pivot: {x: 0, y: 1} --- !u!114 &75821213775944797 MonoBehaviour: m_ObjectHideFlags: 0 @@ -276,6 +200,20 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &5626840860947347716 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5769781236353470992} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter + m_HorizontalFit: 0 + m_VerticalFit: 2 --- !u!1 &6601928016005572456 GameObject: m_ObjectHideFlags: 0 @@ -300,7 +238,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6601928016005572456} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -328,105 +266,4 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::SettingGroup _titleLabel: {fileID: 6282206377201343733} _contentVLG: {fileID: 2347931048431031818} ---- !u!1001 &906604484215949806 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 2347931048431031818} - m_Modifications: - - target: {fileID: 87492550789449837, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_Name - value: BoolSetting - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_Pivot.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_Pivot.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_SizeDelta.x - value: 891.44995 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_SizeDelta.y - value: 38.25 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} ---- !u!224 &1741445776219476952 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 1494698429595343414, guid: 3f5f19a4e1e221c4f8e8f526647430a2, type: 3} - m_PrefabInstance: {fileID: 906604484215949806} - m_PrefabAsset: {fileID: 0} + _titleHeight: 44 diff --git a/Assets/SignalButton.prefab b/Assets/SignalButton.prefab index 5965c54..2d01661 100644 --- a/Assets/SignalButton.prefab +++ b/Assets/SignalButton.prefab @@ -173,11 +173,11 @@ RectTransform: - {fileID: 8956293476614556395} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 321.29, y: 54.02} - m_Pivot: {x: 0.5, y: 0.5} + m_SizeDelta: {x: 321.29004, y: 54.02002} + m_Pivot: {x: 0, y: 1} --- !u!222 &2293965002738895521 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Slider.prefab b/Assets/Slider.prefab index cd8fc93..fe6e4f0 100644 --- a/Assets/Slider.prefab +++ b/Assets/Slider.prefab @@ -188,7 +188,7 @@ MonoBehaviour: m_Color: {r: 0.972549, g: 0.91764706, b: 0.23529412, a: 1} m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 0 + m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -236,11 +236,11 @@ RectTransform: - {fileID: 4111221010602591817} m_Father: {fileID: 2093491171275997573} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: -8} - m_Pivot: {x: 0.5, y: 0.5} + m_SizeDelta: {x: 200, y: 22} + m_Pivot: {x: 0, y: 0.5} --- !u!222 &1104202042189211528 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Sprites/settings_asset.png.meta b/Assets/Sprites/settings_asset.png.meta index 0693b99..6a1c0ec 100644 --- a/Assets/Sprites/settings_asset.png.meta +++ b/Assets/Sprites/settings_asset.png.meta @@ -130,7 +130,7 @@ TextureImporter: height: 188 alignment: 0 pivot: {x: 0.5, y: 0.5} - border: {x: 0, y: 0, z: 0, w: 0} + border: {x: 68, y: 0, z: 68, w: 0} customData: outline: [] physicsShape: [] diff --git a/Assets/Toggle.prefab b/Assets/Toggle.prefab index 0fa5576..98558a0 100644 --- a/Assets/Toggle.prefab +++ b/Assets/Toggle.prefab @@ -128,11 +128,11 @@ MonoBehaviour: ease: 9 _duration: 0.2 _background: {fileID: 6669548061308968566} - _enabledBgColor: {r: 0.972549, g: 0.91764706, b: 0.23529412, a: 0} - _disabledBgColor: {r: 0.40784314, g: 0.40784314, b: 0.40784314, a: 0} + _enabledBgColor: {r: 0.972549, g: 0.91764706, b: 0.23529412, a: 1} + _disabledBgColor: {r: 0.40784314, g: 0.40784314, b: 0.40784314, a: 1} _handleImage: {fileID: 9038509433437643066} - _enabledHandleColor: {r: 0.1254902, g: 0.1254902, b: 0.1254902, a: 0} - _disabledHandleColor: {r: 0.94509804, g: 0.94509804, b: 0.94509804, a: 0} + _enabledHandleColor: {r: 0.1254902, g: 0.1254902, b: 0.1254902, a: 1} + _disabledHandleColor: {r: 0.94509804, g: 0.94509804, b: 0.94509804, a: 1} _handlerect: {fileID: 8510971977262438056} _xOffset: 19 EnableSound: {fileID: 8300000, guid: 1c48900c9ab0aa8418920a8193050870, type: 3}