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 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(); 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(); 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 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; }