49 lines
1.8 KiB
C#
49 lines
1.8 KiB
C#
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
public class RatingPanel : InfoPanel
|
|
{
|
|
[Header("Описание")]
|
|
[SerializeField] private RectTransform descriptionSign;
|
|
[SerializeField] private float descriptionOpenY, descriptionCloseY, descriptionDuration;
|
|
|
|
public override float closeDelay => (infoDuration + buttonDuration + descriptionDuration
|
|
- timeOffset * 3 + titleDuration)
|
|
/ closeSpeedMultiplier;
|
|
|
|
protected override Sequence GetOpenSequence(float delay)
|
|
{
|
|
Sequence seq = DOTween.Sequence();
|
|
seq.AppendInterval(delay);
|
|
seq.Append(root.DOAnchorPos(Vector2.zero, titleDuration));
|
|
seq.Append(titleSign.DOAnchorPosY(titleOpenY, titleDuration));
|
|
|
|
float t = delay + titleDuration * 2;
|
|
seq.Insert(t, descriptionSign.DOAnchorPosY(descriptionOpenY, descriptionDuration));
|
|
seq.Insert(t, button.DOAnchorPosX(buttonOpenX, buttonDuration));
|
|
seq.Insert(t + buttonDuration - timeOffset, info.DOAnchorPosX(infoOpenX, infoDuration).SetEase(Ease.OutBack));
|
|
|
|
return seq;
|
|
}
|
|
|
|
protected override Sequence GetCloseSequence(Vector2 position)
|
|
{
|
|
Sequence seq = DOTween.Sequence();
|
|
float time = 0;
|
|
|
|
seq.Insert(time, info.DOAnchorPosX(infoCloseX, infoDuration));
|
|
time += infoDuration - timeOffset;
|
|
|
|
seq.Insert(time, button.DOAnchorPosX(buttonCloseX, buttonDuration));
|
|
time += buttonDuration - timeOffset;
|
|
|
|
seq.Insert(time, descriptionSign.DOAnchorPosY(descriptionCloseY, descriptionDuration));
|
|
time += descriptionDuration - timeOffset;
|
|
|
|
seq.Insert(time, titleSign.DOAnchorPosY(titleCloseY, titleDuration));
|
|
seq.Append(root.DOAnchorPos(position, titleDuration * 4));
|
|
|
|
seq.timeScale = closeSpeedMultiplier;
|
|
return seq;
|
|
}
|
|
} |