private void DeckUI_Load(object sender, EventArgs e) { // Initialize the directory for deck files if (!Directory.Exists("deckfiles")) { Directory.CreateDirectory("deckfiles"); } if (!File.Exists("deckfiles/SwarmDeck.deck")) { File.WriteAllBytes("deckfiles/SwarmDeck.deck", DeckChoiceUI.SWARM_DECK); } if (!File.Exists("deckfiles/ComboDeck.deck")) { File.WriteAllBytes("deckfiles/ComboDeck.deck", DeckChoiceUI.COMBO_DECK); } FormBorderStyle = FormBorderStyle.FixedSingle; Height = 700; Width = 1000; Builder = new DeckBox() { Location = new Point(0, 0), Width = Width, Height = Height, }; Builder.InitUI(); Controls.Add(Builder); // WinForms dimensions aren't accurate, so this helps Height += 39; Width += 16; }
public CardBuilderBox(DeckBox form) { Form = form; Size = new Size(GameBox.CARD_WIDTH, GameBox.CARD_HEIGHT); BackgroundImage = Properties.Resources.CardBody; CardArt = new PictureBox() { Size = new Size(74, 74), Location = new Point(13, 13), }; CardName = new Label() { Location = new Point(5, 13 + 74 + 13), Size = new Size(90, 25), TextAlign = ContentAlignment.MiddleCenter, BackColor = CARD_COLOR, ForeColor = Color.White, Font = GameBox.CFont.GetFont(12), }; CardInfo = new TextBox() { TextAlign = HorizontalAlignment.Center, Multiline = true, ReadOnly = true, Location = new Point(5, 13 + 74 + 13 + 25 + 7), Size = new Size(90, 65), BackColor = CARD_COLOR, BorderStyle = BorderStyle.None, ForeColor = Color.White, Cursor = Cursors.Arrow, Font = GameBox.CFont.GetFont(9), }; CardCost = new Label() { Size = new Size(22, 22), Top = GameBox.CARD_HEIGHT - 22 - 4, Left = 4, Font = GameBox.CFont.GetFont(12), ForeColor = Color.White, TextAlign = ContentAlignment.MiddleCenter, Image = Properties.Resources.ManaBox, }; CardAttack = new Label() { Size = new Size(22, 22), Top = GameBox.CARD_HEIGHT - 22 - 4, Left = GameBox.CARD_WIDTH - 4 - 22 - 22, Font = GameBox.CFont.GetFont(12), ForeColor = Color.White, TextAlign = ContentAlignment.MiddleCenter, Image = Properties.Resources.AttackBox, }; CardHealth = new Label() { Size = new Size(22, 22), Top = GameBox.CARD_HEIGHT - 22 - 4, Left = GameBox.CARD_WIDTH - 4 - 22, Font = GameBox.CFont.GetFont(12), ForeColor = Color.White, TextAlign = ContentAlignment.MiddleCenter, Image = Properties.Resources.HealthBox, }; Controls.Add(CardArt); Controls.Add(CardInfo); Controls.Add(CardName); Controls.Add(CardCost); CardCost.BringToFront(); Controls.Add(CardHealth); CardHealth.BringToFront(); Controls.Add(CardAttack); CardAttack.BringToFront(); foreach (Control c in Controls) { c.Click += (_s, _e) => { CardClicked(this); } } ; this.Click += (_s, _e) => { CardClicked(this); }; }