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); }
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); } }
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()); }
public void setController(Controller c) { controller = (WerewolfController)c; }