重构:修复 Shop 与 ItemTooltip 跨模块事件边界问题
- 将 _tooltipLocked 状态从 ItemTooltipController 移到 ShopController 维护 - DisplayItem 只发 Shop 模块 UI 事件(Hover/Lock/Hide) - ItemTooltipForm 取消按钮发 ItemTooltip 模块事件自关闭 - ShopController 通过 UIRouter 跨模块控制 ItemTooltipForm - 移除 DisplayItemHideEventArgs 的 Force 字段,分离两种关闭场景
This commit is contained in:
@@ -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:
|
||||
@@ -0,0 +1,41 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class DisplayItemHoverEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(DisplayItemHoverEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public int Index;
|
||||
public bool IsWeapon;
|
||||
public Vector3 TargetPos;
|
||||
|
||||
public DisplayItemHoverEventArgs()
|
||||
{
|
||||
Index = -1;
|
||||
IsWeapon = false;
|
||||
TargetPos = Vector3.zero;
|
||||
}
|
||||
|
||||
public static DisplayItemHoverEventArgs Create(int index, bool isWeapon, Vector3 targetPos)
|
||||
{
|
||||
var args = ReferencePool.Acquire<DisplayItemHoverEventArgs>();
|
||||
args.Index = index;
|
||||
args.IsWeapon = isWeapon;
|
||||
args.TargetPos = targetPos;
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Index = -1;
|
||||
IsWeapon = false;
|
||||
TargetPos = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f43032aabf2403746bf0977988e91bbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class DisplayItemLockEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(DisplayItemLockEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public DisplayItemLockEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
public static DisplayItemLockEventArgs Create()
|
||||
{
|
||||
var args = ReferencePool.Acquire<DisplayItemLockEventArgs>();
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user