Example #1
0
        private object JsonObjectToObject(JSONValue obj)
        {
            switch (obj.Type)
            {
            case JSONValueType.String:
                return(obj.Str);

            case JSONValueType.Number:
                return(obj.Number);

            case JSONValueType.Boolean:
                return(obj.Boolean);

            case JSONValueType.Null:
                return(null);

            case JSONValueType.Array:
                return(obj.Array.Select(v => JsonObjectToObject(v.Obj)).ToList());

            case JSONValueType.Object:
                var dict = new Dictionary <string, object>();
                foreach (var prop in obj.Obj)
                {
                    dict[prop.Key] = JsonObjectToObject(prop.Value);
                }
                return(dict);

            default:
                Puts("Missing type: " + obj.Type);
                break;
            }
            return(null);
        }
Example #2
0
 private static Wearable.OccupationSlots GetOccupationSlot(JSONValue value)
 {
     if (value.Type == JSONValueType.String && !string.IsNullOrEmpty(value.Str))
     {
         return((Wearable.OccupationSlots)JsonConvert.DeserializeObject <OccupationSlotsUnity>(@"""" + value.Str + @"""", new UnityEnumConverter()));
     }
     return(0);
 }
Example #3
0
    public static JSON Parse <T>(T[] array)
    {
        int count = array.Length;

        JSON.Value[] values = new JSON.Value[count];
        for (int i = 0; i < count; i++)
        {
            values[i] = new JSON.Value(array[i]);
        }
        return(new JSON(values));
    }
Example #4
0
 public Image()
 {
     this["type"] = new JSON.Value(type);
 }
Example #5
0
 public RectTransform()
 {
     this["type"] = new JSON.Value(type);
 }
Example #6
0
 public Outline()
 {
     this["type"] = new JSON.Value(type);
 }
 private object JsonObjectToObject(JSONValue obj)
 {
     switch (obj.Type)
     {
         case JSONValueType.String:
             return obj.Str;
         case JSONValueType.Number:
             return obj.Number;
         case JSONValueType.Boolean:
             return obj.Boolean;
         case JSONValueType.Null:
             return null;
         case JSONValueType.Array:
             return obj.Array.Select(v => JsonObjectToObject(v.Obj)).ToList();
         case JSONValueType.Object:
             var dict = new Dictionary<string, object>();
             foreach (var prop in obj.Obj)
             {
                 dict[prop.Key] = JsonObjectToObject(prop.Value);
             }
             return dict;
         default:
             Puts("Missing type: " + obj.Type);
             break;
     }
     return null;
 }
Example #8
0
 public RectTransform()
 {
     this["type"] = new JSON.Value(type);
 }
Example #9
0
 public Image()
 {
     this["type"] = new JSON.Value(type);
 }
Example #10
0
 public NeedsCursor()
 {
     this["type"] = new JSON.Value(type);
 }
Example #11
0
 public Text()
 {
     this["type"] = new JSON.Value(type);
 }
Example #12
0
 public Outline()
 {
     this["type"] = new JSON.Value(type);
 }
Example #13
0
 public Button()
 {
     this["type"] = new JSON.Value(type);
 }
Example #14
0
 public Button()
 {
     this["type"] = new JSON.Value(type);
 }
Example #15
0
 public Text()
 {
     this["type"] = new JSON.Value(type);
 }
Example #16
0
 public NeedsCursor()
 {
     this["type"] = new JSON.Value(type);
 }