Beispiel #1
0
        public void LoadBasic(int id, string name, string title, string groundPath, string path, int size, int groundMode, int structMode, byte[] groundNeighbors, byte[] structNeighbors)
        {
            this.ID              = id;
            this.Name            = name;
            this.Title           = title;
            this.StructPath      = path;
            this.GroundPath      = groundPath;
            this.diversity       = new byte[] { 0 };
            this.Size            = (byte)size;
            this.GroundMode      = groundMode;
            this.StructMode      = structMode;
            this.GroundNeighbors = groundNeighbors;
            this.StructNeighbors = structNeighbors;

            if (groundPath != null)
            {
                Ground = new CGTexture[1];
                if (File.Exists(groundPath + "_g.png"))
                {
                    Ground[0] = new CGTexture(groundPath + "_g.png");
                }
                else
                {
                    Ground[0] = new CGTexture(groundPath + ".png");
                }
            }
            if (path != null)
            {
                int tiles = 0;
                //gmode{ not=0, all=1, focu=2, foen=3, cuen=4, fo=5, cu=6, en=7, st=8}
                switch (structMode)
                {
                case 0: tiles = 1;  break;

                case 1: tiles = 16; break;

                case 2: tiles = 12; break;

                case 3: tiles = 11; break;

                case 4: tiles = 11; break;

                case 5: tiles = 8; break;

                case 6: tiles = 7; break;

                case 7: tiles = 7; break;

                case 8: tiles = 3; break;
                }
                Texture = new CGTexture[tiles][];
                for (int iTile = 0; iTile < tiles; iTile++)
                {
                    Texture[iTile] = loadTiles(path, iTile);
                }
            }
        }
Beispiel #2
0
        private CGTexture[] loadTiles(string path, int tile)
        {
            int lenght = 0;

            while (File.Exists(path + "_" + tile + "_" + lenght + ".png") || File.Exists(path + "_" + lenght + ".png"))
            {
                lenght++;
            }
            CGTexture[] result = new CGTexture[lenght];
            for (int i = 0; i < result.Length; i++)
            {
                if (!File.Exists(path + "_" + tile + "_" + i + ".png"))
                {
                    result[i] = new CGTexture(path + "_" + i + ".png");
                }
                else
                {
                    result[i] = new CGTexture(path + "_" + tile + "_" + i + ".png");
                }
            }
            return(result);
        }