Пример #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Game Player
            IGameView      gameView       = new GameFormView();
            Game           gameModel      = new Game();
            GameController gameController = new GameController(gameModel, gameView);
            GameBoardForm  gameBoard      = new GameBoardForm(gameView, gameController);

            // File Handler
            IFiler  filer  = new Filer();
            ISaver  saver  = (ISaver)filer;
            ILoader loader = (ILoader)filer;

            FilerForm       filerView    = new FilerForm();
            IGameFiler      gameFiler    = new GameFiler();
            FilerController filerControl = new FilerController(saver, loader, filer, gameFiler, gameModel, filerView);

            // Level Designer
            ILevelDesignView designView  = new LevelDesignerForm();
            IChecker         designCheck = new Checker();
            ILevelDesigner   designModel = new LevelDesigner(designCheck);

            ILevelDesignController designController = new LevelDesignController(designView, designModel);


            BaseForm baseForm = new BaseForm(gameBoard, filerControl, designController);

            Application.Run(baseForm);
        }
Пример #2
0
 public BaseForm(GameBoardForm gameBoard, FilerController filerControl, ILevelDesignController designControl)
 {
     GameBoard      = gameBoard;
     FilerControl   = filerControl;
     DesignControl  = designControl;
     FileSave      += new FileHandled(ToSave);
     FileLoad      += new FileHandled(ToLoad);
     SetFile       += new FileHandled(SetLoaded);
     LoadGame      += new FileHandled(ToLoadGame);
     LoadGameState += new FileHandled(ToLoadGameState);
     SetSaveFile   += new FileHandled(SaveFile);
     MapTest       += new FileHandled(LevelToGame);
     InitializeComponent();
     GameBoard.SetParent(this);
 }