Skip to content

Commit

Permalink
add scrolling text testing stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislee0419 committed Nov 2, 2020
1 parent 7b8dcb5 commit 8edc4f6
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 1 deletion.
104 changes: 104 additions & 0 deletions BeatSaberMarkupLanguage/ViewControllers/TestViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,62 @@ public List<object> contents2
}
}

private string _changeableText = "this is a changeable text example that should serve as a testing ground for trying to see what happens when you change the text while the scrolling animation is playing";
[UIValue("changeable-text")]
public string ChangeableText
{
get => _changeableText;
set
{
_changeableText = value;
NotifyPropertyChanged();
}
}
private bool _alwaysScroll = false;
[UIValue("always-scroll")]
public bool AlwaysScroll
{
get => _alwaysScroll;
set
{
_alwaysScroll = value;
NotifyPropertyChanged();
}
}
private float _pauseDuration = 4f;
[UIValue("pause-duration")]
public float PauseDuration
{
get => _pauseDuration;
set
{
_pauseDuration = value;
NotifyPropertyChanged();
}
}
private ScrollingText.ScrollAnimationType _animationType = ScrollingText.ScrollAnimationType.ForwardAndReverse;
[UIValue("animation-type")]
public ScrollingText.ScrollAnimationType AnimationType
{
get => _animationType;
set
{
_animationType = value;
NotifyPropertyChanged();
}
}
private float _scrollSpeed = 15f;
[UIValue("scroll-speed")]
public float ScrollSpeed
{
get => _scrollSpeed;
set
{
_scrollSpeed = value;
NotifyPropertyChanged();
}
}


[UIAction("click")]
private void ButtonPress()
Expand Down Expand Up @@ -108,6 +164,54 @@ private void PostParse()
tableData.data = test;
tableData.tableView.ReloadData();
}

[UIAction("text-1-button-clicked")]
private void ScrollingTextText1ButtonClicked()
{
AlwaysScroll = false;
ChangeableText = "short text example, stop animation";
}

[UIAction("text-2-button-clicked")]
private void ScrollingTextText2ButtonClicked()
{
AlwaysScroll = false;
ChangeableText = "this is a long text example that should cause the scrolling animation to play again. if it doesn't start the scrolling animation again, then something is wrong with the code";
}

[UIAction("text-3-button-clicked")]
private void ScrollingTextText3ButtonClicked()
{
AlwaysScroll = true;
ChangeableText = "short always scroll text example";
}

[UIAction("pause-duration-button-clicked")]
private void ScrollingTextPauseDurationButtonClicked()
{
if (PauseDuration < 4f)
PauseDuration = 4f;
else
PauseDuration = 1f;
}

[UIAction("animation-type-button-clicked")]
private void ScrollingTextAnimationTypeButtonClicked()
{
if (AnimationType == ScrollingText.ScrollAnimationType.ForwardAndReverse)
AnimationType = ScrollingText.ScrollAnimationType.Continuous;
else
AnimationType = ScrollingText.ScrollAnimationType.ForwardAndReverse;
}

[UIAction("scroll-speed-button-clicked")]
private void ScrollingTextScrollSpeedButtonClicked()
{
if (ScrollSpeed < 15f)
ScrollSpeed = 15f;
else
ScrollSpeed = 5f;
}
}
public class TestListObject
{
Expand Down
79 changes: 78 additions & 1 deletion BeatSaberMarkupLanguage/Views/test.bsml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<bg xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='https://monkeymanboy.github.io/BSML-Docs/ https://raw.githubusercontent.com/monkeymanboy/BSML-Docs/gh-pages/BSMLSchema.xsd'>
<macro.define id='button-text' value='Macro defined button text'></macro.define>
<tab-selector tab-tag='new-tab'></tab-selector>
<tab tags='new-tab' tab-name='ScrollView test'>
<tab tags='new-tab' tab-name='ScrollView'>
<vertical vertical-fit='PreferredSize' pref-height='60' pref-width='80'>
<text text='ScrollView test' />
<scroll-view spacing='0' pref-height='50'>
Expand Down Expand Up @@ -126,4 +126,81 @@
<tab tags='new-tab' tab-name='text page'>
<text-page text='~lorem-ipsum'/>
</tab>
<tab tags='new-tab' tab-name='ScrollingText'>
<horizontal>
<vertical preferred-width="60">
<button text="text 1" on-click="text-1-button-clicked" preferred-width="40" preferred-height="9" />
<button text="text 2" on-click="text-2-button-clicked" preferred-width="40" preferred-height="9" />
<button text="text 3" on-click="text-3-button-clicked" preferred-width="40" preferred-height="9" />
<button text="pause duration" on-click="pause-duration-button-clicked" preferred-width="40" preferred-height="9" />
<button text="animation" on-click="animation-type-button-clicked" preferred-width="40" preferred-height="9" />
<button text="scroll speed" on-click="scroll-speed-button-clicked" preferred-width="40" preferred-height="9" />
</vertical>
<vertical preferred-width="90">
<!-- short text examples -->
<scrolling-text text='left text example'
alignment='Left'
font-size='3' />
<scrolling-text text='center text example'
alignment='Center'
font-size='3' />
<scrolling-text text='right short example'
alignment='Right'
font-size='3' />
<scrolling-text text='always scroll short basic example'
font-size='3'
always-scroll='true' />
<scrolling-text text='always scroll short fade example'
font-size='3'
always-scroll='true'
animation-type='FadeInOut' />
<scrolling-text text='always scroll short reverse example'
font-size='3'
always-scroll='true'
alignment='Right'
animation-type='ForwardAndReverse' />
<scrolling-text text='always scroll short continuous example'
font-size='3'
always-scroll='true'
animation-type='Continuous' />

<!-- longer text speed examples -->
<scrolling-text text='this is a much longer example text than the previous example texts that should scroll because it is pretty long. if it doesn&apos;t scroll, then that means that this text is not long enough to activate the scroll animation coroutine. but if this is done correctly, then this long text should always activate the scroll animation coroutine'
font-size='3'
movement-type='BySpeed'
scroll-speed='10'
pause-duration='2'
animation-type='Basic' />
<scrolling-text text='this is the second much longer example text than the shorter example texts that should scroll because it is pretty long. if it doesn&apos;t scroll, then that means that this text is not long enough to activate the scroll animation coroutine. but if this is done correctly, then this long text should always activate the scroll animation coroutine. also, this text is especially long to test whether or not the duration and speed scroll modes will have any differences. texts in duration mode should show a difference, whereas texts in speed mode should not'
font-size='3'
movement-type='BySpeed'
scroll-speed='10'
pause-duration='4'
animation-type='FadeInOut' />
<scrolling-text text='this is the third much longer example text than the shorter example texts that should scroll because it is pretty long. if it doesn&apos;t scroll, then that means that this text is not long enough to activate the scroll animation coroutine. but if this is done correctly, then this long text should always activate the scroll animation coroutine'
font-size='3'
movement-type='BySpeed'
alignment='Right'
scroll-speed='10'
pause-duration='4'
animation-type='ForwardAndReverse' />
<scrolling-text text='this is the fourth much longer example text than the shorter example texts that should scroll because it is pretty long. if it doesn&apos;t scroll, then that means that this text is not long enough to activate the scroll animation coroutine. but if this is done correctly, then this long text should always activate the scroll animation coroutine. also, this text is especially long to test whether or not the duration and speed scroll modes will have any differences. texts in duration mode should show a difference, whereas texts in speed mode should not'
font-size='3'
movement-type='BySpeed'
alignment='Right'
scroll-speed='10'
pause-duration='4'
animation-type='Continuous' />

<scrolling-text text='~changeable-text'
font-size='3'
movement-type='BySpeed'
alignment='Right'
always-scroll='~always-scroll'
scroll-speed='~scroll-speed'
pause-duration='~pause-duration'
animation-type='~animation-type' />
</vertical>
</horizontal>
</tab>
</bg>

0 comments on commit 8edc4f6

Please sign in to comment.