This commit is contained in:
CortexCore
2024-11-08 12:52:09 +08:00
parent 4ba741408d
commit 1650126d55
27 changed files with 851 additions and 193 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
@@ -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;