Exemplo n.º 1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(int))
            {
                return(value);
            }
            MapProperties mep = (MapProperties)context.Instance;
            CHRSelect     cs  = new CHRSelect(mep.mp, true);

            cs.StartPosition = FormStartPosition.CenterParent;
            cs.preselect     = (int)value;
            cs.dualpage      = dualpage;
            cs.sprite        = !dualpage;
            if (cs.ShowDialog() == DialogResult.OK)
            {
                if (cs.highlight >= 0 && cs.highlight < mep.mp.chr_count)
                {
                    value = cs.highlight;
                    if (dualpage)
                    {
                        value = (int)value & ~1;
                    }
                }
            }
            return(value);
        }
Exemplo n.º 2
0
        private void buttonCHREdit_Click(object sender, EventArgs e)
        {
            CHRSelect chr_select = new CHRSelect(this);

            chr_select.Show();
            add_refresh(chr_select);
        }
Exemplo n.º 3
0
        private void pictureTile_MouseDown(object sender, MouseEventArgs e)
        {
            int c = (e.Y * 2) / (16 * 8 * zoom);

            if (c < 0 || c >= 2)
            {
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                CHRSelect cs = new CHRSelect(mp, true);
                cs.StartPosition = FormStartPosition.CenterParent;
                cs.preselect     = chr_set()[c * 2];
                cs.dualpage      = true;
                cs.sprite        = false;
                if (cs.ShowDialog() == DialogResult.OK)
                {
                    if (cs.highlight >= 0 && cs.highlight < mp.chr_count)
                    {
                        if (mp.rom_modify(no + 0x420 + c, (byte)cs.highlight))
                        {
                            cache();
                            redraw();
                        }
                    }
                }
            }
            else
            {
                pictureTile_MouseMove(sender, e);
            }
        }
Exemplo n.º 4
0
        private void tileBox_MouseDown(object sender, MouseEventArgs e)
        {
            int c = e.Y / (TZOOM * 8 * 8);

            if (e.Button == MouseButtons.Right && c >= 0 && c < 2)
            {
                CHRSelect cs = new CHRSelect(mp, true);
                cs.StartPosition = FormStartPosition.CenterParent;
                cs.preselect     = chr[c];
                cs.dualpage      = true;
                cs.sprite        = false;
                if (cs.ShowDialog() == DialogResult.OK)
                {
                    if (cs.highlight >= 0 && cs.highlight < mp.chr_count)
                    {
                        chr[c] = cs.highlight & (~1);
                        cache();
                        redraw();
                    }
                }
            }
            tileBox_MouseMove(sender, e);
        }