public void SetTransparency(object sender, EventArgs e) { CCheckBox cb = (CCheckBox)sender; if (cb.Checked) { cb.BackColor = Color.Transparent; cb.BackgroundImage = FormUtilities.SetImageOpacity(CardImage, Percentage, 0.5F); } else { cb.BackgroundImage = FormUtilities.SetImageOpacity(CardImage, Percentage, 1F); } }
public GameForm() { InitializeComponent(); Game = new CGame(3, 5000, tbLog, true); Utilities = new FormUtilities(this, Game, Game.Players[0], MainLayout, tHand) { LTurns = lTurns, TBState = tbGame, BDiscards = bDiscard, }; //this.bDiscard.Click += new System.EventHandler(Utilities.CardClicked); this.bDiscard.Click += new System.EventHandler(Utilities.bDiscard_Click); Utilities.UpdateGUI(); }
private void UpdateUserHand() { UserHandCards.Clear(); foreach (var p in Game.Players) { if (p.AI != ArtificialIntelligence.AICategory.Human) { break; } int i; Panel pc; for (i = 0; i < p.Hand.Count; i++) { Card c = p.Hand[i]; pc = UserHandPanels[i]; var cb = FormUtilities.CreateButtonCheckBoxCard(c, 0.4, p.ID, i, true); //cb.Click += CardClicked; cb.Click += CardClicked2; UserHandCards.Add(cb); pc.Controls.Clear(); pc.Controls.Add(cb); } while (i < Game.Settings.NumberCardInHand) { pc = UserHandPanels[i]; pc.Controls.Clear(); i++; } } if (Game.IsMyTurn(Me.ID)) { ChangeUserButtons(true); } else { ChangeUserButtons(false); } }
private void UpdatePlayerPanel(int id) { Player p = Game.Players[id]; Panel pItem; int i = 0; for (i = 0; i < p.Body.Items.Count; i++) { pItem = GetBodyItemPanel(id, i); pItem.Controls.Clear(); BodyItem item = p.Body.Items[i]; CCheckBox cb = FormUtilities.CreateButtonCheckBoxCard(item.Organ, 0.4, id, i, false); //cb.Click += CardClicked; cb.Click += CardClicked2; pItem.Controls.Add(cb); for (int j = 0; j < item.Modifiers.Count; j++) { cb = FormUtilities.CreateButtonCheckBoxCard(item.Modifiers[j], 0.25, id, i, false); //cb.Click += CardClicked; cb.Click += CardClicked2; pItem.Controls.Add(cb); } } while (i < Game.Settings.NumberToWin) { pItem = GetBodyItemPanel(id, i); pItem.Controls.Clear(); i++; } }