public PopupMenu(AssetHandler assetHandler, Brush mB, Brush iconBg, int wX, int wY, Graphics g, DebugForm df) { //AssetHandler this.assetHandler = assetHandler; //Brushes und Pens MenuBrush = mB; iconBackgroundBrush = iconBg; //Fenstergröße WindowSizeX = wX; WindowSizeY = wY; //Ränder des gezeichneten Fensters paddingY = (int)(wY * 0.20); paddingX = (int)(wX * 0.55); //Größe des gezeichneten Popup-Fensters PopupSizeX = WindowSizeX - paddingX; PopupSizeY = WindowSizeY - paddingY; //Fonts headerFont = new Font("Arial", (float)(GetMenuRectangleF().Width * 0.05), FontStyle.Underline); textFont = new Font("Arial", (float)(GetMenuRectangleF().Width * 0.03)); HeaderPositionY = (float)(PopupSizeY * 0.15); debugForm = df; //Menü-Farbe als Highlight farbe in hell anzeigen CreateHighlightBrush(); //Grafikkontext Context = g; }
public MainMenu(GameConfig gameConfig, AssetHandler assetHandler, DebugForm debugForm, int pbWidth, int pbHeight) { Config = gameConfig; background = new Bitmap(pbWidth, pbHeight); gesamt = new Bitmap(background); //Liste für Einträge Entries = new List <MainMenuEntry>(); currentMenuEntry = 0; //Höhe der einträge + Padding entryHeight = pbHeight / 12; entryWidth = (pbWidth / 4); padding = entryHeight / 4; //Aktion InVisualEntry = false; InVisualProfileEditor1 = false; InVisualProfileLoading = false; //Brushes für Menu-Einträge und wenn eins markiert ist MenuBrush = new SolidBrush(Color.FromArgb(100, Color.Blue)); highlightBrush = new SolidBrush(Color.FromArgb(100, Color.LightBlue)); //DEBUG AddEntry(new StartGameMenuEntry(debugForm, "Start")); AddEntry(new CloseMenuEntry(debugForm, "Beenden")); CreateBackground(); }
public virtual void KeyHandler(KeyEventArgs e, VisualMenuEntry sender) { if (DebugForm != null && sender != null) { DebugForm.WriteLine(sender.ToString() + " : " + e.KeyCode.ToString()); } }
public void Interact(DebugForm debugForm) { if (interaction.GetType() == typeof(GetItemInteraction) && !interaction.Interacted) { currPlayerOnTile.AddEquipWeapon(debugForm, (Weapon)((GetItemInteraction)interaction).Interact()); interaction.Interacted = true; } }
protected VisualMenuEntryOption(AssetHandler assetHandler, DebugForm debugForm, object windowSizeX, object windowSizeY, Brush menuBrush, string name, string header) { this.assetHandler = assetHandler; this.debugForm = debugForm; this.windowSizeX = windowSizeX; this.windowSizeY = windowSizeY; this.menuBrush = menuBrush; this.name = name; this.header = header; }
public Game(AssetHandler assetHandler, DebugForm debugForm, bool debug, Profile p, Player p2, int tS, int pX, int pY, Assets.Tileset tileset) { //Debug-Form this.debug = debug; this.debugForm = debugForm; //Spielerzuweisung playerProfile = p; Player2 = p2; //Status-Variablen inBattle = false; inOptions = false; isInteracting = false; inInventory = false; inCharacterMenu = false; //Enemy Status-Variablen enemyIsInteracting = false; //Festlegung der Tilesize und der Pixelgröße des zu zeichnenden bereichs tileSize = tS; pbSizeX = pX; pbSizeY = pY; battle = new Battle(pbSizeX, pbSizeY); this.assetHandler = assetHandler; //Random Map GameMap = new Karte(pbSizeX / tileSize, pbSizeY / tileSize, tileSize); GameMap.Tiles = Karte.GenerateRandomTiles(assetHandler, pbSizeX / tileSize, pbSizeY / tileSize, null, tileset); background = GameMap.GetMapBitmap(); //Gesamt-Bitmap gesamt = new Bitmap(background.Width, background.Height); MenuTransparency = 128; menuBrush = new SolidBrush(Color.FromArgb(MenuTransparency, Color.DarkBlue)); iconBackgroundBrush = new SolidBrush(Color.FromArgb(MenuTransparency, Color.Black)); CheckPlayerOnTile(); gesamtGraphics = Graphics.FromImage(gesamt); //Spieler zum Startbeginn TODO: Ersetzen durch Zufall SetupStartingPlayer(playerProfile.Player); //wartezeit nach rundenwechsel für ki TODO: Config-Eintrag maxTickWaitTime = 5; currentTickWaitTime = maxTickWaitTime; }
private void DebugMode() { if (debug) { debugForm = new DebugForm(); debugForm.Show(); } else { debugForm = null; } }
public VisualMenuEntry(AssetHandler assetHandler, DebugForm debugForm, int windowSizeX, int windowSizeY, Brush menuBrush, string name, string header) : base(debugForm, name) { this.Header = header; this.MenuBrush = menuBrush; Background = new Bitmap(windowSizeX, windowSizeY); Gesamt = new Bitmap(Background); this.DebugForm = debugForm; this.assetHandler = assetHandler; Entries = new List <VisualMenuEntryOption>(); CreateEntryBackgroundAndHighlightBrush(MenuBrush); }
public VisualMenuEntryLoadProfileOption(AssetHandler assetHandler, DebugForm debugForm, object windowSizeX, object windowSizeY, Brush menuBrush, string name, string header, string savePath) : base(assetHandler, debugForm, windowSizeX, windowSizeY, menuBrush, name, header) { //Versuchen, Profil zu laden, ansosnten Default try { LoadedProfile = Profile.LoadProfile(savePath); Title = name; } catch (Exception ex) { loadedProfile = new Profile(); Title = "Error"; MessageBox.Show(ex.Message); } }
public static Tile[,] GenerateRandomTiles(int xTiles, int yTiles, DebugForm debugForm) { Tile[,] tiles = new Tile[xTiles, yTiles]; Random rSalt = new Random(); for (int y = 0; y < yTiles; y++) { for (int x = 0; x < xTiles; x++) { tiles[x, y] = Tile.GetRandomTile(debugForm, rSalt.Next()); } } return(tiles); }
public void AddEquipWeapon(DebugForm debug, Weapon w) { if (weapon == null) { if (debug != null) { debug.WriteLine("Waffe ausgerüstet: " + w.Name); } weapon = w; } else { if (debug != null) { debug.WriteLine("Waffe ins Inventar gepackt: " + w.Name); } AddItem(w); } }
public PopupMenu(Brush mB, int wX, int wY, Graphics g, DebugForm df) { menuBrush = mB; WindowSizeX = wX; WindowSizeY = wY; //Ränder des gezeichneten Fensters paddingY = (int)(wY * 0.20); paddingX = (int)(wX * 0.55); //Größe des gezeichneten Fensters PopupSizeX = WindowSizeX - paddingX; PopupSizeY = WindowSizeY - paddingY; //Fonts headerFont = new Font("Arial", (float)(popupSizeY * 0.05), FontStyle.Underline); textFont = new Font("Arial", (float)(popupSizeY * 0.03)); HeaderPositionY = (float)(PopupSizeY * 0.15); Context = g; }
public VisualProfileEditorEntry(GameConfig config, AssetHandler assetHandler, DebugForm debugForm, int windowSizeX, int windowSizeY, Brush menuBrush, string name, string header) : base(assetHandler, debugForm, windowSizeX, windowSizeY, menuBrush, name, header) { //Spielekonfig Merken zur Bearbeitung this.config = config; //Aktuell angewählter Menüeintrag createdPlayer = new Player("Player", false, assetHandler.GetPlayerClassFromCompleteList(0)); tempBitmap = createdPlayer.PlayerClass.ClassBitmap; tempClass = createdPlayer.PlayerClass; tempName = createdPlayer.Name; CurrentMenuItemIndex = 0; OptionButtonWidth = windowSizeX - windowSizeX / 4; OptionButtonHeight = windowSizeY / 12; //Fenstergröße windowSize = new Size(windowSizeX, windowSizeY); this.assetHandler = assetHandler; //Option-Entry SetupOptions(); mapXTiles = config.xTiles; mapYTiles = config.yTiles; performanceProfileIndex = config.gamePerformance; //Tileset setzen, wenn Fehlerhaft = Standard tileset = AssetHandler.GetTilesetFromCompleteList(config.lastTileset); }
public InventoryPopupMenu(Player p, Brush mB, int wX, int wY, Graphics g, DebugForm df) : base(mB, wX, wY, g, df) { this.p = p; iconBackgroundBrush = new SolidBrush(Color.FromArgb(100, Color.Black)); }
public static Tile[,] GenerateRandomTiles(AssetHandler assetHandler, int xTiles, int yTiles, DebugForm debugForm, Tileset tileset) { Tile[,] tiles = new Tile[xTiles, yTiles]; Random rSalt = new Random(); for (int y = 0; y < yTiles; y++) { for (int x = 0; x < xTiles; x++) { tiles[x, y] = Tile.GetRandomTile(assetHandler, debugForm, rSalt.Next() + assetHandler.Rand.Next(), tileset); } } return(tiles); }
private GetItemInteraction interaction; //Item-Interaktion für das Menü public GetItemPopupMenu(GetItemInteraction gii, Brush mB, int wX, int wY, Graphics g, DebugForm df) : base(mB, wX, wY, g, df) { interaction = gii; }
public MainMenuEntry(DebugForm debugForm, string name) { this.name = name; pressed = false; this.DebugForm = debugForm; }
public CloseMenuEntry(DebugForm debugForm, string name) : base(debugForm, name) { }
private GetItemInteraction interaction; //Item-Interaktion für das Menü public GetItemPopupMenu(AssetHandler assetHandler, GetItemInteraction gii, Brush mB, Brush iconBg, int wX, int wY, Graphics g, DebugForm df) : base(assetHandler, mB, iconBg, wX, wY, g, df) { interaction = gii; }
public override void KeyHandler(Keys key) { DebugForm.WriteLine(key.ToString()); }
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)) { } } }
public static Tile GetRandomTile(DebugForm debugForm, int salt) { Random tempRand = new Random(salt); Tile randTile = new Tile(); int rand = tempRand.Next(0, 1000); if (debugForm != null) { debugForm.WriteLine("Random-Value: " + rand); } if (rand < 250) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = Properties.Resources.Tile_Plain_0; randTile.tileName = "Plain_0"; } else if (rand < 500) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = Properties.Resources.Tile_Plain_1; randTile.tileName = "Plain_1"; } else if (rand < 750) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = Properties.Resources.Tile_Plain_2; randTile.tileName = "Plain_2"; } else if (rand < 965) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = Properties.Resources.Tile_Plain_3; randTile.tileName = "Plain_3"; } else if (rand < 985) { randTile.isEnterable = true; randTile.isInteractable = true; randTile.tileBitmap = Properties.Resources.Tile_Plain_House_0; randTile.tileName = "Plain_House_0"; randTile.interaction = new GetItemInteraction(new Weapon(Properties.Resources.Item_Sword_0_ManniKatt, false, true, "Manni Katti", 0.0, 0.0), "Dorfbesuch", "Willkommen im Dummy-Dorf, hier ist ein Item-Test!"); } else if (rand < 998) { randTile.isEnterable = true; randTile.isInteractable = true; randTile.tileBitmap = Properties.Resources.Tile_Plain_House_1; randTile.tileName = "Plain_House_1"; } else if (rand < 1000) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = Properties.Resources.Tile_Plain_Castle_0; randTile.tileName = "Plain_Castle_0"; } else { randTile.isEnterable = true; randTile.isInteractable = true; randTile.tileBitmap = Properties.Resources.Tile_Dummy_0; randTile.tileName = "DUMMY"; } return(randTile); }
public override void KeyHandler(Keys key) { // //DEBUG // if (key == Keys.NumPad1) { p.Weapon = AssetHandler.Assets.PrefabUniqueWeapons[(int)ItemUniqueWeapons.Eckesachs]; } if (key == Keys.R) { DebugForm.WriteLine("drin"); if (currentSelectedItemIndex < p.EquipmentCount) { if (currentSelectedItemIndex == 0) { p.Weapon = Weapon.GetRandomWeapon(AssetHandler); } } else if (currentSelectedItemIndex - p.EquipmentCount < p.Items.Count) { //Abfrage auf Inventar-Slots if (currentSelectedItemIndex - p.EquipmentCount < p.Items.Count) { if (p.Items[currentSelectedItemIndex - p.EquipmentCount] != null) { p.Items[currentSelectedItemIndex - p.EquipmentCount] = Weapon.GetRandomWeapon(AssetHandler); } } } itemSelected = false; } if (key == Keys.Up || key == Keys.W) { if (currentSelectedItemIndex - 1 >= 0) { currentSelectedItemIndex--; if (DebugForm != null) { DebugForm.WriteLine("Up: " + currentSelectedItemIndex); } if (currentSelectedItemIndex != lastSelectedItemIndex) { itemSelected = false; } } } if (key == Keys.Down || key == Keys.S) { if (currentSelectedItemIndex + 1 < P.InventorySpace + 2) { currentSelectedItemIndex++; if (DebugForm != null) { DebugForm.WriteLine("Down: " + currentSelectedItemIndex); } if (currentSelectedItemIndex != lastSelectedItemIndex) { itemSelected = false; } } } if (key == Keys.Left || key == Keys.A) { } if (key == Keys.Right || key == Keys.D) { } if (key == Keys.Enter) { if (currentSelectedItemIndex < p.EquipmentCount) { //Abfrage auf Ausrüstungs-Slots if (currentSelectedItemIndex == 0 && p.Weapon != null)//Waffe { if (DebugForm != null) { DebugForm.WriteLine("Waffe gefunden!"); } currentSelectedItem = p.Weapon; ChangeItemSelectedState(); lastSelectedItemIndex = currentSelectedItemIndex; } else if (currentSelectedItemIndex == 1 && p.Armor != null)//Rüstung { if (DebugForm != null) { DebugForm.WriteLine("Rüstung gefunden!"); } currentSelectedItem = p.Armor; ChangeItemSelectedState(); lastSelectedItemIndex = currentSelectedItemIndex; } } else { //Abfrage auf Inventar-Slots if (currentSelectedItemIndex - p.EquipmentCount < p.Items.Count) { if (p.Items[currentSelectedItemIndex - p.EquipmentCount] != null) { if (DebugForm != null) { DebugForm.WriteLine("Item gefunden!"); } currentSelectedItem = p.Items[currentSelectedItemIndex - p.EquipmentCount]; ChangeItemSelectedState(); lastSelectedItemIndex = currentSelectedItemIndex; } } } } }
public StartGameMenuEntry(DebugForm debugForm, string name) : base(debugForm, name) { }
public InventoryPopupMenu(Player p, Brush iconBg, Brush mB, int wX, int wY, Graphics g, DebugForm df) : base(mB, wX, wY, g, df) { this.p = p; iconBackgroundBrush = iconBg; }
public static Tile GetRandomTile(AssetHandler assetHandler, DebugForm debugForm, int salt, Tileset tileset) { Random tempRand = new Random(salt); Tile randTile = new Tile(); int rand = tempRand.Next(0, 1000); if (debugForm != null) { debugForm.WriteLine("Random-Value: " + rand); } if (rand < 250) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_0]; randTile.tileName = "Plain_0"; } else if (rand < 500) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_1]; randTile.tileName = "Plain_1"; } else if (rand < 750) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_2]; randTile.tileName = "Plain_2"; } else if (rand < 940) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_3]; randTile.tileName = "Plain_3"; } else if (rand < 965) { randTile.isEnterable = false; randTile.isInteractable = false; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_4]; randTile.tileName = "Plain_4"; } else if (rand < 985) { randTile.isEnterable = true; randTile.isInteractable = true; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_House_0]; randTile.tileName = "Plain_House_0"; //randTile.interaction = new GetItemInteraction(Weapon.GetRandomWeapon(assetHandler),"Dorfbesuch","Willkommen im Dummy-Dorf, hier ist ein Item-Test!"); randTile.interaction = GetItemInteraction.GetRandomItemInteraction(assetHandler); } else if (rand < 998) { randTile.isEnterable = true; randTile.isInteractable = true; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_House_1]; randTile.tileName = "Plain_House_1"; } else if (rand < 1000) { randTile.isEnterable = true; randTile.isInteractable = false; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Plain_Castle_0]; randTile.tileName = "Plain_Castle_0"; } else { randTile.isEnterable = true; randTile.isInteractable = true; randTile.tileBitmap = tileset.TileIcons[(int)Tiles.Dummy]; randTile.tileName = "DUMMY"; } return(randTile); }
public InventoryPopupMenu(AssetHandler assetHandler, Player p, Brush mB, Brush iconBg, int wX, int wY, Graphics g, DebugForm df) : base(assetHandler, mB, iconBg, wX, wY, g, df) { this.p = p; IconBackgroundBrush = iconBg; //Auswahl für Details etc currentSelectedItemIndex = 0; itemSelected = false; borderBetweenEntries = PopupSizeY / 12; }
public VisualProfileLoadingEntry(GameConfig config, AssetHandler assetHandler, DebugForm debugForm, int windowSizeX, int windowSizeY, Brush menuBrush, string name, string header) : base(assetHandler, debugForm, windowSizeX, windowSizeY, menuBrush, name, header) { Name = "Laden"; windowSize = new Size(windowSizeX, windowSizeY); //Größe der Einträge OptionButtonWidth = windowSizeX - windowSizeX / 4; OptionButtonHeight = windowSizeY / 16; TryToLoadAllSaves(); }
public OptionsMenuEntry(DebugForm debugForm, string name) : base(debugForm, name) { }