public SearchCard ( int NumberInDeck ) : |
||
NumberInDeck | int | |
Результат |
public SelectTargetCard(User _Player, FECipherVit _Owner, List<int> _Cardset) { InitializeComponent(); Player = _Player; Owner = _Owner; Cardset = new List<Card>(); foreach(int cardnumindeck in _Cardset) { Cardset.Add(Player.SearchCard(cardnumindeck)); } }
private void 导入场面信息ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog importFieldStatus = new OpenFileDialog(); importFieldStatus.Filter = "FECipher场面信息(*.fe0fs)|*.fe0fs"; importFieldStatus.FilterIndex = 1; importFieldStatus.RestoreDirectory = true; if (importFieldStatus.ShowDialog() == DialogResult.OK) { string[] FieldStatus = File.ReadAllText(importFieldStatus.FileName, Encoding.UTF8).Split(new string[] { "#" }, StringSplitOptions.None); int ImportDataBaseVer = Convert.ToInt32(FieldStatus[0]); if (ImportDataBaseVer > DatabaseVer) { MessageBox.Show("要导入的数据版本高于当前程序的数据版本,请下载新版程序。"); } else { Player = new User(FieldStatus[1]); Renew(); buttonGameOn.Visible = false; buttonTurnStart.Visible = true; buttonTurnEnd.Visible = true; buttonUseKizuna.Visible = true; buttonSupport.Visible = true; button_CriticalAttack.Visible = true; button_Miss.Visible = true; label_RivalHandLabel.Visible = true; label_RivalHandTotal.Visible = true; label_RivalHandTotal.BringToFront(); buttonGameOn.Enabled = false; 游戏开始ToolStripMenuItem.Enabled = false; 动作ToolStripMenuItem.Enabled = true; 导出场面信息ToolStripMenuItem.Enabled = true; GameOn = true; string DeckTemp = ""; for (int NumberInDeck = 0; ; NumberInDeck++) { if (NumberInDeck != 0) { DeckTemp += Environment.NewLine; } if (Player.SearchCard(NumberInDeck) != null) { DeckTemp += Player.SearchCard(NumberInDeck).SerialNo.ToString(); } else { break; } } DeckFilename = "decktemp"; File.WriteAllText(DeckFilename, DeckTemp, Encoding.UTF8); msgProcessor.Send("ImportFieldStatus", "#导入场面信息。"); } } }
string CheckUserDeckWithDeckFile(User User, string DeckFileName) { string result = ""; Dictionary<string, int> SubmittedDeckSerialsCount = new Dictionary<string, int>(); List<string> SubmittedDeckCardSerials = new List<string>(); SubmittedDeckCardSerials.AddRange(File.ReadAllLines(DeckFileName)); SubmittedDeckCardSerials.ForEach(str => { if (SubmittedDeckSerialsCount.ContainsKey(str)) { SubmittedDeckSerialsCount[str]++; } else { SubmittedDeckSerialsCount.Add(str, 1); } }); Dictionary<string, int> UsingDeckSerialsCount = new Dictionary<string, int>(); for (int i = 0; User.SearchCard(i) != null; i++) { string Serial = User.SearchCard(i).SerialNo; if (UsingDeckSerialsCount.ContainsKey(Serial)) { UsingDeckSerialsCount[Serial]++; } else { UsingDeckSerialsCount.Add(Serial, 1); } } foreach (string Serial in SubmittedDeckSerialsCount.Keys) { if (!(UsingDeckSerialsCount.ContainsKey(Serial) && (UsingDeckSerialsCount[Serial] == SubmittedDeckSerialsCount[Serial]))) { result += "(" + CardData[Serial][1] + ")" + CardData[Serial][2] + " " + CardData[Serial][4] + " 提交:" + SubmittedDeckSerialsCount[Serial].ToString() + " 当前:"; if (!UsingDeckSerialsCount.ContainsKey(Serial)) { result += "0" + Environment.NewLine; } else { result += UsingDeckSerialsCount[Serial].ToString() + Environment.NewLine; } } UsingDeckSerialsCount.Remove(Serial); } foreach (string Serial in UsingDeckSerialsCount.Keys) { result += "(" + CardData[Serial][1] + ")" + CardData[Serial][2] + " " + CardData[Serial][4] + " 提交:0 当前:" + UsingDeckSerialsCount[Serial].ToString() + Environment.NewLine; } return result; }