public static void ProbePlanet(long planetId, TerrainObj_callback callback) { string fullURL = "probeplanet"; RestRequest request = new RestRequest(fullURL, Method.POST); request.AddParameter("planetid", planetId); apiClient.ExecuteAsync(request, (response) => { if (response.StatusCode == HttpStatusCode.OK) { TerrainObj newObj = response.Content.FromJson <TerrainObj>(); callback(newObj); } else { callback(null); } }); }
public static void FetchTerrain(long planetId, TerrainObj_callback callback) { string fullURL = "terrain"; RestRequest request = new RestRequest(fullURL, Method.GET); request.AddParameter("planetid", planetId); apiClient.ExecuteAsync(request, (response) => { if (response.StatusCode == HttpStatusCode.OK && response.Content != "null") { TerrainObj newObj = response.Content.FromJson <TerrainObj>(); callback(newObj); } else if (response.StatusCode != 0) { callback(null); } }); }
public static void FetchSolSysStatus(long solSysId, TerrainObj_callback callback) { string fullURL = "solsys"; RestRequest request = new RestRequest(fullURL, Method.GET); request.AddParameter("solsysid", solSysId); request.AddParameter("status", solSysId); apiClient.ExecuteAsync(request, (response) => { if (response.StatusCode == HttpStatusCode.OK) { TerrainObj newObj = response.Content.FromJson <TerrainObj>(); callback(newObj); } else if (response.StatusCode != 0) { callback(null); } }); }
public static void SaveTerrainPaint(TerrainObj theTerrain, bool_callback callback) { string fullURL = "terrain"; RestRequest request = new RestRequest(fullURL, Method.PUT); List <SectorPaintObj> sectorList = new List <SectorPaintObj>(); for (int x = 0; x < theTerrain.width; x++) { for (int y = 0; y < theTerrain.height; y++) { var curSect = theTerrain._sectorArray[x][y]; if (curSect.dirty) { sectorList.Add(new SectorPaintObj(curSect)); curSect.dirty = false; } } } string sectorStr = sectorList.ToJson <List <SectorPaintObj> >(); request.AddParameter("sectormap", sectorStr); request.AddParameter("paint", true); apiClient.ExecuteAsync(request, (response) => { if (response.StatusCode == HttpStatusCode.OK) { callback(true); } else { callback(false); } }); }