예제 #1
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();
        }
예제 #2
0
        private void LoadExternalTilesets()
        {
            int expectedFileCount = tilesExpectedFilenames.Count;

            DirectoryInfo dirInf = new DirectoryInfo("Textures\\Tilesets");

            //Array der Unterverzeichnisse (Tileset-Ordner)
            DirectoryInfo[] subDirs = dirInf.GetDirectories("*", SearchOption.TopDirectoryOnly);


            FileInfo[] fileInf;
            for (int i = 0; i < subDirs.Length; i++)
            {
                //Temporäres Tileset
                Assets.Tileset tempSet = new Assets.Tileset();

                tempSet.Name = subDirs[i].Name; //Festlegen des Tileset-Namens

                //Anzahl der Dateien in Verzeichnis merken
                fileInf = subDirs[i].GetFiles();

                if (fileInf.Length == expectedFileCount)
                {
                    for (int y = 0; y < fileInf.Length; y++)
                    {
                        //Versuchen, Bitmaps hinzuzufügen
                        try
                        {
                            if (CheckIfValidTileFilename(fileInf[y].Name))
                            {
                                tempSet.AddTileBitmap(new Bitmap(fileInf[y].FullName));
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("InitializeAssets+\n\n" + ex.Message);
                        }
                    }
                    //Nach hinzufügen der Dateien prüfen, ob alle Dateien hinzugefügt wurden
                    if (tempSet.TileIcons.Count == expectedFileCount)
                    {
                        tempSet.TileIcons.Insert(0, new Bitmap(Properties.Resources.Tile_Dummy_0));
                        ExternalTilesets.Add(tempSet);
                    }
                }
            }
        }
예제 #3
0
 private void CreateDefaultTileset()
 {
     defaultTileset = new Tileset();
     defaultTileset.FillDefaultTileset();
 }
예제 #4
0
        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;
        }