private void Principal_Load(object sender, EventArgs e) { foreach (Base.Nipes nipe in Enum.GetValues(typeof(Base.Nipes)).Cast<Base.Nipes>().ToList()) { foreach (Base.Valor valor in Enum.GetValues(typeof(Base.Valor)).Cast<Base.Valor>().ToList()) { _deck.Add(new Carta(nipe, valor)); } } LoadNovasCartas(); _rndCard = _rndSeed.Next(0, _deck.Count); _crdHandA = _deck[_rndCard]; _deck.RemoveAt(_rndCard); _rndCard = _rndSeed.Next(0, _deck.Count); _crdHandB = _deck[_rndCard]; _deck.RemoveAt(_rndCard); HandA.Text = _crdHandA.ToString(); HandB.Text = _crdHandB.ToString(); }
//Nova Mão private void btnNovaMao_Click(object sender, EventArgs e) { crd1.Clear(); crd2.Clear(); crd3.Clear(); crd4.Clear(); crd5.Clear(); _crd1 = null; _crd2 = null; _crd3 = null; _crd4 = null; _crd5 = null; _MyHand.Clear(); _deck.Clear(); foreach (Base.Nipes nipe in Enum.GetValues(typeof(Base.Nipes)).Cast<Base.Nipes>().ToList()) { foreach (Base.Valor valor in Enum.GetValues(typeof(Base.Valor)).Cast<Base.Valor>().ToList()) { _deck.Add(new Carta(nipe, valor)); } } _rndCard = _rndSeed.Next(0, _deck.Count); _crdHandA = _deck[_rndCard]; _deck.RemoveAt(_rndCard); _rndCard = _rndSeed.Next(0, _deck.Count); _crdHandB = _deck[_rndCard]; _deck.RemoveAt(_rndCard); HandA.Text = _crdHandA.ToString(); HandB.Text = _crdHandB.ToString(); }
//ADD Randomico private void button1_Click(object sender, EventArgs e) { if (_crd1 == null) { _rndCard = _rndSeed.Next(0, _deck.Count); _crd1 = _deck[_rndCard]; _deck.RemoveAt(_rndCard); crd1.Text = _crd1.ToString(); _rndCard = _rndSeed.Next(0, _deck.Count); _crd2 = _deck[_rndCard]; _deck.RemoveAt(_rndCard); crd2.Text = _crd2.ToString(); _rndCard = _rndSeed.Next(0, _deck.Count); _crd3 = _deck[_rndCard]; _deck.RemoveAt(_rndCard); crd3.Text = _crd3.ToString(); } else if (_crd4 == null) { _rndCard = _rndSeed.Next(0, _deck.Count); _crd4 = _deck[_rndCard]; _deck.RemoveAt(_rndCard); crd4.Text = _crd4.ToString(); } else if (_crd5 == null) { _rndCard = _rndSeed.Next(0, _deck.Count); _crd5 = _deck[_rndCard]; _deck.RemoveAt(_rndCard); crd5.Text = _crd5.ToString(); } }