예제 #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);
        }
 public static WerewolfController GetInstance()
 {
     if (_instance == null)
     {
         _instance = new WerewolfController();
     }
     return(_instance);
 }
예제 #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox3.Text == textBox2.Text)
     {
         WerewolfController c    = WerewolfController.GetInstance();
         WerewolfCommand    wcmd = new WerewolfCommand();
         wcmd.Action   = WerewolfCommand.CommandEnum.SignUp;
         wcmd.Payloads = new Dictionary <string, string>()
         {
             { "Login", textBox1.Text }, { "Password", textBox2.Text }, { "Server", TBServer.Text }
         };
         c.ActionPerformed(wcmd);
     }
     else
     {
         MessageBox.Show("Please make sure your passwords match.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
예제 #4
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());
        }
예제 #5
0
파일: MainForm.cs 프로젝트: sompobcmu/eiei
 public void setController(Controller c)
 {
     controller = (WerewolfController)c;
 }