Beispiel #1
0
        public void Save(string filename, GameNS.Game callMeBackforDetails)
        {
            int            rowMax      = callMeBackforDetails.GetRowCount();
            int            colMax      = callMeBackforDetails.GetColumnCount();
            List <MapItem> CurrentGame = callMeBackforDetails.GetMap().Items;
            List <char>    parts       = new List <char>();

            foreach (MapItem item in CurrentGame)
            {
                parts.Add(item.Sign);
            }
            char[] lines  = parts.ToArray();
            string result = "";

            if (!File.Exists(filename))
            {
                using (StreamWriter outputFile = new StreamWriter(filename))
                {
                    string str = "";
                    foreach (char line in lines)
                    {
                        result += line;
                    }
                    int chunkSize    = colMax;
                    int resultLength = result.Length;
                    for (int i = 0; i < resultLength; i += chunkSize)
                    {
                        str += result.Substring(i, chunkSize) + ",";
                    }
                    outputFile.WriteLine(str.TrimEnd(','));
                }
            }
        }
Beispiel #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ILevelDesignView designView  = new LevelDesignForm();
            IErrorHandler    designCheck = new ErrorHandler();
            IMapEditor       designModel = new MapEditor(designCheck);

            ILevelDesignController designController = new Controller(designView, designModel);

            FileHandlerNS.IFiler filer = new FileHandler();
            ISaver  saver  = (ISaver)filer;
            ILoader loader = (ILoader)filer;

            IView gameView = new WindowsFormView();

            GameNS.Game    gameModel = new GameNS.Game();
            GameController gControl  = new GameController(gameModel, gameView);
            GameBoardForm  gameBoard = new GameBoardForm(gameView, gControl);

            FilerForm filerView = new FilerForm();

            FilerNS.IFiler        gameFiler    = new FilerNS.Filer();
            FileHandlerController filerControl = new FileHandlerController(saver, loader, filer, gameFiler, gameModel, filerView);

            MainForm f = new MainForm(designController, filerControl, gameBoard);

            Application.Run(f);
        }
Beispiel #3
0
 public void Save(string filename, GameNS.Game callMeBackforDetails)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
 public GameController(GameNS.Game gameModel, IView view)
 {
     GameModel = gameModel;
     View      = view;
 }