public static void RaiseChangeCardCharacteristics(GameView gameView, ChangeCardCharacteristicsMode mode) { var sectorKey = gameView.GameStructure.GetActivePlayer().Sectors.Single(e => e.Item.Code == SystemSectors.BATTLEFIELD.ToString()).SectorKey; ISectorView sectorView = (ISectorView)gameView.Controls.Find(sectorKey, true).First(); var cards = sectorView.CardViews.Where(c => c.Selected).ToList(); if(cards.Count > 0) { string characteristics = null; bool applyNumericalIncrement = true; switch(mode) { case ChangeCardCharacteristicsMode.AddPower: characteristics = "1/0"; break; case ChangeCardCharacteristicsMode.SubtractPower: characteristics = "-1/0"; break; case ChangeCardCharacteristicsMode.AddToughness: characteristics = "0/1"; break; case ChangeCardCharacteristicsMode.SubtractToughness: characteristics = "0/-1"; break; case ChangeCardCharacteristicsMode.Query: { CharacteristicsEditor dlg = new CharacteristicsEditor(cards.Count > 1 ? string.Empty : cards.First().CardViewItem.CustomCharacteristics); dlg.StartPosition = FormStartPosition.CenterScreen; if(dlg.ShowDialog(gameView) == DialogResult.OK) { characteristics = dlg.CardCharacteristics; applyNumericalIncrement = dlg.ApplyNumericalIncrement; } } break; } if(characteristics != null) gameView.Controller.SetCardsCustomCharacteristics(cards.Select(c => c.Name).ToList(), characteristics, true, applyNumericalIncrement); } }
void menuChangeAllCharacteristics_Click(object sender, EventArgs e) { try { CharacteristicsEditor dlg = new CharacteristicsEditor(string.Empty); dlg.StartPosition = FormStartPosition.CenterScreen; if(dlg.ShowDialog(this) == DialogResult.OK) GameView.Controller.SetCardsCustomCharacteristics(sectorView.CardViews.Select(v => v.Name).ToList(), dlg.CardCharacteristics, false, dlg.ApplyNumericalIncrement); } catch(Exception ex) { GameView.HandleException(ex); } }