添加 ShopForm 下的 StatForm,展示玩家属性

This commit is contained in:
2026-09-25 00:03:39 +08:00
parent c61eb7fb68
commit 051c075183
29 changed files with 6574 additions and 51 deletions
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using SepCore.Components;
using SepCore.Definition;
using SepCore.Entity;
using SepCore.CustomUtility;
@@ -47,10 +48,34 @@ namespace SepCore.UI
PropItems = _player.Props,
PropMaxCount = GameEntry.Luban.Global.PropMaxCount,
WeaponItems = _player.Weapons,
WeaponMaxCount = _player.WeaponCapacity
WeaponMaxCount = _player.WeaponCapacity,
StatRawData = CreateStatRawData()
};
}
public StatRawData CreateStatRawData()
{
var rawData = new StatRawData();
StatComponent statComponent = _player.StatComponent;
if (statComponent == null)
{
Log.Error("ShopUseCase.CreateStatRawData: Player StatComponent is null.");
return rawData;
}
foreach (StatType statType in (StatType[])Enum.GetValues(typeof(StatType)))
{
if (statType == StatType.None)
{
continue;
}
rawData.SetValue(statType, statComponent.GetStatValue(statType));
}
return rawData;
}
public ShopRefreshResult TryRefresh(int cost)
{
if (_player.Coin < cost)
@@ -102,7 +127,8 @@ namespace SepCore.UI
return new ShopPurchaseResult
{
GoodsIndex = goodsIndex,
DisplayItem = displayItem
DisplayItem = displayItem,
StatRawData = CreateStatRawData()
};
}