123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- using Bright.Serialization;
- using System.Collections.Generic;
- using SimpleJSON;
- namespace ET.Editor.LuBanSample
- {
- public sealed partial class LuBanSampleConfig : Bright.Config.EditorBeanBase
- {
- public LuBanSampleConfig()
- {
- Name = "";
- Desc = "";
- Quality = item.EQuality.WHITE;
- ExchangeStream = new item.ItemExchange();
- ExchangeList = new System.Collections.Generic.List<item.ItemExchange>();
- ExchangeColumn = new item.ItemExchange();
- }
- public override void LoadJson(SimpleJSON.JSONObject _json)
- {
- {
- var _fieldJson = _json["id"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsNumber) { throw new SerializationException(); } Id = _fieldJson;
- }
- }
-
- {
- var _fieldJson = _json["name"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsString) { throw new SerializationException(); } Name = _fieldJson;
- }
- }
-
- {
- var _fieldJson = _json["desc"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsString) { throw new SerializationException(); } Desc = _fieldJson;
- }
- }
-
- {
- var _fieldJson = _json["price"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsNumber) { throw new SerializationException(); } Price = _fieldJson;
- }
- }
-
- {
- var _fieldJson = _json["upgrade_to_item_id"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsNumber) { throw new SerializationException(); } UpgradeToItemId = _fieldJson;
- }
- }
-
- {
- var _fieldJson = _json["expire_time"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsString) { throw new SerializationException(); } ExpireTime = _fieldJson;
- }
- }
-
- {
- var _fieldJson = _json["batch_useable"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsBoolean) { throw new SerializationException(); } BatchUseable = _fieldJson;
- }
- }
-
- {
- var _fieldJson = _json["quality"];
- if (_fieldJson != null)
- {
- if(_fieldJson.IsString) { Quality = (item.EQuality)System.Enum.Parse(typeof(item.EQuality), _fieldJson); } else if(_fieldJson.IsNumber) { Quality = (item.EQuality)(int)_fieldJson; } else { throw new SerializationException(); }
- }
- }
-
- {
- var _fieldJson = _json["exchange_stream"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsObject) { throw new SerializationException(); } ExchangeStream = item.ItemExchange.LoadJsonItemExchange(_fieldJson);
- }
- }
-
- {
- var _fieldJson = _json["exchange_list"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsArray) { throw new SerializationException(); } ExchangeList = new System.Collections.Generic.List<item.ItemExchange>(); foreach(JSONNode __e in _fieldJson.Children) { item.ItemExchange __v; if(!__e.IsObject) { throw new SerializationException(); } __v = item.ItemExchange.LoadJsonItemExchange(__e); ExchangeList.Add(__v); }
- }
- }
-
- {
- var _fieldJson = _json["exchange_column"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsObject) { throw new SerializationException(); } ExchangeColumn = item.ItemExchange.LoadJsonItemExchange(_fieldJson);
- }
- }
-
- {
- var _fieldJson = _json["UnitType"];
- if (_fieldJson != null)
- {
- if(!_fieldJson.IsNumber) { throw new SerializationException(); } UnitType = _fieldJson;
- }
- }
-
- }
- public override void SaveJson(SimpleJSON.JSONObject _json)
- {
- {
- _json["id"] = new JSONNumber(Id);
- }
- {
- if (Name == null) { throw new System.ArgumentNullException(); }
- _json["name"] = new JSONString(Name);
- }
- {
- if (Desc == null) { throw new System.ArgumentNullException(); }
- _json["desc"] = new JSONString(Desc);
- }
- {
- _json["price"] = new JSONNumber(Price);
- }
- {
- _json["upgrade_to_item_id"] = new JSONNumber(UpgradeToItemId);
- }
- if (ExpireTime != null)
- {
- _json["expire_time"] = new JSONString(ExpireTime);
- }
- {
- _json["batch_useable"] = new JSONBool(BatchUseable);
- }
- {
- _json["quality"] = new JSONNumber((int)Quality);
- }
- {
- if (ExchangeStream == null) { throw new System.ArgumentNullException(); }
- { var __bjson = new JSONObject(); item.ItemExchange.SaveJsonItemExchange(ExchangeStream, __bjson); _json["exchange_stream"] = __bjson; }
- }
- {
- if (ExchangeList == null) { throw new System.ArgumentNullException(); }
- { var __cjson = new JSONArray(); foreach(var _e in ExchangeList) { { var __bjson = new JSONObject(); item.ItemExchange.SaveJsonItemExchange(_e, __bjson); __cjson["null"] = __bjson; } } _json["exchange_list"] = __cjson; }
- }
- {
- if (ExchangeColumn == null) { throw new System.ArgumentNullException(); }
- { var __bjson = new JSONObject(); item.ItemExchange.SaveJsonItemExchange(ExchangeColumn, __bjson); _json["exchange_column"] = __bjson; }
- }
- {
- _json["UnitType"] = new JSONNumber(UnitType);
- }
- }
- public static LuBanSampleConfig LoadJsonLuBanSampleConfig(SimpleJSON.JSONNode _json)
- {
- LuBanSampleConfig obj = new LuBanSample.LuBanSampleConfig();
- obj.LoadJson((SimpleJSON.JSONObject)_json);
- return obj;
- }
-
- public static void SaveJsonLuBanSampleConfig(LuBanSampleConfig _obj, SimpleJSON.JSONNode _json)
- {
- _obj.SaveJson((SimpleJSON.JSONObject)_json);
- }
-
-
-
- public int Id { get; set; }
-
-
-
- public string Name { get; set; }
-
-
-
- public string Desc { get; set; }
-
-
-
- public int Price { get; set; }
-
-
-
- public int UpgradeToItemId { get; set; }
-
-
-
- public string ExpireTime { get; set; }
-
-
-
- public bool BatchUseable { get; set; }
-
-
-
- public item.EQuality Quality { get; set; }
-
-
-
- public item.ItemExchange ExchangeStream { get; set; }
- public System.Collections.Generic.List<item.ItemExchange> ExchangeList { get; set; }
-
-
-
- public item.ItemExchange ExchangeColumn { get; set; }
-
-
-
- public int UnitType { get; set; }
- }
- }
|