69 lines
2.1 KiB
C#
69 lines
2.1 KiB
C#
using UnityEngine;
|
|
using System.Threading.Tasks;
|
|
using DG.Tweening;
|
|
|
|
public class EventGatherCoreTriggerItemFly : RewardFly
|
|
{
|
|
public override async Task ShowAsync(CollectionItemFly itemFly)
|
|
{
|
|
SetText(itemFly.numStr);
|
|
if (itemFly.sourceIconSize != 0.0f)
|
|
{
|
|
var sourceScale = GetTransitionScale(itemFly.sourceIconSize);
|
|
iconRoot.transform.localScale = new Vector3(sourceScale, sourceScale, 1f);
|
|
}
|
|
if (itemFly.icon != null)
|
|
{
|
|
SetData(itemFly.icon);
|
|
}
|
|
else if (string.IsNullOrEmpty(itemFly.iconName))
|
|
{
|
|
SetData(itemFly.itemID);
|
|
}
|
|
else
|
|
{
|
|
SetData(itemFly.iconName);
|
|
}
|
|
// transform.localScale = itemFly.scale;
|
|
transform.position = itemFly.sourcePos;
|
|
fxTrace.SetActive(false);
|
|
CloseFxRoot();
|
|
OpenFxRoot();
|
|
await Awaiters.Seconds(showDuration);
|
|
SetText("");
|
|
ShowTrace();
|
|
transform.DOMoveX(itemFly.destPos.x, flyDuration).SetEase(curveX);
|
|
transform.DOMoveY(itemFly.destPos.y, flyDuration).SetEase(curveY);
|
|
var targetScale = GetTransitionScale(itemFly.targetIconSize);
|
|
iconRoot.transform.DOScale(targetScale, flyDuration).SetEase(curveScale);
|
|
// Debug.Log("[EventGatherCore] 3: fly.");
|
|
await Awaiters.Seconds(flyDuration);
|
|
if (!itemFly.isPlayClose)
|
|
return;
|
|
if (itemFly.isDestinationRewardStash)
|
|
{
|
|
ani.Play(OUT_STASH);
|
|
await Awaiters.Seconds(closeAnimationDurationStash);
|
|
}
|
|
else
|
|
{
|
|
ani.Play(OUT);
|
|
await Awaiters.Seconds(closeAnimationDuration);
|
|
}
|
|
// ShowTrace();
|
|
}
|
|
|
|
private void OpenFxRoot()
|
|
{
|
|
if (transform.position.x < 0f)
|
|
fxRoot.transform.rotation = Quaternion.Euler(180, 0, 180);
|
|
else
|
|
fxRoot.transform.rotation = Quaternion.identity;
|
|
fxRoot.SetActive(true);
|
|
}
|
|
private void CloseFxRoot()
|
|
{
|
|
fxRoot.SetActive(false);
|
|
}
|
|
}
|