提交修改
This commit is contained in:
3
Assets/Scripts/Common/Extensions.meta
Normal file
3
Assets/Scripts/Common/Extensions.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd909ef726234c2282ca734bca8be5d5
|
||||
timeCreated: 1760875043
|
||||
18
Assets/Scripts/Common/Extensions/IConfigTableExtensions.cs
Normal file
18
Assets/Scripts/Common/Extensions/IConfigTableExtensions.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using NBC;
|
||||
using NBF.Utils;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class IConfigTableExtensions
|
||||
{
|
||||
public static string GetName(this IConfigTable config)
|
||||
{
|
||||
return config.Key.GetName();
|
||||
}
|
||||
|
||||
public static string GetDesc(this IConfigTable config)
|
||||
{
|
||||
return config.Key.GetDesc();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08653a1add0a416cb39ccabdf4bd8280
|
||||
timeCreated: 1760875056
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace NBF.Utils
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF.Utils
|
||||
{
|
||||
public static class ItemHelper
|
||||
{
|
||||
@@ -6,5 +9,31 @@
|
||||
{
|
||||
return (ItemType)(id / 10000);
|
||||
}
|
||||
|
||||
public static string GetName(this uint id)
|
||||
{
|
||||
return Lan.Get($"Name_{id}");
|
||||
}
|
||||
|
||||
public static string GetDesc(this uint id)
|
||||
{
|
||||
return Lan.Get($"Desc_{id}");
|
||||
}
|
||||
|
||||
public static string GetIcon(this uint id)
|
||||
{
|
||||
//Assets/Resources/Icons/baitfrog.png
|
||||
return $"Icons/{id}";
|
||||
}
|
||||
|
||||
public static void SetIcon(this GLoader loader, uint id)
|
||||
{
|
||||
loader.url = id.GetIcon();
|
||||
}
|
||||
|
||||
public static void SetIcon(this GComponent loader, uint id)
|
||||
{
|
||||
loader.icon = id.GetIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user