重构:修复 Shop 与 ItemTooltip 跨模块事件边界问题

- 将 _tooltipLocked 状态从 ItemTooltipController 移到 ShopController 维护
- DisplayItem 只发 Shop 模块 UI 事件(Hover/Lock/Hide)
- ItemTooltipForm 取消按钮发 ItemTooltip 模块事件自关闭
- ShopController 通过 UIRouter 跨模块控制 ItemTooltipForm
- 移除 DisplayItemHideEventArgs 的 Force 字段,分离两种关闭场景
This commit is contained in:
2026-06-17 09:37:44 +08:00
parent 2590f31250
commit c30b256d7a
24 changed files with 340 additions and 213 deletions
@@ -9,24 +9,19 @@ namespace SepCore.Event
public override int Id => EventId;
public bool Force = false;
public ItemTooltipHideEventArgs()
{
Force = false;
}
public static ItemTooltipHideEventArgs Create(bool force = false)
{
var args = ReferencePool.Acquire<ItemTooltipHideEventArgs>();
args.Force = force;
return args;
}
public override void Clear()
{
Force = false;
}
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 17754f00ac924fc29b3604cfed7a5efe
timeCreated: 1771488601
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 51bff2c6818f44398b4b8f7d1448b310
timeCreated: 1771071724
@@ -0,0 +1,27 @@
using GameFramework;
using GameFramework.Event;
namespace SepCore.Event
{
public class DisplayItemHideEventArgs : GameEventArgs
{
public static readonly int EventId = typeof(DisplayItemHideEventArgs).GetHashCode();
public override int Id => EventId;
public DisplayItemHideEventArgs()
{
}
public static DisplayItemHideEventArgs Create()
{
var args = ReferencePool.Acquire<DisplayItemHideEventArgs>();
return args;
}
public override void Clear()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb8173a4a0fb12245bc81b5bd66b5948
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -4,30 +4,30 @@ using UnityEngine;
namespace SepCore.Event
{
public class ItemTooltipShowEventArgs : GameEventArgs
public class DisplayItemHoverEventArgs : GameEventArgs
{
public static readonly int EventId = typeof(ItemTooltipShowEventArgs).GetHashCode();
public static readonly int EventId = typeof(DisplayItemHoverEventArgs).GetHashCode();
public override int Id => EventId;
public int Index { get; private set; }
public int Index;
public bool IsWeapon;
public Vector3 TargetPos;
public bool IsWeapon { get; private set; }
public Vector3 TargetPos { get; private set; }
public ItemTooltipShowEventArgs()
public DisplayItemHoverEventArgs()
{
Index = -1;
IsWeapon = false;
TargetPos = Vector3.zero;
}
public static ItemTooltipShowEventArgs Create(int index, bool isWeapon, Vector3 targetPos)
public static DisplayItemHoverEventArgs Create(int index, bool isWeapon, Vector3 targetPos)
{
var args = ReferencePool.Acquire<ItemTooltipShowEventArgs>();
var args = ReferencePool.Acquire<DisplayItemHoverEventArgs>();
args.Index = index;
args.IsWeapon = isWeapon;
args.TargetPos = targetPos;
return args;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f43032aabf2403746bf0977988e91bbb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -3,19 +3,19 @@ using GameFramework.Event;
namespace SepCore.Event
{
public class ItemTooltipLockEventArgs : GameEventArgs
public class DisplayItemLockEventArgs : GameEventArgs
{
public static readonly int EventId = typeof(ItemTooltipLockEventArgs).GetHashCode();
public static readonly int EventId = typeof(DisplayItemLockEventArgs).GetHashCode();
public override int Id => EventId;
public ItemTooltipLockEventArgs()
public DisplayItemLockEventArgs()
{
}
public static ItemTooltipLockEventArgs Create()
public static DisplayItemLockEventArgs Create()
{
var args = ReferencePool.Acquire<ItemTooltipLockEventArgs>();
var args = ReferencePool.Acquire<DisplayItemLockEventArgs>();
return args;
}
@@ -24,4 +24,4 @@ namespace SepCore.Event
{
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ad9bcc1ac9ad4141b810d224a31a201
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -24,4 +24,4 @@ namespace SepCore.Event
{
}
}
}
}
@@ -1,3 +1,11 @@
fileFormatVersion: 2
guid: b09ad1baac8a41338c0e42baf398beb8
timeCreated: 1770986449
guid: e5e26cd3da0c8bc46ac72f106b73357d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -8,27 +8,26 @@ namespace SepCore.Event
public static readonly int EventId = typeof(ShopPurchaseEventArgs).GetHashCode();
public override int Id => EventId;
public int GoodsIndex { get; private set; }
public ShopPurchaseEventArgs()
{
GoodsIndex = -1;
}
public static ShopPurchaseEventArgs Create(int index)
{
var args = ReferencePool.Acquire<ShopPurchaseEventArgs>();
args.GoodsIndex = index;
return args;
}
public override void Clear()
{
GoodsIndex = -1;
}
}
}
}
@@ -1,3 +1,11 @@
fileFormatVersion: 2
guid: 11c82e4a45804087b1aaf337e38a8836
timeCreated: 1770986490
guid: a39ac97844dfeea4dacfdd80316ddb1e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
using GameFramework;
using GameFramework.Event;
namespace SepCore.Event
{
public class ShopRefreshEventArgs : GameEventArgs
{
public static readonly int EventId = typeof(ShopRefreshEventArgs).GetHashCode();
public override int Id => EventId;
public int Cost { get; private set; }
public ShopRefreshEventArgs()
{
Cost = 0;
}
public static ShopRefreshEventArgs Create(int cost)
{
var args = ReferencePool.Acquire<ShopRefreshEventArgs>();
args.Cost = cost;
return args;
}
public override void Clear()
{
Cost = 0;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ebfa286438bc924f8c0fb8ebdfc5ce1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: