This commit is contained in:
CortexCore
2024-11-13 17:47:45 +08:00
parent c4af12acd7
commit 416e3322db
208 changed files with 2591757 additions and 1497 deletions

View File

@@ -94,6 +94,11 @@ namespace BITKit
/// </summary>
/// <returns></returns>
int Value => 10;
/// <summary>
/// 创建运行时物品
/// </summary>
/// <returns></returns>
IRuntimeItem CreateRuntimeItem();
}
public interface IRuntimeItem : ICloneable
@@ -101,7 +106,7 @@ namespace BITKit
/// <summary>
/// 运行时Id
/// </summary>
public int Id { get; }
public int Id { get; set; }
/// <summary>
/// 配置Id
@@ -111,7 +116,7 @@ namespace BITKit
/// <summary>
/// 数量
/// </summary>
public int Amount { get; }
public int Amount { get; set; }
/// <summary>
/// 运行时属性
@@ -133,14 +138,23 @@ namespace BITKit
/// 被托管的物品
/// </summary>
[Serializable]
public record RuntimeItem : IRuntimeItem
public struct RuntimeItem : IRuntimeItem
{
public int Id { get; set; } = new Random().Next();
public static RuntimeItem Create()
{
var item = new RuntimeItem()
{
Id = new Random().Next(),
RuntimeProperties =
new Dictionary<Type, IScriptableItemProperty>()
};
return item;
}
public int Id { get; set; }
public int ScriptableId { get; set; }
public int Amount { get; set; }
public IDictionary<Type, IScriptableItemProperty> RuntimeProperties { get; set; } =
new Dictionary<Type, IScriptableItemProperty>();
public IDictionary<Type, IScriptableItemProperty> RuntimeProperties { get; set; }
public event Action<IRuntimeItem> OnRuntimePropertiesChanged;