41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
|
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);
|
||
|
|
||
|
public void ShowDropItemInfoUi(IItem iItem)
|
||
|
{
|
||
|
StartCoroutine(ShowDropItemInfoUiCoroutine(iItem));
|
||
|
}
|
||
|
|
||
|
private IEnumerator ShowDropItemInfoUiCoroutine(IItem iItem)
|
||
|
{
|
||
|
while (true)
|
||
|
{
|
||
|
foreach (var list in dropItemInfoUiList)
|
||
|
{
|
||
|
if (list.UiView.gameObject.activeSelf) continue;
|
||
|
|
||
|
var itemText = iItem.ItemName + " x" + iItem.ItemCount;
|
||
|
list.SetInfo(iItem.ItemIcon, itemText);
|
||
|
list.ShowUi();
|
||
|
|
||
|
while (list.UiView.gameObject.activeSelf)
|
||
|
{
|
||
|
yield return null;
|
||
|
}
|
||
|
yield break;
|
||
|
}
|
||
|
yield return coroutineRestartTime;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|