public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); builder.AddLabelField("Name: " + connection.Name); builder.AddLabelField("Source: " + connection.Source.GeneID); builder.AddLabelField("Target: " + connection.Target.GeneID); var weightField = builder.AddDoubleField("Weight:"); weightField.Value = connection.Weight; builder.AddResizableButtonField("OK", delegate(object sender) { connection.Weight = weightField.Value; Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); var nameField = builder.AddTextField("Name: "); nameField.Text = template.TemplateName; var genomeEditPanel = new GenomeEditPanel(); genomeEditPanel.Initialize(template.Genome); builder.AddDrawBoxAsField(genomeEditPanel, DrawBoxAlignment.GetFull()); builder.AddResizableButtonField("OK", delegate(object sender) { template.TemplateName = nameField.Text; Close(); }, FieldBuilder.ResizableButtonOrientation.Right); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var nameField = builder.AddTextField("Name: "); annTypesComboBox = builder.AddComboBoxField("ANN Type: "); var annTypeList = Globals.GetAllTypesDeriving(typeof(INeuralNetChromosome), Assembly.GetExecutingAssembly()); annTypesComboBox.Items.AddRange(annTypeList.Select(s => s.Name)); annTypesComboBox.Index = 0; builder.AddResizableButtonField("OK", delegate(object sender) { Result = new ANNTemplate(); Result.TemplateName = nameField.Text; Result.ANN = (INeuralNetChromosome)Activator.CreateInstance(annTypeList[annTypesComboBox.Index]); Close(); EditAnnTemplateForm.ShowDialogue(Parent, Result); }, FieldBuilder.ResizableButtonOrientation.Right); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override Func <bool> GUI_Edit(SingleSlotBox container) { var builder = new FieldBuilder(); builder.BuildSessionStart(container); builder.AddResizableButtonField("Edit Input-Neurons", delegate(object sender) { EditNeuronListForm <RMP_InputNeuron> .ShowDialogue(container.Parent, InputNeurons); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Hidden-Neurons", delegate(object sender) { EditNeuronListForm <RMP_Neuron> .ShowDialogue(container.Parent, HiddenNeurons); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Output-Neurons", delegate(object sender) { EditNeuronListForm <RMP_OutputNeuron> .ShowDialogue(container.Parent, OutputNeurons); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddVerticalMargin(5); builder.BuildSessionEnd(); return(delegate() { return true; }); }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); var valueField = builder.AddIntegerField("Value: "); valueField.Value = Result; builder.AddVerticalMargin(5); builder.AddResizableButtonField("OK", delegate(object sender) { Result = (byte)valueField.Value; Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); CanResizeFormVertically = false; X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); builder.AddResizableButtonField("Edit ANN", delegate(object sender) { EditANNForm.ShowDialogue(Parent, creature.Brain); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit ANN-Chromosome", delegate(object sender) { EditANNChromosomeForm.ShowDialogue(Parent, creature.CreatureGenome.NetChromosome); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Genome", delegate(object sender) { }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Body", delegate(object sender) { }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public static Func <bool> GUI_Edit(SingleSlotBox container, FitnessWorld world) { var builder = new FieldBuilder(); builder.BuildSessionStart(container); Panel panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); Func <bool> isReadyFunc = World.GUI_Edit(panel, world); var minFood = builder.AddIntegerField("Minimum Food: "); var minCreatures = builder.AddIntegerField("Minimum Creatures: "); builder.BuildSessionEnd(); container.IsClosing += delegate(object sender) { world.MinimumFood = (int)minFood.Value; world.MinimumCreatures = (int)minCreatures.Value; }; return(delegate() { return isReadyFunc(); }); }
public static Func <bool> GUI_Edit(SingleSlotBox container, World world) { var builder = new FieldBuilder(); builder.BuildSessionStart(container); var width = builder.AddIntegerField("World Width: "); width.MinValue = 1; width.Value = world.Width; var height = builder.AddIntegerField("World Height: "); height.MinValue = 1; height.Value = world.Height; var worldHasEdges = builder.AddCheckBoxField("World Edges"); worldHasEdges.Checked = world.WorldHasEdges; var regionSize = builder.AddIntegerField("Region Size: "); regionSize.MinValue = 1; regionSize.Value = world.RegionSize; var gaussianMin = builder.AddIntegerField("Gassian Generator Min: "); gaussianMin.Value = 0; var gaussianMax = builder.AddIntegerField("Gassian Generator Max: "); gaussianMax.Value = 1000; container.IsClosing += delegate(object sender) { world.Width = (int)width.Value; world.Height = (int)height.Value; world.WorldHasEdges = worldHasEdges.Checked; world.RegionSize = (int)regionSize.Value; world.Random = new UniformRandomGenerator(); world.GaussianRandom = new NormalRandomGenerator((int)gaussianMin.Value, (int)gaussianMax.Value, world.Random); foreach (var e in world.EntityList) { e.Position = new EntityPosition(Math.Min(e.Position.X, world.Width - 1), Math.Min(e.Position.Y, world.Height - 1)); } world.ReloadRegions(); }; builder.BuildSessionEnd(); return(delegate() { return true; }); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); templateNameTextField.Text = template.TemplateName; var panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); var guiMethod = template.Creature.GetType().GetMethod("GUI_Edit"); var isReadyFunc = (Func <bool>)guiMethod.Invoke(template.Creature, new object[] { panel }); panel.Width = builder.FieldWidth; Wrap(); var okButton = new ResizableButton(); okButton.Initialize(); AddDrawBox(okButton); okButton.Title = "OK"; okButton.FitToText(); okButton.X = builder.FieldWidth - okButton.Width; okButton.Y = Height + 5; okButton.Click += delegate(object sender) { if (isReadyFunc()) { template.TemplateName = templateNameTextField.Text; Close(); } else { AlertForm.ShowDialogue(Parent, null, "All fields have not been filled out."); } }; builder.BuildSessionEnd(); okButton.Alignment = DrawBoxAlignment.GetRightBottom(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = true; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); var entityTypesComboBox = builder.AddComboBoxField("Entity Type: "); var entityTypeList = Globals.GetAllTypesDeriving(typeof(IEntity), Assembly.GetExecutingAssembly()); //Remove all creature-types var creatureType = typeof(ICreature); foreach (var t in new List <Type>(entityTypeList)) { if (creatureType.IsAssignableFrom(t)) { entityTypeList.Remove(t); } } entityTypesComboBox.Items.AddRange(entityTypeList.Select(s => s.Name)); entityTypesComboBox.Index = 0; builder.AddResizableButtonField("OK", delegate(object sender) { if (entityTypesComboBox.Index == -1) { AlertForm.ShowDialogue(Parent, null, "Select a entity type."); } else { Result = new EntityTemplate(); Result.TemplateName = templateNameTextField.Text; Result.Entity = (IEntity)Activator.CreateInstance(entityTypeList[entityTypesComboBox.Index]); EditEntityTemplateForm.ShowDialogue(Parent, Result); Close(); } }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); nameField = builder.AddTextField("Name: "); nameField.Text = neuronGene.Name; isMutableCheckBox = builder.AddCheckBoxField("Gene Mutability: "); isMutableCheckBox.Checked = neuronGene.IsMutable; builder.AddLabelField("Bias:"); biasMin = builder.AddDoubleField("Min: "); biasMax = builder.AddDoubleField("Max: "); biasVal = builder.AddDoubleField("Value: "); biasMin.Value = neuronGene.Bias.Min; biasMax.Value = neuronGene.Bias.Max; biasVal.Value = neuronGene.Bias.Value; builder.AddResizableButtonField("Edit Sigmoid Function", delegate(object sender) { neuronGene.SigmoidFunction.GetType().InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { Parent, neuronGene.SigmoidFunction }); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Connections", delegate(object sender) { EditConnectionGeneListForm.ShowDialogue(Parent, neuronGene.Connections); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("OK", delegate(object sender) { Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); builder.AddLabelField("Name: " + neuron.Name); builder.AddLabelField("GeneID: " + neuron.GeneID); var activation = builder.AddDoubleField("Activation: "); activation.Value = neuron.Activation; var bias = builder.AddDoubleField("Bias: "); bias.Value = neuron.Bias; builder.AddResizableButtonField("Edit Sigmoid Function", delegate(object sender) { neuron.SigmoidFunction.GetType().InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { Parent, neuron.SigmoidFunction }); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Connections", delegate(object sender) { EditConnectionListForm.ShowDialogue(Parent, neuron.Connections); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("OK", delegate(object sender) { neuron.Activation = activation.Value; neuron.Bias = bias.Value; Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); var worldTypesComboBox = builder.AddComboBoxField("World Type: "); var worldTypeList = Globals.GetAllTypesDeriving(typeof(IWorld), Assembly.GetExecutingAssembly()); worldTypesComboBox.Items.AddRange(worldTypeList.Select(s => s.Name)); worldTypesComboBox.Index = 0; builder.AddResizableButtonField("OK", delegate(object sender) { if (worldTypesComboBox.Index == -1) { AlertForm.ShowDialogue(Parent, null, "Select a world type."); } else { Result = new WorldTemplate(); Result.TemplateName = templateNameTextField.Text; Result.World = (IWorld)Activator.CreateInstance(worldTypeList[worldTypesComboBox.Index]); EditWorldTemplateForm.ShowDialogue(Parent, Result); Close(); } }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); templateNameTextField.Text = template.TemplateName; Panel panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); var isReadyFunc = (Func <bool>)template.World.GetType().InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { panel, template.World }); builder.AddResizableButtonField("OK", delegate(object sender) { if (isReadyFunc()) { template.TemplateName = templateNameTextField.Text; Close(); } else { AlertForm.ShowDialogue(Parent, null, "All fields have not been filled out."); } }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var fileNameTextField = builder.AddBrowseField(FileForm.FileFormTypes.File, FileForm.OperationTypes.Save, "File Directory: ").DrawBox1; var worldTemplatesComboBox = builder.AddComboBoxField("World: "); worldTemplatesComboBox.Items.AddRange(EditorData.WorldTemplates.Select(s => s.TemplateName)); worldTemplatesComboBox.Index = 0; builder.AddResizableButtonField("OK", delegate(object sender) { if (worldTemplatesComboBox.Index == -1) { AlertForm.ShowDialogue(Parent, null, "Choose a world-template"); } else { Result = new Simulation(); Result.World = EditorData.WorldTemplates[worldTemplatesComboBox.Index].World.Clone(); Result.FileName = fileNameTextField.Text; AddDefaultEntityPainters(Result); Close(); } }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); var gName = builder.AddTextField("Name: "); var gMin = builder.AddDoubleField("Min: "); var gMax = builder.AddDoubleField("Max: "); var gVal = builder.AddDoubleField("Value: "); var gMutable = builder.AddCheckBoxField("IsMutable: "); gName.Text = Result.Name; gMin.Value = Result.Min; gMax.Value = Result.Max; gVal.Value = Result.Value; gMutable.Checked = Result.IsMutable; builder.AddVerticalMargin(5); builder.AddResizableButtonField("OK", delegate(object sender) { Result.Name = gName.Text; Result.SetMinMaxValue(gMin.Value, gMax.Value, gVal.Value); Result.IsMutable = gMutable.Checked; Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); CanResizeFormVertically = false; X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var allEntities = new List <IEntity>(); allEntities.AddRange(EditorData.EntityTemplates.Select(e => e.Entity)); allEntities.AddRange(EditorData.CreatureTemplates.Select(e => e.Creature)); var entityTypesComboBox = builder.AddComboBoxField("Entity-Templates: "); entityTypesComboBox.Items.AddRange(EditorData.EntityTemplates.Select(e => e.TemplateName)); entityTypesComboBox.Items.AddRange(EditorData.CreatureTemplates.Select(e => e.TemplateName)); var amountField = builder.AddIntegerField("Amount: "); var okButton = builder.AddResizableButtonField("OK", delegate(object sender) { if (entityTypesComboBox.Index == -1) { return; } spawnPoint.SpawnClones.Add(allEntities[entityTypesComboBox.Index]); Close(); }, FieldBuilder.ResizableButtonOrientation.Right); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public static Func <bool> GUI_Edit(SingleSlotBox container, FoodWorld world) { var builder = new FieldBuilder(); builder.BuildSessionStart(container); Panel panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); Func <bool> isReadyFunc = World.GUI_Edit(panel, world); var minFood = builder.AddIntegerField("Minimum Food: "); minFood.Value = world.MinimumFood; var foodSpawnRate = builder.AddIntegerField("Food Spawn-rate: "); foodSpawnRate.Value = world.FoodSpawnRate; builder.AddResizableButtonField("Edit Food", delegate(object sender) { EditEntityForm.ShowDialogue(container.Parent, world.FoodToClone); }, FieldBuilder.ResizableButtonOrientation.FillWidth); container.IsClosing += delegate(object sender) { world.MinimumFood = (int)minFood.Value; world.FoodSpawnRate = (int)foodSpawnRate.Value; }; builder.BuildSessionEnd(); return(delegate() { return isReadyFunc(); }); }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); targetIntegerField = builder.AddIntegerField("Target: "); targetIntegerField.Value = connection.Target; isOutputConnectionCheckBox = builder.AddCheckBoxField("Is Output-Connection: "); isOutputConnectionCheckBox.Checked = connection.IsOutputConnection; isMutableCheckBox = builder.AddCheckBoxField("Connection Mutability: "); isMutableCheckBox.Checked = connection.IsMutable; builder.AddLabelField("Weight:"); weightMin = builder.AddDoubleField("Min: "); weightMax = builder.AddDoubleField("Max: "); weightVal = builder.AddDoubleField("Value: "); weightMin.Value = connection.Weight.Min; weightMax.Value = connection.Weight.Max; weightVal.Value = connection.Weight.Value; builder.AddResizableButtonField("OK", delegate(object sender) { Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); Panel panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); var guiMethod = ann.GetType().GetMethod("GUI_Edit"); var isReadyFunc = (Func <bool>)guiMethod.Invoke(ann, new object[] { panel }); builder.AddResizableButtonField("OK", delegate(object sender) { if (isReadyFunc()) { Close(); } else { AlertForm.ShowDialogue(Parent, null, "All fields have not been filled out."); } }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); var eye = builder.AddIntegerField("Eye Neurons: "); var input = builder.AddIntegerField("Input Neurons: "); var output = builder.AddIntegerField("Output Neurons: "); var hidden = builder.AddIntegerField("Hidden Neurons: "); builder.AddVerticalMargin(5); builder.AddResizableButtonField("OK", delegate(object sender) { chromosome.CreateRandom((int)eye.Value, (int)input.Value, (int)output.Value, (int)hidden.Value); Close(); }, FieldBuilder.ResizableButtonOrientation.Right); builder.MoveUpOneField(); builder.AddResizableButtonField("Abort", delegate(object sender) { Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var painterTypesComboBox = builder.AddComboBoxField("Painter-type: "); var painterTypes = Globals.GetAllTypesDeriving(typeof(IEntityPainter), Assembly.GetExecutingAssembly()); painterTypesComboBox.Items.AddRange(painterTypes.Select(s => s.Name)); painterTypesComboBox.SelectedItemChanged += delegate(object sender, int newItemIndex, int oldItemIndex) { if (painterTypesComboBox.Index == -1) { return; } Result = (IEntityPainter)Activator.CreateInstance(painterTypes[painterTypesComboBox.Index]); //loadControls(); }; builder.AlignTop = true; builder.AlignBottom = true; entitiesToDraw = builder.AddColumnListBox("Entity-types to draw:", 200, 2); entitiesToDraw.SetColumnName(0, "Type-name"); entitiesToDraw.SetColumnName(1, "State"); entitiesToDraw.SetIntOrStringSort(false, false); builder.AlignTop = false; builder.AlignBottom = true; var entityTypesComboBox = builder.AddComboBoxField("Entity-type: "); var entityTypes = Globals.GetAllTypesDeriving(typeof(IEntity), Assembly.GetExecutingAssembly(), true); entityTypesComboBox.Items.AddRange(entityTypes.Select(s => s.Name)); var addEntityButton = builder.AddResizableButtonField("Add Entity", delegate(object sender) { if (entityTypesComboBox.Index == -1) { return; } Result.EntityTypeList.Add(entityTypes[entityTypesComboBox.Index]); reloadList(); }, FieldBuilder.ResizableButtonOrientation.FillWidth); var okButton = builder.AddResizableButtonField("OK", delegate(object sender) { Close(); }, FieldBuilder.ResizableButtonOrientation.Right); builder.BuildSessionEnd(); startY = Height; painterTypesComboBox.Index = 0; X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = true; }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); var symmetricalBordersCheckBox = builder.AddCheckBoxField("Symmetrical Borders: "); symmetricalBordersCheckBox.Checked = sigmoid.SymmetricalBorders; builder.AddLabelField("P: "); var pMin = builder.AddDoubleField("Min: "); var pMax = builder.AddDoubleField("Max: "); var pVal = builder.AddDoubleField("Value: "); var pMutable = builder.AddCheckBoxField("IsMutable: "); builder.AddVerticalMargin(4); builder.AddLabelField("Output-Border: "); var o1Min = builder.AddDoubleField("Min: "); var o1Max = builder.AddDoubleField("Max: "); var o1Val = builder.AddDoubleField("Value: "); var o1Mutable = builder.AddCheckBoxField("IsMutable: "); var switchBox = new SwitchBox(); switchBox.Initialize(); builder.AddDrawBoxAsField(switchBox, DrawBoxAlignment.GetLeftRight()); var emptyPanel = new Panel(); emptyPanel.Initialize(); switchBox.AddDrawBox(emptyPanel, "symmetrical"); var panel = new Panel(); panel.Initialize(); var builder2 = new FieldBuilder(); builder2.BuildSessionStart(panel); builder2.AddLabelField("Output-Border 2: "); var o2Min = builder2.AddDoubleField("Min: "); var o2Max = builder2.AddDoubleField("Max: "); var o2Val = builder2.AddDoubleField("Value: "); var o2Mutable = builder2.AddCheckBoxField("IsMutable: "); builder2.BuildSessionEnd(); switchBox.AddDrawBox(panel, "non-symmetrical"); int largestHeight = 0; foreach (var p in switchBox.DrawBoxList) { if (p.Height > largestHeight) { largestHeight = panel.Height; } } switchBox.Width = builder.FieldWidth; switchBox.Height = largestHeight; if (sigmoid.GeneList.Count != 0) { var o1Gene = (DoubleGene)sigmoid.GeneList[0]; o1Min.Value = o1Gene.Min; o1Max.Value = o1Gene.Max; o1Val.Value = o1Gene.Value; o1Mutable.Checked = o1Gene.IsMutable; int n = 1; if (!sigmoid.SymmetricalBorders) { var o2Gene = (DoubleGene)sigmoid.GeneList[n++]; o2Min.Value = o2Gene.Min; o2Max.Value = o2Gene.Max; o2Val.Value = o2Gene.Value; o2Mutable.Checked = o2Gene.IsMutable; } var pGene = (DoubleGene)sigmoid.GeneList[n++]; pMin.Value = pGene.Min; pMax.Value = pGene.Max; pVal.Value = pGene.Value; pMutable.Checked = pGene.IsMutable; } if (sigmoid.SymmetricalBorders) { switchBox.SelectDrawBoxWithKey("symmetrical"); } else { switchBox.SelectDrawBoxWithKey("non-symmetrical"); } symmetricalBordersCheckBox.CheckedChanged += delegate(object sender, bool newValue) { if (newValue) { switchBox.SelectDrawBoxWithKey("symmetrical"); } else { switchBox.SelectDrawBoxWithKey("non-symmetrical"); } }; builder.AddResizableButtonField("OK", delegate(object sender) { Close(); }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); IsClosing += delegate(object sender) { geneList.Clear(); var _o1Gene = new DoubleGene(); _o1Gene.SetMinMaxValue(o1Min.Value, o1Max.Value, o1Val.Value); _o1Gene.IsMutable = o1Mutable.Checked; geneList.Add(_o1Gene); if (!symmetricalBordersCheckBox.Checked) { var _o2Gene = new DoubleGene(); _o2Gene.SetMinMaxValue(o2Min.Value, o2Max.Value, o2Val.Value); _o2Gene.IsMutable = pMutable.Checked; geneList.Add(_o2Gene); } var _pGene = new DoubleGene(); _pGene.SetMinMaxValue(pMin.Value, pMax.Value, pVal.Value); _pGene.IsMutable = pMutable.Checked; geneList.Add(_pGene); }; CanResizeFormVertically = false; X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public static Func <bool> GUI_Edit(SingleSlotBox container, RMP_Chromosome chromosome) { var builder = new FieldBuilder(); builder.BuildSessionStart(container); Dictionary <string, object> valueHolder = new Dictionary <string, object>(); valueHolder.Add("RMP_Chromosome", chromosome); var inhibitoryConnectionChance = builder.AddDoubleField("Inhibitory Connection-Chance: "); inhibitoryConnectionChance.Value = chromosome.InhibitoryConnectionChance; var connectionChance = builder.AddDoubleField("Connection-Chance: "); connectionChance.Value = chromosome.ConnectionChance; var newConnectionsCanForm = builder.AddCheckBoxField("NewConnectionsCanForm: "); newConnectionsCanForm.Checked = chromosome.NewConnectionsCanForm; var connectionsCanDie = builder.AddCheckBoxField("ConnectionsCanDie: "); connectionsCanDie.Checked = chromosome.ConnectionsCanDie; var newNeuronsCanForm = builder.AddCheckBoxField("NewNeuronsCanForm: "); newNeuronsCanForm.Checked = chromosome.NewNeuronsCanForm; var neuronsCanDie = builder.AddCheckBoxField("NeuronsCanDie: "); neuronsCanDie.Checked = chromosome.NeuronsCanDie; Action reloadChromosome = delegate() { chromosome.InhibitoryConnectionChance = inhibitoryConnectionChance.Value; chromosome.ConnectionChance = connectionChance.Value; chromosome.NewConnectionsCanForm = newConnectionsCanForm.Checked; chromosome.ConnectionsCanDie = connectionsCanDie.Checked; chromosome.NewNeuronsCanForm = newNeuronsCanForm.Checked; chromosome.NeuronsCanDie = neuronsCanDie.Checked; }; if (chromosome.MutationGenes.Count == 0) { //Mutation Genes chromosome.MutationGenes.Add(new DoubleGene("NeuronAddChance", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("NeuronRemoveChance", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("MaxNeuronRemoving", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("MaxNeuronAdding", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("ConnectionAddChance", 0, 1, 0.05)); chromosome.MutationGenes.Add(new DoubleGene("ConnectionRemoveChance", 0, 1, 0.05)); } builder.AddResizableButtonField("Edit Mutation Genes", delegate(object sender) { EditDoubleGeneListForm.ShowDialogue(container.Parent, chromosome.MutationGenes); }); var sigmoidTypes = Globals.GetAllTypesDeriving(typeof(SigmoidFunction), Assembly.GetExecutingAssembly()); var sigmoidNames = new List <string>(sigmoidTypes.Select(s => s.Name)); var globalSigmoidComboBox = builder.AddComboBoxField("GlobalSigmoid: ", sigmoidNames); if (chromosome.GlobalSigmoidFunction != null) { var globalSigmoidType = chromosome.GlobalSigmoidFunction.GetType(); foreach (var type in sigmoidTypes) { if (type.IsEquivalentTo(globalSigmoidType)) { globalSigmoidComboBox.Index = sigmoidTypes.IndexOf(type); } } } globalSigmoidComboBox.SelectedItemChanged += delegate(object sender, int newItemIndex, int oldItemIndex) { chromosome.GlobalSigmoidFunction = (SigmoidFunction)Activator.CreateInstance(sigmoidTypes[newItemIndex]); }; var globalSigmoidEditButton = builder.AddResizableButtonField("Edit GlobalSigmoid", delegate(object sender) { if (chromosome.GlobalSigmoidFunction == null) { return; } var sigmoid = chromosome.GlobalSigmoidFunction; sigmoidTypes[globalSigmoidComboBox.Index].InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { container.Parent, sigmoid }); }); var globalOutputSigmoidComboBox = builder.AddComboBoxField("GlobalOutputSigmoid: ", sigmoidNames); if (chromosome.GlobalOutputSigmoidFunction != null) { var globalOutputSigmoidType = chromosome.GlobalOutputSigmoidFunction.GetType(); foreach (var type in sigmoidTypes) { if (type.IsEquivalentTo(globalOutputSigmoidType)) { globalOutputSigmoidComboBox.Index = sigmoidTypes.IndexOf(type); } } } globalOutputSigmoidComboBox.SelectedItemChanged += delegate(object sender, int newItemIndex, int oldItemIndex) { chromosome.GlobalOutputSigmoidFunction = (SigmoidFunction)Activator.CreateInstance(sigmoidTypes[newItemIndex]); }; var globalOutputSigmoidEditButton = builder.AddResizableButtonField("Edit GlobalOutputSigmoid", delegate(object sender) { if (chromosome.GlobalOutputSigmoidFunction == null) { return; } var sigmoid = chromosome.GlobalOutputSigmoidFunction; sigmoidTypes[globalOutputSigmoidComboBox.Index].InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { container.Parent, sigmoid }); }); builder.AddResizableButtonField("Randomize", delegate(object sender) { reloadChromosome(); if (chromosome.GlobalSigmoidFunction == null || chromosome.GlobalOutputSigmoidFunction == null) { AlertForm.ShowDialogue(container.Parent, null, "Can't randomize before choosing a sigmoid function."); } else { RandomizeForm.ShowDialogue(container.Parent, chromosome); } }); builder.AddResizableButtonField("Edit Neuron-genes", delegate(object sender) { reloadChromosome(); EditChromosomeNeuronsForm.ShowDialogue(container.Parent, valueHolder); }); container.IsClosing += delegate(object sender) { reloadChromosome(); }; builder.BuildSessionEnd(); return(delegate() { return chromosome.GlobalSigmoidFunction != null && chromosome.GlobalOutputSigmoidFunction != null; }); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var isFirstGeneration = builder.AddCheckBoxField("IsFirstGeneration: "); isFirstGeneration.Checked = genome.IsFirstGeneration; isFirstGeneration.CanChangeValue = false; var parent1 = builder.AddIntegerField("Parent1: "); parent1.Value = genome.Parent1; parent1.CanChangeValue = false; var parent2 = builder.AddIntegerField("Parent2: "); parent2.Value = genome.Parent2; parent2.CanChangeValue = false; builder.AddResizableButtonField("Edit Body-genes", delegate(object sender) { EditDoubleGeneListForm.ShowDialogue(Parent, genome.BodyGenes); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Mutation-genes", delegate(object sender) { EditDoubleGeneListForm.ShowDialogue(Parent, genome.MutationGenes); }, FieldBuilder.ResizableButtonOrientation.FillWidth); var crossoverTypes = Globals.GetAllTypesDeriving(typeof(CrossoverFunction), Assembly.GetExecutingAssembly()); var crossoverNames = new List <string>(crossoverTypes.Select(s => s.Name)); var crossoverComboBox = builder.AddComboBoxField("Crossover Function: ", crossoverNames); if (genome.CrossoverFunction != null) { var crossoverType = genome.CrossoverFunction.GetType(); foreach (var type in crossoverTypes) { if (type.IsEquivalentTo(crossoverType)) { crossoverComboBox.Index = crossoverTypes.IndexOf(type); } } } crossoverComboBox.SelectedItemChanged += delegate(object sender, int newItemIndex, int oldItemIndex) { genome.CrossoverFunction = (CrossoverFunction)Activator.CreateInstance(crossoverTypes[newItemIndex]); }; var globalSigmoidEditButton = builder.AddResizableButtonField("Edit Crossover Function", delegate(object sender) { if (genome.CrossoverFunction == null) { return; } var crossoverFunc = genome.CrossoverFunction; crossoverTypes[crossoverComboBox.Index].InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { Parent, crossoverFunc }); }); builder.BuildSessionEnd(); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var nameField = builder.AddTextField("Name: "); nameField.Text = spawnPoint.Name; var posX = builder.AddDoubleField("Position X: "); posX.Value = spawnPoint.SpawnArea.X; var posY = builder.AddDoubleField("Position Y: "); posY.Value = spawnPoint.SpawnArea.Y; var width = builder.AddIntegerField("Width: "); width.Value = spawnPoint.SpawnArea.Width; var height = builder.AddIntegerField("Height: "); height.Value = spawnPoint.SpawnArea.Height; var timeInterval = builder.AddDoubleField("Time Interval: "); timeInterval.Value = spawnPoint.TimeInterval; reloadValues = delegate() { nameField.Text = spawnPoint.Name; posX.Value = spawnPoint.SpawnArea.X; posY.Value = spawnPoint.SpawnArea.Y; width.Value = spawnPoint.SpawnArea.Width; height.Value = spawnPoint.SpawnArea.Height; timeInterval.Value = spawnPoint.TimeInterval; }; reloadValues(); Action setValues = delegate() { spawnPoint.Name = nameField.Text; spawnPoint.SpawnArea.X = (int)posX.Value; spawnPoint.SpawnArea.Y = (int)posY.Value; spawnPoint.SpawnArea.Width = (int)width.Value; spawnPoint.SpawnArea.Height = (int)height.Value; spawnPoint.SetTimeInterval(timeInterval.Value); }; builder.AddVerticalMargin(5); builder.AddResizableButtonField("Set Spawn-Area with mouse", delegate(object sender) { setValues(); Parent.DialoguesAreHidden = true; Globals.Editor.Mode = Editor.Modes.SetPeremiter; Globals.Editor.Set_SendPeremiterFunction(sendPeremiter); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AlignTop = true; builder.AlignBottom = true; spawnEntitiesList = builder.AddColumnListBox("Spawn-entities", 300, 2); spawnEntitiesList.SetIntOrStringSort(false, true); spawnEntitiesList.SetColumnName(0, "Entity-Type"); spawnEntitiesList.SetColumnName(1, "Amount"); builder.AlignTop = false; builder.AlignBottom = true; builder.AddResizableButtonField("Add Entity", delegate(object sender) { AddSpawnEntityForm.ShowDialogue(Parent, spawnPoint, delegate(object _sender) { reloadList(); }); }, FieldBuilder.ResizableButtonOrientation.Right); builder.AddResizableButtonField("Remove Entity", delegate(object sender) { if (spawnEntitiesList.SelectedRowIndex == -1) { return; } spawnPoint.SpawnClones.Remove((IEntity)spawnEntitiesList.Values[spawnEntitiesList.SelectedRowIndex].ExtraValues[0]); reloadValues(); }, FieldBuilder.ResizableButtonOrientation.Right); builder.AddResizableButtonField("OK", delegate(object sender) { setValues(); Close(); }, FieldBuilder.ResizableButtonOrientation.Right); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var entityTemplatesComboBox = builder.AddComboBoxField("Templates: "); entityTemplatesComboBox.Items.AddRange(EditorData.EntityTemplates.Select(s => s.TemplateName)); entityTemplatesComboBox.SelectedItemChanged += delegate(object sender, int newItemIndex, int oldItemIndex) { if (entityTemplatesComboBox.Index == -1) { return; } string name = entityTemplatesComboBox.Items[entityTemplatesComboBox.Index]; foreach (var c in EditorData.EntityTemplates) { if (c.TemplateName == name) { entity = c.Entity.Clone(); break; } } }; entityTemplatesComboBox.Index = 0; var editButton = builder.AddResizableButtonField("Edit Entity", delegate(object sender) { if (entity != null) { EditEntityForm.ShowDialogue(Parent, entity); } }); var addByClicksCheckBox = builder.AddCheckBoxField("Add by clicks: "); var amountField = builder.AddIntegerField("Amount to add: "); amountField.MinValue = 1; builder.AddResizableButtonField("OK", delegate(object sender) { Editor.GetEntityFunctionDelegate getEntityFunc = delegate() { var clone = (IEntity)entity.Clone(); return(clone); }; if (!addByClicksCheckBox.Checked) { for (int i = 0; i < amountField.Value; i++) { var clone = getEntityFunc(); world.AddEntity(clone); clone.Position = new EntityPosition(Globals.Random.Next(world.Width), Globals.Random.Next(world.Height)); } } else { Globals.Editor.Mode = Editor.Modes.AddEntity; Globals.Editor.Set_GetEntityFunction(getEntityFunc); } Close(); }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); EditNeuronGeneListForm.GenerateNeuronsEvent addNeuronsDelegate = delegate(int neuronsToAdd, List <RMP_NeuronGene> neuronList) { AddRandomNeurons(neuronList, neuronsToAdd); }; builder.AddResizableButtonField("Edit Red Eye-Neurons", delegate(object sender) { EditNeuronGeneListForm.ShowDialogue(Parent, chromosome.EyeRNeuronGenes, addNeuronsDelegate); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Green Eye-Neurons", delegate(object sender) { EditNeuronGeneListForm.ShowDialogue(Parent, chromosome.EyeGNeuronGenes, addNeuronsDelegate); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Blue Eye-Neurons", delegate(object sender) { EditNeuronGeneListForm.ShowDialogue(Parent, chromosome.EyeBNeuronGenes, addNeuronsDelegate); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Distance Eye-Neurons", delegate(object sender) { EditNeuronGeneListForm.ShowDialogue(Parent, chromosome.DistanceNeuronGenes, addNeuronsDelegate); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddVerticalMargin(4); builder.AddResizableButtonField("Edit Input-Neurons", delegate(object sender) { EditNeuronGeneListForm.ShowDialogue(Parent, chromosome.InputNeuronGenes, addNeuronsDelegate); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Hidden-Neurons", delegate(object sender) { EditNeuronGeneListForm.ShowDialogue(Parent, chromosome.HiddenNeuronGenes, addNeuronsDelegate); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Edit Output-Neurons", delegate(object sender) { EditNeuronGeneListForm.ShowDialogue(Parent, chromosome.OutputNeuronGenes, delegate(int neuronsToAdd, List <RMP_NeuronGene> neuronList) { AddRandomOutputNeurons(neuronList, neuronsToAdd); }); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddVerticalMargin(5); builder.AddResizableButtonField("Connect Randomly", delegate(object sender) { chromosome.AllNeuronsConnectRandomly(); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var genomeTemplatesComboBox = builder.AddComboBoxField("Genome: "); genomeTemplatesComboBox.Items.AddRange(EditorData.GenomeTemplates.Select(s => s.TemplateName)); genomeTemplatesComboBox.Index = 0; var annTemplatesComboBox = builder.AddComboBoxField("ANN: "); annTemplatesComboBox.Items.AddRange(EditorData.ANNTemplates.Select(s => s.TemplateName)); annTemplatesComboBox.Index = 0; var creatureTemplatesComboBox = builder.AddComboBoxField("Creature: "); creatureTemplatesComboBox.Items.AddRange(EditorData.CreatureTemplates.Select(s => s.TemplateName)); creatureTemplatesComboBox.Index = 0; var mutateCheckBox = builder.AddCheckBoxField("Mutate the genome: "); var amountField = builder.AddIntegerField("Amount to add: "); amountField.MinValue = 1; builder.AddResizableButtonField("OK", delegate(object sender) { string name = genomeTemplatesComboBox.Items[genomeTemplatesComboBox.Index]; Genome genome = null; foreach (var g in EditorData.GenomeTemplates) { if (g.TemplateName == name) { genome = g.Genome; } } name = annTemplatesComboBox.Items[annTemplatesComboBox.Index]; INeuralNetChromosome ann = null; foreach (var a in EditorData.ANNTemplates) { if (a.TemplateName == name) { ann = a.ANN; } } name = creatureTemplatesComboBox.Items[creatureTemplatesComboBox.Index]; ICreature creature = null; foreach (var c in EditorData.CreatureTemplates) { if (c.TemplateName == name) { creature = c.Creature; } } for (int i = 0; i < amountField.Value; i++) { var clone = (ICreature)creature.Clone(); var cloneGenome = genome.Clone(); cloneGenome.SetNetChromosome(ann.Clone()); if (mutateCheckBox.Checked) { cloneGenome.Mutate(); } clone.ImprintGenome(cloneGenome); world.AddEntity(clone); clone.Position = new EntityPosition(Globals.Random.Next(world.Width), Globals.Random.Next(world.Height)); } }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); leftPanel = new Panel(); leftPanel.Initialize(); AddDrawBox(leftPanel); rightPanel = new Panel(); rightPanel.Initialize(); AddDrawBox(rightPanel); var builder = new FieldBuilder(); builder.BuildSessionStart(leftPanel); entitiesWithPainters = builder.AddColumnListBox("Entities being drawn:", 400, 2); entitiesWithPainters.SetColumnName(0, "Entity-Type"); entitiesWithPainters.SetColumnName(1, "Painter-Type"); builder.BuildSessionEnd(); builder.BuildSessionStart(rightPanel); entityPainters = builder.AddColumnListBox("Entity-painters:", 400, 1); entityPainters.SetColumnName(0, "Painter-Type"); builder.AddResizableButtonField("Add Painter", delegate(object sender) { AddEntityPainterForm.ShowDialogue(Parent, simulation, delegate(object _sender) { var form = (AddEntityPainterForm)_sender; form.Result.Initialize(DrawBox.DefaultSkinFile); simulation.EntityPainters.Add(form.Result); reloadEntitiesWithPaintersList(); reloadPainterList(); }); }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.AddResizableButtonField("Remove Painter", delegate(object sender) { if (entityPainters.SelectedRow != null) { simulation.EntityPainters.Remove((IEntityPainter)entityPainters.SelectedRow.ExtraValues[0]); reloadEntitiesWithPaintersList(); reloadPainterList(); } }, FieldBuilder.ResizableButtonOrientation.FillWidth); builder.BuildSessionEnd(); leftPanel.Width = Math.Max(leftPanel.Width, rightPanel.Width); leftPanel.Height = Math.Max(leftPanel.Height, rightPanel.Height); rightPanel.X = leftPanel.Width + panelMargin; rightPanel.Width = Math.Max(leftPanel.Width, rightPanel.Width); rightPanel.Height = Math.Max(leftPanel.Height, rightPanel.Height); Wrap(); reloadEntitiesWithPaintersList(); reloadPainterList(); leftPanel.Alignment = DrawBoxAlignment.GetTopBottom(); rightPanel.Alignment = DrawBoxAlignment.GetTopBottom(); SizeChanged += new SizeChangedEvent(EntityDrawingOptionsForm_SizeChanged); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }