public void OnClickConfirm() { slides = new slideShow(); //goal is to fill slideshow //1.fill SceneAnswerPair //1. fill dbScene objects foreach (Node node in nodes.GetComponentsInChildren <Node>()) { node.fillJson(); } //2.fill slideShow List <DBScene> slideSet = new List <DBScene>(); foreach (Transform child in nodes.transform) { slideSet.Add(child.GetComponent <Node>().JsonInfo); } slides.sceneSet = slideSet.ToArray(); slides.Firstslide = slideSet[0]; slides.name = SaveName.transform.GetChild(0).GetComponent <InputField>().text; //3.convertTojson //write to json file if (insertNewJson(slides.name)) { uploadDBJson(slides, slides.name); } //4.clean and disable SaveName.transform.GetChild(0).GetComponent <InputField>().text = null; SaveName.gameObject.SetActive(false); }
private void OnEnable() { if (nodes.transform.childCount == 1 && nodes.transform.GetChild(0).tag.Equals("slide")) { slideJson = nodes.transform.GetChild(0).GetComponent <Slide>().slideJson; setJsonImage(slideJson.Firstslide); } else { setImage(nodes.transform.GetChild(0).gameObject); } }
public void uploadDBJson(slideShow db, string name) { //upload json string contents = ""; string urlJson = "http://18.191.23.16/StoryJsonServer/UnityUpload.php"; contents = JsonUtility.ToJson(db); byte[] bytes = Encoding.ASCII.GetBytes(contents); WWWForm form = new WWWForm(); form.AddField("Name", name); form.AddBinaryData("post", bytes); WWW www = new WWW(urlJson, form); }