Exemple #1
0
        public void UpdateEquipment(Bohater Player)
        {
            postac         = Player;
            PlayerPB.Image = postac.getBattleImage();

            setTextColor();

            listBox1.Items.Clear();

            int i = 0;

            foreach (Przedmiot item in Player.Ekwipunek)
            {
                listBox1.Items.Add(Player.Ekwipunek.ElementAt(i).getNazwa().ToString() + " - " +
                                   Player.Ekwipunek.ElementAt(i).getIlosc().ToString());
                i++;
            }

            bohaterHP.Text    = Player.GetHP().ToString();
            bohaterMP.Text    = Player.GetMP().ToString();
            bohaterHPMax.Text = Player.GetMaxHP().ToString();
            bohaterMPMax.Text = Player.GetMaxMP().ToString();

            bohaterLevel.Text   = Player.GetLevel().ToString();
            bohaterPunktyD.Text = Player.GetSkillpoints().ToString();

            bohaterZloto.Text = Player.GetGold().ToString();

            bohaterInteligencja.Text = Player.GetIntelligence().ToString();
            bohaterZrecznosc.Text    = Player.GetDexterity().ToString();
            bohaterSila.Text         = Player.GetStrength().ToString();

            bohaterExp.Maximum = Player.GetEXPtoLevel();
            bohaterExp.Value   = Player.GetEXP();

            uzycie.Enabled = false;
            uzycie.Visible = false;

            zdjecie.Enabled = false;
            zdjecie.Visible = false;

            if (postac.getZalozonaZbroja() != null)
            {
                imageList1.Images.Add(postac.getZalozonaZbroja().getArmorImage());

                ListViewItem listViewItem = new ListViewItem();
                listViewItem.ImageIndex = 0;
                EquippedArmor.Items.Add(listViewItem);
            }

            if (postac.getZalozonaBron() != null)
            {
                imageList2.Images.Add(postac.getZalozonaBron().getWeaponImage());

                ListViewItem listViewItem = new ListViewItem();
                listViewItem.ImageIndex = 0;
                EquippedWeapon.Items.Add(listViewItem);
            }
        }
Exemple #2
0
        public void UpdateEquipment(Bohater Player)
        {
            postac = Player;

            listBox1.Items.Clear();

            int i = 0;

            foreach (Przedmiot item in Player.Ekwipunek)
            {
                listBox1.Items.Add(Player.Ekwipunek.ElementAt(i).getNazwa().ToString() + " - " +
                                   Player.Ekwipunek.ElementAt(i).getIlosc().ToString());
                i++;
            }

            bohaterZloto.Text = postac.GetGold().ToString();
        }
Exemple #3
0
        private void button_kupno_Click(object sender, EventArgs e)
        {
            selling = false;

            if (listBox2.SelectedItem != null)
            {
                Przedmiot P = seller.Ekwipunek.ElementAt(listBox2.SelectedIndex) as Przedmiot;
                if (P != null)
                {
                    if (postac.GetGold() >= P.getItemBuyPrice())
                    {
                        seller.DodajGold(P.getItemBuyPrice());
                        postac.DecreaseGold(P.getItemBuyPrice());

                        if (seller.Ekwipunek.ElementAt(listBox2.SelectedIndex).getIlosc() == 1)
                        {
                            seller.Ekwipunek.RemoveAt(listBox2.SelectedIndex);
                        }

                        else
                        {
                            seller.Ekwipunek.ElementAt(listBox2.SelectedIndex).zmniejszIlosc(1);
                        }

                        postac.DodajPrzedmiot(P.getId());

                        infoBox      = new ShopInfoBox();
                        infoBox.Size = new Size(this.Width / 2, this.Height / 3);

                        infoBox.PointToScreen(new Point(this.Width / 2, this.Height / 2));

                        infoBox.checkTradeState(selling, P.getNazwa().ToString());

                        infoBox.Show();
                        infoBox.Focus();

                        UpdateEquipment(postac);
                        UpdateProducts(seller);

                        Sound.PlaySound(Sound.Sound_goldpickup);
                    }
                }
            }



            /*string listbox_nazwa;
             * int indeks;
             *
             * selling = false;
             *
             * for (int i = 0; i < listBox2.Items.Count; i++)
             * {
             *  if (listBox2.GetSelected(i) == true)
             *  {
             *      listbox_nazwa = listBox2.SelectedItem.ToString();
             *
             *      bool czySpacja = false;
             *
             *      for (int k = listbox_nazwa.Length - 1; k >= 0; k--)
             *      {
             *          if (listbox_nazwa[k] == ' ' && czySpacja == true)
             *          {
             *              indeks = listbox_nazwa.Length - k;
             *              listbox_nazwa = listbox_nazwa.Remove(k, indeks);
             *
             *              break;
             *          }
             *          else if (listbox_nazwa[k] == ' ' && czySpacja == false)
             *              czySpacja = true;
             *      }
             *
             *      int j = 0;
             *
             *      foreach (Przedmiot istniejacyPrzedmiot in seller.Ekwipunek)
             *      {
             *          if (istniejacyPrzedmiot.getNazwa().ToString() == listbox_nazwa)
             *          {
             *              if (postac.GetGold() >= istniejacyPrzedmiot.getItemBuyPrice())
             *              {
             *                  seller.DodajGold(istniejacyPrzedmiot.getItemBuyPrice());
             *                  postac.DecreaseGold(istniejacyPrzedmiot.getItemBuyPrice());
             *
             *                  if (seller.Ekwipunek.ElementAt(i).getIlosc() == 1)
             *                      seller.Ekwipunek.RemoveAt(i);
             *                  else
             *                      seller.Ekwipunek.ElementAt(i).zmniejszIlosc(1);
             *
             *                  postac.DodajPrzedmiot(istniejacyPrzedmiot.getId());
             *
             *                  infoBox.Height = this.Height / 3;
             *                  infoBox.Width = this.Width / 2;
             *                  infoBox.PointToScreen(new Point(this.Width / 2, this.Height / 2));
             *
             *                  infoBox.checkTradeState(selling, istniejacyPrzedmiot.getNazwa().ToString());
             *
             *                  infoBox.Show();
             *                  infoBox.Focus();
             *              }
             *
             *              UpdateEquipment(postac);
             *              UpdateProducts(seller);
             *
             *              break;
             *          }
             *          else
             *              j++;
             *      }
             *  }
             * }*/
        }