/* * * * * * * WORKING ON THIS PART XDDDDDDDDD * * * * * */ public void CreatePin(String[] pinInfo, Vector3 pos, Vector2d latlongDelta) { GameObject newPin = Instantiate(pin, pos, pin.transform.rotation); PinPost pPost = newPin.GetComponent <PinPost>(); pPost.SetMessage(pinInfo[0], pinInfo[1], latlongDelta); _PinCanvasActions.UpdatePin(pPost); LocationResponse location = new LocationResponse(); location.Latitude = (float)latlongDelta.x; location.Longitude = (float)latlongDelta.y; //Location loc = new Location((float)latlongDelta.x, (float)latlongDelta.y); Location loc = new Location(); int indexLat = ChunkManager.GetChunkNumNS(loc); Debug.Log("Chunk index for lat " + indexLat); int indexLon = ChunkManager.GetChunkNumEW(loc); Debug.Log("Chunk index for lat " + indexLon); UserResponse author = new UserResponse() { RealName = "ram", UserName = "******", Location = location }; PostResponse post = new PostResponse() { Author = author, Title = pinInfo[0], Text = pinInfo[1], TimeStamp = DateTime.Now, ApprovalRating = 0, NodeLocation = location, ChunkIndexNS = indexLat, ChunkIndexEW = indexLon }; string jsonData = JsonConvert.SerializeObject(post); StartCoroutine(ClientAPITest.Post("https://kettlex-server.herokuapp.com/postMessage", jsonData)); }
private void RetrieveCurrentPins() { setUp = true; StartCoroutine(ClientAPITest.Get("https://kettlex-server.herokuapp.com/getPostsAroundMe", (string result) => { List <PostResponse> pr = JsonConvert.DeserializeObject <List <PostResponse> >(result); Debug.Log(pr.ToString()); for (int i = 0; i < pr.Count; i++) { String RealName = pr[i].Author.RealName; String UserName = pr[i].Author.UserName; float UserLatitude = pr[i].Author.Location.Latitude; float UserLongitude = pr[i].Author.Location.Longitude; String Title = pr[i].Title; String Text = pr[i].Text; DateTime TimeStamp = pr[i].TimeStamp; int ApprovalRating = pr[i].ApprovalRating; float PostLatitude = pr[i].NodeLocation.Latitude; float PostLongitude = pr[i].NodeLocation.Longitude; //Debug.Log("Post: " + i + "(" + PostLatitude+","+PostLongitude+")"); SetUpPins(PostLatitude, PostLongitude, Title, Text, UserName, TimeStamp.ToString()); } })); }