public static ActionInvestmentDescriptor FromData(JObject data) { if (data == null) { return(null); } return(new ActionInvestmentDescriptor { Items = ItemListJsonConverter.FromJson((JObject)data["Items"]), Time = data.TimeValue("Time"), }); }
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")), }); }
/// <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(); }
private void SaveItems() { data["Resources"] = ItemListJsonConverter.ToJson(resources); }
public JsonPlayer(JsonDataService service, Guid userId, JsonDataItem jsonData) : base(service, userId) { data = jsonData; resources = new ItemCollection(ItemListJsonConverter.FromJson((JObject)jsonData["Resources"]), collection => SaveItems()); }
public override string ToString() { return(ItemListJsonConverter.ToJson(this).ToString()); }