private void Button_Confirm_Click(object sender, EventArgs e)
{
int x;
if (Owner.Language == Language.Chinese)
{
switch (Type)
{
case "抽复数张卡":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Deck.CardList.Count)
{
Owner.Player.Draw(x);
Owner.msgProcessor.Send("MultipleDraw", "#抽" + x.ToString() + "张卡。");
Owner.Renew();
Close();
}
else if (x > Owner.Player.Deck.CardList.Count)
{
MessageBox.Show("卡组不足。", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("请正确输入要抽卡的数量。", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("请正确输入要抽卡的数量。", Text);
textBox.Text = "";
}
break;
case "复数羁绊卡右移":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Kizuna.CardList.Count)
{
for (int i = 0; i < x; i++)
{
Owner.Player.MoveCard(Owner.Player.Kizuna.CardList.Last(), Owner.Player.KizunaUsed);
}
Owner.msgProcessor.Send("MultipleDraw", "#右移" + x.ToString() + "张羁绊卡。");
Owner.Renew();
Close();
}
else if (x > Owner.Player.Kizuna.CardList.Count)
{
MessageBox.Show("羁绊卡不足。", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("请正确输入要移动的数量。", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("请正确输入要移动的数量。", Text);
textBox.Text = "";
}
break;
case "将复数张顶牌置于退避区":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Deck.CardList.Count)
{
string temp = "#将卡组顶端的" + x.ToString() + "张牌置于退避区:";
for (int i = 0; i < x; i++)
{
temp += Environment.NewLine + "[" + Owner.Player.Deck.CardList[0].CardName + "]";
Owner.Player.MoveCard(Owner.Player.Deck, 0, Owner.Player.Grave);
}
Owner.msgProcessor.Send("MoveDeckTopCardsToGrave", temp);
Owner.Renew();
Close();
}
else if (x > Owner.Player.Deck.CardList.Count)
{
MessageBox.Show("卡组不足。", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("请正确输入要置于退避区的顶牌数量。", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("请正确输入要置于退避区的顶牌数量。", Text);
textBox.Text = "";
}
break;
case "查看复数张顶牌":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Deck.CardList.Count)
{
string temp = "#查看卡组顶端的" + x.ToString() + "张卡。";
Region tempRegion_CheckDeckTopCards = new Region(Owner.Player);
Owner.Player.AllRegions.Add(tempRegion_CheckDeckTopCards);
for (int i = 0; i < x; i++)
{
Card card = Owner.Player.Deck.CardList[0];
card.RemoveFromAny();
tempRegion_CheckDeckTopCards.CardList.Add(card);
}
Owner.msgProcessor.Send("CheckDeckTopCards", temp);
Hide();
Owner.Activate();
using (CardSetView CheckDeckTopCards = new CardSetView(tempRegion_CheckDeckTopCards, "CheckDeckTopCards", Owner.Player, Owner))
{
CheckDeckTopCards.Location = new Point(0, 0);
CheckDeckTopCards.StartPosition = FormStartPosition.CenterParent;
CheckDeckTopCards.ShowDialog();
}
Owner.Renew();
Close();
}
else if (x > Owner.Player.Deck.CardList.Count)
{
MessageBox.Show("卡组不足。", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("请正确输入要查看的顶牌数量。", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("请正确输入要查看的顶牌数量。", Text);
textBox.Text = "";
}
break;
}
}
else
{
switch (Type)
{
case "抽复数张卡":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Deck.CardList.Count)
{
Owner.Player.Draw(x);
Owner.msgProcessor.Send("MultipleDraw", "#Draw " + x.ToString() + " cards.");
Owner.Renew();
Close();
}
else if (x > Owner.Player.Deck.CardList.Count)
{
MessageBox.Show("There are no enough cards in Deck.", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
break;
case "复数羁绊卡右移":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Kizuna.CardList.Count)
{
for (int i = 0; i < x; i++)
{
Owner.Player.MoveCard(Owner.Player.Kizuna.CardList.Last(), Owner.Player.KizunaUsed);
}
Owner.msgProcessor.Send("MultipleDraw", "#Count " + x.ToString() + " Bond cards.");
Owner.Renew();
Close();
}
else if (x > Owner.Player.Kizuna.CardList.Count)
{
MessageBox.Show("There are no enough Bond cards.", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
break;
case "将复数张顶牌置于退避区":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Deck.CardList.Count)
{
string temp = "#Send " + x.ToString() + " cards from the top of Deck to Retreat:";
for (int i = 0; i < x; i++)
{
temp += Environment.NewLine + "[" + Owner.Player.Deck.CardList[0].CardName + "]";
Owner.Player.MoveCard(Owner.Player.Deck, 0, Owner.Player.Grave);
}
Owner.msgProcessor.Send("MoveDeckTopCardsToGrave", temp);
Owner.Renew();
Close();
}
else if (x > Owner.Player.Deck.CardList.Count)
{
MessageBox.Show("There are no enough cards in Deck.", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
break;
case "查看复数张顶牌":
if (Int32.TryParse(textBox.Text, out x))
{
if (x > 0 && x <= Owner.Player.Deck.CardList.Count)
{
string temp = "#Check " + x.ToString() + " cards on the top of Deck.";
Region tempRegion_CheckDeckTopCards = new Region(Owner.Player);
Owner.Player.AllRegions.Add(tempRegion_CheckDeckTopCards);
for (int i = 0; i < x; i++)
{
Card card = Owner.Player.Deck.CardList[0];
card.RemoveFromAny();
tempRegion_CheckDeckTopCards.CardList.Add(card);
}
Owner.msgProcessor.Send("CheckDeckTopCards", temp);
Hide();
Owner.Activate();
using (CardSetView CheckDeckTopCards = new CardSetView(tempRegion_CheckDeckTopCards, "CheckDeckTopCards", Owner.Player, Owner))
{
CheckDeckTopCards.Location = new Point(0, 0);
CheckDeckTopCards.StartPosition = FormStartPosition.CenterParent;
CheckDeckTopCards.ShowDialog();
}
Owner.Renew();
Close();
}
else if (x > Owner.Player.Deck.CardList.Count)
{
MessageBox.Show("There are no enough cards in Deck.", Text);
textBox.Text = "";
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
}
else
{
MessageBox.Show("Pleaser enter a correct number.", Text);
textBox.Text = "";
}
break;
}
}
}