private void ConcenReact_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { playerProfile.SaveProfile(""); if (debugForm != null) { debugForm.WriteLine("Gespeichert"); } } if (e.KeyCode == Keys.U) { playerProfile.MainShopcurrency += 15; } if (newTick) { newTick = false; if (e.KeyCode != Keys.Escape) { if (!inMainMenu) { mainGame.KeyHandler(e); } else { if (mainMenu.InVisualProfileEditor1) { ((VisualProfileEditorEntry)lastClickedEntry).KeyHandler(e, ((VisualProfileEditorEntry)lastClickedEntry)); } else if (mainMenu.InVisualProfileLoading) { ((VisualProfileLoadingEntry)lastClickedEntry).KeyHandler(e, ((VisualProfileLoadingEntry)lastClickedEntry)); } else { mainMenu.KeyHandler(e); } } } else { Reset(); } } //Tastendruck weiterreichen an die Spieleinstanz }
public virtual void KeyHandler(KeyEventArgs e, VisualMenuEntry sender) { if (DebugForm != null && sender != null) { DebugForm.WriteLine(sender.ToString() + " : " + e.KeyCode.ToString()); } }
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 void ClickGame(Point clickPos) { //Tile-Information in Debug-Konsole if (debugForm != null) { debugForm.WriteLine(gameMap.Tiles[clickPos.X / tileSize, clickPos.Y / tileSize].GetDebugTileString()); } lastClickedPos.X = clickPos.X / tileSize; lastClickedPos.Y = clickPos.Y / tileSize; }
public override void KeyHandler(Keys key) { DebugForm.WriteLine(key.ToString()); }
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 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(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); }