Подключение настройки Выдача призов в меню
This commit is contained in:
parent
7f2d911771
commit
c2447af94e
@ -344,10 +344,12 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 17729df6bbea32c4c9dcea80389992b7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::MenuPanelsScroll
|
||||
panels:
|
||||
- {fileID: 598468822134491841}
|
||||
- {fileID: 326468047192475538}
|
||||
- {fileID: 3154552816922353642}
|
||||
_panelsRoot: {fileID: 7711449090479930635}
|
||||
_panelPrefabs:
|
||||
- {fileID: 6993114390226871093, guid: 67e72bc2bea1f174a9230d1c93faa461, type: 3}
|
||||
- {fileID: 8610547230789882017, guid: 58f28e78fc94fda42aac2c97d739b50f, type: 3}
|
||||
- {fileID: 3216469017527373294, guid: ad88919b54a98d54296fbc8385cad020, type: 3}
|
||||
_prizesPanel: {fileID: 3216469017527373294, guid: ad88919b54a98d54296fbc8385cad020, type: 3}
|
||||
canvasGroup: {fileID: 7519511420456196728}
|
||||
scrollbar: {fileID: 7669273650859205884}
|
||||
--- !u!1001 &532560093742993924
|
||||
@ -567,17 +569,6 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ad88919b54a98d54296fbc8385cad020, type: 3}
|
||||
--- !u!114 &3154552816922353642 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 3216469017527373294, guid: ad88919b54a98d54296fbc8385cad020, type: 3}
|
||||
m_PrefabInstance: {fileID: 532560093742993924}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6110cf9d04a6dec46a2b4b55189a5ea4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PrizesPanel
|
||||
--- !u!224 &3257043732695003969 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 3050995859893985605, guid: ad88919b54a98d54296fbc8385cad020, type: 3}
|
||||
@ -1071,17 +1062,6 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 67e72bc2bea1f174a9230d1c93faa461, type: 3}
|
||||
--- !u!114 &598468822134491841 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 6993114390226871093, guid: 67e72bc2bea1f174a9230d1c93faa461, type: 3}
|
||||
m_PrefabInstance: {fileID: 7584827331342772724}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7d8cde41c5d00434fb2df12544d95d46, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::RulesPanel
|
||||
--- !u!224 &7330561142982047717 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 935018919262281233, guid: 67e72bc2bea1f174a9230d1c93faa461, type: 3}
|
||||
@ -1184,17 +1164,6 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 58f28e78fc94fda42aac2c97d739b50f, type: 3}
|
||||
--- !u!114 &326468047192475538 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 8610547230789882017, guid: 58f28e78fc94fda42aac2c97d739b50f, type: 3}
|
||||
m_PrefabInstance: {fileID: 8356736836476344115}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 89b35b683a28d1644949c7f141213f9c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::RatingPanel
|
||||
--- !u!224 &8968502302468192568 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 1121276133132447243, guid: 58f28e78fc94fda42aac2c97d739b50f, type: 3}
|
||||
|
||||
@ -897,9 +897,9 @@ RectTransform:
|
||||
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: 485.79993, y: 182.19}
|
||||
m_AnchoredPosition: {x: 39.19995, y: 182.19}
|
||||
m_SizeDelta: {x: 893.2, y: 594.6}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &3216469017527373294
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -919,9 +919,9 @@ RectTransform:
|
||||
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: 485.79993, y: 182.19}
|
||||
m_AnchoredPosition: {x: 39.19995, y: 182.19}
|
||||
m_SizeDelta: {x: 893.2, y: 594.6}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &8610547230789882017
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -1110,9 +1110,9 @@ RectTransform:
|
||||
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: 485.79993, y: 182.19}
|
||||
m_AnchoredPosition: {x: 39.19995, y: 182.19}
|
||||
m_SizeDelta: {x: 893.2, y: 594.6}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &6993114390226871093
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -668,8 +668,10 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 6480876749991534666}
|
||||
- component: {fileID: 7902541525572558347}
|
||||
- component: {fileID: 5471650746545155066}
|
||||
- component: {fileID: 4193645039104733645}
|
||||
- component: {fileID: 237264210385329710}
|
||||
- component: {fileID: 2575980937345747327}
|
||||
m_Layer: 5
|
||||
m_Name: prize game
|
||||
m_TagString: Untagged
|
||||
@ -706,6 +708,18 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6941503060760894153}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5471650746545155066
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6941503060760894153}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8f2e498693f269a4681ae68f1755cdae, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PrizeGameImage
|
||||
--- !u!114 &4193645039104733645
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -762,6 +776,18 @@ MonoBehaviour:
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!225 &2575980937345747327
|
||||
CanvasGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6941503060760894153}
|
||||
m_Enabled: 1
|
||||
m_Alpha: 1
|
||||
m_Interactable: 0
|
||||
m_BlocksRaycasts: 0
|
||||
m_IgnoreParentGroups: 0
|
||||
--- !u!1 &7656407543024209191
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -897,7 +897,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 3212149137108187124}
|
||||
- component: {fileID: 4039173223886909909}
|
||||
- component: {fileID: 2863340069746330934}
|
||||
- component: {fileID: 4533180799854104917}
|
||||
- component: {fileID: 5112631569943608034}
|
||||
m_Layer: 5
|
||||
m_Name: (no)prize game
|
||||
m_TagString: Untagged
|
||||
@ -933,6 +935,18 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8339030418053627575}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2863340069746330934
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8339030418053627575}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8f2e498693f269a4681ae68f1755cdae, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PrizeGameImage
|
||||
--- !u!114 &4533180799854104917
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -963,3 +977,15 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!225 &5112631569943608034
|
||||
CanvasGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8339030418053627575}
|
||||
m_Enabled: 1
|
||||
m_Alpha: 1
|
||||
m_Interactable: 0
|
||||
m_BlocksRaycasts: 0
|
||||
m_IgnoreParentGroups: 0
|
||||
|
||||
@ -29567,6 +29567,10 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5483391176823058074, guid: a34b2a0441a3e2c4a96fca5080d8f203, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5811791877448665319, guid: a34b2a0441a3e2c4a96fca5080d8f203, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 1
|
||||
@ -29651,6 +29655,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Left panel
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6046365875442724057, guid: a34b2a0441a3e2c4a96fca5080d8f203, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7417418181170801207, guid: a34b2a0441a3e2c4a96fca5080d8f203, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
|
||||
@ -4,25 +4,48 @@ using System.Collections;
|
||||
|
||||
public class MenuPanelsScroll : MenuPanel
|
||||
{
|
||||
[SerializeField] List<ClosablePanel> panels;
|
||||
[SerializeField] CanvasGroup canvasGroup;
|
||||
[SerializeField] SegmentedScrollbar scrollbar;
|
||||
[SerializeField] private Transform _panelsRoot;
|
||||
[SerializeField] private List<ClosablePanel> _panelPrefabs;
|
||||
[SerializeField] private PrizesPanel _prizesPanel;
|
||||
|
||||
[SerializeField] private CanvasGroup canvasGroup;
|
||||
[SerializeField] private SegmentedScrollbar scrollbar;
|
||||
|
||||
|
||||
private List<ClosablePanel> _panels;
|
||||
private int verticalIndex = 0;
|
||||
private ClosablePanel currentPanel => panels[verticalIndex];
|
||||
private ClosablePanel currentPanel => _panels[verticalIndex];
|
||||
|
||||
private bool m_enabled = true;
|
||||
private bool isTransitioning = false;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
scrollbar.Init(panels.Count);
|
||||
scrollbar.SetActiveSegment(verticalIndex);
|
||||
foreach (var panel in panels)
|
||||
BuildLayout();
|
||||
SettingsManager.OnSettingsChanged += BuildLayout;
|
||||
}
|
||||
|
||||
private void BuildLayout()
|
||||
{
|
||||
Clear();
|
||||
verticalIndex = 0;
|
||||
|
||||
bool prizing = SettingsManager.GetBool(SettingKey.PRIZING);
|
||||
foreach (var panel in _panelPrefabs)
|
||||
{
|
||||
panel.Disable(1);
|
||||
if (panel == _prizesPanel && prizing == false)
|
||||
continue;
|
||||
|
||||
var panelInst = Instantiate(panel, _panelsRoot);
|
||||
panelInst.GetComponent<RectTransform>().anchoredPosition = Vector3.up * 1000;
|
||||
_panels.Add(panelInst);
|
||||
|
||||
panelInst.Disable(1);
|
||||
}
|
||||
currentPanel.Enable(-1, 0);
|
||||
|
||||
scrollbar.Init(_panels.Count);
|
||||
scrollbar.SetActiveSegment(verticalIndex);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@ -43,7 +66,7 @@ public class MenuPanelsScroll : MenuPanel
|
||||
|
||||
yield return new WaitForSeconds(closeTime);
|
||||
|
||||
int newVerticalIndex = (verticalIndex + direction + panels.Count) % panels.Count;
|
||||
int newVerticalIndex = (verticalIndex + direction + _panels.Count) % _panels.Count;
|
||||
verticalIndex = newVerticalIndex;
|
||||
|
||||
currentPanel.Enable(direction, 0);
|
||||
@ -67,5 +90,16 @@ public class MenuPanelsScroll : MenuPanel
|
||||
m_enabled = true;
|
||||
}
|
||||
|
||||
private void Clear()
|
||||
{
|
||||
for (int i = _panelsRoot.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
var child = _panelsRoot.GetChild(i);
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
_panels = new();
|
||||
verticalIndex = 0;
|
||||
}
|
||||
|
||||
public override void Interact() => currentPanel.Interact();
|
||||
}
|
||||
17
Assets/Scripts/Menu/PrizeGameImage.cs
Normal file
17
Assets/Scripts/Menu/PrizeGameImage.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
public class PrizeGameImage : MonoBehaviour
|
||||
{
|
||||
private CanvasGroup _canvasGroup;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_canvasGroup = GetComponent<CanvasGroup>();
|
||||
|
||||
UpdateView();
|
||||
SettingsManager.OnSettingsChanged += UpdateView;
|
||||
}
|
||||
|
||||
private void UpdateView() => _canvasGroup.alpha = SettingsManager.GetBool(SettingKey.PRIZING) ? 1 : 0;
|
||||
}
|
||||
2
Assets/Scripts/Menu/PrizeGameImage.cs.meta
Normal file
2
Assets/Scripts/Menu/PrizeGameImage.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f2e498693f269a4681ae68f1755cdae
|
||||
Loading…
x
Reference in New Issue
Block a user