Scriptum/Assets/Scripts/REFACTORING/Application/Shared/Manager/UI/UISlotPanelManager.cs
2022-11-24 03:03:30 +01:00

53 lines
1.4 KiB
C#

using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public abstract class UISlotPanelManager<T> : UIBaseManager<T>
{
public virtual int SLOTS_NUMBER => 0;
/// <summary>
/// Function to find item in warehouser by its id, returns list of all slots where item occured
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public abstract List<T> FindItemInWarehouse(int itemId);
/// <summary>
/// Function to find item in warehouser by its name, returns list of all slots where item occured
/// </summary>
/// <param name="itemId"></param>
/// <returns></returns>
public abstract List<T> FindItemInWarehouseByName(string itemName);
public abstract void RemoveByPosition(int keyPosition);
public abstract int RemoveByItemId(int itemId);
public abstract int RemoveByItemName(string itemName);
public virtual void RemoveAll()
{
Elements.Clear();
}
public bool IsFull()
{
return Elements.Count() == SLOTS_NUMBER;
}
protected bool CheckIfSlotIsInRange(int slotNumber)
{
return slotNumber < SLOTS_NUMBER;
}
protected abstract bool CheckIfSlotExists(int slotNumber);
/// <summary>
/// Check if slot is empty in local list
/// </summary>
/// <returns></returns>
protected abstract bool CheckIfPositionIsEmpty(int slotNumber);
}