修改框架

This commit is contained in:
MuHua-123
2025-09-25 17:50:28 +08:00
parent d940a18e13
commit 18c6b4387d
79 changed files with 1017 additions and 392 deletions
@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 库存插槽
/// </summary>
public class InventorySlot {
/// <summary> 数量 </summary>
public int count;
/// <summary> 物品 </summary>
public InventoryItem item;
// /// <summary> 图片 </summary>
public Sprite Sprite => item != null ? item.sprite : null;
// /// <summary> 堆叠数量 </summary>
public int MaxStack => item != null ? item.MaxStack : 0;
public InventorySlot() { }
public InventorySlot(InventoryItem item, int count) {
this.item = item;
this.count = count;
}
/// <summary> 设置 </summary>
public void Settings(InventoryItem item, int count) {
this.item = item;
this.count = count;
}
/// <summary> 是否相同 </summary>
public bool Same(InventoryItem obj) {
return item != null && item.name == obj.name && count < MaxStack;
}
}