重构:统一 UI 模块目录结构规范

- 事件命名规范化:RefreshEventArgs → LevelUpRefreshEventArgs
- LevelUp 子组件目录调整:LevelUpRewardItem + LevelUpRewardItemContext 移动到 LevelUp/
- Shop 子组件目录调整:DisplayItem/DisplayListArea/GoodsItem/ShopGoodsItem 及其 Context/RawData 全部移动到 Shop/
- 删除冗余文件:LevelUpRewardItemRawData(从未被使用)
- 新增 ObjectPool 目录结构
- 更新 LevelUpController 和 LevelUpForm 中的事件引用
This commit is contained in:
SepComet 2026-06-17 09:50:47 +08:00
parent c30b256d7a
commit 5c3b87ab3f
31 changed files with 22 additions and 39 deletions

View File

@ -3,22 +3,22 @@ using GameFramework.Event;
namespace SepCore.Event namespace SepCore.Event
{ {
public class RefreshEventArgs : GameEventArgs public class LevelUpRefreshEventArgs : GameEventArgs
{ {
public static readonly int EventId = typeof(RefreshEventArgs).GetHashCode(); public static readonly int EventId = typeof(LevelUpRefreshEventArgs).GetHashCode();
public override int Id => EventId; public override int Id => EventId;
public int Cost { get; private set; } public int Cost { get; private set; }
public RefreshEventArgs() public LevelUpRefreshEventArgs()
{ {
Cost = 0; Cost = 0;
} }
public static RefreshEventArgs Create(int cost) public static LevelUpRefreshEventArgs Create(int cost)
{ {
var args = ReferencePool.Acquire<RefreshEventArgs>(); var args = ReferencePool.Acquire<LevelUpRefreshEventArgs>();
args.Cost = cost; args.Cost = cost;

View File

@ -21,14 +21,14 @@ namespace SepCore.UI
protected override void SubscribeCustomEvents() protected override void SubscribeCustomEvents()
{ {
GameEntry.Event.Subscribe(RefreshEventArgs.EventId, OnRefresh); GameEntry.Event.Subscribe(LevelUpRefreshEventArgs.EventId, LevelUpRefresh);
GameEntry.Event.Subscribe(LevelUpPropSelectedEventArgs.EventId, OnLevelUpPropSelected); GameEntry.Event.Subscribe(LevelUpPropSelectedEventArgs.EventId, LevelUpPropSelected);
} }
protected override void UnsubscribeCustomEvents() protected override void UnsubscribeCustomEvents()
{ {
GameEntry.Event.Unsubscribe(RefreshEventArgs.EventId, OnRefresh); GameEntry.Event.Unsubscribe(LevelUpRefreshEventArgs.EventId, LevelUpRefresh);
GameEntry.Event.Unsubscribe(LevelUpPropSelectedEventArgs.EventId, OnLevelUpPropSelected); GameEntry.Event.Unsubscribe(LevelUpPropSelectedEventArgs.EventId, LevelUpPropSelected);
} }
private static LevelUpContext BuildContext(LevelUpRawData rawData) private static LevelUpContext BuildContext(LevelUpRawData rawData)
@ -144,14 +144,14 @@ namespace SepCore.UI
await OpenUIAsync(rawData); await OpenUIAsync(rawData);
} }
private void OnRefresh(object sender, GameEventArgs e) private void LevelUpRefresh(object sender, GameEventArgs e)
{ {
if (sender is not LevelUpForm levelUpForm || levelUpForm != Form) if (sender is not LevelUpForm levelUpForm || levelUpForm != Form)
{ {
return; return;
} }
if (e is not RefreshEventArgs args) if (e is not LevelUpRefreshEventArgs args)
{ {
return; return;
} }
@ -159,7 +159,7 @@ namespace SepCore.UI
RefreshRewardListAsync(args.Cost).Forget(); RefreshRewardListAsync(args.Cost).Forget();
} }
private void OnLevelUpPropSelected(object sender, GameEventArgs e) private void LevelUpPropSelected(object sender, GameEventArgs e)
{ {
if (sender is not LevelUpForm levelUpForm || levelUpForm != Form) if (sender is not LevelUpForm levelUpForm || levelUpForm != Form)
{ {

View File

@ -64,7 +64,7 @@ namespace SepCore.UI
public void OnRefreshButtonClick() public void OnRefreshButtonClick()
{ {
GameEntry.Event.Fire(this, RefreshEventArgs.Create(_context.RefreshPrice)); GameEntry.Event.Fire(this, LevelUpRefreshEventArgs.Create(_context.RefreshPrice));
} }
} }
} }

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 166c0ae58c1d0b34ababe6d3a3791efa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,14 +0,0 @@
using SepCore.Definition;
using UnityEngine;
namespace SepCore.UI
{
public class LevelUpRewardItemRawData
{
public string Title;
public Sprite Icon;
public ItemRarity ItemRarity;
public string Description;
public string IconAssetName;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 56a75fb39cca45c4ea220af2c850e677
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: