| | 1 | | using System.Collections.Generic; |
| | 2 | | using TMPro; |
| | 3 | | using UnityEngine; |
| | 4 | | using UnityEngine.UI; |
| | 5 | |
|
| | 6 | | namespace DCL.ContentModeration |
| | 7 | | { |
| | 8 | | public class ContentModerationRatingButtonComponentView : BaseComponentView |
| | 9 | | { |
| | 10 | | [SerializeField] private Button ratingButton; |
| | 11 | | [SerializeField] private GameObject selectedContainer; |
| | 12 | | [SerializeField] private GameObject unselectedContainer; |
| | 13 | | [SerializeField] private Color selectedColor; |
| | 14 | | [SerializeField] private Color unselectedColor; |
| | 15 | | [SerializeField] private Color backgroundNormalColor; |
| | 16 | | [SerializeField] private Color backgroundMarkedColor; |
| | 17 | | [SerializeField] private List<TMP_Text> texts; |
| | 18 | | [SerializeField] private List<Image> imagesToColor; |
| | 19 | | [SerializeField] private GameObject currentMark; |
| | 20 | | [SerializeField] private List<Image> backgroundImages; |
| | 21 | |
|
| 0 | 22 | | public Button RatingButton => ratingButton; |
| 0 | 23 | | public bool IsMarked { get; private set; } |
| | 24 | |
|
| | 25 | | public override void Awake() |
| | 26 | | { |
| 0 | 27 | | base.Awake(); |
| | 28 | |
|
| 0 | 29 | | foreach (Image image in imagesToColor) |
| 0 | 30 | | image.color = selectedColor; |
| 0 | 31 | | } |
| | 32 | |
|
| 0 | 33 | | public override void RefreshControl() { } |
| | 34 | |
|
| | 35 | | public void Select(bool isSelected) |
| | 36 | | { |
| 0 | 37 | | selectedContainer.SetActive(isSelected); |
| 0 | 38 | | unselectedContainer.SetActive(!isSelected); |
| | 39 | |
|
| 0 | 40 | | foreach (TMP_Text text in texts) |
| 0 | 41 | | text.color = IsMarked ? selectedColor : unselectedColor; |
| | 42 | |
|
| 0 | 43 | | foreach (Image background in backgroundImages) |
| 0 | 44 | | background.color = IsMarked && isSelected ? backgroundMarkedColor : backgroundNormalColor; |
| 0 | 45 | | } |
| | 46 | |
|
| | 47 | | public void SetCurrentMarkActive(bool isActive) |
| | 48 | | { |
| 0 | 49 | | IsMarked = isActive; |
| 0 | 50 | | currentMark.SetActive(isActive); |
| 0 | 51 | | } |
| | 52 | | } |
| | 53 | | } |