25 lines
758 B
C#
25 lines
758 B
C#
using UnityEngine;
|
|
|
|
public class StringView : BaseSettingView
|
|
{
|
|
[SerializeField] MStringStepper _stepper;
|
|
[SerializeField] private AudioClip SwitchClip;
|
|
|
|
public SettingDTO CachedSetting { get; private set; }
|
|
|
|
public override void Initialize(SettingDTO setting)
|
|
{
|
|
base.Initialize(setting);
|
|
CachedSetting = setting;
|
|
_stepper.Initialize(setting.StringValue, setting.AllowedValues);
|
|
_stepper.OnValueChanged += _stepper_OnValueChanged;
|
|
}
|
|
|
|
public override void TakeInput(int direction, bool _) => _stepper.SetDirection(direction);
|
|
|
|
private void _stepper_OnValueChanged(string newValue)
|
|
{
|
|
CachedSetting.StringValue = newValue;
|
|
SoundManager.instance.playClip(SwitchClip);
|
|
}
|
|
} |