整合包

gameplay bundle has been imported together
This commit is contained in:
FloatGaming
2025-08-09 18:29:32 +08:00
parent e7962bf492
commit 1d818fa4eb
1654 changed files with 431813 additions and 103 deletions
+43
View File
@@ -0,0 +1,43 @@
/*
* 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);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b77a04c729f174c478baf21a47c16620
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,74 @@
using System.Collections;
using UnityEngine;
// 通过 PlayTween() 触发动画
public class SimpleAxisTween : MonoBehaviour
{
public enum Axis { X, Y } // 轴向选项
[Header("Tween Settings")]
public Axis axis = Axis.X; // 要缓动的轴
public float from = 0f; // 起始值
public float to = 100f; // 终点值
public float duration = 1f; // 总时长(秒)——外部可调
public AnimationCurve ease = AnimationCurve.EaseInOut(0, 0, 1, 1);
private Coroutine tweenCo;
private RectTransform rt;
public void PlayTween()
{
if (tweenCo != null) StopCoroutine(tweenCo);
tweenCo = StartCoroutine(TweenRoutine());
}
private void Awake()
{
TryGetComponent(out rt);
}
private IEnumerator TweenRoutine()
{
float elapsed = 0f;
SetPosition(from);
while (elapsed < duration)
{
elapsed += Time.deltaTime;
float t = Mathf.Clamp01(elapsed / duration);
float easedT = ease.Evaluate(t);
// 缓动插值
float current = Mathf.LerpUnclamped(from, to, easedT);
SetPosition(current);
yield return null;
}
// 强制落在终点
SetPosition(to);
tweenCo = null;
}
private void SetPosition(float value)
{
if (rt != null)
{
Vector2 pos = rt.anchoredPosition;
if (axis == Axis.X) pos.x = value;
else pos.y = value;
rt.anchoredPosition = pos;
}
else
{
Vector3 pos = transform.localPosition;
if (axis == Axis.X) pos.x = value;
else pos.y = value;
transform.localPosition = pos;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f2d99df04537994d9ed3332354ac7b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: