Exemplo n.º 1
0
    private void Update()
    {
        try
        {
            while (res.Count > 0)
            {
                string jsonstring = res.Dequeue();
                jsonstring = jsonstring.Substring(0, jsonstring.IndexOf('}') + 1);//뒤에 쓰레기값이 붙는경우가 있음
                JSONObject json = JSONValue.Parse(jsonstring).Obj;
                switch (json.GetString("t"))
                {
                case "abg":
                    transform.eulerAngles = new Vector3(
                        x: -json.GetFloat("b"),
                        z: -json.GetFloat("g"),
                        y: -json.GetFloat("a")
                        );
                    break;

                case "xyz":
                    //transform.Translate(
                    //    x: up(json.GetFloat("x")),
                    //    y: up(json.GetFloat("y")),
                    //    z: up(json.GetFloat("z"))
                    //    );
                    break;
                }
            }
        }
        catch (Exception e)
        {
        }
    }
Exemplo n.º 2
0
 public static JSONValue Parse(string aJSON)
 {
     return(JSONValue.Parse(aJSON));
 }