public StructureObj(StructureObj master) { structureTypeId = master.structureTypeId; isPublic = master.isPublic; xLoc = master.xLoc; yLoc = master.yLoc; xSize = master.xSize; ySize = master.ySize; curPop = master.curPop; maxPop = master.maxPop; curHP = master.curHP; maxHP = master.maxHP; minPowerNeed = master.minPowerNeed; solidStorageSpace = master.solidStorageSpace; gasStorageSpace = master.gasStorageSpace; foodStorageSpace = master.foodStorageSpace; liquidStorageSpace = master.liquidStorageSpace; energyStorageSpace = master.energyStorageSpace; strangeStorageSpace = master.strangeStorageSpace; maxSolidStorageSpace = master.maxSolidStorageSpace; maxGasStorageSpace = master.maxGasStorageSpace; maxFoodStorageSpace = master.maxFoodStorageSpace; maxLiquidStorageSpace = master.maxLiquidStorageSpace; maxEnergyStorageSpace = master.maxEnergyStorageSpace; maxStrangeStorageSpace = master.maxStrangeStorageSpace; minPopNeed = master.minPopNeed; creationDate = new DateTime(); lastTick = master.lastTick; ownerId = master.ownerId; physicalDefense = master.physicalDefense; energyDefense = master.energyDefense; isVacuumSafe = master.isVacuumSafe; isRadiationSafe = master.isRadiationSafe; }
public static void UpdateStructureLoc(StructureObj theStrut) { string fullURL = "structure"; RestRequest request = new RestRequest(fullURL, Method.PUT); request.AddParameter("updateloc", true); request.AddParameter("structureid", theStrut.Id); request.AddParameter("xloc", theStrut.xLoc); request.AddParameter("yloc", theStrut.yLoc); apiClient.ExecuteAsync(request, null); }
public static StructureObj Instantiate(StructureTypeObj template) { StructureObj newObj = new StructureObj(); newObj.xLoc = 0; newObj.yLoc = 0; newObj.xSize = template.width; newObj.ySize = template.height; newObj.structureTypeId = template.Id; newObj.nickname = template.structurename; return(newObj); }
public SectorObj(SectorObj master) { lowTemp = master.lowTemp; highTemp = master.highTemp; surfaceType = master.surfaceType; ownerId = master.ownerId; claimed = master.claimed; foreach (StructureObj curStruct in master.structures) { StructureObj newStruct = new StructureObj(curStruct); newStruct.sector = this; structures.Add(newStruct); } }
public static void FetchStructure(long structureId, StructureObj_callback callback) { string fullURL = "structure"; RestRequest request = new RestRequest(fullURL, Method.GET); request.AddParameter("structureid", structureId); apiClient.ExecuteAsync(request, (response) => { if (response.StatusCode == HttpStatusCode.OK) { StructureObj newObj = response.Content.FromJson <StructureObj>(); callback(newObj); } else { callback(null); } }); }
public static void SaveNewStructure(StructureObj theStrut, long_callback callback) { string fullURL = "structure"; RestRequest request = new RestRequest(fullURL, Method.POST); string theStructStr = theStrut.ToJson <StructureObj>(); request.AddParameter("structure", theStructStr); apiClient.ExecuteAsync(request, (response) => { if (response.StatusCode == HttpStatusCode.OK) { long newObjId = response.Content.FromJson <long>(); theStrut.Id = newObjId; callback(newObjId); } else if (response.StatusCode != 0) { callback(0); } }); }