private void btnSave_Click(object sender, RoutedEventArgs e) { string name = txtManagerName.Text; if (string.IsNullOrEmpty(name)) { MessageBox.Show("请取一个有意义的经理名."); return; } var check = LocalHelper.ManagerList.Managers.Exists(d => d.Name == name && d.Id != _localTransfer.Id); if (check) { MessageBox.Show("该经理名已经存在,请换一个."); return; } _localTransfer.TalentId = ComboBoxHelper.GetSelectValueInt(cmbTalent); _localTransfer.WillId = ComboBoxHelper.GetSelectValueInt(cmbManagerWill); _localTransfer.SuitId = ComboBoxHelper.GetSelectValueInt(cmbSuit); _localTransfer.FormationId = ComboBoxHelper.GetSelectValueInt(cmbFormation); _localTransfer.FormationLevel = ConvertHelper.ConvertToInt(txtFormationLevel.Text); _localTransfer.Name = name; LocalManagerHelper.SaveBefore(_localTransfer); if (_isNew) { LocalHelper.ManagerList.Managers.Add(_localTransfer); } lblKpi.Content = _localTransfer.Kpi; LocalHelper.SaveLocalTransferManager(); this.DialogResult = true; this.Close(); }
private void btnSure_Click(object sender, RoutedEventArgs e) { if (_dicPlayer == null) { MessageBox.Show("请选择一个球员!"); return; } var check = _manager.Players.Exists(d => d.Index != _player.Index && d.PlayerId == _dicPlayer.Idx); if (check) { MessageBox.Show("该球员已经存在,请换一个."); return; } try { _player.PlayerId = _dicPlayer.Idx; _player.Name = _dicPlayer.Name; _player.Speed = GetTxtValue(txtSpeed); _player.Shooting = GetTxtValue(txtShooting); _player.FreeKick = GetTxtValue(txtFreeKick); _player.Balance = GetTxtValue(txtBalance); _player.Stamina = GetTxtValue(txtStamina); _player.Strength = GetTxtValue(txtStrength); _player.Aggression = GetTxtValue(txtAggression); _player.Disturb = GetTxtValue(txtDisturb); _player.Interception = GetTxtValue(txtInterception); _player.Dribble = GetTxtValue(txtDribble); _player.Passing = GetTxtValue(txtPassing); _player.Mentality = GetTxtValue(txtMentality); _player.Reflexes = GetTxtValue(txtReflexes); _player.Positioning = GetTxtValue(txtPositioning); _player.Handling = GetTxtValue(txtHandling); _player.Acceleration = GetTxtValue(txtAcceleration); _player.Skill = playerSkillControl1.GetSkill(); _player.Skill2 = playerSkillControl2.GetSkill(); _player.StarSkill = ComboBoxHelper.GetSelectValue(cmbStarSkill); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } LocalManagerHelper.SaveBefore(_manager); lblPlayerKpi.Content = "Kpi:" + _player.Kpi; LocalHelper.SaveLocalTransferManager(); this.DialogResult = true; this.Close(); }
LocalTransferManagerEntity CreateLocalManager(int id) { var manager = new LocalTransferManagerEntity(); manager.Id = id; manager.Name = "球队" + id; manager.FormationId = 1; manager.FormationLevel = 1; manager.TalentId = 0; manager.Players = new List <LocalTransferPlayerEntity>(11); var ss = "30437,30704,32356,32124,41299,30542,31976,32006,40813,20169,30273".Split(','); int i = 0; foreach (var s in ss) { manager.Players.Add(CreateLocalPlayer(Convert.ToInt32(s), i++)); } LocalHelper.BuildPlayerPosition(manager); LocalManagerHelper.SaveBefore(manager); return(manager); }