Ejemplo n.º 1
0
 public DominionCard(Windows.Data.Json.JsonValue jsonDescription)
 {
     var dictionary = jsonDescription.GetObject();
     this.Id = dictionary.GetNamedString("id");
     this.Name = dictionary.GetNamedString("name");
     this.Coin = (int)dictionary.GetNamedNumber("coin");
     this.Potion = (int)dictionary.GetNamedNumber("potion");
     this.Expansion = GetExpansionIndex(dictionary.GetNamedString("expansion"));
     this.IsAction = dictionary.GetNamedBoolean("isAction");
     this.IsAttack = dictionary.GetNamedBoolean("isAttack");
     this.IsReaction = dictionary.GetNamedBoolean("isReaction");
     this.IsDuration = dictionary.GetNamedBoolean("isDuration");
     this.isWebCard = true;
     this.dominionCard = null;
 }
Ejemplo n.º 2
0
 public object ConvertFromJson(Windows.Data.Json.IJsonValue value)
 {
     switch (value.ValueType)
     {
         case Windows.Data.Json.JsonValueType.Array:
             return value.GetArray();
         case Windows.Data.Json.JsonValueType.Boolean:
             return value.GetBoolean();
         case Windows.Data.Json.JsonValueType.Null:
             return null;
         case Windows.Data.Json.JsonValueType.Number:
             return value.GetNumber();
         case Windows.Data.Json.JsonValueType.Object:
             return value.GetObject();
         case Windows.Data.Json.JsonValueType.String:
             return value.GetString();
         default:
             return null;
     }
 }