Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKey(KeyCode.LeftArrow))
     {
         // rotate the camera and take a screenshot
         cam.MoveHorizontal(true);
         ScreenshotHandler.TakeScreenshot_Static(1000, 1000);
         Debug.Log(cam.transform.eulerAngles);
     }
     else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKey(KeyCode.RightArrow))
     {
         cam.MoveHorizontal(false);
         ScreenshotHandler.TakeScreenshot_Static(1000, 1000);
     }
     else if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         cam.MoveVertical(true);
         // ScreenshotHandler.TakeScreenshot_Static(1000, 1000);
         Debug.Log(cam.transform.eulerAngles.x);
     }
     else if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         cam.MoveVertical(false);
         // ScreenshotHandler.TakeScreenshot_Static(1000, 1000);
         Debug.Log(cam.transform.eulerAngles.x);
     }
 }
Esempio n. 2
0
 // Update is called once per frame
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         ScreenshotHandler.TakeScreenshot_Static(Screen.width, Screen.height);
     }
 }
Esempio n. 3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         ScreenshotHandler.TakeScreenshot_Static(500, 500);
     }
 }
Esempio n. 4
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         ScreenshotHandler.TakeScreenshot_Static(1024, 768);
     }
 }
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.F8))
     {
         ScreenshotHandler.TakeScreenshot_Static(1024, 1024);
     }
 }
Esempio n. 6
0
    IEnumerator CaptureIt()
    {
        blink.SetActive(true);
        ScreenshotHandler.TakeScreenshot_Static(2560, 1440);
        yield return(new WaitForSeconds(0.04f));

        blink.SetActive(false);
    }
Esempio n. 7
0
 // Update is called once per frame
 void Update()
 {
     // Use Spacebar key to take a screenshot
     if (Input.GetKeyDown(KeyCode.Space))
     {
         ScreenshotHandler.TakeScreenshot_Static(1000, 1000);
     }
 }
Esempio n. 8
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         //ScreenshotHandler.TakeScreenshot_Static(224,224);
         ScreenshotHandler.TakeScreenshot_Static(448, 448, "data/output/haha.png");
         //MakePictures.MakeAllPictures();
     }
 }
Esempio n. 9
0
    IEnumerator AutoSave()
    {
        while (!reload)
        {
            yield return(new WaitForSeconds(autoSaveTime));

            StartCoroutine(AutoSaveBox());
            Save();
            ScreenshotHandler.TakeScreenshot_Static(512, 512);
        }
    }
Esempio n. 10
0
    // Update is called once per frame
    void Update()
    {
        if (keep_going)
        {
            time_counter += Time.deltaTime;
        }

        if (time_counter >= 0.1 && object_counter <= myObjects.Length)
        {
            if (init_position_counter < quarter_arc_count)
            {
                if (level_ss_counter < level_circle_count)
                {
                    transform.RotateAround(new Vector3(obj.transform.position.x, 0, 0), Vector3.up, around_y_rotation);
                    level_ss_counter += 1;
                }

                else
                {
                    transform.position = startingPositions[init_position_counter];
                    transform.LookAt(obj.transform.position);
                    level_ss_counter       = 0;
                    init_position_counter += 1;
                }
            }

            else
            {
                Destroy(myObj);
                myObj                 = Instantiate(myObjects[object_counter]) as GameObject;
                object_counter       += 1;
                init_position_counter = 0;


                transform.position = startingPositions[init_position_counter];
                transform.LookAt(obj.transform.position);
                init_position_counter += 1;
            }

            time_counter = 0;

            if (take_screenshot)
            {
                ss_name = myObjects[object_counter - 1] + (transform.eulerAngles.x.ToString("000")) + "," + (transform.eulerAngles.y.ToString("000")) + "," + (transform.eulerAngles.z.ToString("000"));
                ScreenshotHandler.TakeScreenshot_Static(Screen.width, Screen.height, ss_name);
            }
        }
    }
Esempio n. 11
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            ScreenshotHandler.TakeScreenshot_Static(1024, 768);
        }

        //if (Input.GetKeyDown(KeyCode.UpArrow)) {
        //    ScreenshotHandler.CameraMoveUp_Static();
        //}
        //if (Input.GetKeyDown(KeyCode.DownArrow)) {
        //    ScreenshotHandler.CameraMoveDown_Static();
        //}
        //if (Input.GetKeyDown(KeyCode.RightArrow)) {
        //    ScreenshotHandler.CameraMoveRight_Static();
        //}
        //if (Input.GetKeyDown(KeyCode.LeftArrow)) {
        //    ScreenshotHandler.CameraMoveLeft_Static();
        //}
    }
Esempio n. 12
0
    /* Disable camera temporarily to have a visual effect on
     * the render texture of the image freezing
     * play shutter sound
     * call the screenshot class
     * then reinable cell camera
     */
    private IEnumerator TakePic()
    {
        cellCam.enabled = false;
        gameObject.GetComponentInChildren <AudioSource>().Play();
        ScreenshotHandler.TakeScreenshot_Static(300, 300);
        yield return(new WaitForSecondsRealtime(1f));

        cellCam.enabled       = true;
        cellCam.targetTexture = cellView;

        //If the photograph taken was of a collectable object
        //load into image texture
        if (isFocused)
        {
            StartCoroutine(LoadImage());
        }
        else
        {
            //When not a target object show negative feedback
            yield break;
        }
    }
Esempio n. 13
0
 public void TakeScreenshot()
 {
     ScreenshotHandler.TakeScreenshot_Static(3510, 1620);
 }
Esempio n. 14
0
    void RecordPositions()
    {
        var csv = new StringBuilder();

        // write to json file
        using (FileStream fs = File.Create(pathJSON))
        {
            // write first line
            byte[] line = new UTF8Encoding(true).GetBytes("{\n");
            fs.Write(line, 0, line.Length);
            //Debug.Log(things);

            foreach (string strr in things)
            {
                var str = string.Copy(strr);
                if (recordPositionsAA)
                {
                    str = str.Replace("BB", "AA");
                }

                thing = GameObject.Find(str);
                if (thing != null)
                {
                    //var position = thing.transform.position.ToString().Replace("(", string.Empty).Replace(")", string.Empty);
                    var x = thing.transform.position.x;
                    var y = thing.transform.position.y;
                    var z = thing.transform.position.z;

                    var rx = thing.transform.eulerAngles.x;
                    var ry = thing.transform.eulerAngles.y;
                    var rz = thing.transform.eulerAngles.z;

                    var sx = thing.transform.localScale.x;
                    var sy = thing.transform.localScale.y;
                    var sz = thing.transform.localScale.z;

                    Vector3 boxSize  = thing.GetComponent <Renderer>().bounds.size;
                    var     wx       = boxSize.x * tableSize;
                    var     wz       = boxSize.z * tableSize;
                    var     handle_x = x * tableSize - 0.5 * wx;
                    var     handle_z = -z * tableSize - 0.5 * wz;

                    var newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}",
                                                str, x, y, z, rx, ry, rz, sx, sy, sz, handle_x, handle_z);

                    csv.AppendLine(newLine);
                    //Debug.Log(newLine);

                    if (recordPositionsAA)
                    {
                        str = str.Replace("AA", "BB");
                    }
                    var name1 = names[str];
                    newLine = string.Format("  \"{0}\": [{1:0.00000}, {2:0.0000}, {3:0.00000}, {4:0.0000}]", name1, handle_x, handle_z, wx, wz);
                    if (name1 != "coffee")
                    {
                        newLine = newLine + ",";
                    }

                    //if (name1 == "napkin")
                    //newLine = string.Format("  \"{0}\": [{1:0.00000}, {2:0.0000}, {3:0.00000}, {4:0.0000}]", name1, handle_x, handle_z, wy, wx) + ",";

                    line = new UTF8Encoding(true).GetBytes(newLine + "\n");
                    fs.Write(line, 0, line.Length);

                    //if (recordPositionsAA)
                    //thing.transform.position = new Vector3(0.0f, -0.5f, 0.0f);
                }
            }

            line = new UTF8Encoding(true).GetBytes("}");
            fs.Write(line, 0, line.Length);
        }

        // write to csv file
        if (recordPositionsAA)
        {
            pathCSV = pathCSV.Replace("BB", "AA");
        }

        File.WriteAllText(pathCSV, csv.ToString());
        ScreenshotHandler.TakeScreenshot_Static(448, 448, namehaha.Replace("configs_", "shot_") + ".png");
    }
Esempio n. 15
0
 public void ScreenShot()
 {
     ScreenshotHandler.TakeScreenshot_Static(Screen.width, Screen.height);
 }
Esempio n. 16
0
 void TakeImage()
 {
     ScreenshotHandler.TakeScreenshot_Static(Ratio1, Ratio2);
 }
Esempio n. 17
0
    // move each object according to
    public static void MoveAndShot(string filePath, string[] things)
    {
        if (filePath.Contains("HIT_0_dummy"))
        {
            return;
        }

        var configNumber   = filePath.Substring(filePath.IndexOf("s_"), 5);
        var configFileName = "data/locations/position" + configNumber + ".csv";

        using (var reader = new StreamReader(configFileName))
        {
            while (!reader.EndOfStream)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');

                thing = GameObject.Find(values[0]);
                if (thing != null)
                {
                    if (values[0] == "Salad Knife BB")
                    {
                        if (configNumber.Substring(2, 1) == "5")
                        {
                            thing.GetComponent <MeshRenderer>().enabled = false;
                            thing = GameObject.Find("Tea Spoon BB");
                            thing.GetComponent <MeshRenderer>().enabled = true;
                        }
                        else
                        {
                            GameObject thing2 = GameObject.Find("Tea Spoon BB");
                            thing2.GetComponent <MeshRenderer>().enabled = false;
                            thing.GetComponent <MeshRenderer>().enabled  = true;
                        }
                    }

                    float x  = float.Parse(values[1], CultureInfo.InvariantCulture.NumberFormat);
                    float y  = float.Parse(values[2], CultureInfo.InvariantCulture.NumberFormat);
                    float z  = float.Parse(values[3], CultureInfo.InvariantCulture.NumberFormat);
                    float rx = float.Parse(values[4], CultureInfo.InvariantCulture.NumberFormat);
                    float ry = float.Parse(values[5], CultureInfo.InvariantCulture.NumberFormat);
                    float rz = float.Parse(values[6], CultureInfo.InvariantCulture.NumberFormat);
                    float sx = float.Parse(values[7], CultureInfo.InvariantCulture.NumberFormat);
                    float sy = float.Parse(values[8], CultureInfo.InvariantCulture.NumberFormat);
                    float sz = float.Parse(values[9], CultureInfo.InvariantCulture.NumberFormat);
                    if ((values[0] == "Charger BB"))
                    {
                        y                   = (float)0.017;
                        rend                = thing.GetComponent <Renderer>();
                        rend.enabled        = true;
                        rend.sharedMaterial = materials[0];
                        if (configNumber.Substring(2, 1) == "1")
                        {
                            rend.sharedMaterial = materials[1];
                        }
                    }
                    else if (values[0] == "Butter Knife BB")
                    {
                        y = (float)0.032;
                    }

                    thing.transform.position    = new Vector3(x, y, z);
                    thing.transform.eulerAngles = new Vector3(rx, ry, rz);
                    thing.transform.localScale  = new Vector3(sx, sy, sz);
                }
            }
        }

        if (filePath.Contains("_0.csv"))
        {
            ScreenshotHandler.TakeScreenshot_Static(448, 448, outputPath + filePath.Replace("_0.csv", "_0.png"));
        }
        else
        {
            using (var reader = new StreamReader(inputPath + filePath))
            {
                while (!reader.EndOfStream)
                {
                    var line   = reader.ReadLine();
                    var values = line.Split(',');

                    thing = GameObject.Find(values[0]);
                    if (thing != null)
                    {
                        if (values[0] == "Salad Knife BB")
                        {
                            if (configNumber.Substring(2, 1) == "5")
                            {
                                thing.GetComponent <MeshRenderer>().enabled = false;
                                thing = GameObject.Find("Tea Spoon BB");
                                thing.GetComponent <MeshRenderer>().enabled = true;
                            }
                            else
                            {
                                GameObject thing2 = GameObject.Find("Tea Spoon BB");
                                thing2.GetComponent <MeshRenderer>().enabled = false;
                                thing.GetComponent <MeshRenderer>().enabled  = true;
                            }
                        }

                        Vector3 boxSize = thing.GetComponent <Renderer>().bounds.size;

                        float x = float.Parse(values[1], CultureInfo.InvariantCulture.NumberFormat) + (float)0.5 * boxSize.x;
                        float y = thing.transform.position.y;
                        float z = -float.Parse(values[2], CultureInfo.InvariantCulture.NumberFormat) - (float)0.5 * boxSize.z;

                        float rx = thing.transform.eulerAngles.x;
                        float ry = thing.transform.eulerAngles.y + float.Parse(values[4], CultureInfo.InvariantCulture.NumberFormat);
                        float rz = thing.transform.eulerAngles.z;

                        if ((values[0] == "Charger BB"))
                        {
                            y                   = (float)0.017;
                            rend                = thing.GetComponent <Renderer>();
                            rend.enabled        = true;
                            rend.sharedMaterial = materials[0];
                            if (configNumber.Substring(2, 1) == "1")
                            {
                                rend.sharedMaterial = materials[1];
                            }
                        }
                        else if (values[0] == "Butter Knife BB")
                        {
                            y = (float)0.032;
                        }

                        thing.transform.position    = new Vector3(x, y, z);
                        thing.transform.eulerAngles = new Vector3(rx, ry, rz);
                    }
                }
            }
            string name = outputPath + filePath.Replace(".csv", ".png");
            ScreenshotHandler.TakeScreenshot_Static(448, 448, name);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        textlist = new List <GameObject>();
        NodesStructure[] nodesStructures = JsonReaderObject.GetComponent <JsonReaderTest>().NodesStructures;
        LinksStructure[] linksStructures = JsonReaderObject.GetComponent <JsonReaderTest>().LinksStructures;
        barlist           = new GameObject[nodesStructures.Length];
        linklist          = new GameObject[JsonReaderObject.GetComponent <JsonReaderTest>().LinksStructures.Length];
        graphContainer    = transform.GetComponent <RectTransform>();
        instance          = this;
        tooltipGameObject = graphContainer.Find("tooltip").gameObject;
        tooltipGameObject.SetActive(false);
        GameObjectList     = new List <GameObject>();
        GameLineObjectList = new List <GameObject>();
        showGraph(nodesStructures, linksStructures);
        transform.Find("AboutWindow").Find("Panel").GetComponent <CanvasGroup>().alpha = 0;
        transform.Find("Left").GetComponent <Button_UI>().ClickFunc = () =>
        {
            JsonReaderObject.GetComponent <JsonReaderTest>().align = JsonReaderTest.aligns.left;
            JsonReaderObject.SetActive(true);
            continulFlag = true;
            Update();
        };
        transform.Find("Right").GetComponent <Button_UI>().ClickFunc = () =>
        {
            JsonReaderObject.GetComponent <JsonReaderTest>().align = JsonReaderTest.aligns.right;
            JsonReaderObject.SetActive(true);
            continulFlag = true;
            Update();
        };
        transform.Find("Center").GetComponent <Button_UI>().ClickFunc = () =>
        {
            JsonReaderObject.GetComponent <JsonReaderTest>().align = JsonReaderTest.aligns.center;
            JsonReaderObject.SetActive(true);
            continulFlag = true;
            Update();
        };

        transform.Find("Justify").GetComponent <Button_UI>().ClickFunc = () =>
        {
            JsonReaderObject.GetComponent <JsonReaderTest>().align = JsonReaderTest.aligns.justify;
            JsonReaderObject.SetActive(true);
            continulFlag = true;
            Update();
        };
        transform.Find("Download").GetComponent <Button_UI>().ClickFunc = () =>
        {
            GameObject        gameObject  = new GameObject("MainCamera", typeof(Camera));
            ScreenshotHandler screenshot1 = gameObject.AddComponent <ScreenshotHandler>();
            gameObject.transform.SetParent(window_Graph, false);
            gameObject.AddComponent <RectTransform>();
            RectTransform rectTransform = gameObject.GetComponent <RectTransform>();
            rectTransform.anchoredPosition3D = new Vector3(0, 0, -720);
            Camera camera = gameObject.GetComponent <Camera>();
            // camera.clearFlags = CameraClearFlags.Nothing;
            ScreenshotHandler screenshot = new ScreenshotHandler(camera);
            screenshot.TakeScreenshot_Static(1070, 800);
        };
        transform.Find("Help and about").GetComponent <Button_UI>().ClickFunc = () =>
        {
            transform.Find("AboutWindow").Find("Panel").GetComponent <CanvasGroup>().alpha = 1;
        };
        transform.Find("AboutWindow").Find("Panel").Find("C1").Find("Button").GetComponent <Button_UI>().ClickFunc = () =>
        {
            transform.Find("AboutWindow").Find("Panel").GetComponent <CanvasGroup>().alpha = 0;
        };
    }