public override void DrawVisualMenuEntry()
        {
            base.DrawVisualMenuEntry();

            GesamtGraphic = Graphics.FromImage(Gesamt);

            GesamtGraphic.FillRectangle(EntryBackgroundBrush, new RectangleF(windowSize.Width * 0.15f, CurrentMenuItemIndex * OptionButtonHeight, OptionButtonWidth, OptionButtonHeight));
            for (int i = 0; i < Entries.Count; i++)
            {
                GesamtGraphic.FillRectangle(EntryBackgroundBrush, new RectangleF(windowSize.Width * 0.15f, i * OptionButtonHeight, OptionButtonWidth, OptionButtonHeight));

                GesamtGraphic.DrawString(Entries[i].Title, SystemFonts.DefaultFont, Brushes.White, windowSize.Width * 0.15f, i * OptionButtonHeight);

                //Checks für verschiedene Typen an Optionen
                if (Entries[i].GetType() == typeof(VisualMenuEntryPlayerClassOption))
                {
                    GesamtGraphic.DrawImage(((VisualMenuEntryPlayerClassOption)Entries[i]).CurrPlayerClass.ClassBitmap, windowSize.Width / 2, i * OptionButtonHeight);
                }
                if (Entries[i].GetType() == typeof(VisualMenuEntryChangeTilesetOption))
                {
                    GesamtGraphic.DrawImage(((VisualMenuEntryChangeTilesetOption)Entries[i]).PreviewTile, windowSize.Width / 2, i * OptionButtonHeight);
                }
            }



            GesamtGraphic.Dispose();
        }
Example #2
0
 public void DrawBackground()
 {
     //Zeichnen des Hintergrunds
     GesamtGraphic = Graphics.FromImage(Background);
     GesamtGraphic.FillRectangle(Brushes.Gray, new Rectangle(0, 0, Gesamt.Width, Gesamt.Height));    //Hintergrund
     GesamtGraphic.FillRectangle(MenuBrush, new Rectangle(0, 0, Gesamt.Width, Gesamt.Height));       //menuBrush über Hintergrund gelegt
     GesamtGraphic.Dispose();
 }
Example #3
0
        public virtual void DrawVisualMenuEntry()
        {
            DrawBackground();
            GesamtGraphic = Graphics.FromImage(Gesamt);
            GesamtGraphic.DrawImage(Background, 0, 0, Background.Width, Background.Height);



            GesamtGraphic.Dispose();
        }
        public override void DrawVisualMenuEntry()
        {
            base.DrawVisualMenuEntry();


            GesamtGraphic = Graphics.FromImage(Gesamt);

            GesamtGraphic.FillRectangle(EntryBackgroundBrush, new RectangleF(windowSize.Width * 0.15f, CurrentMenuItemIndex * OptionButtonHeight, OptionButtonWidth, OptionButtonHeight));
            for (int i = 0; i < Entries.Count; i++)
            {
                GesamtGraphic.FillRectangle(EntryBackgroundBrush, new RectangleF(windowSize.Width * 0.15f, i * OptionButtonHeight, OptionButtonWidth, OptionButtonHeight));

                GesamtGraphic.DrawString(Entries[i].Title, SystemFonts.DefaultFont, Brushes.White, windowSize.Width * 0.15f, i * OptionButtonHeight);
            }

            GesamtGraphic.Dispose();
        }
        public override void KeyHandler(KeyEventArgs e, VisualMenuEntry sender)
        {
            //Übergabe an base-methode für Debug-Output
            base.KeyHandler(e, sender);



            if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
            {
                if (e.Modifiers == Keys.Shift)
                {
                    shift = true;
                }
                else
                {
                    shift = false;
                }
                //Übergabe der Keys an AppendName der VisualMenuEntryEnterNameOptions
                if (Entries[CurrentMenuItemIndex] != null)
                {
                    if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryEnterNameOption))
                    {
                        ((VisualMenuEntryEnterNameOption)Entries[CurrentMenuItemIndex]).AppendName((char)e.KeyCode, shift);
                        tempName = ((VisualMenuEntryEnterNameOption)Entries[CurrentMenuItemIndex]).Name;
                        CreatePlayer();
                    }
                }
            }

            shift = false;
            //Menübewegung
            if (e.KeyCode == Keys.Down)
            {
                if (CurrentMenuItemIndex + 1 < Entries.Count)
                {
                    CurrentMenuItemIndex++;
                }
            }
            else if (e.KeyCode == Keys.Up)
            {
                if (CurrentMenuItemIndex - 1 >= 0)
                {
                    CurrentMenuItemIndex--;
                }
            }


            else if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Add)
            {
                if (Entries[CurrentMenuItemIndex] != null)
                {
                    GesamtGraphic = Graphics.FromImage(Gesamt);
                    Entries[CurrentMenuItemIndex].Action(1, windowSize.Width / 4, CurrentMenuItemIndex * OptionButtonHeight, GesamtGraphic);

                    GesamtGraphic.Dispose();

                    if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryPlayerClassOption))
                    {
                        //gewählte Bitmap in Merker schreiben
                        //tempBitmap = ((VisualMenuEntryPlayerClassOption)entries[currentMenuItemIndex]).CurrBitmap;
                        //gewählte Spieler-Klasse in Merker schreiben
                        tempClass = ((VisualMenuEntryPlayerClassOption)Entries[CurrentMenuItemIndex]).CurrPlayerClass;
                        CreatePlayer();
                    }
                    else if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryChangeIntValueOption))
                    {
                        if (((VisualMenuEntryChangeIntValueOption)Entries[CurrentMenuItemIndex]).IsMasked)
                        {
                            if (DebugForm != null)
                            {
                                DebugForm.WriteLine("Neues Profil: " + assetHandler.Assets.PerformanceValues[((VisualMenuEntryChangeIntValueOption)Entries[CurrentMenuItemIndex]).Value]);
                            }
                        }

                        ChangeAndSaveConfig();
                    }
                    else if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryChangeTilesetOption))
                    {
                        tileset = ((VisualMenuEntryChangeTilesetOption)Entries[CurrentMenuItemIndex]).Tileset;
                        ChangeAndSaveConfig();
                    }
                }
            }
            else if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Subtract)
            {
                if (Entries[CurrentMenuItemIndex] != null)
                {
                    GesamtGraphic = Graphics.FromImage(Gesamt);
                    //Action des Eintrags aufrufen
                    Entries[CurrentMenuItemIndex].Action(0, windowSize.Width / 4, CurrentMenuItemIndex * OptionButtonHeight, GesamtGraphic);


                    //Abfrage, ob EnterNameOption
                    if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryEnterNameOption))
                    {
                        //Name kürzen und in Merker schreiben
                        ((VisualMenuEntryEnterNameOption)Entries[CurrentMenuItemIndex]).ShortenName();
                        tempName = ((VisualMenuEntryEnterNameOption)Entries[CurrentMenuItemIndex]).Name;
                    }
                    if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryPlayerClassOption))
                    {
                        //gewählte Bitmap in Merker schreiben
                        //tempBitmap = ((VisualMenuEntryPlayerClassOption)entries[currentMenuItemIndex]).CurrBitmap;
                        //gewählte Klasse in Merker schreiben
                        tempClass = ((VisualMenuEntryPlayerClassOption)Entries[CurrentMenuItemIndex]).CurrPlayerClass;
                        CreatePlayer();
                    }
                    if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryChangeIntValueOption))
                    {
                        ChangeAndSaveConfig();
                    }
                    else if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryChangeTilesetOption))
                    {
                        tileset = ((VisualMenuEntryChangeTilesetOption)Entries[CurrentMenuItemIndex]).Tileset;
                        ChangeAndSaveConfig();
                    }

                    GesamtGraphic.Dispose();
                }
            }
            else if (e.KeyCode == Keys.Escape)
            {
                if (Entries[CurrentMenuItemIndex].GetType() == typeof(VisualMenuEntryPlayerClassOption))
                {
                }
            }
        }