修改为luban
This commit is contained in:
@@ -12,7 +12,7 @@ public static class ItemFactory
|
||||
/// <param name="configId"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <returns></returns>
|
||||
public static Item Create(Scene scene, uint configId, int count = 1)
|
||||
public static Item Create(Scene scene, int configId, int count = 1)
|
||||
{
|
||||
var item = Entity.Create<Item>(scene, true, true);
|
||||
item.ConfigId = configId;
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace NB.Game;
|
||||
|
||||
public static class ItemHelper
|
||||
{
|
||||
public static ItemBasicType GetType(uint id)
|
||||
public static ItemBasicType GetType(int id)
|
||||
{
|
||||
return (ItemBasicType)(id / 10000);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public static class PlayerItemContainerComponentSystem
|
||||
|
||||
#region Add
|
||||
|
||||
public static async FTask Add(this PlayerItemContainerComponent self, Dictionary<uint, int> items)
|
||||
public static async FTask Add(this PlayerItemContainerComponent self, Dictionary<int, int> items)
|
||||
{
|
||||
foreach (var (configId, count) in items)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ public static class PlayerItemContainerComponentSystem
|
||||
await self.Save();
|
||||
}
|
||||
|
||||
public static async FTask Add(this PlayerItemContainerComponent self, uint configId, int count,
|
||||
public static async FTask Add(this PlayerItemContainerComponent self, int configId, int count,
|
||||
bool needSave = true)
|
||||
{
|
||||
var item = ItemFactory.Create(self.Scene, configId, count);
|
||||
|
||||
@@ -158,27 +158,28 @@ public static class PlayerManageComponentSystem
|
||||
player.Exp = 999;
|
||||
player.Head = "xxx.png";
|
||||
|
||||
var list = InitConfig.GetList();
|
||||
// var list = InitConfig.GetList();
|
||||
var list = Configs.Tables.TbInitItemConfig.DataList;
|
||||
|
||||
|
||||
Dictionary<ItemBasicType, Dictionary<uint, int>>
|
||||
addDic = new Dictionary<ItemBasicType, Dictionary<uint, int>>();
|
||||
Dictionary<ItemBasicType, Dictionary<int, int>>
|
||||
addDic = new Dictionary<ItemBasicType, Dictionary<int, int>>();
|
||||
foreach (var initConfig in list)
|
||||
{
|
||||
var itemType = ItemHelper.GetType(initConfig.Id);
|
||||
if (!addDic.TryGetValue(itemType, out var dic))
|
||||
{
|
||||
dic = new Dictionary<uint, int>();
|
||||
dic = new Dictionary<int, int>();
|
||||
addDic.Add(itemType, dic);
|
||||
}
|
||||
|
||||
if (!dic.ContainsKey(initConfig.Id))
|
||||
{
|
||||
dic.Add(initConfig.Id, initConfig.Amount);
|
||||
dic.Add(initConfig.Id, initConfig.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
dic[initConfig.Id] += initConfig.Amount;
|
||||
dic[initConfig.Id] += initConfig.Count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public static class PlayerSystem
|
||||
/// <param name="self"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="items"></param>
|
||||
public static async FTask AddItems(this Player self, Dictionary<uint, int> items)
|
||||
public static async FTask AddItems(this Player self, Dictionary<int, int> items)
|
||||
{
|
||||
|
||||
var itemContainer = self.GetComponent<PlayerItemContainerComponent>();
|
||||
|
||||
@@ -25,7 +25,7 @@ public static class PlayerWalletComponentSystem
|
||||
/// <param name="configId"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Have(this PlayerWalletComponent self, uint configId, int count)
|
||||
public static bool Have(this PlayerWalletComponent self, int configId, int count)
|
||||
{
|
||||
if (self.Currency.TryGetValue(configId, out var value))
|
||||
{
|
||||
@@ -38,7 +38,7 @@ public static class PlayerWalletComponentSystem
|
||||
return false;
|
||||
}
|
||||
|
||||
public static async FTask Add(this PlayerWalletComponent self, uint configId, int count)
|
||||
public static async FTask Add(this PlayerWalletComponent self, int configId, int count)
|
||||
{
|
||||
if (count < 1)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public static class PlayerWalletComponentSystem
|
||||
await self.Save();
|
||||
}
|
||||
|
||||
public static async FTask Sub(this PlayerWalletComponent self, uint configId, int count)
|
||||
public static async FTask Sub(this PlayerWalletComponent self, int configId, int count)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user