Beispiel #1
0
 public static Carta ComparaMaior(Carta crdA, Carta crdB)
 {
     return (crdA.Valor > crdB.Valor ? crdA : crdB);
 }
Beispiel #2
0
        //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();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
 private void HandB_DoubleClick(object sender, EventArgs e)
 {
     _crdNova = _crdHandB;
     _deck.Add(_crdHandB);
     lstNaipe.SelectedItem = _crdHandB.Nipe;
     lstValor.SelectedItem = _crdHandB.Valor;
     panel1.Enabled = true;
 }
Beispiel #5
0
 private void crd5_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     _crdNova = _crd5;
     _deck.Add(_crd5);
     lstNaipe.SelectedItem = _crdHandA.Nipe;
     lstValor.SelectedItem = _crdHandA.Valor;
     panel1.Enabled = true;
 }
Beispiel #6
0
        //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();
            }
        }