CapersProject/Assets/UltimateCleanGUIPack/Common/Scripts/Core/LoopableSelectionSlider.cs
2024-06-04 03:26:03 +09:00

34 lines
929 B
C#

// Copyright (C) 2015-2021 gamevanilla - All rights reserved.
// This code can only be used under the standard Unity Asset Store End User License Agreement.
// A Copy of the Asset Store EULA is available at http://unity3d.com/company/legal/as_terms.
namespace UltimateClean
{
/// <summary>
/// A loopable selection slider.
/// </summary>
public class LoopableSelectionSlider : SelectionSlider
{
public override void OnPreviousButtonPressed()
{
--currentIndex;
if (currentIndex < 0)
{
currentIndex = Options.Count - 1;
}
SetCurrentOptionLabel();
}
public override void OnNextButtonPressed()
{
++currentIndex;
if (currentIndex > Options.Count - 1)
{
currentIndex = 0;
}
SetCurrentOptionLabel();
}
}
}