コード例 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainForm mMainForm = new MainForm();

            mMainForm.Visible = false;
            Login mLogin = new Login(mMainForm);

            mMainForm.Addformlogin(mLogin);
            WerewolfController mControler = WerewolfController.GetInstance();
            WerewolfModel      mModel     = new WerewolfModel();

            mModel.Addserver(mLogin);

            // View -> Controller
            mMainForm.setController(mControler);
            mLogin.setController(mControler);

            // Controler -> Model
            mControler.AddModel(mModel);

            // Model -> View
            mModel.AttachObserver(mLogin);
            mModel.AttachObserver(mMainForm);

            Application.Run(mLogin);
        }
コード例 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Game mGameForm = new Game();

            mGameForm.Visible = false;

            Main mMainForm = new Main(mGameForm);

            mMainForm.Visible = false;

            Login mLogin = new Login(mMainForm);

            //Return to lobby
            mGameForm.SetMainMenu(mMainForm);

            //too lazy to figure better solution yet
            mMainForm.setLoginForm(mLogin);

            WerewolfController mController = WerewolfController.GetInstance();
            WerewolfModel      mModel      = new WerewolfModel();

            // View -> Controller
            mMainForm.setController(mController);
            mLogin.setController(mController);
            mGameForm.setController(mController);

            // Controler -> Model
            mController.AddModel(mModel);

            // Model -> View
            mModel.AttachObserver(mLogin);
            mModel.AttachObserver(mMainForm);
            mModel.AttachObserver(mGameForm);

            Application.Run(mLogin);

            //Application.Run(new Main());
        }