39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using UnityEngine;
|
|
using GameCore;
|
|
using UnityEngine.UI;
|
|
using asap.core;
|
|
|
|
public class OfferStoryChainTaskView : MonoBehaviour
|
|
{
|
|
[SerializeField] private Image[] Icons;
|
|
[SerializeField] private RewardItemNew RewardItem;
|
|
[SerializeField] private RewardFlyBatchController rewardFlyBatchController;
|
|
|
|
public void SetIcons(int progress)
|
|
{
|
|
Debug.Log($"[OfferStoryChain] Set task icons. Progress: {progress}");
|
|
progress = Mathf.Clamp(progress, 0, Icons.Length);
|
|
for (int i = 0; i < Icons.Length; i++)
|
|
Icons[i].gameObject.SetActive(i < progress);
|
|
}
|
|
|
|
public void SetReward(ItemData itemData)
|
|
{
|
|
RewardItem.SetData(itemData);
|
|
}
|
|
|
|
public async System.Threading.Tasks.Task PlayItemFly(RectTransform start, int idx)
|
|
{
|
|
var flyRequest = new BatchedRewardFlyRequest();
|
|
flyRequest.Icon = new BatchedRewardFlyRequestIcon
|
|
{
|
|
icon = Icons[idx].sprite
|
|
};
|
|
flyRequest.StartPoint = new BatchedRewardFlyStartPoint(start);
|
|
flyRequest.EndPoint = new BatchedRewardFlyEndPoint(Icons[idx].rectTransform);
|
|
flyRequest.IsDestinationRewardStash = false;
|
|
flyRequest.AnimationParamIndex = 0;
|
|
await rewardFlyBatchController.OnRewardFlyRequestAsync(flyRequest);
|
|
}
|
|
}
|