private void buttonSaSave_Click(object sender, EventArgs e) { if (saRig.Ship != null) { MessageBox.Show("Нельзя сохранять риг, который сделан на основе экземпляра корабля"); return; } int playerId = 0; string tg = ""; if (checkSaForPlayer.Checked) { playerId = DataConnection.GetResultInt("SELECT MAX(id) AS Result FROM [admirals]"); } else { if (textSaRigTag.Text == "") { MessageBox.Show("Не выбран тег и не помечено что это для игрока"); return; } tg = textSaRigTag.Text; } saRig.SaveData(playerId, tg); }
public HttpResponseMessage StartBattleWithRigInDb(int battleSceneId) { string steamId = User.Identity.Name; int playerId = PlayerDataSql.PlayerId(steamId); SpaceshipRig rig = SpaceshipRig.RigForBattle(playerId, battleSceneId); Battle battle = null; if (rig != null) { if (rig.Id == 0) { rig.SaveData(playerId, ""); } } else { rig = SpaceshipRig.RigForBattle(playerId, battleSceneId); } battle = Battle.CreateBattle(playerId, battleSceneId, rig.Id, true); battle.Rig = rig; string serializedElement = JsonConvert.SerializeObject(battle); serializedElement = CommonFunctions.Compress(serializedElement); var response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(serializedElement); return(response); }
public HttpResponseMessage RegisterRigCompleted(SpaceshipRig rig) { string steamId = User.Identity.Name; int playerId = PlayerDataSql.PlayerId(steamId); if (rig != null) { rig.SaveData(playerId, ""); } var response = new HttpResponseMessage(HttpStatusCode.OK); return(response); }