Exemplo n.º 1
0
        public void updateStatistic()
        {
            labelUsedTrifon.Text = sentence.used_tresome.Count.ToString();
            double d = sentence.power;

            if (d >= 60)
            {
                labelPower.ForeColor = Color.Goldenrod;
            }
            else if (d >= 80)
            {
                labelPower.ForeColor = Color.ForestGreen;
            }
            else
            {
                labelPower.ForeColor = Color.DarkRed;
            }
            labelPower.Text = d.ToString();
            int god = 0;
            int leg = 0;
            int epi = 0;
            int rar = 0;
            int unc = 0;
            int com = 0;

            foreach (string s in sentence.used_tresome)
            {
                if (Rarity.IsInRarirty(true, false, false, false, false, false, dane.treesome[s].words.Count))
                {
                    god += 1;
                }
                else if (Rarity.IsInRarirty(false, true, false, false, false, false, dane.treesome[s].words.Count))
                {
                    leg += 1;
                }
                else if (Rarity.IsInRarirty(false, false, true, false, false, false, dane.treesome[s].words.Count))
                {
                    epi += 1;
                }
                else if (Rarity.IsInRarirty(false, false, false, true, false, false, dane.treesome[s].words.Count))
                {
                    rar += 1;
                }
                else if (Rarity.IsInRarirty(false, false, false, false, true, false, dane.treesome[s].words.Count))
                {
                    unc += 1;
                }
                else if (Rarity.IsInRarirty(false, false, false, false, false, true, dane.treesome[s].words.Count))
                {
                    com += 1;
                }
            }
            labelLegendary.Text = leg.ToString();
            labelGodlike.Text   = god.ToString();
            labelEpic.Text      = epi.ToString();
            labelRare.Text      = rar.ToString();
            labelUncommon.Text  = unc.ToString();
            labelCommon.Text    = com.ToString();
        }
Exemplo n.º 2
0
        public void MadeView()
        {
            double liczba = sentece.CalculatePower();

            labelPower.Text = liczba.ToString();
            if (liczba >= 80)
            {
                labelPower.ForeColor = Color.ForestGreen;
            }
            else if (liczba >= 60)
            {
                labelPower.ForeColor = Color.Goldenrod;
            }
            else
            {
                labelPower.ForeColor = Color.DarkRed;
            }
            int god = 0;
            int leg = 0;

            foreach (string s in sentece.used_tresome)
            {
                if (Rarity.IsInRarirty(true, false, false, false, false, false, dane.treesome[s].words.Count))
                {
                    god += 1;
                }
                else if (Rarity.IsInRarirty(false, true, false, false, false, false, dane.treesome[s].words.Count))
                {
                    leg += 1;
                }
            }
            labelLegendary.Text = leg.ToString();
            labelGodlike.Text   = god.ToString();

            textContent.Text = sentece.showedText;
            labelNr.Text     = sentece.nr_line.ToString();
        }
Exemplo n.º 3
0
        public double CalculatePower()
        {
            double pow = 0;

            foreach (string s in word.TresomesKeys)
            {
                if (dane.UnUsedtreesome.ContainsKey(s))
                {
                    if (Rarity.IsInRarirty(true, false, false, false, false, false, dane.treesome[s].words.Count))
                    {
                        pow += 6;
                    }
                    else if (Rarity.IsInRarirty(false, true, false, false, false, false, dane.treesome[s].words.Count))
                    {
                        pow += 3;
                    }
                    else if (Rarity.IsInRarirty(false, false, true, false, false, false, dane.treesome[s].words.Count))
                    {
                        pow += 2;
                    }
                    else if (Rarity.IsInRarirty(false, false, false, true, false, false, dane.treesome[s].words.Count))
                    {
                        pow += 1.5;
                    }
                    else if (Rarity.IsInRarirty(false, false, false, false, true, false, dane.treesome[s].words.Count))
                    {
                        pow += 1;
                    }
                    else if (Rarity.IsInRarirty(false, false, false, false, false, true, dane.treesome[s].words.Count))
                    {
                        pow += 1;
                    }
                }
            }
            return(pow);
        }
Exemplo n.º 4
0
        public void Search()
        {
            if (textLiczbaSlow.Text == String.Empty || textLiczbaSlow.Text == null)
            {
                liczbaWyswietlanychSlow = 100;
            }
            else
            {
                liczbaWyswietlanychSlow = Convert.ToInt32(textLiczbaSlow.Text);
            }
            //Szukanie czesci słowa
            if (textContent.Text != null && textContent.Text != String.Empty)
            {
                List <Lex.Word> wor = new List <Lex.Word>();
                wor = dane.words.Values.Where(w => w.Content.Contains(textContent.Text)).ToList();
                for (int i = 0; i < wor.Count; i++)
                {
                    Lex.Word w = wor[i];
                    words.Add(w);
                    panelSlow.Controls.Add(new WordSmall(dane, w, this, panelSlow));
                    if (i > liczbaWyswietlanychSlow)
                    {
                        break;
                    }
                }
                return;
            }
            //Szukanie dokładnego słowa
            if (textDokladne.Text != null && textDokladne.Text != String.Empty)
            {
                if (dane.words.ContainsKey(textDokladne.Text))
                {
                    panelSlow.Controls.Add(new WordSmall(dane, dane.words[textDokladne.Text], this, panelSlow));
                }
                return;
            }

            Random rnd = new Random();

            //Sprawdzanie czy rzadkosc zaznaczona
            if (checkGodlike.Checked == false && checkLegendary.Checked == false && checkEpic.Checked == false &&
                checkRare.Checked == false && checkCommon.Checked == false && checkUncommon.Checked == false)
            {
                checkGodlike.Checked = true; checkLegendary.Checked = true; checkEpic.Checked = true;
                checkRare.Checked    = true; checkCommon.Checked = true; checkUncommon.Checked = true;
            }
            //Sprawdzanie czy wartosc minimalna zaznaczona
            if (textMin.Text == null || textMin.Text == String.Empty)
            {
                textMin.Text = "0";
            }
            if (textMax.Text == null || textMax.Text == String.Empty)
            {
                textMax.Text = "100";
            }
            //Tworzenie listy z ktorej losowane sa słowa
            List <Lex.Word> temp;

            if (checkUsedTreefone.Checked == true)
            {
                temp = dane.treesome.Values.Where(t => Rarity.IsInRarirty(
                                                      checkGodlike.Checked,
                                                      checkLegendary.Checked,
                                                      checkEpic.Checked,
                                                      checkRare.Checked,
                                                      checkUncommon.Checked,
                                                      checkCommon.Checked, t.words.Count)).SelectMany(t => t.words).ToList();
            }
            else
            {
                temp = dane.UnUsedtreesome.Values.Where(t => Rarity.IsInRarirty(
                                                            checkGodlike.Checked,
                                                            checkLegendary.Checked,
                                                            checkEpic.Checked,
                                                            checkRare.Checked,
                                                            checkUncommon.Checked,
                                                            checkCommon.Checked, t.words.Count)).SelectMany(t => t.words).ToList();
            }

            //Sprawdzanie poprawności max i min wartości
            if ((textMin.Text == null || textMin.Text == String.Empty) && (textMax.Text == null || textMax.Text == String.Empty))
            {
            }
            else
            {
                int min = Convert.ToInt32(textMin.Text);
                int max = Convert.ToInt32(textMax.Text);
                if (min > max)
                {
                    int ii = min;
                    min = max;
                    max = ii;
                }
                temp = temp.Where(w => w.Content.Length >= min && w.Content.Length <= max).ToList();
            }
            //Dodawanie losowych słow
            temp.Shuffle();
            if (temp.Count <= 0)
            {
                panelSlow.Controls.Add(new Label
                {
                    Text      = "Nie znaleziono wyników",
                    BackColor = Color.DarkRed
                });
                return;
            }
            for (int i = 0; i < temp.Count(); i++)
            {
                if (temp.Count > 0)
                {
                    Lex.Word w = temp[i];
                    words.Add(w);
                    panelSlow.Controls.Add(new WordSmall(dane, w, this, panelSlow));
                }
                if (i >= liczbaWyswietlanychSlow)
                {
                    break;
                }
            }
        }