//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace cfg.LevelCfg
{
public sealed partial class DataLevel : Bright.Config.BeanBase
{
public DataLevel(JSONNode _json)
{
{ if(!_json["Id"].IsNumber) { throw new SerializationException(); } Id = _json["Id"]; }
{ if(!_json["Type"].IsNumber) { throw new SerializationException(); } Type = (LevelCfg.LevelType)_json["Type"].AsInt; }
{ if(!_json["ChapterID"].IsNumber) { throw new SerializationException(); } ChapterID = _json["ChapterID"]; }
{ var __json0 = _json["Unlock"]; if(!__json0.IsArray) { throw new SerializationException(); } int _n0 = __json0.Count; Unlock = new int[_n0]; int __index0=0; foreach(JSONNode __e0 in __json0.Children) { int __v0; { if(!__e0.IsNumber) { throw new SerializationException(); } __v0 = __e0; } Unlock[__index0++] = __v0; } }
{ var __json0 = _json["CostID"]; if(!__json0.IsArray) { throw new SerializationException(); } int _n0 = __json0.Count; CostID = new int[_n0]; int __index0=0; foreach(JSONNode __e0 in __json0.Children) { int __v0; { if(!__e0.IsNumber) { throw new SerializationException(); } __v0 = __e0; } CostID[__index0++] = __v0; } }
{ var __json0 = _json["CostCount"]; if(!__json0.IsArray) { throw new SerializationException(); } int _n0 = __json0.Count; CostCount = new int[_n0]; int __index0=0; foreach(JSONNode __e0 in __json0.Children) { int __v0; { if(!__e0.IsNumber) { throw new SerializationException(); } __v0 = __e0; } CostCount[__index0++] = __v0; } }
PostInit();
}
public DataLevel(int Id, LevelCfg.LevelType Type, int ChapterID, int[] Unlock, int[] CostID, int[] CostCount )
{
this.Id = Id;
this.Type = Type;
this.ChapterID = ChapterID;
this.Unlock = Unlock;
this.CostID = CostID;
this.CostCount = CostCount;
PostInit();
}
public static DataLevel DeserializeDataLevel(JSONNode _json)
{
return new LevelCfg.DataLevel(_json);
}
///
/// 关卡ID
///
public int Id { get; private set; }
///
/// 关卡类型
///
public LevelCfg.LevelType Type { get; private set; }
///
/// 章节Id
///
public int ChapterID { get; private set; }
///
/// 解锁条件
///
public int[] Unlock { get; private set; }
///
/// 消耗ID
///
public int[] CostID { get; private set; }
///
/// 消耗Count
///
public int[] CostCount { get; private set; }
public const int __ID__ = -1884167220;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary _tables)
{
PostResolve();
}
public void TranslateText(System.Func translator)
{
}
public override string ToString()
{
return "{ "
+ "Id:" + Id + ","
+ "Type:" + Type + ","
+ "ChapterID:" + ChapterID + ","
+ "Unlock:" + Bright.Common.StringUtil.CollectionToString(Unlock) + ","
+ "CostID:" + Bright.Common.StringUtil.CollectionToString(CostID) + ","
+ "CostCount:" + Bright.Common.StringUtil.CollectionToString(CostCount) + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}