Beispiel #1
0
    static void TryGetTransform(JSONClass json, BoneFrameData data)
    {
        if (json.ContainKey("transform"))
        {
            JSONClass t = json["transform"].AsObject;

            data.transPos    = t.ContainKey("x") || t.ContainKey("y");
            data.transScale  = t.ContainKey("scX") || t.ContainKey("scY");
            data.transRotate = t.ContainKey("skX");

            data.pos      = new Vector2(TryGetFloat(t, "x", 0), TryGetFloat(t, "y", 0));
            data.rotation = -TryGetFloat(t, "skX", 0);
            data.scale    = new Vector2(TryGetFloat(t, "scX", 1), TryGetFloat(t, "scY", 1));
        }
    }
Beispiel #2
0
 static string TryGetString(JSONClass json, string key, string d)
 {
     if (json.ContainKey(key))
     {
         return(json[key].Value);
     }
     return(d);
 }
Beispiel #3
0
 static Vector2 TryGetVector2(JSONClass json, string key, Vector2 d)
 {
     if (json.ContainKey(key))
     {
         return(new Vector2(TryGetFloat(json[key].AsObject, "x", d.x), TryGetFloat(json[key].AsObject, "y", d.y)));
     }
     return(d);
 }
Beispiel #4
0
 static float TryGetFloat(JSONClass json, string key, float d)
 {
     if (json.ContainKey(key))
     {
         return(json[key].AsFloat);
     }
     return(d);
 }
Beispiel #5
0
 static int TryGetInt(JSONClass json, string key, int d)
 {
     if (json.ContainKey(key))
     {
         return(json[key].AsInt);
     }
     return(d);
 }
Beispiel #6
0
 static void TryGetColor(JSONClass json, ref Color mul, ref Vector4 add)
 {
     if (json.ContainKey("color"))
     {
         JSONClass c = json["color"].AsObject;
         mul = new Color(TryGetFloat(c, "rM", 100) / 100, TryGetFloat(c, "gM", 100) / 100, TryGetFloat(c, "bM", 100) / 100, TryGetFloat(c, "aM", 100) / 100);
         add = new Vector4(TryGetFloat(c, "rO", 0) / 255, TryGetFloat(c, "gO", 0) / 255, TryGetFloat(c, "bO", 0) / 255, TryGetFloat(c, "aO", 0) / 255);
     }
 }
Beispiel #7
0
    static void TryGetTransform(JSONClass json, TransformData data)
    {
        if (json.ContainKey("transform"))
        {
            JSONClass t = json["transform"].AsObject;

            data.pos      = new Vector2(TryGetFloat(t, "x", 0), TryGetFloat(t, "y", 0));
            data.rotation = -TryGetFloat(t, "skX", 0);
            data.scale    = new Vector2(TryGetFloat(t, "scX", 1), TryGetFloat(t, "scY", 1));
        }
    }