コード例 #1
0
        public Tile(string imageName, Toolbox.TileType tileType = Toolbox.TileType.Plains)
        {
            TileType = tileType;

            if (TileType == Toolbox.TileType.Castle ||
                TileType == Toolbox.TileType.Dirt ||
                TileType == Toolbox.TileType.Dungeon ||
                TileType == Toolbox.TileType.Forest ||
                TileType == Toolbox.TileType.Home ||
                TileType == Toolbox.TileType.Plains
                )
            {
                if (imageName == "")
                {
                    ImageName = "cotton_green_" + ToT.Settings.TileSize.X.ToString();
                }
                else
                {
                    ImageName = imageName;
                }
            }
            else
            {
                ImageName = imageName;
            }
        }
コード例 #2
0
ファイル: Toolbox.cs プロジェクト: lurked/ToT_Adventure
        public static string GetImgName(Toolbox.TileType tileType, int iLen, int jLen, int iInd, int jInd)
        {
            string imgPrefix = "terrain{tilesize}\\tile_{terrain}_{spriteposY}{spriteposX}";
            string imgName   = "";
            string imgPrename;

            imgPrefix = imgPrefix.Replace("{tilesize}", ToT.Settings.LevelTileSize.X.ToString());
            imgPrefix = imgPrefix.Replace("{terrain}", tileType.ToString().ToLower().Replace("level_", ""));
            if (iInd == 0)
            {
                imgPrename = imgPrefix.Replace("{spriteposX}", "left");
            }
            else if (iInd == iLen)
            {
                imgPrename = imgPrefix.Replace("{spriteposX}", "right");
            }
            else
            {
                imgPrename = imgPrefix.Replace("{spriteposX}", "middle");
            }

            imgName = imgPrename;
            if (jInd == 0)
            {
                imgName = imgName.Replace("{spriteposY}", "top");
            }
            else if (jInd == jLen)
            {
                imgName = imgName.Replace("{spriteposY}", "bottom");
            }
            else
            {
                imgName = imgName.Replace("{spriteposY}", "middle");
            }

            return(imgName);
        }