public MaterialSmallCard AgregarOpcion(string name, Image icon, MouseEventHandler handler) { MaterialSmallCard card = AgregarOpcion(name, icon); card.MouseClick += handler; return(card); }
private void GameCard_Click(object sender, EventArgs e) { MaterialSmallCard sm = (MaterialSmallCard)sender; Card c = (Card)sm.Tag; if (c != null) { if (me.MP < c.Cost) { return; } meCard.Tag = c; meCard.Text = c.Name; meCard.Info = "Cost: " + c.Cost.ToString(); meCard.Show(); me.MP -= c.Cost; c.Action(me, opp); if (me == null) { return; } me.ActiveCard.Remove(c); opp.MP -= 1; me.FillActiveCard(); updateCard(); RefreshMeEffects(); RefreshOppEffects(); Me_OnValueChange(me); Opp_OnValueChange(opp); meCard.AutoExpand = false; timerMeRecentCard.Start(); } }
private void Me_OnValueChange(Player sender) { if (me == null) { return; } meHP.Maximum = me.MaxHP; meHP.Minimum = 0; meHP.Value = me.HP; lblMeHP.Text = me.HP.ToString() + "/" + me.MaxHP.ToString(); meMP.Maximum = me.MaxMP; meMP.Minimum = 0; meMP.Value = me.MP; lblMeMP.Text = me.MP.ToString() + "/" + me.MaxMP.ToString(); for (int i = 1; i < 5; i++) { MaterialSmallCard sm = panelBattle.Controls["card" + i.ToString()] as MaterialSmallCard; if (sm != null) { Card c = sm.Tag as Card; if (c != null) { if (me.MP >= c.Cost) { sm.Image = MathsBattle.Properties.Resources.lightCard; } else { sm.Image = MathsBattle.Properties.Resources.darkCard; } } } } }
public MaterialSmallCard AgregarOpcion(string name, Image icon) { MaterialSmallCard card = DefaultCard(); card.Text = name; card.Image = icon; panel1.Controls.Add(card); return(card); }
private void GameCard_MouseEnter(object sender, EventArgs e) { MaterialSmallCard sm = (MaterialSmallCard)sender; Card c = (Card)sm.Tag; if (c != null) { lblCardInfo.Text = c.Info; panelCardInfo.Show(); } }
private void updateCard() { for (int i = 0; i < me.ActiveCard.Count; i++) { MaterialSmallCard sm = panelBattle.Controls["card" + (i + 1).ToString()] as MaterialSmallCard; if (sm != null) { sm.Text = me.ActiveCard[i].Name; sm.Info = "Cost: " + me.ActiveCard[i].Cost.ToString(); sm.Tag = me.ActiveCard[i]; } } }