using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
namespace Snxxz.UI
|
{
|
public class ExpertSkillCyclicScroll : CyclicScroll
|
{
|
[SerializeField] float m_FadeInTime = 0.2f;
|
|
bool m_IsPlaying = false;
|
public bool IsPlaying
|
{
|
get { return m_IsPlaying; }
|
private set
|
{
|
m_IsPlaying = value;
|
this.enabled = !m_IsPlaying;
|
}
|
}
|
|
Coroutine m_Coroutine = null;
|
|
public override void Init<T>(List<T> _datas, bool _stepByStep = false)
|
{
|
base.Init(_datas, _stepByStep);
|
IsPlaying = false;
|
|
if (m_Coroutine != null)
|
{
|
StopCoroutine(m_Coroutine);
|
m_Coroutine = null;
|
}
|
}
|
|
public void DisplayAnimation(Action callback)
|
{
|
IsPlaying = true;
|
|
m_Coroutine = StartCoroutine(Co_DisplayAnimation(callback));
|
}
|
|
IEnumerator Co_DisplayAnimation(Action callback)
|
{
|
var behaviour = infiniteItems[0] as ExpertSkillConditionCell;
|
behaviour.alphaTween.SetStartState();
|
behaviour.alphaTween.Play();
|
yield return WaitingForSecondConst.GetWaitForSeconds(behaviour.alphaTween.duration);
|
behaviour.gameObject.SetActive(false);
|
|
var time = 0f;
|
|
for (int i = 1; i < infiniteItems.Count; i++)
|
{
|
behaviour = infiniteItems[i] as ExpertSkillConditionCell;
|
var fromY = behaviour.rectTransform.anchoredPosition.y;
|
behaviour.linerMove.from = behaviour.rectTransform.anchoredPosition.SetY(fromY);
|
var toY = behaviour.rectTransform.anchoredPosition.y + cellSize.y;
|
behaviour.linerMove.to = behaviour.rectTransform.anchoredPosition.SetY(toY);
|
behaviour.linerMove.Begin();
|
|
time = behaviour.linerMove.duration;
|
}
|
|
yield return WaitingForSecondConst.GetWaitForSeconds(time);
|
|
if (callback != null)
|
{
|
callback();
|
}
|
|
IsPlaying = false;
|
}
|
}
|
}
|