public yahtzee_gui(InputHandler roll_dice_, InputHandler score_roll_, InputHandler new_game_, game_data data_)
        {
            roll_dice  = roll_dice_;
            score_roll = score_roll_;
            new_game   = new_game_;
            data       = data_;

            InitializeComponent();
        }
Exemple #2
0
        static void Main()
        {
            /* Notes for high score handling
             *   Create a new controller for the hs forms
             *   Let this controller control the end game forms and hs list
             *   Give the game controller a handle to running the end game form
             *   Give the yahtzee gui a handle to the hs list form  */

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /* create models */
            game_data gd  = new game_data();
            hs_data   hsd = new hs_data();

            /* create controllers */
            game_controller c   = new game_controller(gd);
            hs_controller   hsc = new hs_controller(hsd);

            /* create views */
            yahtzee_gui  gui       = new yahtzee_gui(c.roll_dice, c.score_roll, c.new_game, gd);
            hs_list_gui  hs_gui    = new hs_list_gui(gui, hsd);
            enter_hs_gui entry_gui = new enter_hs_gui(hsd, hsc.add_entry, gui);
            end_game_gui end_gui   = new end_game_gui(gui);

            /* register delegates */
            c.register_sel_cat_getter(gui.get_sel_cat);
            c.register_lock_dice_getter(gui.get_lock_dice);
            c.register_updater(gui.update);
            c.register_end_game(end_gui.run);
            c.register_hs_getter(hsc.is_high_score);
            c.register_hs_entry(entry_gui.run);
            gui.register_hs_list(hs_gui.run);

            /* run application */
            gui.run();
        }
Exemple #3
0
 /* Constructor. Must pass yahtzee game data. */
 public game_controller(game_data d)
 {
     data = d;
 }