更新编辑器MenuItem导表与导出协议

更新编辑器MenuItem导表与导出协议
This commit is contained in:
ALEXTANGXIAO
2023-07-29 00:03:54 +08:00
parent 30192d52cf
commit 98dcb80942
29 changed files with 217 additions and 1018 deletions

View File

@@ -7,50 +7,31 @@
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.item
{
{
public sealed partial class Item : Bright.Config.BeanBase
{
public Item(JSONNode _json)
public Item(ByteBuf _buf)
{
{ if(!_json["id"].IsNumber) { throw new SerializationException(); } Id = _json["id"]; }
{ if(!_json["name"].IsString) { throw new SerializationException(); } Name = _json["name"]; }
{ if(!_json["desc"].IsString) { throw new SerializationException(); } Desc = _json["desc"]; }
{ if(!_json["price"].IsNumber) { throw new SerializationException(); } Price = _json["price"]; }
{ if(!_json["upgrade_to_item_id"].IsNumber) { throw new SerializationException(); } UpgradeToItemId = _json["upgrade_to_item_id"]; }
{ var _j = _json["expire_time"]; if (_j.Tag != JSONNodeType.None && _j.Tag != JSONNodeType.NullValue) { { if(!_j.IsNumber) { throw new SerializationException(); } ExpireTime = _j; } } else { ExpireTime = null; } }
{ if(!_json["batch_useable"].IsBoolean) { throw new SerializationException(); } BatchUseable = _json["batch_useable"]; }
{ if(!_json["quality"].IsNumber) { throw new SerializationException(); } Quality = (item.EQuality)_json["quality"].AsInt; }
{ if(!_json["exchange_stream"].IsObject) { throw new SerializationException(); } ExchangeStream = item.ItemExchange.DeserializeItemExchange(_json["exchange_stream"]); }
{ var __json0 = _json["exchange_list"]; if(!__json0.IsArray) { throw new SerializationException(); } ExchangeList = new System.Collections.Generic.List<item.ItemExchange>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { item.ItemExchange __v0; { if(!__e0.IsObject) { throw new SerializationException(); } __v0 = item.ItemExchange.DeserializeItemExchange(__e0); } ExchangeList.Add(__v0); } }
{ if(!_json["exchange_column"].IsObject) { throw new SerializationException(); } ExchangeColumn = item.ItemExchange.DeserializeItemExchange(_json["exchange_column"]); }
Id = _buf.ReadInt();
Name = _buf.ReadString();
Desc = _buf.ReadString();
Price = _buf.ReadInt();
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);
PostInit();
}
public Item(int id, string name, string desc, int price, int upgrade_to_item_id, int? expire_time, bool batch_useable, item.EQuality quality, item.ItemExchange exchange_stream, System.Collections.Generic.List<item.ItemExchange> exchange_list, item.ItemExchange exchange_column )
public static Item DeserializeItem(ByteBuf _buf)
{
this.Id = id;
this.Name = name;
this.Desc = desc;
this.Price = price;
this.UpgradeToItemId = upgrade_to_item_id;
this.ExpireTime = expire_time;
this.BatchUseable = batch_useable;
this.Quality = quality;
this.ExchangeStream = exchange_stream;
this.ExchangeList = exchange_list;
this.ExchangeColumn = exchange_column;
PostInit();
}
public static Item DeserializeItem(JSONNode _json)
{
return new item.Item(_json);
return new item.Item(_buf);
}
/// <summary>
@@ -135,4 +116,5 @@ public sealed partial class Item : Bright.Config.BeanBase
partial void PostInit();
partial void PostResolve();
}
}
}

View File

@@ -7,32 +7,22 @@
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.item
{
{
public sealed partial class ItemExchange : Bright.Config.BeanBase
{
public ItemExchange(JSONNode _json)
public ItemExchange(ByteBuf _buf)
{
{ if(!_json["id"].IsNumber) { throw new SerializationException(); } Id = _json["id"]; }
{ if(!_json["num"].IsNumber) { throw new SerializationException(); } Num = _json["num"]; }
Id = _buf.ReadInt();
Num = _buf.ReadInt();
PostInit();
}
public ItemExchange(int id, int num )
public static ItemExchange DeserializeItemExchange(ByteBuf _buf)
{
this.Id = id;
this.Num = num;
PostInit();
}
public static ItemExchange DeserializeItemExchange(JSONNode _json)
{
return new item.ItemExchange(_json);
return new item.ItemExchange(_buf);
}
/// <summary>
@@ -67,4 +57,5 @@ public sealed partial class ItemExchange : Bright.Config.BeanBase
partial void PostInit();
partial void PostResolve();
}
}
}

View File

@@ -7,26 +7,25 @@
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.item
{
public sealed partial class TbItem
{
public partial class TbItem
{
private readonly Dictionary<int, item.Item> _dataMap;
private readonly List<item.Item> _dataList;
public TbItem(JSONNode _json)
public TbItem(ByteBuf _buf)
{
_dataMap = new Dictionary<int, item.Item>();
_dataList = new List<item.Item>();
foreach(JSONNode _row in _json.Children)
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
var _v = item.Item.DeserializeItem(_row);
item.Item _v;
_v = item.Item.DeserializeItem(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
@@ -57,7 +56,6 @@ public sealed partial class TbItem
}
}
partial void PostInit();
partial void PostResolve();
}