Skip to content

Commit

Permalink
Get rid of hackfix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoco007 committed Jun 10, 2023
1 parent 951ae22 commit 6c8554d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
14 changes: 0 additions & 14 deletions BeatSaberMarkupLanguage/Components/Settings/ListSliderSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public override void Setup()
text = slider.GetComponentInChildren<TextMeshProUGUI>();
slider.numberOfSteps = values.Count;
slider.valueDidChangeEvent += OnChange;
StartCoroutine(SetInitialText());
}

public override void ApplyValue()
Expand All @@ -54,19 +53,6 @@ protected string TextForValue(object value)
private void Awake()
{
ReceiveValue();
}

private void OnEnable()
{
StartCoroutine(SetInitialText());
}

// I don't really like this but for some reason I can't get the initial starting text any other quick way and this works perfectly fine
private IEnumerator SetInitialText()
{
yield return new WaitForFixedUpdate();
text.text = TextForValue(Value);
yield return new WaitForSeconds(0.1f); // If the first one is too fast, don't yell at me pls
text.text = TextForValue(Value);
}

Expand Down
14 changes: 7 additions & 7 deletions BeatSaberMarkupLanguage/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ public void OnExit()

public void MenuLoadFresh(ScenesTransitionSetupDataSO scenesTransitionSetupData, DiContainer diContainer)
{
// GameplaySetup.GameplaySetup.instance.AddTab("Test", "BeatSaberMarkupLanguage.Views.gameplay-setup-test.bsml", GameplaySetupTest.instance);
// GameplaySetup.GameplaySetup.instance.AddTab("Test", "BeatSaberMarkupLanguage.Views.gameplay-setup-test.bsml", GameplaySetup.GameplaySetupTest.instance);
// BSMLSettings.instance.AddSettingsMenu("Test", "BeatSaberMarkupLanguage.Views.settings-test.bsml", SettingsTest.instance);
// SharedCoroutineStarter.instance.StartCoroutine(PresentTest<TestViewController>());
// SharedCoroutineStarter.instance.StartCoroutine(PresentTest<LocalizationTestViewController>());
// SharedCoroutineStarter.instance.StartCoroutine(PresentTest<ViewControllers.TestViewController>());
// SharedCoroutineStarter.instance.StartCoroutine(PresentTest<ViewControllers.LocalizationTestViewController>());
// MenuButtons.MenuButtons.instance.RegisterButton(new MenuButtons.MenuButton("test", () => MenuButtons.MenuButtons.instance.RegisterButton(new MenuButtons.MenuButton("test2",null))));
BSMLSettings.instance.Setup();
MenuButtons.MenuButtons.instance.Setup();
Expand Down Expand Up @@ -161,13 +161,13 @@ private void OnInstallEarlyBindings(ScenesTransitionSetupDataSO setupData, DiCon

// It's just for testing so don't yell at me
/*private IEnumerator PresentTest<T>()
where T : ViewController
where T : HMUI.ViewController
{
yield return new WaitForSeconds(1);
ViewController testViewController = BeatSaberUI.CreateViewController<T>();
HMUI.ViewController testViewController = BeatSaberUI.CreateViewController<T>();
FloatingScreen.FloatingScreen floatingScreen = FloatingScreen.FloatingScreen.CreateFloatingScreen(new Vector2(400, 200), true, Vector3.zero, Quaternion.identity);
floatingScreen.SetRootViewController(testViewController, ViewController.AnimationType.None);
Resources.FindObjectsOfTypeAll<MainFlowCoordinator>().First().PresentViewController(testViewController, null, ViewController.AnimationDirection.Horizontal, false);
floatingScreen.SetRootViewController(testViewController, HMUI.ViewController.AnimationType.None);
Resources.FindObjectsOfTypeAll<MainFlowCoordinator>().First().PresentViewController(testViewController, null, HMUI.ViewController.AnimationDirection.Horizontal, false);
}*/
}
}
2 changes: 1 addition & 1 deletion BeatSaberMarkupLanguage/Settings/SettingsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class SettingsTest : NotifiableSingleton<SettingsTest>
private List<object> options = new object[] { "1", "Something", "Kapow", "Yeet" }.ToList();

[UIValue("list-choice")]
private string listChoice = "Something";
private string listChoice = "Kapow";

[UIValue("bool-test")]
private bool BoolTest
Expand Down
1 change: 1 addition & 0 deletions BeatSaberMarkupLanguage/Views/settings-test.bsml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<string-setting text='string test' value='string-value'></string-setting>
<slider-setting text='slider test' min='-10' max='50' increment='1' value='slider-value' integer-only='true' formatter='format'></slider-setting>
<dropdown-list-setting text='Dropdown Test' value='list-choice' choices='list-options'></dropdown-list-setting>
<list-slider-setting text='List Slider Test' value='list-choice' choices='list-options'></list-slider-setting>
<bool-setting text='bool test' value='bool-test' bind-value='true'></bool-setting>
<clickable-text text='Test change value' on-click='change-bool'></clickable-text>
<settings-submenu text='Open Submenu' hover-hint='we got hover hints boi'>
Expand Down

0 comments on commit 6c8554d

Please sign in to comment.