Files
ft/Client/Assets/Scripts/EventOfferJourney/Wheel/EventOfferJourneyWheelScrollingBg.cs
2026-06-29 21:18:33 +08:00

29 lines
925 B
C#

using System.Collections;
using System.Collections.Generic;
using EnhancedUI.EnhancedScroller;
using UnityEngine;
public class EventOfferJourneyWheelScrollingBg : MonoBehaviour
{
[SerializeField] private EnhancedScroller scroller;
[SerializeField] private float topPos, bottomPos;
private RectTransform Rt => transform as RectTransform;
private void Start()
{
if (scroller == null)
{
Debug.LogError("[EventOfferJourney] EnhancedScroller reference is not assigned in EventOfferJourneyWheelScrollingBg.", this);
return;
}
bottomPos = 0;
topPos = (scroller.transform as RectTransform).rect.size.y - (transform as RectTransform).rect.size.y;
}
private void LateUpdate()
{
if (scroller == null) return;
Rt.anchoredPosition = new Vector2(0, Mathf.Lerp(topPos, bottomPos, scroller.NormalizedScrollPosition));
}
}