//------------------------------------------------------------------------------
//
// 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
{
public sealed partial class CommonTask : Bright.Config.BeanBase
{
public JSONNode json;
public CommonTask(JSONNode _json)
{
{ if(!_json["Id"].IsNumber) { throw new SerializationException(); } Id = _json["Id"]; }
{ if(!_json["TaskType"].IsNumber) { throw new SerializationException(); } TaskType = (ConditionType)_json["TaskType"].AsInt; }
{ if(!_json["TaskDesc"]["key"].IsString) { throw new SerializationException(); } TaskDesc_l10n_key = _json["TaskDesc"]["key"]; if(!_json["TaskDesc"]["text"].IsString) { throw new SerializationException(); } TaskDesc = _json["TaskDesc"]["text"]; }
{ if(!_json["TaskReward"].IsNumber) { throw new SerializationException(); } TaskReward = _json["TaskReward"]; }
{ var __json0 = _json["TaskParam"]; if(!__json0.IsArray) { throw new SerializationException(); } TaskParam = new System.Collections.Generic.List(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { int __v0; { if(!__e0.IsNumber) { throw new SerializationException(); } __v0 = __e0; } TaskParam.Add(__v0); } }
json = _json;
PostInit();
}
public CommonTask(int Id, ConditionType TaskType, string TaskDesc, int TaskReward, System.Collections.Generic.List TaskParam )
{
this.Id = Id;
this.TaskType = TaskType;
this.TaskDesc = TaskDesc;
this.TaskReward = TaskReward;
this.TaskParam = TaskParam;
PostInit();
}
public static CommonTask DeserializeCommonTask(JSONNode _json)
{
return new CommonTask(_json);
}
public int Id { get; private set; }
public ConditionType TaskType { get; private set; }
///
/// key
///
public string TaskDesc { get; private set; }
public string TaskDesc_l10n_key { get; }
///
/// 读Drop表
///
public int TaskReward { get; private set; }
///
/// 0
///
public System.Collections.Generic.List TaskParam { get; private set; }
public const int __ID__ = -1117011408;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary _tables)
{
PostResolve();
}
public void TranslateText(System.Func translator)
{
TaskDesc = translator(TaskDesc_l10n_key, TaskDesc);
}
public override string ToString()
{
return "{ "
+ "Id:" + Id + ","
+ "TaskType:" + TaskType + ","
+ "TaskDesc:" + TaskDesc + ","
+ "TaskReward:" + TaskReward + ","
+ "TaskParam:" + Bright.Common.StringUtil.CollectionToString(TaskParam) + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}