//todo Überprüfen,ob noch Karten da sind

        private void VergleicheKarte(DeckStructure.CardProperties eigenschaft)
        {
            //todo Karte vom Gegner bekommen
            DeckStructure.QuartettCard   karteDesGegners    = GetKarteFromOpponent();
            DeckStructure.CardProperties propertyDesGegners = new DeckStructure.CardProperties();
            if (karteDesGegners.cardProperties is null)
            {
                return;
            }
            foreach (DeckStructure.CardProperties tmpProperties in karteDesGegners.cardProperties)
            {
                if (tmpProperties.propertyName == eigenschaft.propertyName)
                {
                    propertyDesGegners = tmpProperties;
                }
            }

            //Vergleichen
            if (eigenschaft.greaterIsBetter)
            {
                if (eigenschaft.propertyValue > propertyDesGegners.propertyValue)
                {
                    //Ich bekomme die Karte
                    RemoveKarteFromOpponent(karteDesGegners);
                }
                else if (eigenschaft.propertyValue < propertyDesGegners.propertyValue)
                {
                    //Der Gegner bekommt die Karte
                    RemoveKarteFromMe();
                }
                else
                {
                    AddKarteToRest(karteDesGegners);
                }
            }
            else
            {
                if (eigenschaft.propertyValue > propertyDesGegners.propertyValue)
                {
                    //Der Gegner bekommt die Karte
                    RemoveKarteFromMe();
                }
                else if (eigenschaft.propertyValue < propertyDesGegners.propertyValue)
                {
                    //Ich bekomme die Karte
                    RemoveKarteFromOpponent(karteDesGegners);
                }
                else
                {
                    AddKarteToRest(karteDesGegners);
                }
            }
        }
Exemple #2
0
        //todo Declare Current Quartett
        //Todo Save When all 4 Cards are done
        private Boolean SaveQuartettCard()
        {
            Boolean nResult = true;
            List <DeckStructure.CardProperties> nCardProperties = new List <DeckStructure.CardProperties>();

            DeckStructure.QuartettCard nCard = new DeckStructure.QuartettCard();
            try
            {
                if (textBox_CardName.Text != "")
                {
                    nCard.cardName = textBox_CardName.Text;
                }
                else
                {
                    nResult = false;
                }

                if (pictureBox_Image.ImageLocation != "")
                {
                    nCard.cardImagePath = pictureBox_Image.ImageLocation;
                    //todo Bilder in den Exortpfad kopieren
                    //todo Ordner Generieren, wenn nicht exitstiert
                    //todo da feste Ordnerstruktur, den Pfad nicht aus der XML auslesen
                    if (!Directory.Exists(mDeckPath))
                    {
                        Directory.CreateDirectory(mDeckPath);
                    }

                    string imageExportPath = mDeckPath + @"\" + mDeckName + @"\" + (mQuartetts.Count + 1).ToString() + @"\";
                    if (!Directory.Exists(imageExportPath))
                    {
                        Directory.CreateDirectory(imageExportPath);
                    }

                    //todo Dateiendung bekommen
                    String dateiendung = nCard.cardImagePath.Remove(0, nCard.cardImagePath.LastIndexOf("."));

                    File.Copy(nCard.cardImagePath, imageExportPath + (mQuartettCards.Count + 1).ToString() + dateiendung);
                }

                for (int i = 1; i < mProprtiesAmount + 1; i++)
                {
                    DeckStructure.CardProperties myCardProperties = new DeckStructure.CardProperties();
                    myCardProperties.propertyName         = mPropertyTextBoxList.ElementAt(i - 1).Text;
                    myCardProperties.propertyDisplayValue = mPropertyDisplayValueTextBoxList.ElementAt(i - 1).Text;
                    myCardProperties.propertyValue        = double.Parse(mPropertyValueTextBoxList.ElementAt(i - 1).Text);
                    myCardProperties.greaterIsBetter      = mCheckBoxList.ElementAt(i - 1).Checked;
                    nCardProperties.Add(myCardProperties);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                nResult = false;
            }

            if (nResult)
            {
                nCard.cardProperties = nCardProperties;
                mQuartettCards.Add(nCard);
            }
            return(nResult);
        }