public void Build(string modifier)
        {
            int iconSize = 50;
            int rows     = DesignerFileable.GetRowCount();
            int columns  = DesignerFileable.GetColumnCount();

            for (var i = 0; i < rows; i++)
            {
                for (var j = 0; j < columns; j++)
                {
                    char part = (char)DesignerFileable.WhatsAt(i, j);

                    switch (modifier)
                    {
                    case "New":
                        DesignerView.NewButton(part, iconSize, rows, columns, i, j);
                        break;

                    case "Update":
                        DesignerView.UpdateButton(part, i, j);
                        break;
                    }
                }
            }
            DesignerView.Show();
        }
示例#2
0
        public void RestartGame()
        {
            GameView.Reset();
            Game.Restart();
            int rows = GameFileable.GetRowCount();
            int cols = GameFileable.GetColumnCount();

            BuildGameLevel(cols, rows);
            GameView.UpdateMoveCount(0);
        }
示例#3
0
        public void Save(string filename, IFileable callMeBackforDetails)
        {
            // sorry – you gotta do this

            string txt    = "";
            int    column = callMeBackforDetails.GetColumnCount();
            int    row    = callMeBackforDetails.GetRowCount();

            // whatIsAs.WhatsAt(row, column);
            for (int r = 0; r < row; r++)
            {
                for (int c = 0; c < column; c++)
                {
                    //txt += Convert.ToString(callMeBackforDetails.WhatsAt(r, c));
                    txt += callMeBackforDetails.WhatsAt(r, c).ToString();
                    if (c == (column - 1))
                    {
                        txt += "\n";
                    }
                }
            }
            this.Converter.Compress(txt);
            string compressedLevel = this.Converter.Compressed;

            Saver.Save(filename, compressedLevel);
        }
示例#4
0
        protected void Builder(string modifier)
        {
            int count    = 0;
            int iconSize = 50;
            int rows     = GameFileable.GetRowCount();
            int columns  = GameFileable.GetColumnCount();

            for (var i = 0; i < rows; i++)
            {
                for (var j = 0; j < columns; j++)
                {
                    char part = (char)GameFileable.WhatsAt(i, j);
                    switch (modifier)
                    {
                    case "New":
                        GameView.NewButton(part, iconSize, rows, columns, i, j);
                        //GameView.NewImage(part, iconSize, rows, columns, i, j);
                        //GameView.NewDrawing(part, iconSize, rows, columns, i, j);

                        //Element elt = new Element(count, part, iconSize, rows, columns, i, j);
                        //GameView.SetElementData(elt);
                        break;

                    case "Update":
                        GameView.UpdateButton(part, /*iconSize, rows, columns,*/ i, j);
                        break;
                    }
                    count++;
                }
            }
            int moveCount = Game.GetMoveCount();

            GameView.UpdateMoveCount(moveCount);
            GameView.Show();
        }
示例#5
0
        public void BuilderTemp(string fileName, IFileable callBack)
        {
            string empty   = "";
            int    rows    = callBack.GetRowCount();
            int    columns = callBack.GetColumnCount();

            for (int row = 0; row < rows; row++)
            {
                for (int column = 0; column < columns; column++)
                {
                    char part = (char)callBack.WhatsAt(row, column);
                    empty += part.ToString();
                }
                empty += "\r\n";
            }
            System.IO.File.WriteAllText(fileName, empty);
        }
示例#6
0
        public void Save(string filename, IFileable callMeBackforDetails)
        {
            StringBuilder builder = new StringBuilder();
            int           rows    = callMeBackforDetails.GetRowCount();
            int           columns = callMeBackforDetails.GetColumnCount();

            for (var i = 0; i < rows; i++)
            {
                for (var j = 0; j < columns; j++)
                {
                    char part = (char)callMeBackforDetails.WhatsAt(i, j);
                    builder.Append(part);
                }
                if (i < (rows - 1))
                {
                    builder.AppendLine();
                }
            }
            RawString = builder.ToString();
            Compress();
            System.IO.File.WriteAllText(filename, CompressedString);
        }
示例#7
0
文件: Filer.cs 项目: jav244/sokoban
        public void Save(string file, IFileable callBack)
        {
            int           rows    = callBack.GetRowCount();
            int           columns = callBack.GetColumnCount();
            StringBuilder level   = new StringBuilder();

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                {
                    char part = (char)callBack.WhatsAt(i, j);
                    level.Append(part);
                }
                if (i < (rows - 1))
                {
                    level.AppendLine();
                }
            }
            RawString = level.ToString();
            compress();
            System.IO.File.WriteAllText(file, CompressedString);
        }
示例#8
0
 public int GetHeight()
 {
     return(DesignerFileable.GetRowCount());
 }