// GET api/game/5 public FieldInfo Get(string id) { ICampaignController controller = data.getCampaignController(id); // SektorInfo in 2 dimensionalen Array liefern int x = controller.CampaignEngine.FieldField.FieldDimension.X; int y = controller.CampaignEngine.FieldField.FieldDimension.Y; SektorInfo[,] sektorArr = new SektorInfo[y, x]; for (int iy = 0; iy < y; iy++) { for (int jx = 0; jx < x; jx++) { var sektor = controller.CampaignEngine.FieldField.get(new clsSektorKoordinaten(jx, iy){}); sektorArr[iy, jx] = sektor.getInfo(); } } var field = new FieldInfo() { Campaign = controller.Campaign_getInfo(), FieldKoord = controller.CampaignEngine.FieldField.FieldDimension, ListSektors = controller.CampaignEngine.FieldField.getSektorList().Select(s => s.getInfo()), SektorField = sektorArr }; return field; }
public CampaignInfo() { campaignId = String.Empty; campaignName = String.Empty; ListPlayerInfo = new List<PlayerInfo>(); FieldDimension = new clsSektorKoordinaten(); SektorField = new SektorInfo[0, 0]; ListUnits = new List<UnitInfo>(); objCampaignData = new CampaignState(); }