using System;
using System.Collections.Generic;
using Verse;
namespace WulaFallenEmpire
{
///
/// 用于武装穿梭机口袋空间的IThingHolder实现,与CompTransporter的容器分离
///
public class PocketSpaceThingHolder : IThingHolder, IExposable
{
/// 持有的物品容器
public ThingOwner innerContainer;
/// 该容器的拥有者(通常是Building_ArmedShuttleWithPocket)
private IThingHolder owner;
/// 实现IThingHolder.ParentHolder属性
public IThingHolder ParentHolder => owner;
public PocketSpaceThingHolder()
{
innerContainer = new ThingOwner(this);
}
public PocketSpaceThingHolder(IThingHolder owner) : this()
{
this.owner = owner;
}
///
/// 获取直接持有的物品
///
public ThingOwner GetDirectlyHeldThings()
{
return innerContainer;
}
///
/// 获取子持有者
///
public void GetChildHolders(List outChildren)
{
// 目前没有子持有者,留空
}
///
/// 通知物品被添加
///
public void Notify_ThingAdded(Thing t)
{
// 这里可以添加逻辑来处理物品被添加到口袋空间的情况
Log.Message($"[WULA] Item {t.LabelCap} added to pocket space container.");
}
///
/// 通知物品被移除
///
public void Notify_ThingRemoved(Thing t)
{
// 这里可以添加逻辑来处理物品被从口袋空间移除的情况
Log.Message($"[WULA] Item {t.LabelCap} removed from pocket space container.");
}
public void ExposeData()
{
Scribe_Deep.Look(ref innerContainer, "innerContainer", this);
// owner 通常在构造函数中设置,不需要序列化
}
}
}