284 lines
6.4 KiB
C#
284 lines
6.4 KiB
C#
// 此文件由 ThriftIntegratedPipeline 自动生成,请勿手动修改
|
||
// 配置类: PetShopItem
|
||
// 数据类: PetShopItemItem
|
||
|
||
using UnityEngine;
|
||
using Byway.Config;
|
||
using Byway.Thrift.Data;
|
||
using UnityGameFramework.Runtime;
|
||
|
||
namespace CrazyMaple
|
||
{
|
||
/// <summary>
|
||
/// PetShopItem 数据行
|
||
/// </summary>
|
||
public class DRPetShopItem : DataRowBase
|
||
{
|
||
private PetShopItemItem _configData;
|
||
|
||
/// <summary>
|
||
/// 唯一标识
|
||
/// </summary>
|
||
public override int Id
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Id ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// GroupId
|
||
/// </summary>
|
||
public int GroupId
|
||
{
|
||
get
|
||
{
|
||
return _configData?.GroupId ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Page
|
||
/// </summary>
|
||
public int Page
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Page ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// ItemId
|
||
/// </summary>
|
||
public int ItemId
|
||
{
|
||
get
|
||
{
|
||
return _configData?.ItemId ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Icon
|
||
/// </summary>
|
||
public string Icon
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Icon ?? "";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// ReqId
|
||
/// </summary>
|
||
public int ReqId
|
||
{
|
||
get
|
||
{
|
||
return _configData?.ReqId ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Level
|
||
/// </summary>
|
||
public int Level
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Level ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// SellType
|
||
/// </summary>
|
||
public string SellType
|
||
{
|
||
get
|
||
{
|
||
return _configData?.SellType ?? "";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// SellPrice
|
||
/// </summary>
|
||
public int SellPrice
|
||
{
|
||
get
|
||
{
|
||
return _configData?.SellPrice ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Mood
|
||
/// </summary>
|
||
public int Mood
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Mood ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// BagItem
|
||
/// </summary>
|
||
public string BagItem
|
||
{
|
||
get
|
||
{
|
||
return _configData?.BagItem ?? "";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Animation
|
||
/// </summary>
|
||
public string Animation
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Animation ?? "";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// MouthPos
|
||
/// </summary>
|
||
public string MouthPos
|
||
{
|
||
get
|
||
{
|
||
return _configData?.MouthPos ?? "";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// BubbleRes
|
||
/// </summary>
|
||
public string BubbleRes
|
||
{
|
||
get
|
||
{
|
||
return _configData?.BubbleRes ?? "";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Exp
|
||
/// </summary>
|
||
public int Exp
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Exp ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Cooldown
|
||
/// </summary>
|
||
public int Cooldown
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Cooldown ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Dailystorage
|
||
/// </summary>
|
||
public int Dailystorage
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Dailystorage ?? 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Name
|
||
/// </summary>
|
||
public string Name
|
||
{
|
||
get
|
||
{
|
||
return _configData?.Name ?? "";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 从配置加载数据(优先使用传入的配置实例)
|
||
/// </summary>
|
||
public void LoadFromConfig(int id, PetShopItem config = null)
|
||
{
|
||
if (config == null)
|
||
{
|
||
config = ConfigManager.Instance.GetConfig<PetShopItem>();
|
||
}
|
||
|
||
if (config?.Petshopitems != null)
|
||
{
|
||
config.Petshopitems.TryGetValue(id, out _configData);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 直接设置配置数据(性能优化:跳过字典查询)
|
||
/// </summary>
|
||
public void SetConfigData(PetShopItemItem configData)
|
||
{
|
||
_configData = configData;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 解析数据行(优化:使用 userData 传入的配置实例,避免重复调用 GetConfig)
|
||
/// </summary>
|
||
public override bool ParseDataRow(string dataRowString, object userData)
|
||
{
|
||
int id = 0;
|
||
if (!int.TryParse(dataRowString, out id))
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// 性能优化:尝试从 userData 获取配置字典,直接获取 Item
|
||
if (userData is System.Collections.Generic.Dictionary<string, object> userDataDict)
|
||
{
|
||
// 优先尝试从缓存的字典直接获取 Item(最快)
|
||
if (userDataDict.TryGetValue("ConfigDict", out object dictObj))
|
||
{
|
||
var dict = dictObj as System.Collections.Generic.Dictionary<int, PetShopItemItem>;
|
||
if (dict != null && dict.TryGetValue(id, out var item))
|
||
{
|
||
_configData = item;
|
||
return true;
|
||
}
|
||
}
|
||
|
||
// 备选方案:从配置实例获取
|
||
if (userDataDict.TryGetValue("ConfigInstance", out object configObj))
|
||
{
|
||
var config = configObj as PetShopItem;
|
||
if (config != null)
|
||
{
|
||
LoadFromConfig(id, config);
|
||
return _configData != null;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 兜底方案:直接查询(最慢)
|
||
LoadFromConfig(id);
|
||
return _configData != null;
|
||
}
|
||
}
|
||
}
|