public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            Common.WindowsForms.SelectTypeDialog t = new Common.WindowsForms.SelectTypeDialog();
            t.LoadTypes(typeof(BaseType).Assembly, typeof(BaseType));
            if (t.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return(base.EditValue(context, provider, value));
            }

            return((Type)t.SelectedObject);
        }
        private void addButton_Click(object sender, EventArgs e)
        {
            Common.WindowsForms.SelectTypeDialog d = new Common.WindowsForms.SelectTypeDialog();

            d.LoadTypes(typeof(Client.Game.Map.GameEntity).Assembly, typeof(Client.Game.Map.MapScript));
            if (d.ShowDialog() == DialogResult.Cancel) return;

            var s = (Client.Game.Map.MapScript)Activator.CreateInstance((Type)d.SelectedObject);
            s.Name = ((Type)d.SelectedObject).Name + scripts.Count;
            scriptsListBox.Items.Add(s);
            scriptsListBox.SelectedItem = s;
            UpdateScripts();
        }
Beispiel #3
0
        private void addButton_Click(object sender, EventArgs e)
        {
            Common.WindowsForms.SelectTypeDialog d = new Common.WindowsForms.SelectTypeDialog();

            d.LoadTypes(typeof(Client.Game.Map.GameEntity).Assembly, typeof(Client.Game.Map.MapScript));
            if (d.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            var s = (Client.Game.Map.MapScript)Activator.CreateInstance((Type)d.SelectedObject);

            s.Name = ((Type)d.SelectedObject).Name + scripts.Count;
            scriptsListBox.Items.Add(s);
            scriptsListBox.SelectedItem = s;
            UpdateScripts();
        }
Beispiel #4
0
        private void selectAllEntitiesOfTypeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Common.WindowsForms.SelectTypeDialog d = new Common.WindowsForms.SelectTypeDialog();
            d.LoadTypes(typeof(Client.Game.Map.GameEntity).Assembly, typeof(Client.Game.Map.GameEntity));
            if (d.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            var type = (Type)d.SelectedObject;
            List <Graphics.Entity> toSelect = new List <Graphics.Entity>();

            foreach (var v in worldView.Scene.AllEntities)
            {
                if (type.IsAssignableFrom(v.GetType()))
                {
                    toSelect.Add(v);
                }
            }
            worldView.SelectEntities(toSelect.ToArray());
        }
 private void selectAllEntitiesOfTypeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Common.WindowsForms.SelectTypeDialog d = new Common.WindowsForms.SelectTypeDialog();
     d.LoadTypes(typeof(Client.Game.Map.GameEntity).Assembly, typeof(Client.Game.Map.GameEntity));
     if (d.ShowDialog() == DialogResult.Cancel) return;
     var type = (Type)d.SelectedObject;
     List<Graphics.Entity> toSelect = new List<Graphics.Entity>();
     foreach (var v in worldView.Scene.AllEntities)
         if (type.IsAssignableFrom(v.GetType()))
             toSelect.Add(v);
     worldView.SelectEntities(toSelect.ToArray());
 }