迁移数据表到 Luban,移除 JsonNet、EnumUtility
This commit is contained in:
@@ -5,13 +5,13 @@ namespace SepCore.UI
|
||||
public class DisplayItemContext : UIContext
|
||||
{
|
||||
public string IconAssetName;
|
||||
public ItemRarity Rarity;
|
||||
public Rarity Rarity;
|
||||
public bool IsWeapon;
|
||||
|
||||
public DisplayItemContext()
|
||||
{
|
||||
IconAssetName = string.Empty;
|
||||
Rarity = ItemRarity.None;
|
||||
Rarity = Rarity.None;
|
||||
IsWeapon = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using SepCore.CustomUtility;
|
||||
using SepCore.DataTable;
|
||||
using SepCore.Definition;
|
||||
using SepCore.Entity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.UI
|
||||
@@ -9,7 +9,7 @@ namespace SepCore.UI
|
||||
public class GoodsItemContext : UIContext
|
||||
{
|
||||
public string Title;
|
||||
public ItemRarity Rarity;
|
||||
public Rarity Rarity;
|
||||
public Sprite Icon;
|
||||
public ItemType ItemType;
|
||||
public string Description;
|
||||
@@ -19,35 +19,50 @@ namespace SepCore.UI
|
||||
{
|
||||
Title = string.Empty;
|
||||
Description = string.Empty;
|
||||
Rarity = ItemRarity.White;
|
||||
Rarity = Rarity.White;
|
||||
Price = 0;
|
||||
Icon = null;
|
||||
ItemType = ItemType.None;
|
||||
ItemType = ItemType.Weapon;
|
||||
}
|
||||
|
||||
public GoodsItemContext(GoodsItemRawData rawData)
|
||||
public GoodsItemContext(GoodsItemRawData rawData)
|
||||
{
|
||||
if (rawData == null)
|
||||
{
|
||||
Title = string.Empty;
|
||||
Description = string.Empty;
|
||||
Rarity = Rarity.White;
|
||||
Price = 0;
|
||||
Icon = null;
|
||||
ItemType = ItemType.Weapon;
|
||||
return;
|
||||
}
|
||||
|
||||
Price = rawData.Price;
|
||||
Rarity = rawData.Rarity;
|
||||
ItemType = rawData.ItemType;
|
||||
|
||||
|
||||
if (ItemType == ItemType.None)
|
||||
if (rawData.DataRow == null)
|
||||
{
|
||||
Description = string.Empty;
|
||||
Icon = null;
|
||||
Title = string.Empty;
|
||||
}
|
||||
else if (ItemType == ItemType.Weapon)
|
||||
{
|
||||
var weapon = (DRWeapon)rawData.DataRow;
|
||||
Title = weapon.Title;
|
||||
Description = ItemDescUtility.CreateWeaponDescription(weapon);
|
||||
if (rawData.DataRow is WeaponConfig weaponConfig)
|
||||
{
|
||||
Title = weaponConfig.Name;
|
||||
Description = ItemDescUtility.CreateWeaponDescription(weaponConfig);
|
||||
}
|
||||
else if (rawData.DataRow is WeaponData weaponData)
|
||||
{
|
||||
Title = weaponData.Title;
|
||||
Description = ItemDescUtility.CreateWeaponDescription(weaponData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var prop = (DRProp)rawData.DataRow;
|
||||
var prop = (PropConfig)rawData.DataRow;
|
||||
Title = prop.Title;
|
||||
Description = ItemDescUtility.CreatePropDescription(prop.Modifiers);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using SepCore.DataTable;
|
||||
using SepCore.Definition;
|
||||
using SepCore.Entity;
|
||||
using SepCore.Entity.Weapon;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace SepCore.UI
|
||||
private static DisplayItemContext BuildPropItem(PropItem propItem)
|
||||
{
|
||||
string iconAssetName = null;
|
||||
ItemRarity rarity = ItemRarity.None;
|
||||
Rarity rarity = Rarity.None;
|
||||
|
||||
if (propItem != null)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace SepCore.UI
|
||||
private static DisplayItemContext BuildWeaponItem(WeaponBase weaponBase)
|
||||
{
|
||||
string iconAssetName = null;
|
||||
ItemRarity rarity = ItemRarity.None;
|
||||
Rarity rarity = Rarity.None;
|
||||
|
||||
if (weaponBase != null && weaponBase.WeaponData != null)
|
||||
{
|
||||
@@ -164,8 +164,13 @@ namespace SepCore.UI
|
||||
var context = new GoodsItemContext(rawData);
|
||||
context.Icon = context.ItemType switch
|
||||
{
|
||||
ItemType.Weapon => await GameEntry.SpriteCache.GetSprite(((DRWeapon)rawData.DataRow).IconAssetName),
|
||||
ItemType.Prop => await GameEntry.SpriteCache.GetSprite(((DRProp)rawData.DataRow).IconAssetName),
|
||||
ItemType.Weapon => await GameEntry.SpriteCache.GetSprite(rawData.DataRow switch
|
||||
{
|
||||
WeaponConfig weaponConfig => weaponConfig.IconAssetName,
|
||||
WeaponData weaponData => weaponData.IconAssetName,
|
||||
_ => string.Empty
|
||||
}),
|
||||
ItemType.Prop => await GameEntry.SpriteCache.GetSprite(((PropConfig)rawData.DataRow).IconAssetName),
|
||||
_ => null
|
||||
};
|
||||
return context;
|
||||
|
||||
Reference in New Issue
Block a user