//private int zoomScale; //public bool FitToWindow { get; set; } public MapView(MapPainter painter) : this() { this.painter = painter; }
public ScreenForm(Game game) { MPainter = new MapPainter(game.Maze, this); Game = game; StatPanel = new FlowLayoutPanel { Padding = Padding.Empty, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, Location = new System.Drawing.Point(ClientSize.Width - (256 + 16), ClientSize.Height - (32 + 16)), Anchor = (AnchorStyles.Right | AnchorStyles.Bottom), Size = new Size(256, 32), BackColor = Color.OrangeRed, FlowDirection = FlowDirection.BottomUp, }; ControlPanel = new FlowLayoutPanel { Padding = Padding.Empty, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, Bounds = new Rectangle(ClientSize.Width - 272, levelPanelSize + 16, 256, 0), BackColor = Color.MidnightBlue, FlowDirection = FlowDirection.TopDown, }; PerksPanel = new FlowLayoutPanel() { Location = new System.Drawing.Point(ClientSize.Width - (256 + perksPanelSide), ClientSize.Height - (perksPanelSide + 24)), Anchor = (AnchorStyles.Right | AnchorStyles.Bottom), Size = new Size(0, perksPanelPadding * 2 + perksPanelSide), AutoSize = true, FlowDirection = FlowDirection.RightToLeft, BackColor = Color.OrangeRed, }; var topPanel = new TableLayoutPanel { Dock = DockStyle.Top, Height = levelPanelSize, BackColor = Color.Black, }; for (int i = 0; i < Game.Players.Count; i++) { topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f / Game.Players.Count)); } PlayerPanels = CreatePlayerPanels(topPanel, Game.Players); View = new MapView(MPainter) { Dock = DockStyle.Fill }; HeroPanel = new CurrentHeroPanel(Game.CurrentHero, this) { Size = new Size(128, 128), Anchor = AnchorStyles.Bottom | AnchorStyles.Left, Location = new System.Drawing.Point(32, ClientSize.Height - 160) }; Controls.Add(HeroPanel); Controls.Add(ControlPanel); Controls.Add(StatPanel); Controls.Add(PerksPanel); Controls.Add(View); Controls.Add(topPanel); CenterOnPoint(Game.Maze.UnitPositions[Game.CurrentHero]); PlayerPanelUpdate(); ControlPanelUpdate(); StatPanelUpdate(); SkillPanel = new HeroSkillPanel(Game, Game.CurrentHero, this, ControlPanel.Width); ShopPanel = new ShopPanel(Game.CurrentHero, this, new Rectangle(ClientSize.Width / 4, ClientSize.Height / 4, ClientSize.Width / 2, ClientSize.Height / 2)); SizeChanged += (sender, args) => { Controls.Remove(ShopPanel); Controls.Remove(SkillPanel); //StatPanel.Bounds = new Rectangle(ClientSize.Width - 272, ClientSize.Height - 528, 256, 512); MPainter.ResizeMap(Size); ResizePlayerPanels(PlayerPanels); SkillPanel = new HeroSkillPanel(Game, Game.CurrentHero, this, ControlPanel.Width); ShopPanel = new ShopPanel(Game.CurrentHero, this, //new Rectangle(ClientSize.Width / 4, ClientSize.Height / 4, ClientSize.Width / 2, ClientSize.Height / 2)); new Rectangle(ClientSize.Width / 2 - 480, ClientSize.Height / 2 - 300, 960, 600)); }; }