void Start()
    {
        Debug.Log("Loading");
        string url = "http://localhost:3838/api/";

        Glyphics.DecodeToGrid(nexusSerialized, 0, 0, 0);

        Glyphics.DestroyObjects();
        Glyphics.DecodeToGrid(nexusSerialized, 0, 0, 0);

        //Glyphics.DecodeToGrid();

        /*
         * Name2Serialized.Add("PrintableNexus", Glyphics.HttpGet("http://localhost:3838/api/srects?PrintableNexus"));
         * Name2Serialized.Add("Decoder", Glyphics.HttpGet("http://localhost:3838/api/srects?Decoder"));
         * Name2Serialized.Add("PinkGreenArena", Glyphics.HttpGet("http://localhost:3838/api/srects?PinkGreenArena"));
         * Name2Serialized.Add("Ascent", Glyphics.HttpGet("http://localhost:3838/api/srects?Ascent"));
         * Name2Serialized.Add("Arena", Glyphics.HttpGet("http://localhost:3838/api/srects?Arena"));
         * Name2Serialized.Add("Workspace", Glyphics.HttpGet("http://localhost:3838/api/srects?Workspace"));
         * Name2Serialized.Add("MegaGrid", Glyphics.HttpGet("http://localhost:3838/api/srects?MegaGrid"));
         * Name2Serialized.Add("Ascent", Glyphics.HttpGet("http://localhost:3838/api/srects?Ascent"));
         * Name2Serialized.Add("Ascent", Glyphics.HttpGet("http://localhost:3838/api/srects?Ascent"));
         * Name2Serialized.Add("Ascent", Glyphics.HttpGet("http://localhost:3838/api/srects?Ascent"));
         * Name2Serialized.Add("Map", Glyphics.HttpGet("http://localhost:3838/api/srects?Map"));
         */
        //Name2Serialized.Add(CreateGridSpaceAddress


        /*AddLookup(-1, 0, 1);
        *  AddLookup(0, 0, 1);
        *  AddLookup(1, 0, 1);
        *  AddLookup(-1, 0, 0);
        *  AddLookup(0, 0, 0);
        *  AddLookup(1, 0, 0);
        *  AddLookup(-1, 0, -1);
        *  AddLookup(0, 0, -1);
        *  AddLookup(1, 0, -1);*/

        //Glyphics.DestroyObjects();
        //GenerateMegaGridObjects();

        //Glyphics.DestroyObjects();
        //Glyphics.DecodeToGrid(srects, 0, 0, 0);



        //    Glyphics.DestroyObjects();
        //      string digest = Glyphics.HttpGet("http://localhost:3838/api/digest");
        //
        //GameObject.CreatePrimitive(PrimitiveType.Cube);
        //GameObject.DestroyObject()

        //        GetComponent<Renderer>().material.color = Color.cyan;

        /*        GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
         *      cube.transform.position = new Vector3(0, 0, 0);
         *      cube = null;
         *      GameObject cube2 = GameObject.CreatePrimitive(PrimitiveType.Cube);
         *      cube2.transform.position = new Vector3(1, 0, 0);*/
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }

        Glyphics.DestroyObjects();
        Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?PrintableNexus"), 0, 0, 0);
        return;

        if (Input.GetKeyDown("1"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?PrintableNexus"), 0, 0, 0);
        }
        if (Input.GetKeyUp("2"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?Decoder"), 0, 0, 0);
        }
        if (Input.GetKeyUp("3"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?PinkGreenArena"), 0, 0, 0);
        }
        if (Input.GetKeyUp("4"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?Ascent"), 0, 0, 0);
        }
        if (Input.GetKeyUp("5"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?Arena"), 0, 0, 0);
        }
        if (Input.GetKeyUp("6"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?Workspace"), 0, 0, 0);
        }
        if (Input.GetKeyUp("7"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?MegaGrid"), 0, 0, 0);
        }
        if (Input.GetKeyUp("8"))
        {
            Glyphics.DestroyObjects();
            Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?Map"), 0, 0, 0);
        }
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }

        Glyphics.DestroyObjects();
        Glyphics.DecodeToGrid(homeWorld, 0, 0, 0);
        return;

        if (Input.GetKeyDown("1"))
        {
            Glyphics.DestroyObjects();
            //   Glyphics.DecodeToGrid(Glyphics.HttpGet("http://localhost:3838/api/srects?PrintableNexus"), 0, 0, 0);
        }
    }
    private static void AddLookup(int X, int Y, int Z)
    {
        string url = "http://localhost:3838/api/";
        string gridSpaceAddress = CreateGridSpaceAddress(X, Y, Z);

        string name = null;

        if (!GridSpaceAddress2Name.ContainsKey(gridSpaceAddress))
        {
            name = Glyphics.HttpGet(url + "megagrid?" + gridSpaceAddress);
            GridSpaceAddress2Name.Add(gridSpaceAddress, name);
        }

        if (!Name2Serialized.ContainsKey(name))
        {
            string srects = Glyphics.HttpGet(url + "srects?" + name);
            Name2Serialized.Add(name, srects);
        }
    }
    private static void GenerateMegaGridObjects()
    {
        //25,8,255
        int spanX = 25;
        int spanY = 1;
        int spanZ = 25;
        int GridX, GridY, GridZ;

        for (int y = 0; y <= spanY; y++)
        {
            for (int z = -spanZ; z <= spanZ; z++)
            {
                for (int x = -spanX; x <= spanX; x++)
                {
                    AddLookup(x, y, z);

                    GridX = x * 64;
                    GridY = y * 64;
                    GridZ = z * 64;
                    string gsa = CreateGridSpaceAddress(x, y, z);
                    string gsaName;

                    if (GridSpaceAddress2Name.ContainsKey(gsa))
                    {
                        gsaName = GridSpaceAddress2Name[gsa];
                        string srects;
                        if (Name2Serialized.ContainsKey(gsaName))
                        {
                            srects = Name2Serialized[gsaName];
                            Glyphics.DecodeToGrid(srects, GridX, GridY, GridZ);
                        }
                    }
                }
            }
        }

        //Glyphics.DecodeToGrid(srects, 0, 0, 0);
    }