Example #1
0
 public Gegenstand Clone()
 {
     Gegenstand g = new Gegenstand();
     g.Set(Name, Desc, Gewicht);
     g.Art = Art;
     g.Bedingung = Bedingung;
     g.Flags.AddRange(Flags);
     g.Hidden = Hidden;
     return g;
 }
            public ItemListe(string NeuText, Gegenstand.Kategorie Kategorie, CharakterErstellungsDaten Daten, int Maximum)
            {
                this.Kategorie = Kategorie;
                this.Daten = Daten;
                this.Gegenstande = new List<Gegenstand>();
                this.Form = new ElementAuswahlForm<Gegenstand>(Daten.Universe.Gegenstande);
                this.Maximum = Maximum;

                Liste = new ControlList();
                ScrollBox = new ScrollBox(Liste);
                Neu = new Button();
                Neu.Text = NeuText;
                Neu.AutoSize = true;
                Neu.Click += NeuKlick;
                Neu.Enabled = false;
                this.Controls.Add(ScrollBox);

                this.Size = ScrollBox.Size = new Size(300, 300);

                FillListe(Gegenstande);
                UpdateInfo();
            }
 public ItemListe(string NeuText, Gegenstand.Kategorie Kategorie, CharakterErstellungsDaten Daten)
     : this(NeuText, Kategorie, Daten, int.MaxValue)
 {
 }
            protected override void CreatePaar(Gegenstand Gegenstand)
            {
                Gegenstand Klon = Gegenstand.Clone();

                Button A = new Button();
                A.AutoSize = true;
                A.Text = "Entfernen";

                Button C = new Button();
                C.AutoSize = true;
                C.Text = "Bearbeiten";

                Label B = new Label();
                B.AutoSize = true;
                B.Text = Klon.SchreibName;
                B.Font = new System.Drawing.Font("Calibri", 13);

                ArrayControl cp = new ArrayControl(A, C, B);
                Liste.Add(cp);
                Gegenstande.Add(Klon);

                GegenstandForm f = new GegenstandForm();
                f.Set(Klon);

                A.Click += (sender, e) =>
                {
                    Liste.Remove(cp);
                    Gegenstande.Remove(Klon);
                    UpdateInfo();
                };
                C.Click += (sender, e) =>
                {
                    f.ShowDialog();
                    if (f.OK)
                        f.Edit(Klon);
                    B.Text = Klon.SchreibName;
                    UpdateInfo();
                };

                UpdateInfo();
            }
            protected virtual void CreatePaar(Gegenstand Gegenstand)
            {
                Button A = new Button();
                A.AutoSize = true;
                A.Text = "Entfernen";

                Label B = new Label();
                B.AutoSize = true;
                B.Text = Gegenstand.SchreibName;
                B.Font = new System.Drawing.Font("Calibri", 13);

                ControlPaar cp = new ControlPaar(A, B);
                Liste.Add(cp);
                this.Gegenstande.Add(Gegenstand);

                A.Click += (sender, e) =>
                {
                    Liste.Remove(cp);
                    this.Gegenstande.Remove(Gegenstand);
                    UpdateInfo();
                };
            }
Example #6
0
 public void SetListe(Gegenstand.Kategorie Kategorie, IEnumerable<Gegenstand> Liste)
 {
     switch (Kategorie)
     {
         case Gegenstand.Kategorie.Nahkampfwaffe:
             NahkampfWaffen = new List<NahkampfWaffe>();
             foreach (var item in Liste)
                 NahkampfWaffen.Add((NahkampfWaffe)item);
             break;
         case Gegenstand.Kategorie.Fernkampfwaffe:
             FernkampfWaffen = new List<FernkampfWaffe>();
             foreach (var item in Liste)
                 FernkampfWaffen.Add((FernkampfWaffe)item);
             break;
         case Gegenstand.Kategorie.Schild:
             Schilde = new List<Schild>();
             foreach (var item in Liste)
                 Schilde.Add((Schild)item);
             break;
         case Gegenstand.Kategorie.Rustung:
             Rustungen = new List<Rustung>();
             foreach (var item in Liste)
                 Rustungen.Add((Rustung)item);
             break;
         case Gegenstand.Kategorie.Gegenstand:
             Gegenstande = new List<Gegenstand>();
             Gegenstande.AddRange(Liste);
             break;
         default:
             throw new NotImplementedException();
     }
 }
Example #7
0
 public IEnumerable<Gegenstand> GetListe(Gegenstand.Kategorie Kategorie)
 {
     switch (Kategorie)
     {
         case Gegenstand.Kategorie.Nahkampfwaffe:
             return NahkampfWaffen;
         case Gegenstand.Kategorie.Fernkampfwaffe:
             return FernkampfWaffen;
         case Gegenstand.Kategorie.Schild:
             return Schilde;
         case Gegenstand.Kategorie.Gegenstand:
             return Gegenstande;
         case Gegenstand.Kategorie.Rustung:
             return Rustungen;
         default:
             throw new NotImplementedException();
     }
 }
Example #8
0
 public override void ReadElement(ManifestData Data)
 {
     Clear();
     Data.Section("inventar", () =>
     {
         switch (Data.Reader.Name)
         {
             case "rustungen":
                 Data.Section(() =>
                 {
                     Rustungen.Add((Rustung)Data.getGegenstand("name"));
                     Data.NextElement();
                 });
                 break;
             case "schilde":
                 Data.Section(() =>
                 {
                     Schilde.Add((Schild)Data.getGegenstand("name"));
                     Data.NextElement();
                 });
                 break;
             case "nahkampfwaffen":
                 Data.Section(() =>
                 {
                     NahkampfWaffen.Add((NahkampfWaffe)Data.getGegenstand("name"));
                     Data.NextElement();
                 });
                 break;
             case "fernkampfwaffen":
                 Data.Section(() =>
                 {
                     FernkampfWaffen.Add((FernkampfWaffe)Data.getGegenstand("name"));
                     Data.NextElement();
                 });
                 break;
             case "gegenstande":
                 Data.Section(() =>
                 {
                     Gegenstand g = new Gegenstand();
                     g.Read(Data, 0);
                     Gegenstande.Add(g);
                     Data.NextElement();
                 });
                 break;
             default:
                 throw new NotImplementedException();
         }
     });
 }
Example #9
0
 public void Set(Gegenstand Element)
 {
     NameBox.Text = Element.SchreibName;
     DescBox.Text = Element.Desc;
     GewichtBox.Text = Element.Gewicht.ToString("F3");
 }
Example #10
0
 public Gegenstand GetGegenstand()
 {
     Gegenstand g = new Gegenstand();
     Edit(g);
     return g;
 }
Example #11
0
 public void Edit(Gegenstand Gegenstand)
 {
     Gegenstand.Set(NameBox.Text.Replace(' ', '_'), DescBox.Text,getGewicht());
 }