2021-04-08 20:09:59 +08:00
|
|
|
|
using ET;
|
|
|
|
|
using FairyGUI;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public class BagHelper
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取背包物品的名字和图标名 (名,图标资源名)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static (string, string) GetIconName(int id)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0) return (null,null);
|
|
|
|
|
if (id < 110000)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
MaterialBase materialBase = DataTableHelper.Get<MaterialBase>(id);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return (materialBase.Name, materialBase.IconName);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (id < 120000)
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
GoodsBase goodsBase = DataTableHelper.Get<GoodsBase>(id);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return (goodsBase.Name, goodsBase.IconName);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-04-11 19:50:39 +08:00
|
|
|
|
EquipBase equipBase = DataTableHelper.Get<EquipBase>(id);
|
2021-04-08 20:09:59 +08:00
|
|
|
|
return (equipBase.Name, equipBase.IconName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据Id获取物品类型(自行判断类型)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IConfig GetItemBase(int id)
|
|
|
|
|
{
|
|
|
|
|
if (id == 0) return null;
|
|
|
|
|
if (id < 110000)
|
|
|
|
|
{
|
|
|
|
|
return DataTableHelper.Get<MaterialBase>(id) as IConfig;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (id < 120000)
|
|
|
|
|
{
|
|
|
|
|
return DataTableHelper.Get<GoodsBase>(id) as IConfig;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return DataTableHelper.Get<EquipBase>(id) as IConfig;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|