52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using DG.Tweening;
|
|
using EnhancedUI.EnhancedScroller;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
namespace game
|
|
{
|
|
public class FriendAddItem : EnhancedScrollerCellView
|
|
{
|
|
public Vector2 zoomOut = new Vector2(0.4f, 0.4f);
|
|
public float zoomOutTime = 0.15f;
|
|
|
|
protected Vector3 originalScale = Vector3.one;
|
|
|
|
protected FriendAddItemData m_Data;
|
|
protected FishingFriendAddPanel m_Panel;
|
|
public UnityAction<FriendAddItemData> Callback = null; // 回调事件
|
|
public virtual void SetData(FishingFriendAddPanel panel, FriendAddItemData data, UnityAction<FriendAddItemData> callback)
|
|
{
|
|
m_Panel = panel;
|
|
m_Data = data;
|
|
this.Callback = null;
|
|
this.Callback = callback;
|
|
}
|
|
|
|
protected void LockScrollView(float lockTime = -1f)
|
|
{
|
|
if (m_Panel == null) return;
|
|
if (lockTime < 0f)
|
|
{
|
|
lockTime = zoomOutTime + 0.1f;
|
|
}
|
|
m_Panel.StartLockScrollView(lockTime);
|
|
}
|
|
|
|
protected void ResumeScale()
|
|
{
|
|
transform.GetComponent<RectTransform>().localScale = originalScale;
|
|
}
|
|
|
|
protected void StartScalingAnimation(TweenCallback onComplete)
|
|
{
|
|
transform.DOKill();
|
|
|
|
Vector3 targetScale = new Vector3(zoomOut.x, zoomOut.y, originalScale.z);
|
|
transform.DOScale(targetScale, zoomOutTime).SetEase(Ease.OutQuad).OnComplete(onComplete);
|
|
}
|
|
}
|
|
}
|