コード例 #1
0
        public Tuple <Bitmap[][], string[][], int[], int[]> LoadAssetTiles()
        {
            Bitmap[][] allUnitTiles  = new Bitmap[assetTypes.Length][];
            string[][] allUnitLines  = new string[assetTypes.Length][];
            int[]      allUnitWidth  = new int[assetTypes.Length];
            int[]      allUnitHeight = new int[assetTypes.Length];
            //int[][] allUnitIndex = new int[assetTypes.Length][];
            string          folder = "img";
            CGraphicTileset loader = new CGraphicTileset(); //use for loading data/img/ files

            for (int i = 0; i < assetTypes.Length; i++)     //iterate through all assetTypes in above array
            {
                string curFile = assetTypes[i] + ".dat";    //generate dat file name
                Tuple <string[], Bitmap[], int, int, int> temp = loader.LoadTileset(curFile, folder);
                allUnitTiles[i] = temp.Item2;               //image


                /*if (i < 3) //resize unit images only if unit
                 * {
                 *  allUnitTiles[i] = resizeImage(allUnitTiles[i]);
                 * }*/
                allUnitLines[i]  = temp.Item1;
                allUnitWidth[i]  = temp.Item4;
                allUnitHeight[i] = temp.Item5;
            }


            return(Tuple.Create(allUnitTiles, allUnitLines, allUnitWidth, allUnitHeight));
        }
コード例 #2
0
        static void initMap()
        {
            //Get data for maps
            CGraphicTileset generator = new CGraphicTileset();

            mapObject = new maps();
            mapObject.DTileIndices = generator.OrganizeTiles(tileObject.lines);
            Tuple <int[][], int[][], string[], int[][], string[][], int[][], string[][]> tempMapData = generator.LoadMap("map", tileObject.lines, mapObject.DTileIndices);

            mapObject.mapData        = tempMapData.Item1;
            mapObject.mapDataIndices = tempMapData.Item2;
            mapObject.mapNames       = tempMapData.Item3;
            int[][] tempMapXY = tempMapData.Item4;
            mapObject.mapX          = tempMapXY[0];
            mapObject.mapY          = tempMapXY[1];
            mapObject.allMapStrings = tempMapData.Item5;
            mapObject.mapPartials   = tempMapData.Item6;
            mapObject.mapLines      = tempMapData.Item7;

            int numMaps = mapObject.mapNames.Length;

            mapObject.entireMaps      = new Bitmap[numMaps];
            mapObject.entireMapsIndex = new EntireMapsIndex[numMaps];

            for (int i = 0; i < numMaps; i++)
            {
                //mapObject.entireMaps[i] = new Bitmap(mapObject.mapX[i], mapObject.mapY[i]);

                //AZ: Optimized this step, no longer need to generate big bitmaps..
                mapObject.entireMaps[i] = generator.generateMiniMap(i, SplashScreen.tileObject, mapObject);
                //Just need a 2D int array:
                mapObject.entireMapsIndex[i] = generator.generateMapIndex(i, SplashScreen.tileObject, mapObject);
            }
        }
コード例 #3
0
        public Tuple <string[], Bitmap[], int, int, int> LoadFont(string file, string folder) //loads dat file
        {
            CGraphicTileset fontLoader = new CGraphicTileset();
            Tuple <string[], Bitmap[], int, int, int> fontData = fontLoader.LoadTileset(file, folder);

            return(fontData);
        }
コード例 #4
0
        public Bitmap[] loadDroppedResource()
        {
            string filesToLoad = "DroppedResources.dat";

            CGraphicTileset tempLoader = new CGraphicTileset();

            Bitmap[] temp;
            Tuple <string[], Bitmap[], int, int, int> tempRet = tempLoader.LoadTileset(filesToLoad, "img");

            temp = tempRet.Item2;
            return(temp);
        }
コード例 #5
0
        public Bitmap[] loadMiniBevel()
        {
            string filesToLoad = "MiniBevel.dat";

            CGraphicTileset tempLoader = new CGraphicTileset();

            Bitmap[] temp;
            Tuple <string[], Bitmap[], int, int, int> tempRet = tempLoader.LoadTileset(filesToLoad, "img");

            temp = tempRet.Item2;
            return(temp);
        }
コード例 #6
0
        public Bitmap[][] LoadCorpse()
        { //Load unit corpse and building death explosion
            string[]        fileToLoad = { "Corpse.dat", "BuildingDeath.dat" };
            CGraphicTileset tempLoader = new CGraphicTileset();

            Bitmap[][] temp = new Bitmap[fileToLoad.Length][]; //hardcoded
            for (int i = 0; i < fileToLoad.Length; i++)
            {
                //temp[i] = new Bitmap[16];
                Tuple <string[], Bitmap[], int, int, int> tempRet = tempLoader.LoadTileset(fileToLoad[i], "img");
                temp[i] = tempRet.Item2;
            }
            return(temp);
        }
コード例 #7
0
        static void initTile()
        {
            //Get data for tile
            CGraphicTileset generator = new CGraphicTileset();

            tileObject = new loader();
            Tuple <string[], Bitmap[], int, int, int> tileData = generator.LoadTileset("Terrain.dat", "img");

            tileObject.lines      = tileData.Item1;
            tileObject.tiles      = tileData.Item2;
            tileObject.numTiles   = tileData.Item3;
            tileObject.tileWidth  = tileData.Item4;
            tileObject.tileHeight = tileData.Item5;
        }
コード例 #8
0
        static void initButtons()
        {
            icons = new ButtonImage();
            CGraphicTileset generator = new CGraphicTileset();
            Tuple <string[], Bitmap[], int, int, int> tileData = generator.LoadTileset("Icons.dat", "img");

            icons.lines      = tileData.Item1;
            icons.tiles      = tileData.Item2;
            icons.numTiles   = tileData.Item3;
            icons.tileWidth  = tileData.Item4;
            icons.tileHeight = tileData.Item5;

            initDone(); //we are done loading stuff
        }
コード例 #9
0
        public Bitmap[][] LoadProjectiles()
        {
            string[] filesToLoad = new string[SplashScreen.allProjectilesNames.Length + 1]; //plus 1 for cannonballdeath
            for (int i = 0; i < SplashScreen.allProjectilesNames.Length; i++)
            {
                filesToLoad[i] = SplashScreen.allProjectilesNames[i] + ".dat";
            }
            filesToLoad[filesToLoad.Length - 1] = "CannonballDeath.dat";
            CGraphicTileset tempLoader = new CGraphicTileset();

            Bitmap[][] temp = new Bitmap[filesToLoad.Length][]; //hardcoded
            for (int i = 0; i < filesToLoad.Length; i++)
            {
                Tuple <string[], Bitmap[], int, int, int> tempRet = tempLoader.LoadTileset(filesToLoad[i], "img");
                temp[i] = tempRet.Item2;
            }
            return(temp);
        }