2024-01-21 17:42:31 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
namespace BlueWaterProject
|
|
|
|
{
|
|
|
|
public class DropItemGroupController : MonoBehaviour
|
|
|
|
{
|
|
|
|
[field: SerializeField] public List<DropItemInfoUi> dropItemInfoUiList = new(3);
|
|
|
|
|
|
|
|
private WaitForSeconds coroutineRestartTime = new(0.5f);
|
|
|
|
|
2024-04-08 19:57:31 +00:00
|
|
|
public void ShowDropItemInfoUi(Item item, int count)
|
2024-01-21 17:42:31 +00:00
|
|
|
{
|
2024-04-08 19:57:31 +00:00
|
|
|
StartCoroutine(ShowDropItemInfoUiCoroutine(item, count));
|
2024-01-21 17:42:31 +00:00
|
|
|
}
|
|
|
|
|
2024-04-08 19:57:31 +00:00
|
|
|
private IEnumerator ShowDropItemInfoUiCoroutine(Item item, int count)
|
2024-01-21 17:42:31 +00:00
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
foreach (var list in dropItemInfoUiList)
|
|
|
|
{
|
|
|
|
if (list.UiView.gameObject.activeSelf) continue;
|
|
|
|
|
2024-04-08 19:57:31 +00:00
|
|
|
var itemText = item.name + " x" + count;
|
|
|
|
list.SetInfo(item.icon, itemText);
|
2024-01-21 17:42:31 +00:00
|
|
|
list.ShowUi();
|
|
|
|
|
|
|
|
while (list.UiView.gameObject.activeSelf)
|
|
|
|
{
|
|
|
|
yield return null;
|
|
|
|
}
|
|
|
|
yield break;
|
|
|
|
}
|
|
|
|
yield return coroutineRestartTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|