public Card(string CardAsString, User _Controller) { List<string> Card = new List<string>(); Card.AddRange(CardAsString.Replace("[", "").Replace("]", "").Split(new string[] { "," }, StringSplitOptions.None)); NumberInDeck = Convert.ToInt32(Card[0]); SerialNo = Convert.ToInt32(Card[1]); UnitTitle = Card[2]; UnitName = Card[3]; Power = Convert.ToInt32(Card[4]); Support = Convert.ToInt32(Card[5]); IsHorizontal = Convert.ToBoolean(Card[6]); FrontShown = Convert.ToBoolean(Card[7]); Visible = Convert.ToBoolean(Card[8]); List<string> temp = new List<string>(); if (Card[9] != "()") { temp.AddRange(Card[9].Replace("(", "").Replace(")", "").Split(new string[] { ";" }, StringSplitOptions.None)); while (temp.Contains("")) { temp.Remove(""); } OverlayCardNo = temp.ConvertAll<Int32>(Convert.ToInt32); } else { OverlayCardNo = new List<int>(); } Comments = Card[10]; Controller = _Controller; }
public Card(int _NumberInDeck, string _SerialNo, string _CardName, string _Power, string _Support, User _Controller) { NumberInDeck = _NumberInDeck; SerialNo = _SerialNo; if (_CardName != "") { int pos; if (_CardName.Contains(",")) { pos = _CardName.IndexOf(","); UnitTitle = _CardName.Substring(pos + 2); UnitName = _CardName.Substring(0, pos); } else { pos = _CardName.IndexOf(" "); UnitTitle = _CardName.Substring(0, pos); UnitName = _CardName.Substring(pos + 1); } } CardName = _CardName; Power = _Power; Support = _Support; Controller = _Controller; OverlayCardNo = new List<int>(); }
public SelectTargetCard(User _Player, FECipherVit _Owner, List<Card> _Cardset) { InitializeComponent(); Player = _Player; Owner = _Owner; Cardset = _Cardset; }
public CardSetView(Region _ThisRegion, string _RegionType, User _Player, FECipherVit _Owner) { InitializeComponent(); ThisRegion = _ThisRegion; RegionType = _RegionType; Player = _Player; Owner = _Owner; }
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)); } }
public Card(string CardAsString, User _Controller) { Controller = _Controller; List<string> Card = new List<string>(); Card.AddRange(CardAsString.Replace("[", "").Replace("]", "").Split(new string[] { "," }, StringSplitOptions.None)); NumberInDeck = Convert.ToInt32(Card[0]); SerialNo = Card[1]; string cardname = _Controller.Owner.CardData[SerialNo][4]; CardName = cardname; int pos = cardname.IndexOf(" "); if (cardname.Contains(",")) { pos = cardname.IndexOf(","); UnitTitle = cardname.Substring(pos + 2); UnitName = cardname.Substring(0, pos); } else { pos = cardname.IndexOf(" "); UnitTitle = cardname.Substring(0, pos); UnitName = cardname.Substring(pos + 1); } Power = _Controller.Owner.CardData[SerialNo][13]; Support = _Controller.Owner.CardData[SerialNo][14]; IsHorizontal = Convert.ToBoolean(Card[6]); FrontShown = Convert.ToBoolean(Card[7]); Visible = Convert.ToBoolean(Card[8]); List<string> temp = new List<string>(); if (Card[9] != "()") { temp.AddRange(Card[9].Replace("(", "").Replace(")", "").Split(new string[] { ";" }, StringSplitOptions.None)); while (temp.Contains("")) { temp.Remove(""); } OverlayCardNo = temp.ConvertAll<Int32>(Convert.ToInt32); } else { OverlayCardNo = new List<int>(); } SolCounter = Convert.ToInt32(Card[10]); LunaCounter = Convert.ToInt32(Card[11]); }
public SelectHero(User _Player, FECipherVit _Owner) { InitializeComponent(); Player = _Player; Owner = _Owner; }
public Region(string RegionAsString, User _Controller) { Controller = _Controller; List<string> temp = new List<string>(); temp.AddRange(RegionAsString.Replace("{", "").Replace("}", "").Split(new string[] { "],[" }, StringSplitOptions.RemoveEmptyEntries)); CardList = new List<Card>(); foreach (string cardtemp in temp) { CardList.Add(new Card(cardtemp, Controller)); } }
public Region(User _Controller) { CardList = new List<Card>(); Controller = _Controller; }
private string GetTextFromUser(User user) { string text = ""; text += "卡组:" + user.Deck.CardList.Count.ToString() + Environment.NewLine; foreach (Card card in user.Deck.CardList) { text += "[" + (user.Deck.CardList.IndexOf(card) + 1).ToString() + "]" + card.CardName + Environment.NewLine; } text += Environment.NewLine; text += "手牌:" + user.Hand.CardList.Count.ToString() + Environment.NewLine; foreach (Card card in user.Hand.CardList) { text += "[" + (user.Hand.CardList.IndexOf(card) + 1).ToString() + "]" + card.CardName + Environment.NewLine; } text += Environment.NewLine; text += "退避区:" + user.Grave.CardList.Count.ToString() + Environment.NewLine; foreach (Card card in user.Grave.CardList) { text += "[" + (user.Grave.CardList.IndexOf(card) + 1).ToString() + "]" + card.CardName + Environment.NewLine; } text += Environment.NewLine; text += "支援区:"; if (user.Support.CardList.Count == 0) { text += "无" + Environment.NewLine; } else { Card card = user.Support.CardList[0]; text += card.CardName + Environment.NewLine; } text += Environment.NewLine; text += "羁绊区:" + (user.Kizuna.CardList.Count + user.KizunaUsed.CardList.Count).ToString() + Environment.NewLine; foreach (Card card in user.Kizuna.CardList) { text += "[" + (user.Kizuna.CardList.IndexOf(card) + 1).ToString() + "]" + card.CardName; if (!card.FrontShown) { text += "(已翻面)"; } text += Environment.NewLine; } foreach (Card card in user.KizunaUsed.CardList) { text += "[" + (user.KizunaUsed.CardList.IndexOf(card) + 1).ToString() + "]" + card.CardName; if (!card.FrontShown) { text += "(已翻面)"; } text += Environment.NewLine; } text += Environment.NewLine; text += "宝玉区:" + user.Orb.CardList.Count.ToString() + Environment.NewLine; foreach (Card card in user.Orb.CardList) { text += "[" + (user.Orb.CardList.IndexOf(card) + 1).ToString() + "]" + card.CardName + Environment.NewLine; } text += Environment.NewLine; text += "前卫区:" + user.FrontField.CardList.Count.ToString() + Environment.NewLine; foreach (Card card in user.FrontField.CardList) { text += card.CardName; if (card.IsHorizontal) { text += "(已行动)"; } text += Environment.NewLine; } text += Environment.NewLine; text += "后卫区:" + user.BackField.CardList.Count.ToString() + Environment.NewLine; foreach (Card card in user.BackField.CardList) { text += card.CardName; if (card.IsHorizontal) { text += "(已行动)"; } text += Environment.NewLine; } return text; }
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; }
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", "#导入场面信息。"); } } }
void Reset() { if (DeckFilename != "") { string[] DeckContents = File.ReadAllLines(DeckFilename); int CardNum = 0; Player = new User(); foreach (string CardSerialNo in DeckContents) { if (CardSerialNo != "") { string[] CardDataInfo = CardData[Convert.ToInt32(CardSerialNo)]; Player.Deck.CardList.Add(new Card(CardNum, Convert.ToInt32(CardSerialNo), CardDataInfo[4], Convert.ToInt32(CardDataInfo[13]), Convert.ToInt32(CardDataInfo[14]), Player)); CardNum++; } } buttonGameOn.Visible = true; buttonTurnStart.Visible = false; buttonTurnEnd.Visible = false; buttonUseKizuna.Visible = false; buttonSupport.Visible = false; button_CriticalAttack.Visible = false; button_Miss.Visible = false; buttonGameOn.Enabled = true; 游戏开始ToolStripMenuItem.Enabled = true; label_RivalHandLabel.Visible = false; label_RivalHandTotal.Visible = false; 动作ToolStripMenuItem.Enabled = false; 导出场面信息ToolStripMenuItem.Enabled = false; GameOn = false; try { pictureBoxCardInfo.Image = Image.FromFile(@"img/back.jpg"); } catch { pictureBoxCardInfo.Image = pictureBoxCardInfo.ErrorImage; } textBoxCardInfo.Text = ""; } Renew(); }
private void FECipherVit_Load(object sender, EventArgs e) { File.Delete("decktemp"); Player = new User(); Rival = new User(); msgProcessor = new MsgProcessor(this); string[] CardDataTemp = File.ReadAllLines("CardData.fe0db", Encoding.UTF8); CardData = new List<string[]>(); foreach (string carddatumtemp in CardDataTemp) { string[] temp = carddatumtemp.Split(new char[] { ',' }, StringSplitOptions.None); CardData.Add(temp); } CardData.Sort(delegate (string[] x, string[] y) { return Convert.ToInt32(x[0]) - Convert.ToInt32(y[0]); }); try { pictureBoxCardInfo.Image = Image.FromFile(@"img/back.jpg"); } catch { pictureBoxCardInfo.Image = pictureBoxCardInfo.ErrorImage; } ConnectionRenew(); connection = new Connection(this); connection.ShowDialog(); ContextMenuStripRenew(); UpdateThread = new Thread(new ThreadStart(CheckUpdate)); UpdateThread.Start(); }
private void FECipherVit_Load(object sender, EventArgs e) { if (SpeVer.Contains("Compi")) { DisablePlaying(); } if (SpeVer.Contains("Judge")) { 开启裁判功能ToolStripMenuItem.Visible = true; } File.Delete("decktemp"); Player = new User(this); Rival = new User(this); msgProcessor = new MsgProcessor(this); report = res.GetString("report_string1", Thread.CurrentThread.CurrentUICulture) + DateTime.Now.ToString(); try { string[] CardDataTemp; if (Language == Language.Chinese) { CardDataTemp = File.ReadAllLines("CardData.fe0db", Encoding.UTF8); } else { CardDataTemp = File.ReadAllLines("CardData_En.fe0db", Encoding.UTF8); } CardData = new Dictionary<string, string[]>(); foreach (string carddatumtemp in CardDataTemp) { if (carddatumtemp.Contains("USO")) { continue; } string[] temp = carddatumtemp.Split(new char[] { ',' }, StringSplitOptions.None); if (Language == Language.English && temp.Length >= 19) { temp[4] = temp[4].Replace("%%", ","); temp[16] = temp[16].Replace("%%", ","); temp[17] = temp[17].Replace("%%", ","); } CardData.Add(temp[0], temp); if (temp.Length >= 19 && temp[18] == "2") { string[] temp2 = (string[])temp.Clone(); temp2[0] += "+"; temp2[2] += "+"; CardData.Add(temp2[0], temp2); } } DatabaseVer = int.Parse(CardData["0"][2]); try { pictureBoxCardInfo.Image = Image.FromFile(@"img/back.jpg"); } catch { pictureBoxCardInfo.Image = pictureBoxCardInfo.ErrorImage; } } catch { MessageBox.Show(res.GetString("LoadCardData_string1", Thread.CurrentThread.CurrentUICulture), res.GetString("LoadCardData_caption", Thread.CurrentThread.CurrentUICulture)); Application.Exit(); } if (Language == Language.Chinese) { UpdateGetMsgTextBox("欢迎使用FECipherVit。\r\n程序版本号:" + Version.ToString() + " " + SpeVer + "\r\n数据库版本号:" + DatabaseVer.ToString()); } else { UpdateGetMsgTextBox("Welcome to FECipherVit.\r\nVersion: " + Version.ToString() + " " + SpeVer + "\r\nDatabase version: " + DatabaseVer.ToString()); } ConnectionRenew(); connection = new Connection(this); connection.ShowDialog(); historychecker = new HistoryChecker(this); ContextMenuStripRenew(); CreateThumbnailsThread = new Thread(new ThreadStart(CheckCardImgs)); CreateThumbnailsThread.Start(); }
public void AddHistory(string UserName, string Time, string ActionType, User User) { listBox.Items.Add(UserName + " " + Time + " " + "\"" + ActionType + "\""); Historys.Add(User); }
public void UnSetWatchingMode() { WatchingMode = false; MyAccessCharacter = AccessCharater.Host; buttonGameOn.Visible = true; buttonGameOn.Enabled = false; 载入卡组ToolStripMenuItem.Enabled = true; 重置ToolStripMenuItem.Enabled = true; 其他ToolStripMenuItem1.Enabled = true; 请求猜拳ToolStripMenuItem.Enabled = true; 导出场面信息ToolStripMenuItem.Enabled = true; 导入场面信息ToolStripMenuItem.Enabled = true; contextMenuStrip_HandRegion.Enabled = true; Player = new User(this); Rival = new User(this); PlayerName = connection.textBox_UserName.Text; RivalName = ""; WatcherName = ""; Renew(); RivalRenew(); }