Пример #1
0
        public MapList(MapEditorState mes, ToolStripMenuItem mnuitem)
        {
            InitializeComponent();
            mes.maps.Keys.ToList().ForEach(x => {
                listBox1.Items.Add(new MapInfo(x));
            });

            mes.RegisterWindow("MapList", this, mnuitem);
            this.FormClosing += new FormClosingEventHandler((o, e) => { mes.DeregisterWindow("MapList"); });
            this.mes = mes;
        }
Пример #2
0
        public Floors(MapEditorState mes, ToolStripMenuItem tsmi)
        {
            InitializeComponent();
            mes.RegisterWindow("Floors", this, tsmi);
            this.FormClosing += new FormClosingEventHandler((o, e) =>
            {
                mes.DeregisterWindow("Floors");
            });

            mes.floortypes.ToList().ForEach(x =>
            {

                MapFloor floor = (MapFloor)Activator.CreateInstance(x.Value);
                Image img = mes.tilebank.GetTileImage(floor.TileIndex);

                RadioButton rb = new RadioButton();
                rb.Appearance = Appearance.Button;
                rb.Image = img;
                rb.Size = img.Size;
                flowLayoutPanel1.Controls.Add(rb);
                rb.Tag = floor;
                rb.MouseDown += new MouseEventHandler((ob, ev) =>
                {
                    if (ev.Button == MouseButtons.Right)
                    {
                        contextMenuStrip1.Show(rb, ev.Location);
                        contextMenuStrip1.Tag = rb;
                    }
                });
                rb.CheckedChanged += new EventHandler((ob, ev) => {
                    if (rb.Checked)
                    {
                        mes.selectedFloor = x.Value;
                    }
                });

                if (mes.selectedFloor == x.Value)
                {
                    rb.Checked = true;
                }

            });
        }