mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
拓展自定义鲁班加载配置,支持UniTask异步 默认使用同步加载
拓展自定义鲁班加载配置,支持UniTask异步 默认使用同步加载
This commit is contained in:
@@ -6,53 +6,36 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
using Bright.Serialization;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
|
||||
namespace GameConfig
|
||||
{
|
||||
public partial class Tables
|
||||
{
|
||||
|
||||
public sealed class Tables
|
||||
{
|
||||
public item.TbItem TbItem {get; private set; }
|
||||
public Battle.TbSkill TbSkill {get; private set; }
|
||||
public Battle.TbBuff TbBuff {get; private set; }
|
||||
public Battle.TbBuffAttr TbBuffAttr {get; private set; }
|
||||
public item.TbItem TbItem {get; }
|
||||
public Battle.TbSkill TbSkill {get; }
|
||||
public Battle.TbBuff TbBuff {get; }
|
||||
public Battle.TbBuffAttr TbBuffAttr {get; }
|
||||
|
||||
public Tables() { }
|
||||
|
||||
public async UniTask LoadAsync(System.Func<string, UniTask<ByteBuf>> loader)
|
||||
public Tables(System.Func<string, ByteBuf> loader)
|
||||
{
|
||||
var tables = new System.Collections.Generic.Dictionary<string, object>();
|
||||
List<UniTask> list = new List<UniTask>();
|
||||
list.Add(UniTask.Create(async () =>
|
||||
{
|
||||
TbItem = new item.TbItem(await loader("item_tbitem"));
|
||||
tables.Add("item.TbItem", TbItem);
|
||||
}));
|
||||
list.Add(UniTask.Create(async () =>
|
||||
{
|
||||
TbSkill = new Battle.TbSkill(await loader("battle_tbskill"));
|
||||
tables.Add("Battle.TbSkill", TbSkill);
|
||||
}));
|
||||
list.Add(UniTask.Create(async () =>
|
||||
{
|
||||
TbBuff = new Battle.TbBuff(await loader("battle_tbbuff"));
|
||||
tables.Add("Battle.TbBuff", TbBuff);
|
||||
}));
|
||||
list.Add(UniTask.Create(async () =>
|
||||
{
|
||||
TbBuffAttr = new Battle.TbBuffAttr(await loader("battle_tbbuffattr"));
|
||||
tables.Add("Battle.TbBuffAttr", TbBuffAttr);
|
||||
}));
|
||||
|
||||
await UniTask.WhenAll(list);
|
||||
TbItem = new item.TbItem(loader("item_tbitem"));
|
||||
tables.Add("item.TbItem", TbItem);
|
||||
TbSkill = new Battle.TbSkill(loader("battle_tbskill"));
|
||||
tables.Add("Battle.TbSkill", TbSkill);
|
||||
TbBuff = new Battle.TbBuff(loader("battle_tbbuff"));
|
||||
tables.Add("Battle.TbBuff", TbBuff);
|
||||
TbBuffAttr = new Battle.TbBuffAttr(loader("battle_tbbuffattr"));
|
||||
tables.Add("Battle.TbBuffAttr", TbBuffAttr);
|
||||
|
||||
PostInit();
|
||||
TbItem.Resolve(tables);
|
||||
TbSkill.Resolve(tables);
|
||||
TbBuff.Resolve(tables);
|
||||
TbBuffAttr.Resolve(tables);
|
||||
PostResolve();
|
||||
}
|
||||
|
||||
public void TranslateText(System.Func<string, string, string> translator)
|
||||
@@ -62,6 +45,9 @@ public sealed class Tables
|
||||
TbBuff.TranslateText(translator);
|
||||
TbBuffAttr.TranslateText(translator);
|
||||
}
|
||||
|
||||
partial void PostInit();
|
||||
partial void PostResolve();
|
||||
}
|
||||
|
||||
}
|
@@ -22,6 +22,7 @@ public sealed partial class Item : Bright.Config.BeanBase
|
||||
UpgradeToItemId = _buf.ReadInt();
|
||||
if(_buf.ReadBool()){ ExpireTime = _buf.ReadInt(); } else { ExpireTime = null; }
|
||||
BatchUseable = _buf.ReadBool();
|
||||
Quality = (item.EQuality)_buf.ReadInt();
|
||||
ExchangeStream = item.ItemExchange.DeserializeItemExchange(_buf);
|
||||
{int n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);ExchangeList = new System.Collections.Generic.List<item.ItemExchange>(n0);for(var i0 = 0 ; i0 < n0 ; i0++) { item.ItemExchange _e0; _e0 = item.ItemExchange.DeserializeItemExchange(_buf); ExchangeList.Add(_e0);}}
|
||||
ExchangeColumn = item.ItemExchange.DeserializeItemExchange(_buf);
|
||||
@@ -63,6 +64,10 @@ public sealed partial class Item : Bright.Config.BeanBase
|
||||
/// </summary>
|
||||
public bool BatchUseable { get; private set; }
|
||||
/// <summary>
|
||||
/// 品质
|
||||
/// </summary>
|
||||
public item.EQuality Quality { get; private set; }
|
||||
/// <summary>
|
||||
/// 道具兑换配置
|
||||
/// </summary>
|
||||
public item.ItemExchange ExchangeStream { get; private set; }
|
||||
@@ -101,6 +106,7 @@ public sealed partial class Item : Bright.Config.BeanBase
|
||||
+ "UpgradeToItemId:" + UpgradeToItemId + ","
|
||||
+ "ExpireTime:" + ExpireTime + ","
|
||||
+ "BatchUseable:" + BatchUseable + ","
|
||||
+ "Quality:" + Quality + ","
|
||||
+ "ExchangeStream:" + ExchangeStream + ","
|
||||
+ "ExchangeList:" + Bright.Common.StringUtil.CollectionToString(ExchangeList) + ","
|
||||
+ "ExchangeColumn:" + ExchangeColumn + ","
|
||||
|
Reference in New Issue
Block a user