using System; using System.Collections.Generic; using System.Linq; using UnityEditor; using UnityEngine; public class EquipmentDataListManager : DataListManager> { public new DataListManager> SetUiManager(ref EquipmentUIManager _uiManager) { uiManager = _uiManager; return this; } /// /// Function to init equipment list /// We should init this before each operation on equipment /// /// public List> InitEquipment() { List> convertedList = new List>(); foreach (EquipmentPanelSlotsTypeEnum emptyElement in Enum.GetValues(typeof(EquipmentPanelSlotsTypeEnum))) { convertedList.Add(new IndexValuePair((int)emptyElement, null)); } return convertedList; } public override void AddElementToList(IndexValuePair newElement) { Elements .Where(equipment => equipment.Key == newElement.Key) .ToList() .ForEach(equipment => equipment.Value = newElement.Value); } public override void RemoveElementFromList(IndexValuePair element) { Elements .Where(equipment => equipment.Key == element.Key) .ToList() .ForEach(equipment => equipment.Value = null); } }