IEnumerator Send() { userRoomInfo = GameObject.Find("UserRoomInformation"); roomInfo = GameObject.Find("RoomInformation"); createdRoomInfo = GameObject.Find("CreatedRoomInformation"); if (createdRoomInfo != null) { //isUR = false; createdRoomInfo = GameObject.Find("CreatedRoomInformation"); cr = createdRoomInfo.GetComponent <CreatedRoomInfo>(); addressDoSi = cr.addressDoSi; address = cr.address; x = cr.x; y = cr.y; z = cr.z; // roomId = cr.roomId; password = cr.password; //Debug.Log(roomId); } string ip = "10.27.18.70"; www = new WWW("http://" + ip + "/~kim/add.php?roomx=" + x + "&roomy= " + y + " &roomz= " + z + " &addressdosi= " + addressDoSi + "&address=" + address + " &password="******"안녕123123"); yield return(www); JsonData itemdata = JsonMapper.ToObject(www.text); // Debug.Log(www.text); for (int i = 0; i < itemdata.Count; i++) { Debug.Log(itemdata[i]["ROOMID"].ToString() + "병수"); int.TryParse(itemdata[i]["ROOMID"].ToString(), out cr.roomId); } }
public void OnClick() { LocatedListBlock[] blocks = list.GetComponentsInChildren <LocatedListBlock>(); if (createdRoomInfo != null) { createdRoomInfo = GameObject.Find("CreatedRoomInformation"); cr = createdRoomInfo.GetComponent <CreatedRoomInfo>(); //addressDoSi = cr.addressDoSi; //address = cr.address; x = cr.x; y = cr.y; z = cr.z; roomId = cr.roomId; Destroy(createdRoomInfo); //password = cr.password; //Debug.Log(roomId + "f**k"); } else if (roomInfo != null) { ri = roomInfo.GetComponent <RoomInfo>(); x = ri.x; y = ri.y; z = ri.z; roomId = ri.roomId; Destroy(roomInfo); } else if (userRoomInfo != null) { ur = userRoomInfo.GetComponent <UserRoomInfo>(); x = ur.x; y = ur.y; z = ur.z; roomName = ur.roomName; List <LocalData> itemList = new List <LocalData>(); itemList.Add(new LocalData((plane.transform.localScale.x * 1000).ToString(), (plane.transform.localScale.z * 1000).ToString(), "1", 0, 0, 0, 0, "0")); JsonData itemJson = JsonMapper.ToJson(itemList); PlayerPrefs.SetString("roomList", PlayerPrefs.GetString("roomList", null) + "," + roomName); PlayerPrefs.Save(); for (int i = 0; i < blocks.Length; i++) { Debug.Log("!!"); itemList.Add(new LocalData(blocks[i].Position.x.ToString(), blocks[i].Position.y.ToString(), blocks[i].Position.z.ToString(), int.Parse(blocks[i].Info.FurnitureNumber), (int)blocks[i].target.transform.GetComponent <MeshFilter>().mesh.bounds.size.x, (int)blocks[i].target.transform.GetComponent <MeshFilter>().mesh.bounds.size.y, (int)blocks[i].target.transform.GetComponent <MeshFilter>().mesh.bounds.size.z, blocks[i].target.transform.rotation.z.ToString())); } itemJson = JsonMapper.ToJson(itemList); ur = userRoomInfo.GetComponent <UserRoomInfo>(); PlayerPrefs.SetString(roomName, itemJson.ToString()); PlayerPrefs.Save(); Destroy(userRoomInfo); return; } //StartCoroutine(Send()); string ip = "10.27.18.70"; for (int i = 0; i < blocks.Length; i++) { info = "http://" + ip + "//~kim/addobject.php?ROOMID=" + rid; info = info + "&objectx=" + blocks[i].Position.x.ToString(); info = info + "&objecty=" + blocks[i].Position.y.ToString(); info = info + "&objectz=" + blocks[i].Position.z.ToString(); info = info + "&objectkey=" + blocks[i].Info.FurnitureNumber.ToString(); info = info + "&objectsizex=" + ((int)blocks[i].Scale.x).ToString(); info = info + "&objectsizey=" + ((int)blocks[i].Scale.y).ToString(); info = info + "&objectsizez=" + ((int)blocks[i].Scale.z).ToString(); info = info + "&objectrotation=" + blocks[i].target.transform.rotation.y.ToString(); Debug.Log(info); StartCoroutine(ObSend()); } }
// Start is called before the first frame update public void Start() { //StartCoroutine(Send()); userRoomInfo = GameObject.Find("UserRoomInformation"); roomInfo = GameObject.Find("RoomInformation"); createdRoomInfo = GameObject.Find("CreatedRoomInformation"); if (roomInfo != null) { //Debug.Log("Update1"); ri = roomInfo.GetComponent <RoomInfo>(); x = ri.x; y = ri.y; z = ri.z; //address = ri.address; //addressDoSi = ri.addressDoSi; roomId = ri.roomId; Debug.Log("roomid"); } else if (userRoomInfo != null) { ur = userRoomInfo.GetComponent <UserRoomInfo>(); x = ur.x; y = ur.y; z = ur.z; roomName = ur.roomName; floor.transform.localScale = new Vector3((float)x / 1000, 1, (float)y / 1000); Debug.Log(roomName); string info = PlayerPrefs.GetString(roomName, null); if (info != null) { itemdata = JsonMapper.ToObject(info); floor.transform.localScale = new Vector3(float.Parse(itemdata[0]["objectx"].ToString()) / 1000, 1, float.Parse(itemdata[0]["objecty"].ToString()) / 1000); start = 1; } else { return; } } else if (createdRoomInfo != null) { Debug.Log("Update1"); createdRoomInfo = GameObject.Find("CreatedRoomInformation"); cr = createdRoomInfo.GetComponent <CreatedRoomInfo>(); x = cr.x; y = cr.y; z = cr.z; roomId = cr.roomId; } else { Debug.Log("Update3"); } FurnitureBlock[] blocks = list.GetComponentsInChildren <FurnitureBlock>(); for (int i = start; i < itemdata.Count; i++) { for (int j = 0; j < blocks.Length; j++) { if (int.Parse(blocks[j].furnitureData.FurnitureNumber) == int.Parse(itemdata[i]["objectkey"].ToString())) { target = blocks[j].LoadFurniture(new Vector3(float.Parse(itemdata[i]["objectx"].ToString()), float.Parse(itemdata[i]["objecty"].ToString()), float.Parse(itemdata[i]["objectz"].ToString())), new Vector3(-90, float.Parse(itemdata[i]["objectrotation"].ToString()), 0), new Vector3(float.Parse(itemdata[i]["objectsizex"].ToString()) / blocks[j].furnitureData.FurniturePrefab.transform.GetComponent <MeshFilter>().mesh.bounds.size.x, float.Parse(itemdata[i]["objectsizey"].ToString()) / blocks[j].furnitureData.FurniturePrefab.transform.GetComponent <MeshFilter>().mesh.bounds.size.y, float.Parse(itemdata[i]["objectsizez"].ToString()) / blocks[j].furnitureData.FurniturePrefab.transform.GetComponent <MeshFilter>().mesh.bounds.size.z)); } } } }