调整部分数据表配置,优化 SpriteCache 功能

This commit is contained in:
2026-09-13 20:36:21 +08:00
parent de53890de6
commit 7dc529a840
520 changed files with 24231 additions and 967 deletions
@@ -1,4 +1,5 @@
using Cysharp.Threading.Tasks;
using SepCore.AsyncTask;
using SepCore.Event;
using UnityEngine;
using UnityEngine.UI;
@@ -29,7 +30,7 @@ namespace SepCore.UI
if (_iconArea != null)
{
var sprite = await GameEntry.SpriteCache.GetSprite(_context.IconAssetName);
var sprite = await SpriteLoader.LoadSpriteByKeyAsync(_context.IconAssetName);
_iconArea.OnInit(sprite, context.Rarity);
}
}
@@ -8,7 +8,7 @@ namespace SepCore.UI
{
public class GoodsItemContext : UIContext
{
public string Title;
public string Name;
public Rarity Rarity;
public Sprite Icon;
public ItemType ItemType;
@@ -17,7 +17,7 @@ namespace SepCore.UI
public GoodsItemContext()
{
Title = string.Empty;
Name = string.Empty;
Description = string.Empty;
Rarity = Rarity.White;
Price = 0;
@@ -29,7 +29,7 @@ namespace SepCore.UI
{
if (rawData == null)
{
Title = string.Empty;
Name = string.Empty;
Description = string.Empty;
Rarity = Rarity.White;
Price = 0;
@@ -45,25 +45,25 @@ namespace SepCore.UI
if (rawData.DataRow == null)
{
Icon = null;
Title = string.Empty;
Name = string.Empty;
}
else if (ItemType == ItemType.Weapon)
{
if (rawData.DataRow is WeaponConfig weaponConfig)
{
Title = weaponConfig.Name;
Name = weaponConfig.WeaponType.ToString();
Description = ItemDescUtility.CreateWeaponDescription(weaponConfig);
}
else if (rawData.DataRow is WeaponData weaponData)
{
Title = weaponData.Title;
Name = weaponData.Title;
Description = ItemDescUtility.CreateWeaponDescription(weaponData);
}
}
else
{
var prop = (PropConfig)rawData.DataRow;
Title = prop.Title;
Name = prop.Name;
Description = ItemDescUtility.CreatePropDescription(prop.Modifiers);
}
}
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using SepCore.AsyncTask;
using SepCore.Definition;
using SepCore.Entity;
using SepCore.Entity.Weapon;
using UnityGameFramework.Runtime;
namespace SepCore.UI
@@ -164,13 +164,13 @@ namespace SepCore.UI
var context = new GoodsItemContext(rawData);
context.Icon = context.ItemType switch
{
ItemType.Weapon => await GameEntry.SpriteCache.GetSprite(rawData.DataRow switch
ItemType.Weapon => await SpriteLoader.LoadSpriteByKeyAsync(rawData.DataRow switch
{
WeaponConfig weaponConfig => weaponConfig.IconAssetName,
WeaponConfig weaponConfig => weaponConfig.Sprite,
WeaponData weaponData => weaponData.IconAssetName,
_ => string.Empty
}),
ItemType.Prop => await GameEntry.SpriteCache.GetSprite(((PropConfig)rawData.DataRow).IconAssetName),
ItemType.Prop => await SpriteLoader.LoadSpriteByKeyAsync(((PropConfig)rawData.DataRow).Sprite),
_ => null
};
return context;
@@ -1,7 +1,7 @@
using Cysharp.Threading.Tasks;
using SepCore.Event;
using SepCore.Definition;
using SepCore.Entity.Weapon;
using SepCore.Entity;
using GameFramework.Event;
using UnityEngine;
using UnityGameFramework.Runtime;
@@ -22,7 +22,7 @@ namespace SepCore.UI
public void Init(GoodsItemContext data)
{
_iconArea.OnInit(data.Icon, data.Rarity);
_titleText.text = data.Title;
_titleText.text = data.Name;
_typeText.text = data.ItemType switch
{
ItemType.None => "error",