/// <summary> Perform a http request to fetch the details about this place. Results are cached and will be returned immediately if called again. </summary> public void FetchDetails(Action <string> onError, Action <Place> onSuccess) { if (fetched) { onSuccess(this); } else { WWWFormPlus form = new WWWFormPlus(); form.Request(WORLD_API_FETCH + guid, onError, x => { ApplyFetchResult(x); onSuccess(this); }); } }
public void GetCoords(Action <string> onFail, Action <Vector2Int> onSuccess) { if (coordinates.HasValue) { onSuccess(coordinates.Value); } else { WWWFormPlus form = new WWWFormPlus(); form.Request( $"https://cap.secondlife.com/cap/0/d661249b-2b5a-4436-966a-3d3b8d7a574f?var=coords&sim_name={name}", onFail, x => { coordinates = ParseCordsResult(x); onSuccess(coordinates.Value); } ); } }
public void GetName(Action <string> onFail, Action <string> onSuccess) { if (name != null) { onSuccess(name); } else { WWWFormPlus form = new WWWFormPlus(); form.Request( $"https://cap.secondlife.com/cap/0/b713fe80-283b-4585-af4d-a3b7d9a32492?var=region&grid_x={coordinates.Value.x}&grid_y={coordinates.Value.y}", onFail, x => { name = ParseNameResult(x); onSuccess(name); } ); } }
public void GetMap(Action <string> onFail, Action <Texture2D> onSuccess) { if (map != null) { onSuccess(map); } else { GetCoords(onFail, coords => { WWWFormPlus.RequestTexture( $"https://map.secondlife.com/map-1-{coords.x}-{coords.y}-objects.jpg", onFail, tex => { map = tex; onSuccess(tex); } ); }); } }
public void Search() { items.Clear(); MaturityRating rating = 0; if (pg) { rating |= MaturityRating.PG; } if (mature) { rating |= MaturityRating.Mature; } if (adult) { rating |= MaturityRating.Adult; } WWWFormPlus form = new WWWFormPlus(); string url = $"http://search.secondlife.com/client_search.php?q={searchInput.text.ToLower()}&start={start}&mat={(int)rating}&output=xml_no_dtd&client=raw_xml_frontend&s={category.ToString()}"; Debug.Log(url); form.Request(url, OnSearchFail, OnSearchSuccess); }