コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: SlagDrop/ConcenReact
        public ConcenReact()
        {
            //Initialize Assets
            assetHandler = new AssetHandler();

            //GameConfig Laden
            InitConfig();

            //Initialize Block
            InitializeComponent();

            //DEBUG
            debug = true;
            DebugMode();

            inMainMenu          = true;
            gameInitialized     = false; //Spiellogik erst nach Menü initialisieren
            mainMenuInitialized = false;
            newTick             = false;


            SetGamePerformanceFromConfig();

            //Spielerprofil laden
            playerProfile = new Profile();


            //Haupttimer für Spiellogik und Zeichnung
            timerGameTick.Start();
        }
コード例 #4
0
        public InitializeAssets(AssetHandler assetHandler)
        {
            //Festlegen des asset-Handlers
            this.assetHandler = assetHandler;

            //Initialisieren der generischen Listen
            WeaponIcons = new List <Bitmap>();

            TileIcons         = new List <Bitmap>();
            WeaponNames       = new List <string>();
            uniqueWeaponNames = new List <string>();
            rarityPrefix      = new List <List <string> >();
            uniqueWeaponIcons = new List <Bitmap>();
            characterBitmaps  = new List <Bitmap>();

            PrefabWeapons       = new List <Weapon>();
            prefabUniqueWeapons = new List <Weapon>();

            rarityPens    = new List <Pen>();
            rarityBrushes = new List <Brush>();

            CreateDefaultTileset();
            defaultTileset         = new Tileset();
            tilesExpectedFilenames = new List <string>();
            ExternalTilesets       = new List <Assets.Tileset>();

            defaultPlayerClasses  = new List <PlayerClass>();
            externalPlayerClasses = new List <PlayerClass>();

            performanceValues = new List <int>();
            Initialize();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
ファイル: ItemWithIcon.cs プロジェクト: SlagDrop/ConcenReact
 public ItemWithIcon(ItemWithIcon item)
 {
     this.assetHandler = item.assetHandler;
     this.ItemBitmap   = item.ItemBitmap;
     this.IsUsable     = item.IsUsable;
     this.IsEquipable  = item.IsEquipable;
     this.Name         = item.Name;
 }
コード例 #7
0
        public VisualMenuEntryChangeTilesetOption(AssetHandler asset, Size windowSize, int lastTilesetIndex) : base(asset, windowSize)
        {
            tilesetCount = AssetHandler.TilesetCount;
            //Überprüfen, ob Config validen Wert für Tilesetindex enthält
            CheckAndCorrectTilesetIndex(lastTilesetIndex);


            Refresh();
        }
コード例 #8
0
        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;
        }
コード例 #9
0
 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;
 }
コード例 #10
0
ファイル: Game.cs プロジェクト: SlagDrop/ConcenReact
        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;
        }
コード例 #11
0
        public VisualMenuEntryPlayerClassOption(AssetHandler assetHandler, Size windowSize) : base(assetHandler, windowSize)
        {
            classIndex = 0;
            iconCount  = assetHandler.Assets.CharacterBitmaps.Count;
            classCount = AssetHandler.ClassesCount;
            iconSize   = windowSize.Width * 0.1f;


            SetCurrentClass();
            Refresh();
        }
コード例 #12
0
 public void CheckAndCorrectTilesetIndex(int i)
 {
     if (AssetHandler.CheckifValidIndex(i, AssetHandler.TilesetCount))
     {
         tilesetIndex = i;
     }
     else
     {
         tilesetIndex = 0;
     }
 }
コード例 #13
0
        public VisualMenuEntryChangeIntValueOption(AssetHandler asset, Size windowSize, int value, int maxValue, int minValue, string valTitle) : base(asset, windowSize)
        {
            this.Value = value;
            ValueTitle = valTitle;

            this.maxValue = maxValue;
            this.minValue = minValue;


            IsMasked = false;
            Refresh();
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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();
        }
コード例 #16
0
ファイル: Karte.cs プロジェクト: SlagDrop/ConcenReact
        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);
        }
コード例 #17
0
 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);
     }
 }
コード例 #18
0
        public static GetItemInteraction GetRandomItemInteraction(AssetHandler assetHandler)
        {
            GetItemInteraction interaction;
            Item item;

            Random r    = new Random();
            int    rand = 0;

            if (rand == 0) //Weapon
            {
                interaction = new GetItemInteraction(Weapon.GetRandomWeapon(assetHandler), "Interaktion", "Interaktiontext");
            }
            else
            {
                interaction = new GetItemInteraction(Weapon.GetRandomWeapon(assetHandler), "Interak", "ItnerText");
            }



            return(interaction);
        }
コード例 #19
0
ファイル: Weapon.cs プロジェクト: SlagDrop/ConcenReact
        public static Weapon GetRandomWeapon(AssetHandler assetHandler)
        {
            //Zufallsgenerator initialisieren

            Random r = new Random(assetHandler.Rand.Next());

            int rand;

            //temporäre Merker
            Bitmap icon;
            string name;
            int    rarity;
            double attackModifier;
            double scoreModifier;

            try
            {
                rand = r.Next(0, assetHandler.WeaponIconsCount);


                icon = assetHandler.Assets.WeaponIcons[rand];

                rand = r.Next(0, assetHandler.WeaponNamesCount);
                name = assetHandler.Assets.WeaponNames[rand];

                rand           = r.Next(0, 50);
                attackModifier = (double)rand / 10;

                int combScore = rand;
                rand          = r.Next(0, 50);
                scoreModifier = (double)rand / 10;

                combScore += rand;

                //Kombinierter Score für Abfrage nach Rarity


                if (combScore < 55)  //common
                {
                    rarity = 0;
                }
                else if (combScore < 79) //rare
                {
                    rarity = 1;
                }
                else if (combScore < 88) //very rare
                {
                    rarity = 2;
                }
                else if (combScore < 94) //epic
                {
                    rarity = 3;
                }
                else if (combScore < 97.5) //legendary
                {
                    rarity = 4;
                }
                else if (combScore < 100) //unique
                {
                    rarity          = 5;
                    attackModifier += 0.25;
                    scoreModifier  += 0.25;
                }
                else
                {
                    rarity = 0;
                }
            }
            catch (Exception e)
            {
                icon           = assetHandler.Assets.WeaponIcons[(int)ItemWeapons.Eisenschwert];
                name           = assetHandler.Assets.WeaponNames[(int)ItemWeapons.Eisenschwert];
                rarity         = 0;
                attackModifier = 0.0;
                scoreModifier  = 0.0;
            }
            rand = r.Next(0, assetHandler.Assets.RarityPrefix[rarity].Count);

            Weapon w = new Weapon(assetHandler, icon, false, true, name, assetHandler.Assets.RarityPrefix[rarity][rand], attackModifier, scoreModifier, rarity);

            return(w);
        }
コード例 #20
0
 private void SetTitle()
 {
     Title = AssetHandler.GetPlayerClassFromCompleteList(classIndex).ClassName;
 }
コード例 #21
0
ファイル: Weapon.cs プロジェクト: SlagDrop/ConcenReact
        private double scoreModifier;   //Prozentsatz für Score-Bonus


        public Weapon(AssetHandler assetHandler, Bitmap itemBitmap, bool isUsable, bool isEquipable, string name, string prefix, double attackModifier, double scoreModifier, int rarity)
            : base(assetHandler, itemBitmap, isUsable, isEquipable, name, prefix, rarity)
        {
            this.attackModifier = attackModifier;
            this.scoreModifier  = scoreModifier;
        }
コード例 #22
0
        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);
        }
コード例 #23
0
 private void SetCurrentClass()
 {
     CurrPlayerClass = AssetHandler.GetPlayerClassFromCompleteList(classIndex);
 }
コード例 #24
0
ファイル: ItemWithIcon.cs プロジェクト: SlagDrop/ConcenReact
 public ItemWithIcon(AssetHandler assetHandler, Bitmap itemBitmap, bool isUsable, bool isEquipable, string name, string prefix, int rarity) : base(itemBitmap, isUsable, isEquipable, name, prefix, rarity)
 {
     this.AssetHandler = assetHandler;
 }
コード例 #25
0
        public VisualMenuEntryOption(AssetHandler asset, Size windowSize)
        {
            AssetHandler = asset;

            this.windowSize = windowSize;
        }
コード例 #26
0
        private double defenseModifier; //Prozentsatz für Verteidigung


        public Armor(AssetHandler assetHandler, Bitmap itemBitmap, bool isUsable, bool isEquipable, string name, string prefix, double defenseModifier, int rarity)
            : base(assetHandler, itemBitmap, isUsable, isEquipable, name, prefix, rarity)
        {
            this.defenseModifier = defenseModifier;
        }
コード例 #27
0
        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;
        }
コード例 #28
0
 public VisualMenuEntryEnterNameOption(AssetHandler asset, Size windowSize) : base(asset, windowSize)
 {
     Title = "Name: ";
     Name  = "";
 }