81 lines
2.7 KiB
C#
81 lines
2.7 KiB
C#
using UnityEngine;
|
|
using GameCore;
|
|
using System;
|
|
|
|
public abstract class ASocialRushRewardItemView: MonoBehaviour
|
|
{
|
|
[SerializeField] protected RewardItemNew reward;
|
|
[SerializeField] protected GameObject[] pointsLeft, pointsRight;
|
|
[SerializeField] protected GameObject goDone;
|
|
[SerializeField] protected SocialRushRewardItemViewType type;
|
|
[SerializeField] protected GameObject[] pointsLightLeft, pointsLightRight;
|
|
[SerializeField] protected GameObject[] fxLeftList, fxRightList;
|
|
[SerializeField] protected Animation aniPointsLeft, aniPointsRight, aniMain;
|
|
private const float _pointGap = 0.15f;
|
|
|
|
public void Set(SocialRushRewardItemViewData data)
|
|
{
|
|
gameObject.SetActive(data.DoShow);
|
|
if (!data.DoShow)
|
|
return;
|
|
reward.SetData(data.Reward);
|
|
// goDone.SetActive(data.IsDone);
|
|
aniPointsLeft.gameObject.SetActive(data.Type == SocialRushRewardItemViewType.RightSide);
|
|
aniPointsRight.gameObject.SetActive(data.Type == SocialRushRewardItemViewType.LeftSide);
|
|
foreach (var point in pointsLeft)
|
|
point.SetActive(false);
|
|
foreach (var point in pointsRight)
|
|
point.SetActive(false);
|
|
for (int i = 0; i < pointsLightLeft.Length; i++)
|
|
{
|
|
pointsLightLeft[i].SetActive(false);
|
|
pointsLightRight[i].SetActive(false);
|
|
fxLeftList[i].SetActive(false);
|
|
fxRightList[i].SetActive(false);
|
|
}
|
|
PlayInit();
|
|
}
|
|
public abstract System.Threading.Tasks.Task PlayClaimed();
|
|
public void PlayInit()
|
|
{
|
|
gameObject.SetActive(true);
|
|
aniMain.Play("EventSocialRushCommonInit");
|
|
}
|
|
public void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public class SocialRushRewardItemView : ASocialRushRewardItemView
|
|
{
|
|
|
|
public override async System.Threading.Tasks.Task PlayClaimed()
|
|
{
|
|
gameObject.SetActive(true);
|
|
// reward.gameObject.SetActive(false);
|
|
aniMain.Play("EventSocialRushCommonGet");
|
|
await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(35f / 60f));
|
|
aniPointsLeft.Play("EventSocialRushVikingLineLeft");
|
|
aniPointsRight.Play("EventSocialRushVikingLineRight");
|
|
var length = aniPointsLeft.GetClip("EventSocialRushVikingLineLeft").length;
|
|
await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(length));
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public class SocialRushRewardItemViewData
|
|
{
|
|
public ItemData Reward { get; set; }
|
|
public bool IsDone { get; set; }
|
|
public SocialRushRewardItemViewType Type { get; set; }
|
|
public bool DoShow { get; set; } = true;
|
|
}
|
|
|
|
public enum SocialRushRewardItemViewType
|
|
{
|
|
LeftSide,
|
|
RightSide,
|
|
Final
|
|
} |