添加 SepCore.Runtime 和 SepCore.Base 程序集

- 暂时将 Entity 全部归进 Runtime 程序集里
- 调整部分 UI 的 UseCase/RawData/Context 之间的关系,让 RawData 更接近业务原始数据,Context 更接近 UI 直接可读的数据
- 调整其他程序集的引用关系
This commit is contained in:
SepComet
2026-06-03 11:15:58 +08:00
parent d5893ac52b
commit 91f70dd783
176 changed files with 245 additions and 231 deletions
@@ -1,110 +0,0 @@
using System;
using System.Collections.Generic;
using SepCore.DataTable;
using SepCore.Definition;
using GameFramework;
namespace Entity.EntityData
{
[Serializable]
public class WeaponData : AccessoryObjectData
{
private DRWeapon _drWeapon;
private int _entityTypeId = 0;
public WeaponData(int entityId, WeaponType weaponType, int ownerId, CampType ownerCamp)
: base(entityId, (int)weaponType, ownerId, ownerCamp)
{
_drWeapon = GameEntry.DataTable.GetDataTableRow<DRWeapon>((int)weaponType);
if (_drWeapon == null)
{
throw new Exception($"Weapon data table row is missing, WeaponType='{weaponType}'.");
}
_entityTypeId = _drWeapon.EntityTypeId;
}
public WeaponType WeaponType => (WeaponType)_drWeapon.Id;
public bool TryGetParam(string key, out string value)
{
value = null;
if (string.IsNullOrEmpty(key) || Params == null)
{
return false;
}
return Params.TryGetValue(key, out value);
}
protected TParams ParseParams<TParams>() where TParams : new()
{
if (string.IsNullOrWhiteSpace(_drWeapon.ParamsJson))
{
return new TParams();
}
try
{
TParams parsed = Utility.Json.ToObject<TParams>(_drWeapon.ParamsJson);
return parsed ?? new TParams();
}
catch (Exception exception)
{
throw new Exception(
$"Failed to parse weapon params, WeaponType='{WeaponType}', Json='{_drWeapon.ParamsJson}'.",
exception);
}
}
/// <summary>
/// 攻击力。
/// </summary>
public int Attack => _drWeapon.Attack;
public int EntityTypeId => _entityTypeId;
/// <summary>
/// 武器名称。
/// </summary>
public string Title => _drWeapon.Title;
/// <summary>
/// 图标资源名称。
/// </summary>
public string IconAssetName => _drWeapon.IconAssetName;
public ItemRarity Rarity => _drWeapon.Rarity;
public int Price => _drWeapon.Price;
/// <summary>
/// 攻击间隔。
/// </summary>
public float Cooldown => _drWeapon.Cooldown;
/// <summary>
/// 攻击范围。
/// </summary>
public float AttackRange => _drWeapon.AttackRange;
/// <summary>
/// 攻击音效。
/// </summary>
public int AttackSoundId => _drWeapon.AttackSoundId;
/// <summary>
/// 额外参数。
/// </summary>
public Dictionary<string, string> Params => _drWeapon.Pramas;
public string ParamsJson => _drWeapon.ParamsJson;
/// <summary>
/// 额外属性。
/// </summary>
public StatModifier[] Modifiers => _drWeapon.Modifiers;
}
}