using System;
using ColdMint.scripts.map.events;
namespace ColdMint.scripts.inventory;
///
/// item container
/// 物品容器
///
public interface IItemContainer
{
///
/// This event is triggered when the selected item changes
/// 当选中的物品改变时,触发此事件
///
Action? SelectedItemChangeEvent { get; set; }
///
/// This event is triggered when the item's data changes, such as the number increases, decreases, or new items are added to the container
/// 当物品的数据发生改变时,例如数量增加,减少,或者新物品被添加到容器内触发此事件
///
Action? ItemDataChangeEvent { get; set; }
///
/// Allow Adding Item By Type
/// 允许添加指定类型的物品
///
///
void AllowAddingItemByType(int itemType);
///
/// Disallow Adding Item By Type
/// 禁止添加指定类型的物品
///
///
void DisallowAddingItemByType(int itemType);
///
/// 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
/// 此物品容器是否支持选中
///
bool SupportSelect { get; set; }
///
/// Gets a placeholder object
/// 获取占位符对象
///
///
///index
///占位符代替的索引
///
///
IItem GetPlaceHolderItem(int index);
///
/// Gets the selected location
/// 获取选中的位置
///
///
int GetSelectIndex();
///
/// Gets the currently selected item
/// 获取当前选中的物品
///
///
IItem? GetSelectItem();
///
/// Gets the item in the specified location
/// 获取指定位置的物品
///
///
///
IItem? GetItem(int index);
///
/// ReplaceItem
/// 替换物品
///
///
///Even if the item corresponding to the index is null, it can be successfully replaced.
///即使索引对应的物品为null,也可以成功的替换。
///
///
///
///
bool ReplaceItem(int index, IItem item);
///
/// Whether items are replaceable
/// 是否可替换物品
///
///
///
///
bool CanReplaceItem(int index, IItem item);
///
/// ClearItem
/// 清理物品
///
///
///
bool ClearItem(int index);
///
/// ClearAllItems
/// 清理全部物品
///
void ClearAllItems();
///
/// 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);
}