added initial logic for the volume sliders
This commit is contained in:
@@ -34,6 +34,18 @@ public class AudioSliderDragHandler : MonoBehaviour, IBeginDragHandler, IDragHan
|
||||
UpdateSlider(eventData);
|
||||
}
|
||||
|
||||
public void SetHandlePosition(float normalizedValue)
|
||||
{
|
||||
float halfWidth = sliderBackground.rect.width * 0.5f;
|
||||
float limit = halfWidth * slideareaOffsetMultiplier;
|
||||
|
||||
float x = Mathf.Lerp(-limit, limit, normalizedValue);
|
||||
handleRect.localPosition = new Vector3(x, handleRect.localPosition.y, 0);
|
||||
|
||||
CurrentValue = normalizedValue;
|
||||
}
|
||||
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
UpdateSlider(eventData);
|
||||
@@ -46,6 +58,7 @@ public class AudioSliderDragHandler : MonoBehaviour, IBeginDragHandler, IDragHan
|
||||
}
|
||||
private void UpdateSlider(PointerEventData eventData)
|
||||
{
|
||||
|
||||
Debug.Log("UpDating Slider");
|
||||
Vector2 localPoint;
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(sliderBackground, eventData.position, eventData.pressEventCamera, out localPoint);
|
||||
|
||||
Reference in New Issue
Block a user