备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user