public void SwitchScene(Scene scene) { BaseUserControl ctrl = null; switch (scene) { case Scene.Autorization: { ctrl = new AutorizationUserControl(); break; } case Scene.Combat: { ctrl = new CombatUserControl(); break; } case Scene.Menu: { ctrl = new MenuUserControl(); break; } case Scene.PlayerCreation: { ctrl = new PlayerCreationUserControl(); break; } case Scene.RecordTable: { ctrl = new RecordTableUserControl(); break; } case Scene.SecondPlayerLoad: { ctrl = new SecondPlayerLoadUserControl(); break; } default: { break; } } if (ctrl != null) { //this.Height = ctrl.Height + 20; //this.Width = ctrl.Width + 15; this.MinimumSize = new Size(ctrl.Width + 15, ctrl.Height + 20); this.MaximumSize = new Size(ctrl.Width + 15, ctrl.Height + 20); mainPanel.Height = ctrl.Height + 20; mainPanel.Width = ctrl.Width + 15; this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2); ctrl.Dock = DockStyle.Fill; mainPanel.Controls.Clear(); mainPanel.Controls.Add(ctrl); } }
public CombatScenePresenter(CombatUserControl view, AbstractPlayer player1, AbstractPlayer player2) { if (player2 == null) { game = new GameController(player1); gameType = GameType.PvE; } else { game = new GameController(player1, player2); gameType = GameType.PvP; } this.view = view; DrawPlayersInfo(); }
public void SwitchScene(Scene scene, object par1, object par2) { BaseUserControl ctrl = null; ctrl = new CombatUserControl(par1, par2); if (ctrl != null) { this.MinimumSize = new Size(ctrl.Width + 15, ctrl.Height + 20); this.MaximumSize = new Size(ctrl.Width + 15, ctrl.Height + 20); //mainPanel.Height = ctrl.Height + 20; //mainPanel.Width = ctrl.Width + 15; this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2); ctrl.Dock = DockStyle.Fill; mainPanel.Controls.Clear(); mainPanel.Controls.Add(ctrl); } }