重构:修复 Shop 与 ItemTooltip 跨模块事件边界问题
- 将 _tooltipLocked 状态从 ItemTooltipController 移到 ShopController 维护 - DisplayItem 只发 Shop 模块 UI 事件(Hover/Lock/Hide) - ItemTooltipForm 取消按钮发 ItemTooltip 模块事件自关闭 - ShopController 通过 UIRouter 跨模块控制 ItemTooltipForm - 移除 DisplayItemHideEventArgs 的 Force 字段,分离两种关闭场景
This commit is contained in:
@@ -25,37 +25,32 @@ namespace SepCore.UI
|
||||
ItemType = ItemType.None;
|
||||
}
|
||||
|
||||
public static async UniTask<GoodsItemContext> CreateAsync(GoodsItemRawData rawData)
|
||||
public GoodsItemContext(GoodsItemRawData rawData)
|
||||
{
|
||||
var context = new GoodsItemContext
|
||||
{
|
||||
Price = rawData.Price,
|
||||
Rarity = rawData.Rarity,
|
||||
ItemType = rawData.ItemType
|
||||
};
|
||||
|
||||
if (context.ItemType == ItemType.None)
|
||||
Price = rawData.Price;
|
||||
Rarity = rawData.Rarity;
|
||||
ItemType = rawData.ItemType;
|
||||
|
||||
|
||||
if (ItemType == ItemType.None)
|
||||
{
|
||||
context.Description = string.Empty;
|
||||
context.Icon = null;
|
||||
context.Title = string.Empty;
|
||||
Description = string.Empty;
|
||||
Icon = null;
|
||||
Title = string.Empty;
|
||||
}
|
||||
else if (context.ItemType == ItemType.Weapon)
|
||||
else if (ItemType == ItemType.Weapon)
|
||||
{
|
||||
var weapon = (DRWeapon)rawData.DataRow;
|
||||
context.Title = weapon.Title;
|
||||
context.Description = ItemDescUtility.CreateWeaponDescription(weapon);
|
||||
context.Icon = await GameEntry.SpriteCache.GetSprite(weapon.IconAssetName);
|
||||
Title = weapon.Title;
|
||||
Description = ItemDescUtility.CreateWeaponDescription(weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
var prop = (DRProp)rawData.DataRow;
|
||||
context.Title = prop.Title;
|
||||
context.Description = ItemDescUtility.CreatePropDescription(prop.Modifiers);
|
||||
context.Icon = await GameEntry.SpriteCache.GetSprite(prop.IconAssetName);
|
||||
Title = prop.Title;
|
||||
Description = ItemDescUtility.CreatePropDescription(prop.Modifiers);
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user