상속: Newtonsoft.Json.JsonConverter
예제 #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"),
            });
        }
예제 #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")),
            });
        }
예제 #3
0
파일: Place.cs 프로젝트: Ivony/HelloWorld
        /// <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();
        }
예제 #4
0
 private void SaveItems()
 {
     data["Resources"] = ItemListJsonConverter.ToJson(resources);
 }
예제 #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());
 }
예제 #6
0
 public override string ToString()
 {
     return(ItemListJsonConverter.ToJson(this).ToString());
 }