Files
bansonic_beta_main/Assets/scripts/UI/Panel_Setting/Cell.cs
T
FloatGaming 1d818fa4eb 整合包
gameplay bundle has been imported together
2025-08-09 18:29:32 +08:00

44 lines
1.1 KiB
C#

/*
* FancyScrollView (https://github.com/setchi/FancyScrollView)
* Copyright (c) 2020 setchi
* Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
*/
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace FancyScrollView.Example01
{
class Cell : FancyCell<ItemData>
{
[SerializeField] Animator animator = default;
[SerializeField] TMP_Text message = default;
static class AnimatorHash
{
public static readonly int Scroll = Animator.StringToHash("scroll");
}
public override void UpdateContent(ItemData itemData)
{
message.text = itemData.Message;
}
public override void UpdatePosition(float position)
{
currentPosition = position;
if (animator.isActiveAndEnabled)
{
animator.Play(AnimatorHash.Scroll, -1, position);
}
animator.speed = 0;
}
float currentPosition = 0;
void OnEnable() => UpdatePosition(currentPosition);
}
}