コード例 #1
0
ファイル: p2p.cs プロジェクト: naratteu/phone_tracker
    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)
        {
        }
    }
コード例 #2
0
 public void FromJson(JSONObject json)
 {
     Lat      = json.GetFloat("Lat");
     Lon      = json.GetFloat("Lon");
     Zoom     = json.GetInt("Zoom");
     Scale    = json.GetInt("Scale");
     Range    = json.GetInt("Range");
     TileSize = json.GetInt("TileSize");
 }
コード例 #3
0
    protected void SetView(string msg)
    {
        var view = new JSONObject(msg);
        var iv   = appState.Config.InitalView;

        iv.Lat  = view.GetFloat("Lat");
        iv.Lon  = view.GetFloat("Lon");
        iv.Zoom = view.GetInt("Zoom");
        if (appState.TileManager)
        {
            appState.TileManager.Latitude  = iv.Lat;
            appState.TileManager.Longitude = iv.Lon;
            appState.TileManager.Zoom      = iv.Zoom;
            appState.TileManager.Start();
        }
    }
コード例 #4
0
        public void FromJson(JSONObject json)
        {
            Name     = json.GetString("name");
            Lat      = json.GetFloat("lat");
            Lon      = json.GetFloat("lon");
            Zoom     = json.GetInt("zoom");
            Scale    = json.GetInt("scale");
            Range    = json.GetInt("range");
            TileSize = json.GetInt("tileSize");
            Layers   = new List <string>();
            if (json.HasField("layers"))
            {
                var ll = json["layers"];
                for (var l = 0; l < ll.Count; l++)
                {
                    Layers.Add(ll[l].str);
                }
            }
            ;

            TileLayers = new List <string>();
            if (json.HasField("tileLayers"))
            {
                var ll = json["tileLayers"];
                for (var l = 0; l < ll.Count; l++)
                {
                    TileLayers.Add(ll[l].str);
                }
            }
            ;

            Mapzen = new List <string>();
            if (json.HasField("mapzen"))
            {
                var ll = json["mapzen"];
                for (var l = 0; l < ll.Count; l++)
                {
                    Mapzen.Add(ll[l].str);
                }
            }
            ;
        }
コード例 #5
0
        protected void SetView(string msg)
        {
            var av    = appState.Config.ActiveView;
            var view  = new JSONObject(msg);
            var lat   = view.GetFloat("lat");
            var lon   = view.GetFloat("lon");
            var zoom  = view.GetInt("zoom");
            var range = view.GetInt("range", av.Range);

            if (av.Equal(lat, lon, zoom, range))
            {
                return;
            }
            av.SetView(lat, lon, zoom, range);
            if (!appState.TileManager)
            {
                return;
            }
            appState.ResetMap(av);
        }
コード例 #6
0
 public void FromJson(JSONObject json)
 {
     Title           = json.GetString("Title");
     Url             = json.GetString("Url");
     Type            = json.GetString("Type");
     Enabled         = json.GetBoolean("Enabled");
     VoiceCommand    = json.GetString("VoiceCommand");
     UseTransparency = json.GetBoolean("UseTransparency");
     Height          = json.GetFloat("Height");
     Group           = json.GetString("Group");
     IconUrl         = json.GetString("IconUrl");
     Scale           = json.GetInt("Scale", 30);
     if (json.HasField("Refresh"))
     {
         Refresh = json.GetInt("Refresh");
     }
 }
コード例 #7
0
 public void FromJson(JSONObject json)
 {
     Title           = json.GetString("title");
     Url             = json.GetString("url");
     Type            = json.GetString("type");
     Enabled         = json.GetBoolean("enabled");
     VoiceCommand    = json.GetString("voiceCommand");
     UseTransparency = json.GetBoolean("useTransparency");
     Height          = json.GetFloat("height");
     Group           = json.GetString("group");
     IconUrl         = json.GetString("iconUrl");
     Scale           = json.GetInt("scale", 30);
     if (json.HasField("refresh"))
     {
         Refresh = json.GetInt("refresh");
     }
 }
コード例 #8
0
    // Start is called before the first frame update
    void Start()
    {
        if (!socket)
        {
            var go = GameObject.Find("SocketIO");
            socket = go.GetComponent <SocketIOComponent>();
        }

        Debug.Log("Connecting to '" + socket.url + "'.");

        socket.On("open", OnOpen);
        socket.On("close", OnClose);
        socket.On("error", OnError);

        var json = new JSONObject();

        json.SetField("test", 1.5f);
        print(json.GetFloat("test"));
    }
コード例 #9
0
 public void FromJson(JSONObject json)
 {
     TableSize   = json.GetFloat("TableSize");
     TableHeight = json.GetFloat("TableHeight");
 }
コード例 #10
0
ファイル: Table.cs プロジェクト: ly774508966/WorldExplorer
 public void FromJson(JSONObject json)
 {
     Size      = json.GetFloat("size", 1.5F);
     Height    = json.GetFloat("height", 1.3F);
     Thickness = json.GetFloat("thickness", 0.1F);
 }