对 DisplayItemInfoForm 按 5 层 UI 规范做结构整理

- 删除无用的 DisplayItemInfoUseCase,转为轻量 UI(Controller + Context + View)
- RawData 类型安全:object Data 拆分为 WeaponData + PropItem
- View 事件规范:回收按钮改用 UI 专用事件,由 Controller 通过回调转发
- 简化 _locked 状态管理,统一在 CloseUIAsync 中清理
This commit is contained in:
SepComet
2026-06-16 17:09:21 +08:00
committed by basil
parent 68b9f98e0e
commit 1fe2f31ede
11 changed files with 107 additions and 173 deletions
@@ -1,4 +1,7 @@
using System;
using SepCore.Definition;
using SepCore.Entity;
using SepCore.Entity.Weapon;
using UnityEngine;
namespace SepCore.UI
@@ -9,14 +12,16 @@ namespace SepCore.UI
Weapon,
Prop
}
public class DisplayItemInfoRawData
{
public int Index;
public object Data;
public WeaponData WeaponData;
public PropItem PropData;
public ItemType ItemType;
public ItemRarity Rarity;
public int Price;
public Vector3 TargetPos;
public Action<int, int> OnRecycle;
}
}
@@ -1,68 +0,0 @@
using SepCore.Definition;
using SepCore.Entity;
using SepCore.CustomUtility;
using SepCore.Entity.Weapon;
namespace SepCore.UI
{
public class DisplayItemInfoUseCase : IUIUseCase
{
private readonly Player _player;
private Player Player => _player;
public DisplayItemInfoUseCase(Player player)
{
_player = player;
}
public DisplayItemInfoRawData CreateModel(int index, bool isWeapon)
{
if (index < 0 || Player == null)
{
return null;
}
if (isWeapon)
{
var weapons = Player.Weapons;
if (weapons == null || index >= weapons.Count)
{
return null;
}
WeaponBase weapon = weapons[index];
if (weapon == null || weapon.WeaponData == null)
{
return null;
}
return new DisplayItemInfoRawData
{
Data = weapon.WeaponData,
ItemType = ItemType.Weapon,
Price = 0,
};
}
var props = Player.Props;
if (props == null || index >= props.Count)
{
return null;
}
PropItem prop = props[index];
if (prop == null)
{
return null;
}
return new DisplayItemInfoRawData
{
Data = prop,
ItemType = ItemType.Prop,
Price = 0,
};
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 48c1f32fe95e20c43b8015ac1438d54e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: