void OnMouseDown() { this.transform.position = new Vector3(0.051f, 2.89f, -0.09f); for (int i = 1; i <= 6; i++) { GameObject pictures = GameObject.Find("picture" + i.ToString()); if (pictures != null) { picture picScript = pictures.GetComponent <picture>(); picScript.setTimer(); } } }
void OnMouseDown() { // When delete button is activated, and picture is selected(working space) if ((check == 1) && (File.Exists(Application.dataPath + "/galleryData/" + receivedFilename + ".data")) && (delPicCode.state == 1)) { renderer.material.color = Color.gray; // Picture's color is darkend because of selection's expression. delOn = 1; // Permit to select of deletion check = 0; // Provide chance to deselction } // When delete button is activated, and picture is deselected(working space) else if ((check == 0) && (File.Exists(Application.dataPath + "/galleryData/" + receivedFilename + ".data")) && (delPicCode.state == 1)) { renderer.material.color = Color.white; // Picture's color is brightened because of deselection's expression. delOn = 0; // Cancel to select of deletion check = 1; // Provide chance to selection } // If png file involve data file(working file) else if ((check == 1) && (File.Exists(Application.dataPath + "/galleryData/" + receivedFilename + ".data"))) { datafile = new FileInfo(Application.dataPath + "/galleryData/" + receivedFilename + ".data"); // Data file reader = datafile.OpenText(); // Open data file by text nextScene = reader.ReadLine(); // Read first line(wateroil or sandart) if (nextScene == "wateroil") // If wateroil datafile { PlayerPrefs.SetString("art", receivedFilename); // Send datafile's name Application.LoadLevel("wateroil"); // switch to wateroil scene } else if (nextScene == "sandart") // If sandart datafile { PlayerPrefs.SetString("art", receivedFilename); // Send datafile's name Application.LoadLevel("sandart"); // switch to sandart scene } } else if ((check == 1) && (delPicCode.state == 1)) // When delete button is activated, and picture is selected(screenshot) { renderer.material.color = Color.gray; // Picture's color is darkend because of selection's expression. delOn = 1; // Permit to select of deletion check = 0; // Provide chance to deselction } else if ((check == 0) && (delPicCode.state == 1)) // When delete button is activated, and picture is deselected(screenshot) { renderer.material.color = Color.white; // Picture's color is brightened because of deselection's expression. delOn = 0; // Cancel to select of deletion check = 1; // Provide chance to selection } else if (check == 1) // When select picture, picture is expanded(screenshot) { renderer.transform.position = new Vector3(0.05f, 0.96f, -0.1f); // Apply expanded picturs's position renderer.transform.localScale = new Vector3(1.83f, 1.16f, 0.01f); // Apply expanded picture,s scale check = 0; // Provide chance to deselction //notify file name GameObject.Find("print").SendMessage("setFileName", Application.dataPath + "/galleryData/" + receivedFilename + ".png"); } else if (check == 0) // When select expanded picture, pictue is returned original size and position(screenshot) { for (int i = 1; i <= 6; i++) { if (this.name == ("picture" + i.ToString())) { continue; } GameObject pictures = GameObject.Find("picture" + i.ToString()); if (pictures != null) { picture picScript = pictures.GetComponent <picture>(); picScript.setTimer(); } } renderer.transform.position = receivedPosition; // Return to original position renderer.transform.localScale = receivedScale; // Return to original scale check = 1; // Provide chance to selction GameObject.Find("print").SendMessage("setFileName", string.Empty); } }