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(',')); } } }
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); }
public void Save(string filename, GameNS.Game callMeBackforDetails) { throw new NotImplementedException(); }
public GameController(GameNS.Game gameModel, IView view) { GameModel = gameModel; View = view; }