using System;
using System.Collections.Generic;
using ColdMint.scripts.map.events;
namespace ColdMint.scripts.inventory;
///
/// item container
/// 物品容器
///
///
///Item containers can store items. Things like backpacks and Hotbars are containers with visual pages.
///物品容器可以储存物品。像背包和hotbar是具有可视化页面的容器。
///
public interface IItemContainer : IEnumerable
{
///
/// This event is triggered when the selected item changes
/// 当选中的物品改变时,触发此事件
///
Action? SelectedItemChangeEvent { get; set; }
///
/// Can the specified item be added to the container?
/// 指定的物品是否可添加到容器内?
///
///
///
bool CanAddItem(IItem item);
///
/// Implement methods for adding items
/// 实现添加物品的方法
///
///
///
///How many items were successfully added. The addition failed, and 0 was returned.
///有多少个物品被成功添加了。添加失败,返回0
///
int AddItem(IItem item);
///
/// Whether this item container supports checking
/// 此物品容器是否支持选中
///
public bool SupportSelect { get; set; }
///
/// Gets the selected location
/// 获取选中的位置
///
///
int GetSelectIndex();
///
/// Gets the currently selected item
/// 获取当前选中的物品
///
///
IItem? GetSelectItem();
///
/// Gets the item in the specified location
/// 获取指定位置的物品
///
///
///
IItem? GetItem(int index);
///
/// Gets the item in the specified location, equivalent to
/// 获取指定位置的物品,等同于
///
///
///
IItem? this[int index] => GetItem(index);
///
/// Removes the item from the currently selected location
/// 移除当前选中位置的物品
///
///
/// Quantity to be removed, inputs below zero represent all items
/// 要删除的数量,小于0的输入代表全部物品
///
///
///How many items were actually removed
///实际移除了多少个物品
///
int RemoveSelectItem(int number);
///
/// Deduct the number of items in the specified location
/// 扣除指定位置的物品数量
///
///
///
/// Quantity to be removed, inputs below zero represent all items
/// 要删除的数量,小于0的输入代表全部物品
///
///
///How many items were actually removed
///实际移除了多少个物品
///
int RemoveItem(int itemIndex, int number);
///
/// Gets the used capacity of the item container
/// 获取物品容器已使用的容量
///
///
int GetUsedCapacity();
///
/// Gets the total capacity of the item container
/// 获取物品容器的总容量
///
///
int GetTotalCapacity();
///
/// Select the next item
/// 选择下一个物品
///
void SelectNextItem();
///
/// Select the previous item
/// 选择上一个物品
///
void SelectPreviousItem();
///
/// 选择物品
/// Select item
///
///
void SelectItem(int index);
}