Inheritance: Newtonsoft.Json.JsonConverter
Ejemplo n.º 1
0
        public static ActionInvestmentDescriptor FromData(JObject data)
        {
            if (data == null)
            {
                return(null);
            }

            return(new ActionInvestmentDescriptor
            {
                Items = ItemListJsonConverter.FromJson((JObject)data["Items"]),
                Time = data.TimeValue("Time"),
            });
        }
Ejemplo n.º 2
0
        public static ActionReturnsDescriptor FromData(JObject data)
        {
            if (data == null)
            {
                return(null);
            }

            return(new ActionReturnsDescriptor
            {
                Items = ItemListJsonConverter.FromJson((JObject)data["Items"]),
                Building = GameHost.GameRules.GetDataItem <ImmovableDescriptor>(data.GuidValue("Building")),
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 初始化 Place 对象
        /// </summary>
        protected override void Initialize()
        {
            {
                var items = ItemListJsonConverter.FromJson((JObject)DataObject.Resources);
                Resources = new ItemCollection(items, collection =>
                {
                    DataObject.Resources = ItemListJsonConverter.ToJson(collection);
                });
            }


            Acting = PlaceActing.FromData(this, (JObject)DataObject.Acting);


            Terrain       = InitializeImmovableInstance <Terrain>((JsonDataObject)DataObject.Terrain);
            TraficNetwork = InitializeImmovableInstance <TraficNetwork>((JsonDataObject)DataObject.TraficNetwork);
            Building      = InitializeImmovableInstance <Building>((JsonDataObject)DataObject.Building);



            base.Initialize();
        }
Ejemplo n.º 4
0
 private void SaveItems()
 {
     data["Resources"] = ItemListJsonConverter.ToJson(resources);
 }
Ejemplo n.º 5
0
 public JsonPlayer(JsonDataService service, Guid userId, JsonDataItem jsonData)
     : base(service, userId)
 {
     data      = jsonData;
     resources = new ItemCollection(ItemListJsonConverter.FromJson((JObject)jsonData["Resources"]), collection => SaveItems());
 }
Ejemplo n.º 6
0
 public override string ToString()
 {
     return(ItemListJsonConverter.ToJson(this).ToString());
 }