Skip to content

Commit

Permalink
Merge pull request monkeymanboy#88 from BToersche/feature/several-imp…
Browse files Browse the repository at this point in the history
…rovements

Added several improvements to UI components.
  • Loading branch information
monkeymanboy authored Apr 28, 2021
2 parents 47e00b7 + 1e04583 commit cee874e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
13 changes: 11 additions & 2 deletions BeatSaberMarkupLanguage/Components/ScrollViewContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace BeatSaberMarkupLanguage.Components
public class ScrollViewContent : MonoBehaviour
{
public ScrollView scrollView;

private bool _dirty = false;

void Start()
{
LayoutRebuilder.ForceRebuildLayoutImmediate(transform as RectTransform);
Expand All @@ -21,7 +22,15 @@ void OnEnable()
}
void OnRectTransformDimensionsChange()
{
UpdateScrollView();
_dirty = true; // Need to delay the update such that it doesn't run during the rebuild loop
}
void Update()
{
if (_dirty)
{
_dirty = false;
UpdateScrollView();
}
}
private IEnumerator SetupScrollView()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
using IPA.Utilities;
using System.Linq;
using TMPro;
using UnityEngine.UI;

namespace BeatSaberMarkupLanguage.Components.Settings
{
public class DropDownListSetting : GenericSetting
public class DropDownListSetting : GenericInteractableSetting
{
private int index;

public List<object> values;

public SimpleTextDropdown dropdown;
Expand All @@ -33,6 +34,12 @@ public object Value
}
}

public override bool interactable
{
get => dropdown.GetField<Button, DropdownWithTableView>("_button").interactable;
set => dropdown.GetField<Button, DropdownWithTableView>("_button").interactable = value;
}

public override void Setup()
{
dropdown.didSelectCellWithIdxEvent += OnSelectIndex;
Expand Down
9 changes: 9 additions & 0 deletions BeatSaberMarkupLanguage/Components/Settings/SliderSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ public class SliderSetting : GenericSliderSetting
{
public bool isInt = false;
public float increments;
public float Value
{
get => slider.value;
set
{
slider.value = value;
text.text = TextForValue(value);
}
}

public override void Setup()
{
Expand Down

0 comments on commit cee874e

Please sign in to comment.